1. 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)
  2. JavaScript / Говнокод #5690

    +175

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

    striker, 16 Февраля 2011

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

    +172

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

    vugluskr, 15 Февраля 2011

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

    +154

    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
    // Parse strings looking for color tuples [255,255,255]
    function getRGB(color) {
      var result;
      if (color && isArray(color) && color.length == 3)
        return color;
      if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
        return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
      if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
        return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
      if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
        return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
      if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
        return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
    }

    InstantI, 11 Февраля 2011

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

    +164

    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
    aLength = V_Array.length;
    if(aLength == 1) { 
     if(V_Array[0][0]=='true'){
      document.MainListForm.list_DV[0].checked = true;
      document.MainListForm.list_NE[0].checked = true;
     }else{
      document.MainListForm.list_DV[0].checked = false;
      document.MainListForm.list_NE[0].checked = false;
     }
     if(V_Array[0][1]=='true'){
      document.MainListForm.list_DV[1].checked = true;
      document.MainListForm.list_NE[1].checked = true;
     }else{
      document.MainListForm.list_DV[1].checked = false;
      document.MainListForm.list_NE[1].checked = false;
     }
     if(V_Array[0][2]=='true'){
      document.MainListForm.list_DV[2].checked = true;
      document.MainListForm.list_NE[2].checked = true;
     }else{
      document.MainListForm.list_DV[2].checked = false;
      document.MainListForm.list_NE[2].checked = false;
     }
     if(V_Array[0][3]=='true'){
      document.MainListForm.list_DV[3].checked = true;
      document.MainListForm.list_NE[3].checked = true;
     }else{
      document.MainListForm.list_DV[3].checked = false;
      document.MainListForm.list_NE[3].checked = false;
     }
     return;
    }
    
    for (i = 0; i < aLength ; i++) {
     if(V_Array[i][0]=='true'){
      document.MainListForm[i].list_DV[0].checked = true;
      document.MainListForm[i].list_NE[0].checked = true;
     }else{
      document.MainListForm[i].list_DV[0].checked = false;
      document.MainListForm[i].list_NE[0].checked = false;
     }
     if(V_Array[i][1]=='true'){
      document.MainListForm[i].list_DV[1].checked = true;
      document.MainListForm[i].list_NE[1].checked = true;
     }else{
      document.MainListForm[i].list_DV[1].checked = false;
      document.MainListForm[i].list_NE[1].checked = false;
     }
     if(V_Array[i][2]=='true'){
      document.MainListForm[i].list_DV[2].checked = true;
      document.MainListForm[i].list_NE[2].checked = true;
     }else{
      document.MainListForm[i].list_DV[2].checked = false;
      document.MainListForm[i].list_NE[2].checked = false;
     }
     if(V_Array[i][3]=='true'){
      document.MainListForm[i].list_DV[3].checked = true;
      document.MainListForm[i].list_NE[3].checked = true;
     }else{
      document.MainListForm[i].list_DV[3].checked = false;
      document.MainListForm[i].list_NE[3].checked = false;
     }
    }

    типично китайский привет из реал лайф проект

    kuku, 09 Февраля 2011

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

    +166

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if(VisabilityOnOff==true){
    	   document.SearchForm.searchoption[0].disabled=true;
    	   document.SearchForm.searchoption[1].disabled=true;
    }else if(VisabilityOnOff==false){
    	   document.SearchForm.searchoption[0].disabled=false;
    	   document.SearchForm.searchoption[1].disabled=false;
    }

    kuku, 09 Февраля 2011

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (aNew=='true'){
    	  path = './page.html?show='+ashow+'&avail='+aavail+'&page='+page+'&size='+asize+'&order='+aorder+'&ordera='+aordera+'&refresh='+arefresh+'&letter='+aletter+'&sortcount='+asortcount+'&search=off&new=true';
    }else{
    	  path = './page.html?show='+ashow+'&avail='+aavail+'&page='+page+'&size='+asize+'&order='+aorder+'&ordera='+aordera+'&refresh='+arefresh+'&letter='+aletter+'&sortcount='+asortcount+'&search=off&new=false';
    }

    разница в &new=true/false
    Код из большого серьезного продакшен проекта.

    kuku, 09 Февраля 2011

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

    +160

    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
    <script language="javascript" type="text/javascript">
    <!--
    var ie=document.all?1:0;
    var ns=document.getElementById&&!document.all?1:0;
     
    function InsertSmile(SmileId)
    {
        if(ie)
        {
        document.all.message.focus();
        document.all.message.value+=" "+SmileId+" ";
        }
     
        else if(ns)
        {
        document.forms['guestbook'].elements['message'].focus();
        document.forms['guestbook'].elements['message'].value+=" "+SmileId+" ";
        }
     
        else
        alert("Ваш браузер не поддерживается!");
    }
    // -->
    </script>

    qbasic, 08 Февраля 2011

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function onsub(text){
    	if (confirm(text)) { 
    		return true;
    	}
    	else {
    		return false;
    	}
    }

    Копаюсь в системе биллинга...
    Убило!

    Gogogo, 08 Февраля 2011

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

    +159

    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
    var DatePicker = function () {
      ...
      return {
        init: function(options) {...},
        showPicker: function() {...},
        hidePicker: function() {...},
        setDate: function(date, shiftTo) {...},
        getDate: function(formated) {...},
        clear: function() {...},
        fixLayout: function() {...}
      };
    }();
    $.fn.extend({
      DatePicker: DatePicker.init,
      DatePickerHide: DatePicker.hidePicker,
      DatePickerShow: DatePicker.showPicker,
      DatePickerSetDate: DatePicker.setDate,
      DatePickerGetDate: DatePicker.getDate,
      DatePickerClear: DatePicker.clear,
      DatePickerLayout: DatePicker.fixLayout
    });

    Взято с http://www.eyecon.ro/datepicker/

    wmmorgun, 08 Февраля 2011

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