1 2jQuery(document).ready(function() { 3 $j = jQuery; 4 5 var pixperclick = 10; 6 $j('#titulares').css('overflow', 'hidden'); 7 8 // arrow up --------------------------------------------------------------- 9 var up = $j('<div class="up"></div>'); 10 up.get(0).__pressed = false; 11 up.mousedown(function() 12 { 13 this.__pressed = true; 14 $j(this).addClass('up-click'); 15 go_up(); 16 return false; 17 }); 18 function go_up() 19 { 20 if ($j("#blogs .up").get(0).__pressed) 21 { 22 setTimeout(function() 23 { 24 var min = 0; 25 var n = (parseInt($j("#blogs .scrolltip").css('top'), 10) - pixperclick); 26 n = (n > min) ? n : min; 27 $j("#blogs .scrolltip").css('top', n + 'px'); 28 $j('#titulares').get(0).scrollTop -= (pixperclick * ratio); 29 go_up() 30 }, 50); 31 } 32 } 33 up.mouseup(function() 34 { 35 this.__pressed = false; 36 $j(this).removeClass('up-click'); 37 }); 38 // arrow down ------------------------------------------------------------- 39 var dw = $j('<div class="down"></div>'); 40 dw.get(0).__pressed = false; 41 dw.mousedown(function() 42 { 43 this.__pressed = true; 44 $j(this).addClass('down-click'); 45 go_down(); 46 return false; 47 }); 48 function go_down() 49 { 50 if ($j("#blogs .down").get(0).__pressed) 51 { 52 var max = 255; 53 var max = ($j("#blogs .scroll").get(0).offsetHeight - $j("#blogs .scrolltip").get(0).offsetHeight); 54 var n = (parseInt($j("#blogs .scrolltip").css('top'), 10) + pixperclick); 55 n = (n < max) ? n : max; 56 $j("#blogs .scrolltip").css('top', n + 'px'); 57 $j('#titulares').get(0).scrollTop += (pixperclick * ratio); 58 setTimeout(function() 59 { 60 go_down() 61 }, 50); 62 } 63 } 64 dw.mouseup(function() 65 { 66 this.__pressed = false; 67 $j(this).removeClass('down-click'); 68 }); 69 var scr = $j('<div class="scroll"></div>'); 70 var sct = $j('<div class="scrolltip"></div>'); 71 sct.append($j('<div class="scrolltiptop"></div>')); 72 sct.append($j('<div class="scrolltipbottom"></div>')); 73 74 $j('#blogs').append(up); 75 $j('#blogs').append(dw); 76 $j('#blogs').append(scr); 77 $j(scr).append(sct); 78 79 if($j('#titulares ul').length > 0) { 80 var scrollbar_height = parseInt($j("#blogs .scroll").css('height'), 10); 81 var viewport_absolute_height = $j('#titulares ul').get(0).offsetHeight; 82 var viewport_relative_height = parseInt($j('#titulares').css('height'), 10); 83 } 84 85 var scrolltip_height = ((scrollbar_height - 10) / viewport_absolute_height * viewport_relative_height); 86 if (scrolltip_height >= scrollbar_height) 87 { 88 scrolltip_height = 0; 89 $j("#blogs .scrolltip .scrolltiptop").css('height', 0); 90 $j("#blogs .scrolltip .scrolltipbottom").css('height', 0); 91 } 92 var ratio = (viewport_absolute_height / scrollbar_height); 93 $j("#blogs .scrolltip").css('height', scrolltip_height + 'px'); 94 $j("#blogs .scrolltip").draggable( 95 { 96 drag: function() 97 { 98 var index = parseInt($j(this).css('top'), 10) * ratio; 99 $j('#titulares').get(0).scrollTop = Math.round(index); 100 }, 101 axis: 'y', 102 containment: 'parent' 103 }); 104 105 // random position scrollbar 106 var bs = scrollbar_height - parseInt($j("#blogs .scrolltip").css('height'), 10); // bar-scroll 107 108 if($j('#titulares').length > 0) { 109 var ps = $j('#titulares ul').get(0).offsetHeight - $j('#titulares').get(0).offsetHeight; // pan-scroll 110 111 var pos = (Math.floor(Math.random() * 3) / 2); 112 $j('#titulares').get(0).scrollTop = Math.round(ps * pos); 113 $j("#blogs .scrolltip").css('top', Math.round(bs * pos) + 'px'); 114 } 115}); 116 117/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.