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

    +159.6

    1. 1
    document.getElementById('myID').disabled = document.getElementById('myCheckbox').checked == false ? true : false;

    Это замечательно, тащем-та! =) Досталось в наследство от команды аутсорсеров. =)

    Red Son, 15 Января 2010

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

    +143.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (data.success) {
         document.location = "/contests/" + $('#contest_id').val() + '/' + $('#composition_type').val() + '/page/1';
    }else {
         document.location = "/contests/" + $('#contest_id').val() + '/' + $('#composition_type').val() + '/page/1';
    }

    Stinkie, 15 Января 2010

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

    +151.2

    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
    $('#state_checkboxes input[type=checkbox]').each(function(i) {
        $(this).click(function() {
            if (!$(this).attr('checked')) {
                if ($('#state_checkboxes input[type=checkbox]:checked').length == 0) {
                    $('#state_checkboxes input[type=checkbox]').not(this).attr('checked', 'checked');
                }
            }
        });
    });
    
    $('#type_checkboxes input[type=checkbox]').each(function(i) {
        $(this).click(function() {
            if (!$(this).attr('checked')) {
                if ($('#type_checkboxes input[type=checkbox]:checked').length == 0) {
                    $('#type_checkboxes input[type=checkbox]').not(this).attr('checked', 'checked');
                }
            }
        });
    });
    
    $('#own_checkboxes input[type=checkbox]').each(function(i) {
        $(this).click(function() {
            if (!$(this).attr('checked')) {
                if ($('#own_checkboxes input[type=checkbox]:checked').length == 0) {
                    $('#own_checkboxes input[type=checkbox]').not(this).attr('checked', 'checked');
                }
            }
        });
    });

    Только что наговнокодил, еще тепленькое.
    Суть в следующем: есть несколько пар чекбоксов, в каждой из этих пар обязательно должен быть выделен хотя бы один. Если снимаем выделение со всех чекбоксов в паре, то установиться выделение должно у другого чекбокса.
    В данном говнокоде 3 пары чекбоксов, у меня в проекте их будет больше, вот сижу и думаю, как бы это всё покрасивее сделать, а то совсем уже

    striker, 14 Января 2010

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

    +158.2

    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
    function compiledTest(ID, rank, memoryLimit, timeLimit, outputLimit, language, address){
        this.ID = ID;
        this.Rank = rank;
        this.MemoryLimit = memoryLimit;
        this.TimeLimit = timeLimit;
        this.OutputLimit = outputLimit;
        this.Language = language;
        this.Address = address;
        this.TestCases = new Array();
        
        this.getAnswer = function() {
            return document.getElementById(this.ID).value;
        }
        this.getScore = function() {
            var res = service(
                    this.getAnswer(), 
                    new this.allInfo(
                        this.Rank, this.MemoryLimit, this.TimeLimit, this.OutputLimit, this.Language, this.TestCases
                        ),
                    this.Address
                );
            
            return res;
        }
        
        // Смотри здесь ))))))
        this.allInfo = function(rank, memoryLimit, timeLimit, outputLimit, language, testCases) {
        
            this.Rank = rank;
            this.MemoryLimit = memoryLimit;
            this.TimeLimit = timeLimit;
            this.OutputLimit = outputLimit;
            this.TestCases = testCases;
            this.Language = language;
        }
        
        var c = arguments.length;
        for (var i = 6; i < c; i++) {
            this.TestCases.push(arguments[i]);
        }
    }

    Собственноличний говнокод. Буквально на днях писал єтот джаваскрипт. И только теперь заметил УЕБИЩНОЙ КОД. Проект пишется на С#. Джаваскрипта мало, но есть - приходилось писать его двум веб-программистам (также занимались С#) но они уже закончили свою роботу и ушли з проекта. Вот скинули на меня поодержку скриптов ( я js писал давно, но единственний в команде, кто его вообще писал). Написал первое, что пришло в голову для решения задачи.

    ajukraine, 14 Января 2010

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

    +207.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $('div').each(function () {
    if ($(this).attr('id') == 'blok') {
    $(this).html('');
    }
    });

    Хочется взять и уебать…

    fuckyounoob, 12 Января 2010

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

    +145.6

    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
    extend(Object, {
        extend:        extend,
        inspect:       inspect,
        toJSON:        toJSON,
        toQueryString: toQueryString,
        toHTML:        toHTML,
        keys:          keys,
        values:        values,
        clone:         clone,
        isElement:     isElement,
        isArray:       isArray,
        isHash:        isHash,
        isFunction:    isFunction,
        isString:      isString,
        isNumber:      isNumber,
        isUndefined:   isUndefined
      });

    Из Prototype JS.

    Cr@ZyBoY, 10 Января 2010

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

    +167.6

    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
    --------------хтмл заголовок, ява скрипты -------------------
    function CheckFields(){
    
      	if(document.feedback.password.value!='0A23BD671'){
    		alert('Пароль неправильный!');
    		document.feedback.password.focus();
    		document.feedback.password.select();
    		return false;
    	} 	
     }	
    ------------------хтмл-------------------------------------------------
    
    		<form name="feedback" action="/handlers/get_prz.php" method=POST onSubmit="return CheckFields()">
    			<tr bgcolor="#dfefef" >
    				<td align="right"><b>Пароль: </b></td>
    				<td valign="top"><INPUT TYPE="PASSWORD" NAME="password" SIZE="9" value=""></b>
    				<INPUT TYPE="HIDDEN" NAME="ftpzip" SIZE="9" value="finans.zip"></b></td>
    			</tr>
    			<tr bgcolor="#dfefef" >
    				<td colspan=2 align="center">
    				<INPUT TYPE="submit" VALUE="Скачать 2.8Mb" style="color:#cc0000;font-weight:bold;background=#dfefef">
    				</td></tr></form>

    иф пассворд не равен пассворд..... а с какого сайта я скопикомуниздил этот код, типа ERP система Компас... серьезная софтина для крупных предпрятий... а на сайте такое твориться... как теперь можно доверить такой софтине, сайт для которой студенты писали... ды, нет, думаю студенты не такие дубы чтоб такое писать, школьники наверное....
    оригинал кода например тут - http://www.compas.ru/solutions/prz_fin.php
    там почти все файлы типа через пароль качать...

    LuCiFer, 31 Декабря 2009

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

    +160.4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    $('input').each(function () { 
      if ($(this).attr('type') == 'text') { 
      this.className = 'textInput'; 
      } 
      if ($(this).attr('type') == 'password') { 
      this.className = 'passwordInput'; 
      } 
     }); 
     $('textarea').each(function () { 
      this.className = 'textarea'; 
     });

    это чудо было найдено здесь http://uweb.ws/publ/javascript/dobavljaem_vsem_ehlementam_input_i_texta rea_klassy/1-1-0-8

    fuckyounoob, 28 Декабря 2009

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

    +149.1

    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
    myAutoComp.formatResult = function(oResultData, sQuery, sResultMatch) { 
    
          .....
          var aMarkup = ["<div class='myCustomResult'>", 
    	      "<span style='font-weight:bold'>", 
    	      sKey, 
    	      "</span>", 
    	      sKeyRemainder, 
    	      ": ", 
    	      moreData1, 
    	      ", ", 
    	      moreData2, 
    	      "</div>"]; 
                  return (aMarkup.join("")); 
    };

    Отсюда http://developer.yahoo.com/yui/examples/autocomplete/ac_basic_xhr.html

    Oleg_quadro, 25 Декабря 2009

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

    +174.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
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");

    bb-коды на индусском сайте

    fuckyounoob, 24 Декабря 2009

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