1. JavaScript / Говнокод #5796

    +177

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if(msg == "" || msg == "{}"){
    	// странный баг, форма очищается, но не прячется
    	return;
    	$("#variants_div").html('');
    	$("variants_div").hide();
    }

    Даже Джумла первая была радостным кодом по сравнению с этим.

    Shock, 24 Февраля 2011

    Комментарии (6)
  2. JavaScript / Говнокод #5786

    +165

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    function get_sel_values(index){
                    var test = eval('typeof opt_val'+index);
                    if ( test != 'undefined' ){
                      eval('var sel_values = opt_val'+index);
                      return sel_values;
                    }
        else { return false; }
    }
    //**************************************************************
    function get_sel_text(index){
                    var test = eval('typeof opt_text'+index); 
                    if ( test != 'undefined' ){
                      eval('var sel_text = opt_text'+index);
                      return sel_text;
                    }
        else { return false; }              
    }
    //**************************************************************
    function show_select(index, lev, dv){
        if ( dv == 'jdc1'){ var tr = "jdc2";}
        if ( dv == 'jdc2'){ var tr = "jdc3";}
        if ( dv == 'jdc3'){ var tr = "jdc4";}
        var curr_sel_text = get_sel_text(index);
        var curr_sel_value = get_sel_values(index);
                    if ( curr_sel_value != false && curr_sel_text != false ){
          if ( dv == 'jdc1'){
            document.getElementById('jdc1').style.visibility = "visible";
            document.getElementById('jdc2').style.visibility = "hidden";
            document.getElementById('jdc3').style.visibility = "hidden";
            document.getElementById('jdc4').style.visibility = "hidden";
                              document.forms["form1"].elements['cc2'].length = 0;
                              document.forms["form1"].elements['cc3'].length = 0;
                              document.forms["form1"].elements['cc4'].length = 0;
                      }
          if ( dv == 'jdc2'){
            document.getElementById('jdc1').style.visibility = "visible";
            document.getElementById('jdc2').style.visibility = "visible";
            document.getElementById('jdc3').style.visibility = "hidden";
            document.getElementById('jdc4').style.visibility = "hidden";
                              document.forms["form1"].elements['cc3'].length = 0;
                              document.forms["form1"].elements['cc4'].length = 0;
                      }
          if ( dv == 'jdc3'){
            document.getElementById('jdc1').style.visibility = "visible";
            document.getElementById('jdc2').style.visibility = "visible";
            document.getElementById('jdc3').style.visibility = "visible";
            document.getElementById('jdc4').style.visibility = "hidden";
                              document.forms["form1"].elements['cc4'].length = 0;
                      }
          var count_values = curr_sel_value.length;
          var category_list = document.forms["form1"].elements[lev];
          var count_category_list = category_list.options.length;
          category_list.length = 0; 
          for (i = 0; i < count_values; i++){
            if (document.createElement){
                var newCategoryListOption = document.createElement("OPTION");
                newCategoryListOption.text = curr_sel_text[i];
                newCategoryListOption.value = curr_sel_value[i];
                (category_list.options.add) ? category_list.options.add(newCategoryListOption) : category_list.add(newCategoryListOption);
            }else{
                category_list.options[i] = new Option(curr_sel_text[i], curr_sel_value[i], false, false);
            }
          }
          document.getElementById(tr).style.visibility = "visible";
              }
                    else{
          document.getElementById(tr).style.visibility = "hidden";
                    }
      }
    //-->

    qbasic, 23 Февраля 2011

    Комментарии (24)
  3. JavaScript / Говнокод #5785

    +169

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    <script type="text/javascript"> 
    opt_text13=new Array("Internet","Hardware","Mobiles","Soft","Sequrity","Networks","Interface");
    opt_val13=new Array("14","28","44","54","61","67","72");
    opt_val113=new Array("114","115","116","117","118","119","120","121");
    opt_text122=new Array("Essays","Scintific Publications","Online Lessons & Tests","Scintific Libraries","Other");
    opt_val122=new Array("123","124","125","126","127");
    opt_text128=new Array("Your Appartment","Cookery","All for Holidays","Family","Pats","Health","Fashion and Beauty","Purchases");
    opt_val128=new Array("129","138","146","155","162","170","179","189");
    opt_text129=new Array("Country Cottage","Repair","Construction","Interior Design","Landscape Design","Building Materials","Sanitary","Other");
    opt_val129=new Array("130","131","132","133","134","135","136","137");
    opt_text138=new Array("Recepies","Diet","Products","Tabacco","Bavarage","Delivery","Other");
    opt_val138=new Array("139","140","141","142","143","144","145");
    opt_text146=new Array("E-Cards","Tostes and scenaries","Gifts","Flowers Delivery","Holiday Organization","Fireworks","Holidays","Other");
    opt_val146=new Array("147","148","149","150","151","152","153","154");
    opt_text155=new Array("For Parents","For Children","Relation's Psyhology","Marrage","Marrage Agancies","Other");
    //...............
    opt_val252=new Array("253","254","255","256","257","258");opt_text259=new Array("Astrology","Fortune-telling","Esotericism","UFO","Other");
    opt_val259=new Array("260","261","262","263","264");
    opt_text268=new Array("Places","Tourism","Vocation","Hobbies");
    opt_val268=new Array("269","280","292","297");
    opt_text269=new Array("Restaurants & Bars","Clubs & Diskos","Bowling & Billiard","Casinos","Places for children","Circuses","Parks & Zoos","Theaters","Cinemas","Other");
    opt_val269=new Array("270","271","272","273","274","275","276","277","278","279");
    opt_text428=new Array("Newspapers","Magazines","Publishing Houses","Business publications","Computer publications","Motor-Car publications","Sport publications","Entertaining publications","Music/Cinema/TV","Publications for women","Publications for men","Publications for kids","Other publications");opt_val428=new Array("429","430","431","432","433","434","435","436","437","438","439","440","441");opt_text446=new Array("Metallurgy","Mechanical engineering","Equipment","Electronics","Energetics","Chemical industry","Agriculture","Food Industry","Factories","Light Industry","Heavy Industry","Other industries");opt_val446=new Array("447","451","458","469","473","479","483","484","485","486","487","488");opt_text447=new Array("Iron industry","Non-ferrous metallurgy","Other");opt_val447=new Array("448","449","450");opt_text451=new Array("Motor-car Factories","Engeenering Factories","Agricultural Factories","Sheepbuilding","Aircraft building","Other");
    //........
    opt_text529=new Array("Office equipment","Office furneture","Lock boxes","Stationery","Other");opt_val529=new Array("530","531","532","533","534");opt_text536=new Array("Encyclopedias","Transport","Maps","Addresses & Phones","Search people","Dictionaries","Weather","Other");opt_val536=new Array("537","543","552","553","554","555","556","557");opt_text537=new Array("Universal","Medical","Biographical","Subject encyclopedia","Other");opt_val537=new Array("538","539","540","541","542");opt_text543=new Array("Timetables","Air transport","Railway","Sailing","Urban transport","Taxi & Car rent","Bus transport","Other");opt_val543=new Array("544","545","546","547","548","549","550","551");opt_text558=new Array("Other");
    opt_val558=new Array("559");//**************************************************************

    qbasic, 23 Февраля 2011

    Комментарии (10)
  4. JavaScript / Говнокод #5772

    +168

    1. 1
    2. 2
    3. 3
    4. 4
    if(videoID == undefined || typeof videoID == 'undefined' || !videoID){
    	alert("Invalid video!");
    	return false;
    }

    Боги, спасите мою душу от этого проекта

    Shock, 22 Февраля 2011

    Комментарии (7)
  5. JavaScript / Говнокод #5771

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function shake(dom, power, count, duration) {
        dom.stop();
        for (var i = 0; i < count; i++) {
            dom.animate({'margin-left': ((i%2 == 0) ? '+' : '-') + '=' + ((i == 0 || i == count-1) ? power/2 : power)}, duration);
        }
    }

    Оптимизация рулит :)

    serj_alekseev, 22 Февраля 2011

    Комментарии (25)
  6. JavaScript / Говнокод #5760

    +158

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    <script type="text/javascript" src="swfobject.js"></script>
    <script type="text/javascript">
    	function  myTags(mytags){
    		mytags=mytags.replace(/<A/g, '<a')
    			.replace(/\/A>/g, "/a>")
    			.replace(/(\starget=_)(\w*)/g, ' target="_$2"')
    			.replace(/(\sclass=)(?!")(\w*)/g, ' class="$2"')
    			.replace(/(\sname=)(?!")(\w*)/g, ' name="$2"')
    			.replace(/(\sid=)(?!")(\w*)/g, ' id="$2"')
    			.replace(/(\srel=)(?!")(\w*)/g, ' rel="$2"');
    		mytags=encodeURIComponent(mytags).replace(/!/g, '%21')
    			.replace(/'/g, '%27').replace(/\(/g, '%28')
    			.replace(/\)/g, '%29').replace(/\*/g, '%2A');
    		var rnumber = Math.floor(Math.random()*9999999);
    		var flashvars = {
    			tcolor:"0x2A62C8",
    			tcolor2:"0x000000",
    			hicolor:"0xB12AC8",
    			tspeed:"110",
    			distr:"true",
    			mode:"tags",
    			tagcloud:mytags
    		};
    		var params = {
    			allowScriptAccess:"always",
    			bgcolor:'#ffffff'
    		};
    		var attributes = {
    			id:"flash_cloud"
    		};
    		swfobject.embedSWF("tagcloud.swf?r="+rnumber,
    						   "tags", "600", "420", "9.0.0",
    						   "expressInstall.swf", flashvars,
    						   params, attributes);
    	}
    	window.onload=function(){
    		var mytags="<tags>"
    		+document.getElementById('tags').innerHTML
    		+"</tags>";
    		myTags(mytags);
    	};
    </script>

    qbasic, 22 Февраля 2011

    Комментарии (0)
  7. JavaScript / Говнокод #5741

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    function auCtrl(whSound,play) {
    if (IE) this.src = play? aySound[whSound]:'';
    else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
    }

    ___, 21 Февраля 2011

    Комментарии (0)
  8. JavaScript / Говнокод #5707

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    window.onload = function() {
      var canvas = document.getElementById('canvas');
      var ctx = canvas.getContext('2d');
    
      canvas.height = canvas.height;
      canvas.width = canvas.width;
    
    // …
    }

    Jesus, 17 Февраля 2011

    Комментарии (13)
  9. JavaScript / Говнокод #5690

    +175

    1. 1
    $("input[id='yearB']")

    striker, 16 Февраля 2011

    Комментарии (14)
  10. JavaScript / Говнокод #5680

    +172

    1. 1
    var rus_rl = ('А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я-а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я').split('-');

    vugluskr, 15 Февраля 2011

    Комментарии (20)