1/* 2 DraggScroll is a JQuery extension for scrolling by clicking and dragging from within a container. 3 Author: James Climer (http://climers.com) 4 Released under the Apache V2 License: http://www.apache.org/licenses/LICENSE-2.0.html 5 Requires JQuery: http://jquery.com 6 Get latest version from: https://github.com/jaclimer/JQuery-DraggScroll 7 8 options: Currently not used 9*/ 10(function ($) { 11 $.fn.dragScroll = function (options) { 12 /* Mouse dragg scroll */ 13 var x, y, top, left = 0, lastLeft = 0, down, direction; 14 var $scrollArea = $(this); 15 16 $($scrollArea).attr("onselectstart", "return false;"); // Disable text selection in IE8 17 18 $($scrollArea).mousedown(function (e) { 19 if(typeof options.limitTo == "object") { 20 for(var i = 0; i < options.limitTo.length; i++) { 21 if($(e.target).hasClass(options.limitTo[i])) { 22 doMousedown(e); 23 } 24 } 25 } else { 26 doMousedown(e); 27 } 28 }); 29 $($scrollArea).mouseleave(function (e) { 30 down = false; 31 }); 32 $("body").mousemove(function (e) { 33 if (down) { 34 var newX = e.pageX; 35 var newY = e.pageY; 36 var leftDrag = left - newX + x; 37 38 if(lastLeft>0){ 39 left = lastLeft; 40 }else{ 41 left = 1; 42 } 43 if(left > 20) 44 $($scrollArea).scrollTop(top - newY + y); 45 $($scrollArea).scrollLeft(leftDrag); 46 47 } 48 }); 49 $scrollArea.mouseup(function (e) { 50 if(lastLeft < $scrollArea.scrollLeft()){ 51 if($scrollArea.scrollLeft()-lastLeft>0){ 52 lastLeft = $scrollArea.scrollLeft() + 150; 53 $scrollArea.animate({scrollLeft: lastLeft},300,"easeOutCubic"); 54 down = false; 55 setTimeout(function(){ 56 lastLeft = $scrollArea.scrollLeft(); 57 },800); 58 }else{ 59 lastLeft = $scrollArea.scrollLeft(); 60 down = false; 61 } 62 }else{ 63 if(lastLeft-$scrollArea.scrollLeft()>0){ 64 lastLeft = $scrollArea.scrollLeft() -150; 65 $scrollArea.animate({scrollLeft: lastLeft},300,"easeOutCubic"); 66 down = false; 67 setTimeout(function(){ 68 lastLeft = $scrollArea.scrollLeft(); 69 70 },800); 71 }else{ 72 lastLeft = $scrollArea.scrollLeft(); 73 down = false; 74 } 75 76 } 77 }); 78 79 $scrollArea.next().mouseup(function (e) { 80 if(lastLeft < $scrollArea.scrollLeft()){ 81 lastLeft = $scrollArea.scrollLeft() + 150; 82 $scrollArea.animate({scrollLeft: lastLeft},300,"easeOutCubic"); 83 down = false; 84 setTimeout(function(){ 85 lastLeft = $scrollArea.scrollLeft(); 86 },800); 87 }else{ 88 lastLeft = $scrollArea.scrollLeft() -150; 89 $scrollArea.animate({scrollLeft: lastLeft},300,"easeOutCubic"); 90 down = false; 91 setTimeout(function(){ 92 lastLeft = $scrollArea.scrollLeft(); 93 94 },800); 95 } 96 }); 97 98 function doMousedown(e) { 99 e.preventDefault(); 100 down = true; 101 x = e.pageX; 102 y = e.pageY; 103 top = $(this).scrollTop(); 104 if(!left) 105 left = $(this).scrollLeft(); 106 else 107 left = lastLeft; 108 109 } 110 }; 111})(jQuery);
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.