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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    function getAnchor(link){
    	var url=( (!link) ? window.location : link).toString();
    	var idx = url.indexOf("#");
    	return (idx != -1 ? url.substring(idx+1) : '');	
    }
    function setAnchor(anchor){
    	var url=(window.location).toString();
    	var idx = url.indexOf("#");
    	return ( window.location= 
    		(idx != -1 ? url.substring(0,idx+1) : url+'#')+anchor
    	);
    }

    3.14159265, 16 Мая 2012

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

    +8

    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 validate() {
                var at = document.getElementById("email").value.indexOf("@");
                var age = document.getElementById("age").value;
                var fname = document.getElementById("fname").value;
                submitOK = "true";
    
                if (fname.length > 10) {
                    alert("Имя не должно содержать более 10 знаков");
                    submitOK = "false";
                }
                if (isNaN(age) || age < 1 || age > 100) {
                    alert("Возраст должен быть от 1 до 100");
                    submitOK = "false";
                }
                if (at == -1) {
                    alert("Неправильный e-mail");
                    submitOK = "false";
                }
                if (submitOK == "false") {
                    return false;
                }
            }

    Джордж Буль в гробу перевернулся.

    Arigato, 15 Мая 2012

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

    +5

    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
    $(document).click(function (e) {
        if ($(e.target).parents().filter('#idAddItTopPopUpMenu:visible').length != 1) {
            $('#idAddItTopPopUpMenu').hide();
        }
        if ($(e.target).parents().filter('#idAddItProductDetailPopUpMenu:visible').length != 1) {
            $('#idAddItProductDetailPopUpMenu').hide();
        }
        if ($(e.target).parents().filter('#idPampItProductDetailPopUpMenu:visible').length != 1) {
            $('#idPampItProductDetailPopUpMenu').hide();
        }
        if ($(e.target).parents().filter('#idPrivacyProductPopUpMenu:visible').length != 1) {
            $('#idPrivacyProductPopUpMenu').hide();
        }
        if ($(e.target).parents().filter('#idSocialNetworkMenu:visible').length != 1) {
            $('#idSocialNetworkMenu').hide();
        }
        if ($(e.target).parents().filter('#idPampItTopPopUpMenu:visible').length != 1) {
            $('#idPampItTopPopUpMenu').hide();
        }
    . . .
        if ($(e.target).parents().filter('div[id=idAreaLastMessage]:visible').length != 1 && $(e.target).parents().filter('div[id=idbtnMessages]').length != 1) {
            $('div[id=idListLastMessage]').hide();
        }
        if ($(e.target).parents().filter('div[id=idAreaLastAlert]:visible').length != 1 && $(e.target).parents().filter('div[id=idbtnAlert]').length != 1) {
            $('div[id=idListLastAlert]').hide();
        }
        if ($(e.target).parents().filter('div[id=idAreaNearestCalendar]:visible').length != 1 && $(e.target).parents().filter('div[id=idbtnNearestCalendar]').length != 1) {
            $('div[id=idListNearestCalendar]').hide();
        }
    });

    нет слов o_O

    DarkThinker, 14 Мая 2012

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

    +8

    1. 1
    2. 2
    3. 3
    4. 4
    <button type='button' id='button-download'>download zipfile</button>
    $("#button-download").live("click", function() {
        $.get("http://localhost/admin/zip/002140.zip"); // doesn't work?
    })

    Ссылка на скачивание файла, современный вариант.

    mozg, 13 Мая 2012

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

    +18

    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
    pic = new Array()
    for(i=0;i<21;i++)
    {
    pic[i] = new Image();
    if(i==0) pic[i].src = "http://philosophy.do.am/_ph/1/1/272439236.jpg";
    if(i==1) pic[i].src = "http://philosophy.do.am/_ph/1/1/987050819.jpg";
    if(i==2) pic[i].src = "http://philosophy.do.am/_ph/1/1/442166179.jpg";
    if(i==3) pic[i].src = "http://philosophy.do.am/_ph/1/1/925090451.jpg";
    if(i==4) pic[i].src = "http://philosophy.do.am/_ph/1/1/833480698.jpg";
    if(i==5) pic[i].src = "http://philosophy.do.am/_ph/1/1/958410581.jpg";
    if(i==6) pic[i].src = "http://philosophy.do.am/_ph/1/1/472798047.jpg";
    if(i==7) pic[i].src = "http://philosophy.do.am/_ph/1/1/657609683.jpg";
    if(i==8) pic[i].src = "http://philosophy.do.am/_ph/1/1/559445124.jpg";
    if(i==9) pic[i].src = "http://philosophy.do.am/_ph/1/1/292242334.jpg";
    if(i==10) pic[i].src = "http://philosophy.do.am/_ph/1/1/2741410.jpg";
    if(i==11) pic[i].src = "http://philosophy.do.am/_ph/1/1/312659858.jpg";
    if(i==12) pic[i].src = "http://philosophy.do.am/_ph/1/1/333153864.jpg";
    if(i==13) pic[i].src = "http://philosophy.do.am/_ph/1/1/811066713.jpg";
    if(i==14) pic[i].src = "http://philosophy.do.am/_ph/1/1/108915398.jpg";
    if(i==15) pic[i].src = "http://philosophy.do.am/_ph/1/1/661197254.jpg";
    if(i==16) pic[i].src = "http://philosophy.do.am/_ph/1/1/255266572.jpg";
    if(i==17) pic[i].src = "http://philosophy.do.am/_ph/1/1/507281622.jpg"; 
    if(i==18) pic[i].src = "http://philosophy.do.am/_ph/1/1/996088137.jpg"; 
    if(i==19) pic[i].src = "http://philosophy.do.am/_ph/1/1/870834686.jpg"; 
    if(i==20) pic[i].src = "http://philosophy.do.am/_ph/1/1/507281622.jpg"; 
    if(i==21) pic[i].src = "http://philosophy.do.am/_ph/1/1/496256382.jpg"; 
    }

    так ребята с форума присваивают ссылки списку изображений

    heleg, 13 Мая 2012

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

    +5

    1. 1
    var c = 'function' === typeof o.pop ? [] : {};

    хуита, 05 Мая 2012

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

    −3

    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
    function (post, hash) {
        if (!vk.id || cur.viewAsBox) return;
    
        var icon = ge('like_icon' + post),
            my = hasClass(icon, hasClass(icon, 'fw_like_icon') ? 'fw_my_like' : 'my_like'),
            matches = post.match(/(-?\d+)(_?)(photo|video|note|topic|wall_reply|note_reply|photo_comment|video_comment|topic_post|)(\d+)/),
            like_obj = (matches[3] || 'wall') + matches[1] + '_' + matches[4],
            ref = cur.wallType ? (cur.wallType == 'feed' ? 'feed_' + cur.section : ('wall_' + (cur.onepost ? 'one' : (!(cur.wallType || '').indexOf('full_') ? 'full' : 'page')))) : cur.module;
    
        ajax.post('like.php', {act: 'a_do_' + (my ? 'un' : '') + 'like', 'object': like_obj, hash: hash, wall: 1, from: ref}, {
          onDone: wall.likeUpdate.pbind(post, !my)
        });
        var count = val(ge('like_real_count_wall' + post) || ge('like_count' + post));
        wall.likeUpdate(post, !my, intval(count) + (my ? -1 : 1));
        if (cur.onWallLike) {
          cur.onWallLike();
        }
      }

    Зачем посоны из контакта пишут такой говно-код? Куда смотрит Паша?

    mark, 04 Мая 2012

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

    +12

    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
    /* выравниваем высотку блока контента, чтобы совпадал с клеточками бэкграунда */		
    			$('#center>div').each(function(){
    				$(this).height(function(i,val){
    					if(val<200){return 200;} 
    					if(val<401){return 401;}
    					if(val<602){return 602;}
    					if(val<803){return 803;}
    					if(val<1004){return 1004;}
    					if(val<1205){return 1205;}
    					if(val<1406){return 1406;}
    					if(val<1607){return 1607;}
    					if(val<1808){return 1808;}
    					if(val<2009){return 2009;}
    					if(val<2210){return 2210;}
    					if(val<2411){return 2411;}
    					if(val<2612){return 2612;}
    					if(val<2813){return 2813;}
    					if(val<3014){return 3014;}								
    				});	
    			});

    Это была первая и вероятно последняя попытка разгрузить штатных программистов, отдав часть несложной работы фрилансерам :)

    wildhind, 04 Мая 2012

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

    +8

    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
    $('documetnt').ready (function () {
    	 $('#navcat ul li ul').addClass('over');
     		if ('/faq'.indexOf('/faq') == 0) {
    			$('#navcat #child40 > ul').addClass('active');
    		}
    		if ('massbuying' == 'aion') {
    			$('#navcat ul li.scand ul').addClass('active');
    		}
    		if ('massbuying' == '...') {
    			$('#navcat ul li.scand ul').addClass('active');
    		}
    		if ('massbuying' == '...') {
    			$('#navcat ul li.kaz ul').addClass('active');
    		}
    		if ('massbuying' == 'cao') {
    			$('#navcat ul li.kaz > ul').addClass('active');
    		}
    		if ('/massbuying/faq'.indexOf('...') == 0) {
    			$('#navcat #child7 > ul').addClass('active');
    		}
    		if ('massbuying' == 'site') {
    			$('#navcat ul li.mini ul').addClass('active');
    		}
    		if ('massbuying' == 'portal') {
    			$('#navcat ul li.portals ul').addClass('active');
    		}
    		if ('massbuying' == '...') {
    			$('#navcat ul li.portals ul').addClass('active');
    		}
    		if ('massbuying' == 'shop') {
    			$('#navcat ul li.shop ul').addClass('active');
    		}
    		if ('massbuying' == 'design') {
    			$('#navcat ul li.design ul').addClass('active');
    		}
    		if ('massbuying' == 'services') {
    			$('#navcat ul li.services ul').addClass('active');
    		}
    		if ('massbuying' == 'rekl') {
    			$('#navcat ul li.contextAdv ul').addClass('active');
    		}
    			
    		...
    		if ('/massbuying/faq' == '/faq') {
    			$('#child40 > a').addClass('active2');
    		}
    ...

    код для выпадающего меню))))) И такого говна там 400 строк ))) (оторвать прогеру руки и засунуть туда от куда они у него растут)

    corsair_gt, 03 Мая 2012

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

    +1

    1. 1
    2. 2
    this.ie = (name=="ie" && this.v>=4)
    this.activeX = ( this.ie ) ? true : false;

    Кусочек шедевра
    https://github.com/miketaylr/Snort/blob/master/snort.yml

    kindofbear, 30 Апреля 2012

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