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

    +156

    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
    var Utils = {
      // https://gist.github.com/1308368
      uuid: function(a,b){for(b=a='';a++<36;b+=a*51&52?(a^15?8^Math.random()*(a^20?16:4):4).toString(16):'-');return b},
      pluralize: function( count, word ) {
       return count === 1 ? word : word + 's';
      },
      store: function( namespace, data ) {
       if ( arguments.length > 1 ) {
        return localStorage.setItem( namespace, JSON.stringify( data ) );
       } else {
        var store = localStorage.getItem( namespace );
        return ( store && JSON.parse( store ) ) || [];
       }
      }
     };

    kyzi007, 27 Августа 2012

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

    +177

    1. 1
    2. 2
    3. 3
    if(e.password == '23f9dg'){
        $('#editable').show(0);
    }

    Клиентский JS, упоротым под баклофеном лучше не кодить...

    Stud, 27 Августа 2012

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

    +153

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    if ((this.formType.urlParam === 'sell1') || (this.formType.urlParam === 'supply1')) {
                                    url = 'sell-return-list';
                                } else if ((this.formType.urlParam === 'sell2') || (this.formType.urlParam === 'supply2')) {
                                    url = 'buy-return-list';
                                } else if ((this.formType.urlParam === 'service1') || (this.formType.urlParam === 'service2')) {
                                    url = 'get-service-list';
                                } else {
                                    url = 'provide-service-list';
                                }

    Ниньзя стайл

    nur, 13 Августа 2012

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

    +154

    1. 1
    2. 2
    3. 3
    if(Math.round(Math.random()*10)==7){
              alert('Your name/lastname alredy used! Try other.');
    }

    Валидация форм, чё

    denis90, 08 Августа 2012

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

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    onChange: function (el, e) {         
                var val = el.val();
                if (val.substring(8, 10) === "  ") {
                    this.setValue(val.substring(0, 6) + "20" + val.substring(6, 8));
                }
    
                this.setValue(val === "" ? null : val);
            }

    Обработчик onChange в дейтпикере
    нинзя-разработчик 16 levl

    nur, 06 Августа 2012

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

    +148

    1. 1
    2. 2
    3. 3
    4. 4
    $("#select_id :selected").attr("selected", false);
    $("#select_id option[value='" + new_value + "']").attr("selected", true);
    вместо
    $("#select_id").val(new_value);

    splinter89, 03 Августа 2012

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

    +154

    1. 1
    2. 2
    3. 3
    function isEmptyStr(val) {
        return val == null || val === "";
    }

    glprizes, 01 Августа 2012

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

    +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
    15. 15
    function reNumberAreas(parent)
    {
     for (i=0;i<parent.childNodes.length;i++)
     {
      try
      {
       parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.id = cutNumber(parent.childNodes[0].firstChild.firstChild.firstChild.firstChild.id) + i;
       parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.id = parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.id + "_text";
       parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.src = parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.src.replace(/index=\d+/g,"index=" + i);
      }
      catch (e)
      {
      }
     }
    }

    Форматирование кода сохранено для придания драматичности.

    Areks, 30 Июля 2012

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

    +141

    1. 1
    <div onclick="javascript: fun1();" style="position:absolyte; z-index:1;" id="div1">text</div>

    AjiTae, 24 Июля 2012

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

    +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
    $(window).load(function() {
    	if ($(window).height() < 587) {
    		$('#inquiry').css({'position' : 'relative','margin-top' : -511,'top' : 0});
    	}
    	$(document).ready(function() {
    		$(function() {
    			if ($.browser.msie && $.browser.version >= 7) {
    				$('.ask').click(function() {
    					$('#inquiry').css({'display' : 'block'});
    					$('#inquiry_pop').css({'display' : 'block'});
    				});
    				$('#close_iq').click(function() {
    					$('#inquiry').hide();
    					$('#inquiry_pop').hide();
    				});
    				$('.sub_fo').click(function() {
    					$('#inquiry, #inquiry_pop').hide(0);
    					$('#thank_you').delay(500).show(0);
    					$('#thank_you').delay(3000).hide(0);
    				});
    			} else {
    				$('.ask').click(function() {
    					$('#inquiry, #inquiry_pop').fadeIn(1500);
    				});
    				$('#close_iq').click(function() {
    					$('#inquiry, #inquiry_pop').fadeOut(1500);
    				});
    
    				$('.sub_fo').click(function() {
    					$('#inquiry, #inquiry_pop').fadeOut(1500);
    					$('#thank_you').delay(500).fadeIn(1500);
    					$('#thank_you').delay(3000).fadeOut(1500);
    				});
    			}
    		});
    	});
    });

    YamahaSY, 23 Июля 2012

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