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

    +153

    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
    $('#panAll').click( function(){
    	                $(this).addClass('panactive');
    	                
    	                $('#panPan').removeClass('panactive');
    	                $('#pan3D').removeClass('panactive');
    	                $('#panVtour').removeClass('panactive');
    	                
    	                $('#AllDesc').css('display', 'block');
    	                $('#PanDesc').css('display', 'none');
    	                $('#3DDesc').css('display', 'none');
    	                $('#VtourDesc').css('display', 'none');
    	            }); 
    	            
    	            $('#panPan').click( function(){
    	                $(this).addClass('panactive');
    	                
    	                $('#panAll').removeClass('panactive');
    	                $('#pan3D').removeClass('panactive');
    	                $('#panVtour').removeClass('panactive');
    	                
    	                $('#AllDesc').css('display', 'none');
    	                $('#PanDesc').css('display', 'block');
    	                $('#3DDesc').css('display', 'none');
    	                $('#VtourDesc').css('display', 'none');
    	            }); 
    	            
    	            $('#pan3D').click( function(){
    	                $(this).addClass('panactive');
    	                
    	                $('#panAll').removeClass('panactive');
    	                $('#panPan').removeClass('panactive');
    	                $('#panVtour').removeClass('panactive');
    	                
    	                $('#AllDesc').css('display', 'none');
    	                $('#PanDesc').css('display', 'none');
    	                $('#3DDesc').css('display', 'block');
    	                $('#VtourDesc').css('display', 'none');
    	            }); 
    	            $('#panVtour').click( function(){
    	                $(this).addClass('panactive');
    	                
    	                $('#panAll').removeClass('panactive');
    	                $('#panPan').removeClass('panactive');
    	                $('#pan3D').removeClass('panactive');
    	                
    	                $('#AllDesc').css('display', 'none');
    	                $('#PanDesc').css('display', 'none');
    	                $('#3DDesc').css('display', 'none');
    	                $('#VtourDesc').css('display', 'block');
    	            });

    Висит задание в црм - доделать ***.
    Таким вот образом был реализован функционал
    переключения между 4мя дивами, содержащими в себе данные.

    denum, 05 Марта 2012

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

    +209

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    const evalScript = "with (__win__.__scope__.vars) { with (__win__.__scope__.api) { with (__win__.__scope__.userVars) { with (__win__) {" +
        "try {" +
            "__win__.__scope__.callback(eval(__win__.__scope__.expr));" +
        "} catch (exc) {" +
            "__win__.__scope__.callback(exc, true);" +
        "}" +
    "}}}}";

    http://code.google.com/p/fbug/source/browse/branches/firebug1.2/content/firebug/commandLine.js?r=444

    3.14159265, 03 Марта 2012

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

    +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
    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
    function trySearch(form)
    {
    	var loc = "/?";
    	
    	var query_len = $.trim(form.query.value).length;
    	
    	if(form.game.value !== "all")
    	{
    		loc += 'game='+form.game.value;
    	}
    	
    	if(!query_len && form.search_by.value !== 'hostname' && form.search_by.value !== 'mode')
    	{
    		$('#display').slideDown();
    		Timer.set(function(){$('#display').slideUp();},5000);
    		
    		form.query.focus();
    		var msg = '';
    		
    		switch(form.search_by.value)
    		{
    			case 'map':
    				msg = 'Введите название карты которую хотите найти, например: <a href="#" onclick="$(\'#query\').val(\'de_dust2,de_inferno\').submit(); return false;">de_dust2,de_inferno</a>';
    				break;
    			case 'player':
    				msg = 'Введите имя игрока которого хотите найти';
    				break;
    			case 'rules':
    				msg = 'Введите настройку которую хотите найти, например: <a href="#" onclick="$(\'#query\').val(\'amxmodx_version 1.8.2-dev\').submit(); return false;">amxmodx_version 1.8.2-dev</a>';
    				break;
    			case 'ip':
    				msg = 'Введите ип-адрес который хотите найти';
    				break;
    		}
    		
    		$('#Msg').html(msg);
    		
    		return false;
    	}
    	if(query_len > 0 || form.search_by.value !== 'hostname')
    		loc += (form.game.value !== "all" ? '&' : '')+"search_by="+form.search_by.value;
    	if(query_len > 0)
    	{
    		loc += "&query="+escape(form.query.value);
    	}
    	
    	location.href = loc;
    	return false;
    }

    Zend, 24 Февраля 2012

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

    +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
    <script language="JavaScript">
                    <!--
                        document.write('<a href="#top" onclick="takeThis(\'<?php echo $PMA_Theme; ?>\'); return false;">');
                        document.write('<img src="<?php echo $screen_directory; ?>/screen.png" border="1" ');
                        if (document.getElementById) {
                            document.write('style="border: 1px solid #000000;" ');
                        }
                        document.write('alt="<?php echo htmlspecialchars(addslashes($theme_name)); ?>" ');
                        document.write('title="<?php echo htmlspecialchars(addslashes($theme_name)); ?>" />');
                        document.write('</a><br />');
                        document.write('[ <b><a href="#top" onclick="takeThis(\'<?php echo $PMA_Theme; ?>\'); return false;">');
                        document.write('<?php echo addslashes($strTakeIt); ?>');
                        document.write('</a></b> ]');
                    //-->
                    </script>

    Чужая самописная CMF. Файл themes в админке.

    zii, 22 Февраля 2012

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

    +150

    1. 1
    2. 2
    3. 3
    $('.form_gb textarea[name="vopros"]').val(replace_n($('.form_gb textarea[name="vopros"]').val()));//заменяем переводы строк на br
    var serialize_mas = $('.form_gb').serializeArray();
    $('.form_gb textarea[name="vopros"]').val(replace_br($('.form_gb textarea[name="vopros"]').val()));//заменяем br на переводы строк

    englandpost, 22 Февраля 2012

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

    +163

    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
    fadeOutAnimate($("#bigsun"), 500);
                fadeInAnimate($("#littlesun"), 500, function(){
                    fadeInAnimate($("#point1"), 300, function(){
                        fadeInAnimate($("#point2"), 300, function(){
                            fadeInAnimate($("#point3"), 300, function(){
                                fadeInAnimate($("#point4"), 300, function(){
                                    fadeInAnimate($("#point5"), 300, function(){
                                        fadeInAnimate($("#point6"), 300, function(){
                                            fadeInAnimate($("#point7"), 300, function(){
                                                fadeInAnimate($("#point8"), 300, function(){
                                                    fadeInAnimate($("#arrows"), 600, function(){
                                                        fadeInAnimate($("#direction1"), 300, function(){
                                                            fadeInAnimate($("#direction2"), 300, function(){
                                                                fadeInAnimate($("#direction3"), 300, function(){
                                                                    fadeInAnimate($("#direction4"), 300, function(){
                                                                        fadeInAnimate($("#direction5"), 300, function(){
                                                                            fadeInAnimate($("#direction6"), 300, function(){
                                                                                fadeInAnimate($("#direction7"), 300, function(){
                                                                                    fadeInAnimate($("#direction8"), 300, function(){
                                                        
                                                                                    });
                                                                                });
                                                                            });
                                                                        });
                                                                    });
                                                                });
                                                            });
                                                        });
                                                    });
                                                });
                                            });
                                        });
                                    });
                                });
                            });
                        });

    Анимация.

    fixxxerrr, 21 Февраля 2012

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

    +24

    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
    function on_record(status)
    {
    	// Ext.MessageBox.prompt('Name', 'Please enter your name:', 1);
    	var label = form2label();
        if(label['answers'][10]==1&&label['start']=='1970-01-01 03:00:00'&&label['order_num']!='1'){
            label['start'] = get_starttime_mysql();
        }
        else if(label['answers'][10]==2&&label['start']=='1970-01-01 03:00:00'){
            label['start'] = get_finishtime_mysql();
        }
    	label['status'] = status;
    	save_label(label);
    
    }

    превед.

    brainstorm, 20 Февраля 2012

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

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    //*****************************************************************************
    //************** ВНИМАНИЕ! ДАЛЬШЕ ИДЕТ СТРАШНЫЙ СТАРЫЙ КОД! *****************
    //**************** ОДЕНЬТЕ СКАФАНДР ПРИ ВХОДЕ В ЭТУ ЗОНУ! *******************
    //*****************************************************************************

    http://habrahabr.ru/js/1329490138/system.js

    kafeman, 20 Февраля 2012

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

    +153

    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
    do {
    			size = ($("#textHeight").val()) + "px";
    			$("#textView")
    				.text($("#textInput").val())
    				.css({
    					"color":rs.textColor,
    					"font-color":"#" + rs.textColor,
    					"font-size":size
    				});
    			Cufon.set("fontSize", size).replace("#textView", {
    				"color":"#" + rs.textColor,
    				"fontSize":size
    			});
    			$("#textView").center("#canvasBg");
    			($("#textView canvas").length ? $("#textView canvas") : $("#textView")).center("#canvasBg");
    			if ($("#textView canvas").length && ($("#textView canvas").width() <= $("#canvasBg").width()) && ($("#textView canvas").height() <= $("#canvasBg").height())) break;
    			if (($("#textView").width() <= $("#canvasBg").width()) && ($("#textView").height() <= $("#canvasBg").height())) break;
    			$("#textHeight").val($("#textHeight").val() - 1);
    
    		} while ($("#textHeight").val() > 9);

    Было сжатие картинки в цикле, а вот вам подгонка текста в канвасе.

    kyzi007, 18 Февраля 2012

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

    +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
    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
    data = Ext.JSON.decode(resp.responseText);
                Ext.getCmp('id').setValue(id);
                Ext.getCmp('address').setValue(data.address);
                Ext.getCmp('dateImp').setValue(data.dateImp);
                Ext.getCmp('numberCompl').setValue(data.numberCompl);
                Ext.getCmp('dateReg').setValue(data.dateReg);
                Ext.getCmp('numberOut').setValue(data.numberOut);
                Ext.getCmp('dateOut').setValue(data.dateOut);
                Ext.getCmp('inResolution').setValue(data.inResolution);
                Ext.getCmp('inFio').setValue(data.inFio);
                Ext.getCmp('shortText').setValue(data.shortText);
                Ext.getCmp('dateControl').setValue(data.dateControl);
                Ext.getCmp('dateClose').setValue(data.dateClose);
                Ext.getCmp('dateChange').setValue(data.dateChange);
                //            Ext.getCmp('department').setValue(data.department);
                //            Ext.getCmp('userview').setValue(data.userName);
                Ext.getCmp('useredit').setRawValue(data.user);
                Ext.getCmp('statusCompl').setRawValue(data.statusCompl);
                Ext.getCmp('description').setValue(data.description);
                
                if (data.canAdmin) {
                    Ext.getCmp('useredit').show();
                    //                Ext.getCmp('userview').hide();
                    Ext.getCmp('removeButton').show();
                    Ext.getCmp('copyComp').show();             
                } else {
                    Ext.getCmp('useredit').hide();
                    //                Ext.getCmp('userview').show();
                    Ext.getCmp('removeButton').hide();
                    Ext.getCmp('copyComp').hide();
                }
                
                if (data.canEdit) {
                    Ext.getCmp('save').hide();
                }
            }

    проект на Ext.js4
    Много Ext.getCmp('');
    Весь код - сплошная каша, динамическая загрузка Ext.js4 не используется, прикручено require.js,
    ни одного класса.

    maxt, 18 Февраля 2012

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