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

    +155

    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
    var nav = document.getElementById('navigation');
    
    var properties = {
    	'display' : 'block',
    	'position' : 'fixed',
    	'top' : '5px',
    	'backgroundColor' : '#F2F0E3',
    	'opacity' : '.6',
            ........
            //Много всяких свойств
            ........
    	'border' : '2px solid #DDDDDD',
    	'borderRadius' : '1em',
    	'padding' : '5px',
    	'zIndex' : '1'
    }
    
    for (var i in properties) {
    	nav.style[i] = properties[i];
    }

    Послать бы автора на три буквы: CSS

    vistefan, 30 Мая 2012

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

    +142

    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
    $("#idSave").click(function () {
            var img_src = $("#idImg").attr('src');
            var web_src = $("#idFromWebSite").attr('href');
            var pamp_id = $.cookie('pamp');
            var title_src = $("#idTitle").val();
            var brand_src = $("#idBrand").val();
            var tags_src = $("#idTags").val();
            var price_src = $("#idPrice").val();
            var privacy_src = $("#idPrivacy").val();
    
            var data = new Object();
            data.Url = img_src;
            data.UrlFrom = web_src;
            data.PampID = pamp_id;
            data.Title = title_src;
            data.Brand = brand_src;
            data.Tags = tags_src;
            data.Price = price_src;
            data.Privacy = privacy_src;
    
            $.ajax({
                url: url,
                type: "POST",
                dataType: "json",
                data: data,
                success: successProductSave,
                error: errorProductSave
            });
        });

    - $().serialize() and $().serializeArray() ?? WTF ??
    - RTFM ....

    DarkThinker, 25 Мая 2012

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

    +145

    1. 1
    backgroundImage: 'url(\'' . add . '\')'

    Привет из php...

    nethak, 25 Мая 2012

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

    +147

    1. 1
    2. 2
    3. 3
    function trim(str) {   //Маленький трёхколёсный велосипед
        return str.replace(/^\s+|\s+$/g, '');
    }

    Комментарий оригинала...

    vistefan, 25 Мая 2012

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

    +148

    1. 1
    if(type_file=='png'||type_file=='jpg'||type_file=='gif'||type_file=='jpeg'||type_file=='png')

    хуита, 24 Мая 2012

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

    +152

    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
    $(document).ready(function(){
     var m;
     function fourSize()
     {
        var size=$(window).width();
    	if (size<'1210') { css='1000'; m=160;}
    	if ((size>='1210')&&(size<'1296')) {css='1240';m=160;}
    	if ((size>='1296')&&(size<'1370')) {css='1320';m=180;}
    	if(size>='1370') {css='1400';m=180;}
        $('#four-size').attr({	href: 'css/styles_'+css+'.css'});marginFoot();
     } 
     function marginFoot()
        {
            w=$(window).width();
            h=$(window).height();
            if (h<500)  $('.center').css('height',($(window).height()-m));
            if ((h>500 && w<1210)||(h>600 && w>1210)){
            $('.center').css('height',($(window).height()-m)); //alert($(document).height()-180);
            margin=$(window).height()-$('.center').height()-m;
            $('.foot').css('margin-top',margin);}
        }   
        fourSize();marginFoot();
        $(window).resize(function(){fourSize();})
        
    })

    У парня 1 год опыта верстки и js.

    katsgeorgeek, 23 Мая 2012

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

    +138

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <script>window.google={kEI:"iBS9T5-8NY6CtQbXmN3PDQ",getEI:function(a){var b;while(a&&!(a.getAttribute&&(b=a.getAttribute("eid"))))a=a.parentNode;return b||google.kEI},https:function(){return window.location.protocol=="https:"},kEXPI:"24878,27400,30316,31215,35702,35703,38100,38135,38221,38285,38738,38786,38816,38941,39000",kCSI:{e:"24878,27400,30316,31215,35702,35703,38100,38135,38221,38285,38738,38786,38816,38941,39000",ei:"iBS9T5-8NY6CtQbXmN3PDQ"},authuser:0,
    ml:function(){},pageState:"#",kHL:"uk",time:function(){return(new Date).getTime()},log:function(a,b,c,e){var d=new Image,h=google,i=h.lc,f=h.li,j="";d.onerror=(d.onload=(d.onabort=function(){delete i[f]}));i[f]=d;if(!c&&b.search("&ei=")==-1)j="&ei="+google.getEI(e);var g=c||"/gen_204?atyp=i&ct="+a+"&cad="+b+j+"&zx="+google.time();
    var k=/^http:/i;if(k.test(g)&&google.https()){google.ml(new Error("GLMM"),false,{src:g});delete i[f];return}d.src=g;h.li=f+1},lc:[],li:0,j:{en:1,l:function(){google.fl=true},e:function(){google.fl=true},
    b:location.hash&&location.hash!="#",bv:21,cf:"osb",pm:"p",pl:[],mc:0,sc:0.5,u:"f05f80a8"},Toolbelt:{},y:{},x:function(a,b){google.y[a.id]=[a,b];return false}};(function(){var a=
    google.j;window.onpopstate=function(){a.psc=1};for(var b=0,c;c=["ad","bc","inpr","is","p","pa","ac","pc","pah","ph","sa","sifp","slp","spf","spn","xx","zc","zz"][b++];)(function(e){a[e]=function(){a.pl.push([e,arguments])}})(c)})();if(!window.chrome)window.chrome={};window.chrome.sv=2.00;window.chrome.userWantsQuery=function(a){google.x({id:"psyapi"},function(){google.nav.search({q:encodeURIComponent(a),
    sourceid:"chrome-psyapi1"})})};
    window.google.sn="webhp";window.google.timers={};window.google.startTick=function(a,b){window.google.timers[a]={t:{start:(new Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!window.google.timers[a])google.startTick(a);window.google.timers[a].t[b]=c||(new Date).getTime()};google.startTick("load",true);try{}catch(u){}
    </script>

    GggTtt, 23 Мая 2012

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

    +147

    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
    <br><br><br><br>
    
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    
             <a style="color:red; font-type:bold;" href="recipes.html">Рецепты хлеба</a>&nbsp;&nbsp;&nbsp;
    
             <a style="color:red;" href="vipechka.html">Выпечка хлеба</a>&nbsp;&nbsp;&nbsp;
    
             <a style="color:red;" href="combinates_msk.html">Хлебозаводы Москвы</a>&nbsp;&nbsp;&nbsp;
    
             <a style="color:red;" href="faq.php">Вопрос эксперту</a>&nbsp;&nbsp;&nbsp;
    
             <a style="color:red;" href="press.php">Хлебные новости</a>
    
    
    
             </div>

    Не знал куда выложить, запостил сюда. Нувыпоняли...

    ibrain, 19 Мая 2012

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

    +176

    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)
  10. JavaScript / Говнокод #10269

    +161

    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, 14 Мая 2012

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