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

    +144

    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
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    Draggable.prototype.move = function(event){		
    		var event = Runic.event.getEvent(event),
    			mLeft = (this.direction == 'both' || this.direction == 'horizontal') ? (Runic.event.getEventX(event) - this.mdiffX) : this.element.offsetLeft,
    			mTop = (this.direction == 'both' || this.direction == 'vertical') ? (Runic.event.getEventY(event) - this.mdiffY) : this.element.offsetTop,
    		//get cursor position
    			curx = Runic.event.getEventX(event),
    			cury = Runic.event.getEventY(event);
    		if (this.box) {
    			if (this.direction == 'horizontal' || this.direction == 'both') {
    				if (curx > this.fromX && curx < this.toX) {
    					this.element.style.left = mLeft  + 'px';
    				} else if (curx <= this.fromX && this.direction) {
    					if (this.boxCSSPosition == 'relative' || this.boxCSSPosition=='absolute') {
    						this.element.style.left = 0 + 'px'
    						this.element.style.right = 'auto'
    					} else {
    						this.element.style.left = this.box.offsetLeft + 'px'
    					}
    				} else if (curx >= this.toX) {
    					if (this.boxCSSPosition == 'relative' || this.boxCSSPosition=='absolute') {
    						this.element.style.right = 0 + 'px'
    						this.element.style.left = 'auto'
    					} else {
    						this.element.style.left = this.box.offsetLeft + this.box.clientWidth - this.element.clientWidth + 'px'
    					}
    				}
    			}
    			if (this.direction == 'vertical' || this.direction == 'both') {
    				if (cury > this.fromY && cury < this.toY) {
    					this.element.style.top = mTop + 'px';
    				} else if (cury <= this.fromY) {
    					if (this.boxCSSPosition == 'relative' || this.boxCSSPosition=='absolute') {
    						this.element.style.top = 0 + 'px';
    						this.element.style.bottom = 'auto'
    					} else {
    						this.element.style.top = this.box.offsetTop + 'px'
    					}		
    				} else if (cury >= this.toY) {
    					if (this.boxCSSPosition == 'relative' || this.boxCSSPosition=='absolute') {
    						this.element.style.bottom = 0 + 'px';
    						this.element.style.top = 'auto'
    					} else {
    						this.element.style.top = this.box.offsetTop + this.box.clientHeight - this.element.clientHeight + 'px'
    					}
    				}
    			}
    		} else {
    			this.element.style.left = mLeft  + 'px';
    			this.element.style.top = mTop + 'px';
    		}
    		//run callback funciton
    		if (this.onDrag != undefined && typeof this.onDrag.func == 'function') {
    			if (this.onDragCount < this.onDrag.count || this.onDrag.count == 0) {
    				this.onDragCount++;
    				this.onDrag.func();
    			}
    		}
    	}

    наговнокодил

    kubynek, 20 Августа 2010

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

    +150

    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
    function countdown() {
    		var today = new Date();
    		var start = new Date();
    		start.setTime(Math.ceil(Время ближайшей трансляции будет скоро объявлено * 1000));
    		var remains = new Date();
    		remains.setTime(start - today);
    		//window.status = remains;
    		var d = remains.getUTCDate() - 1;
    		var h = remains.getUTCHours();
    		var m = remains.getUTCMinutes();
    		
    		d = textize(d, 'день', 'дня', 'дней');
    		h = textize(h, 'час', 'часа', 'часов');
    		m = textize(m, 'минуту', 'минуты', 'минут');
    		
    		if (remains.getUTCHours() == 0 && remains.getUTCMinutes() < 5) {
    			document.getElementById('remains').innerHTML="Трансляция начнется с минуты на минуту";
    		} else if (remains.getTime() < 0) {
    			document.getElementById('remains').innerHTML="Трансляция идет";
    			//if (!document.getElementById('hll')) {
    			//	location.reload(true);
    			//}
    		} else {
    			document.getElementById('remains').innerHTML="Ближайшая трансляция — через <b>"+d+" "+h+" "+m+"</b>";
    		}
    	
    		t = setTimeout('countdown()',500);
    	}

    взято с сайта http://kultu.ru/

    kubynek, 20 Августа 2010

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

    +173

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    function jsPlay(soundobj) {
     var thissound= eval("document."+soundobj);
     try {
     thissound.Play(); // играй!!!
     }
     catch (e) {
     thissound.DoPlay(); // играй СЦУКО!!!!!!!!!!!
     }
    }

    http://rabota2009.ucoz.ru/
    вот так надо использовать try-catch если вы не знали.

    Alfred, 20 Августа 2010

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

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function rnd(){
    var randscript = -1;
    var num = banners.length;
    while (randscript < 0 || randscript > parseInt(num/col)-1 || isNaN(randscript)){
            randscript = parseInt(Math.random()*(num+1))
    }
    return randscript
    }

    http://earninguide.biz/top.js
    генераторы бывают случайные и псевдослучайные.
    но есть еще и псевдо_ХУ_евые!
    вот один из них...

    Alfred, 20 Августа 2010

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

    +162

    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 urldecode(code) {
    code = escape(code);
    code = code.replace(/\+/g,' ');
    code = code.replace(/%21/g,'!');
    code = code.replace(/%22/g,'"');
    code = code.replace(/%23/g,'#');
    code = code.replace(/%24/g,'$');
    code = code.replace(/%2D/g,'-');
    code = code.replace(/%5E/g,'^');
    code = code.replace(/%26/g,'&');
    code = code.replace(/%B9/g,'?');
    code = code.replace(/%3B/g,';');
    code = code.replace(/%25/g,'%');
    code = code.replace(/%3A/g,':');
    code = code.replace(/%3F/g,'?');
    code = code.replace(/%28/g,'(');
    code = code.replace(/%29/g,')');
    
    /*...70 строк такого же говна...*/
    
    return code;
    }

    http://informer.gismeteo.ru/js/decode.js
    Прошу прощения если баян.

    Vindicar, 18 Августа 2010

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

    +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
    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
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    <div id="header">
    <script>
        function mShow (mEl) {
          if (document.getElementById(mEl)) {
            el = document.getElementById(mEl);
            if (el.style.display=='block') el.style.display = 'none';
            else el.style.display ='block';
            if (mEl != 'mFoto') document.getElementById('mFoto').style.display = 'none';
            if (mEl != 'mFriend') document.getElementById('mFriend').style.display = 'none';
            if (mEl != 'mMessage') document.getElementById('mMessage').style.display = 'none';
          }
        }
        function sOff (e) {
            if(!e){e=window.event;}
            var message="";
            document.getElementById('mFoto').style.display = 'none';
            document.getElementById('mFriend').style.display = 'none';
            document.getElementById('mMessage').style.display = 'none';
            
            function clickIE() {if (document.all) {(message);return false;}}
            function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) {
              if (e.which==2||e.which==3) {
                (message);
              return false;}}}
                if (document.layers) {
                  document.captureEvents(Event.MOUSEDOWN);
                  document.onmousedown=clickNS;
                }else{
                  document.onmouseup=clickNS;
                  document.oncontextmenu=clickIE;
                }
      //document.oncontextmenu=new Function("return false")
        }
    
    if(document.addEventListener){
      document.addEventListener("click",sOff,true);
    }else if(document.attachEvent){
      document.attachEvent("onclick",sOff);
    }else{
      document.onclick = sOff;
    }
    
      </script>
    <ul class="menu_top">
    
    <li><a href="/users/555355" style="font-weight:bold;">inkanus</a> (<a href="/logout">выйти</a>)
    </li>
    <li>
    <a href="#" onClick="mShow('mFoto');return false;">Мои фотографии <small>▼</small></a>
      <ul id='mFoto' class="submenu_top" style="right:280px;">
      <li><a href="/users/555355">Моя страница</a></li>
        <li><a href="/upload">Загрузить фотографии</a></li>
        <li><a href="/create">Создать альбом</a></li>
        <li><a href="/comments">Последние комментарии</a></li>
        <li><a href="/options">Настройки</a></li>
      </ul>
    </li>
    <li>
    <a href="#" onClick="mShow('mFriend');return false;">Мои друзья <small>▼</small></a>
      <ul id='mFriend' class="submenu_top" style="right:166px;">
        <li><a href="/friends">Фотки друзей</a></li>
        <li><a href="/friends/control">Друзья</a></li>
        <li><a href="/friends/banned">Игнорируемые</a></li>
      </ul>
    </li>
    <li>
    <a href="#" onClick="mShow('mMessage');return false;">Мои сообщения <small>▼</small></a>
      <ul id='mMessage' class="submenu_top" style="right:5px;">
        <li><a href="/messages">Входящие</a></li>
        <li><a href="/messages/sent">Исходящие</a></li>
        <li><a href="/messages/send">Отправить сообщение</a></li>
      </ul>
    </li>
    </ul>
      </div>

    Взято с одного фотосайта.

    inkanus-gray, 17 Августа 2010

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

    +151

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    <div id="stat" class="list_menu" onclick="
                            if ($('#stat_sub').is(':hidden')){
                                $('#stat_sub').slideDown('slow');
                            } else {
                                $('#stat_sub').slideUp('slow');
                            }">Статистика</div>

    Тот же автор, что и #4015

    scalar4eblo4no, 17 Августа 2010

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

    +165

    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).ready(function(){
            if (2==0){
                $("#manage").hide();
                $("#manage_sub").hide();
            }
            if (2==0){
                $("#dfd").hide();
                $("#dfd_sub").hide();
            }
            if (2==0){
                $("#pfd").hide();
                $("#pfd_sub").hide();
            }
            if (2==0){
                $("#act").hide();
                $("#act_sub").hide();
            }
            if (2==0){
                $("#tests").hide();
                $("#tests_sub").hide();
            }
            if (2==0){
                $("#stat").hide();
                $("#stat_sub").hide();
            }
            if (2==0){
                $("#users").hide();
                $("#users_sub").hide();
            }
        })

    Условия (2==0) выводятся на страницу PHP-скриптом, в зависимости от выходных параметров

    scalar4eblo4no, 17 Августа 2010

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

    +147

    1. 1
    <a href="javascript://close" class="closeButton"></a>

    temotor, 17 Августа 2010

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

    +165

    1. 1
    2. 2
    if (evt.keyCode == 13)
    	evt.keyCode = 9

    Нашел на работе. Вообще, оно только для чтения, но в IE почему то работает.

    glazs, 17 Августа 2010

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