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

    +155.2

    1. 1
    setEvent((a,b,c){i=(a==this)?this:return document.getElementById(a);i.on+b=c}})

    fuckyounoob, 24 Декабря 2009

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

    +166.4

    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
    function InitializeSubmenu(submenucontainerid, tablecellroid, tablecellid, fname) { 
    var s = "";
    s = s + "function " + fname + "() { ";
    s = s + "document.getElementById(submenucontainerid).style.visibility='';";
    s = s + "BringToFront(submenucontainerid);";
    s = s + "}";
    if ((index = navigator.userAgent.indexOf("MSIE")) >= 0)
    s = s + "document.getElementById('" + tablecellid + "').attachEvent(\"onmouseover\", " + fname + ");";
    else
    s = s + "document.getElementById('" + tablecellid + "').addEventListener(\"mouseover\", " + fname + ", true);";
    s = s + "document.getElementById(tablecellroid).onclick = function() {";
    s = s + "if( document.createEvent ) {";
    s = s + "var evObj = document.createEvent('MouseEvents');";
    s = s + "evObj.initEvent( 'click', true, false );";
    s = s + "document.getElementById(tablecellid).dispatchEvent(evObj);";
    s = s + "} else if( document.createEventObject ) {";
    s = s + "document.getElementById(tablecellid).fireEvent('onclick');";
    s = s + "}";
    s = s + "}";
    eval(s);
    }

    Как говориться, "eval() is evil" :-)
    http://stackoverflow.com/questions/197769/when-is-javascripts-eval-not-evil

    ramanowski, 23 Декабря 2009

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

    +165.7

    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
    function sendClicked(F)
    {
    var binary = document.getElementById("binary");
    var binary_file = binary.value;
    var binary_len = binary_file.length;
    if(binary_file == ""){
    binary.focus();
    alert('File name can not be empty !');
    return false;
    }
    else {
    if(binary_len<=4) {
    binary.focus();
    alert('File is wrong !');
    return false;
    }
    if(binary_file.charAt(0) != '/') {
    if(binary_file.charAt(1) != ':') {
    binary.focus();
    alert('File is wrong !!');
    return false;
    }
    }
    if(binary_file.charAt(binary_len-4) != '.') {
    binary.focus();
    alert('File is wrong !!');
    return false;
    }
    if(binary_file.charAt(binary_len-3) != 'B') {
    if(binary_file.charAt(binary_len-3) != 'b') {
    binary.focus();
    alert('File is wrong !!');
    return false;
    }
    }
    if(binary_file.charAt(binary_len-2) != 'I') {
    if(binary_file.charAt(binary_len-2) != 'i') {
    binary.focus();
    alert('File is wrong !!');
    return false;
    }
    }
    if(binary_file.charAt(binary_len-1) != 'N') {
    if(binary_file.charAt(binary_len-1) != 'n') {
    binary.focus();
    alert('File is wrong !!');
    return false;
    }
    }
    show_div(true, "progress_div");
    progress();
    return true;
    }
    }
    
    </script>

    Со странички обновления прошивки DWL-G700AP. Из-за этого говнокода прошивается только из internet explorer.

    user.user521, 19 Декабря 2009

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

    +154.4

    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
    function _patchManualImagesClasses() {
        var images=document.getElementsByTagName('img');
        var re0=/^image_image_\d+$/;
        var re1=/^image_middle_\d+$/;
        var re2=/^image_small_\d+$/;
        for(var i=0; i<images.length; i++ ) {
            var id=images[i].id;
            if (re0.test(id) || re1.test(id) || re2.test(id) ) {
                var _m=images[i];
                var align=_m.getAttribute('align');
                var iClass=_m.getAttribute('className');
                if (iClass == null || iClass.length==0 ) {
                    iClass=_m.getAttribute('class');
                };
    
                if (iClass==null || iClass.length==0 ) {
                    _m.setAttribute('class', 'content_img_'+align);
                    _m.setAttribute('className', 'content_img_'+align);
                };
            };
        };
    };
    
    function _patchManulImagesClasses() {
    	_patchManualImagesClasses();
    };

    Первая функция нужна только ради того, чтобы для картинок сделать 10px отступ через CSS. А вот вторая — понятия не имею зачем она написана. Причем, нигде на сайте _patchManulImagesClasses, конечно, не используется.

    Господи, спасибо Тебе, что дал нам Джона Резига и jQuery!

    rusavv, 11 Декабря 2009

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

    +144.4

    1. 1
    2. 2
    function ppc() {
    };

    Пипец :-)

    rusavv, 11 Декабря 2009

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

    +149.6

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <script>
    function _checkCommentsForm ()
    {
        return true;
    };
    </script>
    <form ... onsubmit="_checkCommentsForm();">
    ...
    <input type="submit" onclick="_checkCommentsForm();" onmousedown="_checkCommentsForm();">
    </form>

    Наверное, просто из функции что-то вырезали, но осталось хорошо :-)

    rusavv, 11 Декабря 2009

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

    +144

    1. 1
    2. 2
    el.setAttribute('class', 'forum_alt_over');
    	    el.setAttribute('className', 'forum_alt_over');

    Господи, ну почему не просто el.className="forum_alt_over"; ?

    rusavv, 09 Декабря 2009

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

    +165.4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    <script language="JavaScript">
    		function change_city() 
    		{
    			document.getElementById("header_18").style.display='none';
    			document.getElementById("header_18_add").style.display='block';
    			document.getElementById("header_18_add").id='header_18'; //т.к. стили прописаны для id
    		}
    	</script>
    </head>
    <body>
    
    <div id="mega_scroller">

    <div id="mega_scroller">
    document.getElementById("header_18_add") .id='header_18'; //т.к. стили прописаны для id
    http://www.cinemapark.ru/ - гении делали

    pompomru, 07 Декабря 2009

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

    +155.7

    1. 1
    2. 2
    3. 3
    4. 4
    if (document.all.input.req.value == "" ||
              document.all.input.req.value=="" ||      //на всякий пожарный надо еще раз проверить - а вдруг!
              document.all.input.req.value=="")          //наверное автор решил что доверяй-но проверяй
    	{ document.all.input.req.value=""; }

    нашел в 1 из заброшенных кемто проектов для 1 из сайтов

    markoffk, 05 Декабря 2009

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

    +152.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    function $(element, method) {
      if (!method) {
        return document.getElementById(element);
      } else {
        return {
          node: $(element)
        }
      }
    }

    nagato, 03 Декабря 2009

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