1var RSGoPro_JSPParentSelector = '.scrollp'; 2var RSGoPro_JSPScrollSelector = '.scroll'; 3var RSGoPro_JSPAllChildrensSelector = '.scrollinner'; 4var RSGoPro_JSPOneChildrenSelector = '.scrollitem'; 5var RSGoPro_JSPButtonsSelector = '.scrollbtn'; 6var RSGoPro_SimpleScrollScrollSpeed = 500; 7 8(function($){ 9 $.fn.hasScrollBarY = function(){ 10 var divnode = this.get(0); 11 if(divnode.scrollHeight>divnode.clientHeight) 12 return true; 13 } 14 $.fn.hasScrollBarX = function(){ 15 var divnode = this.get(0); 16 if(divnode.scrollWidth>divnode.clientWidth) 17 return true; 18 } 19})(jQuery); 20 21function RSGoPro_JSPInit(selector) { 22 var $scroll = $(selector); 23 if ($scroll.length > 0) { 24 $scroll.parents(RSGoPro_JSPParentSelector).addClass('jsp'); 25 RSGoPro_JSPInitByObj($scroll); 26 $scroll.each(function(i) { 27 if ($(this).hasClass('jspScrollable')) { 28 $(this).parents(RSGoPro_JSPParentSelector).addClass('jspHasScroll'); 29 } 30 }); 31 } 32} 33 34function RSGoPro_JSPInitByObj($scroll) { 35 $scroll.jScrollPane({animateScroll: true, mouseWheelSpeed: 30, verticalGutter: 0}); 36} 37 38function RSGoPro_JSPReinit(selector, needDestroy) { 39 var $scroll = $(selector); 40 RSGoPro_JSPReinitByObj($scroll, needDestroy); 41} 42 43function RSGoPro_JSPReinitByObj($scroll, needDestroy) { 44 if ($scroll.length > 0) { 45 var selector = '#'; 46 if ($scroll.parents(RSGoPro_JSPParentSelector).hasClass('horizontal')) { 47 var count=0,elemWidth=0; 48 $scroll.each(function(i){ 49 count = $(this).find(RSGoPro_JSPAllChildrensSelector).find(RSGoPro_JSPOneChildrenSelector).length; 50 elemWidth = $(this).find(RSGoPro_JSPAllChildrensSelector).find(RSGoPro_JSPOneChildrenSelector).filter(':first').outerWidth(true); 51 $(this).find(RSGoPro_JSPAllChildrensSelector).css({width:(count*elemWidth)+'px'}); 52 }); 53 } 54 55 setTimeout(function(){ // fix for slow shit 56 if (needDestroy) { 57 $scroll.each(function(i) { 58 pane2api = $(this).data('jsp'); 59 if (!!pane2api) { 60 pane2api.destroy(); 61 RSGoPro_JSPInitByObj($(this)); 62 } else { 63 RSGoPro_JSPInitByObj($(this)); 64 } 65 }); 66 } else { 67 var pane2api; 68 $scroll.parents(RSGoPro_JSPParentSelector).removeClass('jspHasScroll'); 69 $scroll.each(function(i) { 70 pane2api = $(this).data('jsp'); 71 if (!!pane2api) { 72 pane2api.reinitialise(); 73 } else { 74 RSGoPro_JSPInitByObj($(this)); 75 } 76 if ($(this).hasClass('jspScrollable')) { 77 $(this).parents(RSGoPro_JSPParentSelector).addClass('jspHasScroll'); 78 } 79 }); 80 } 81 }, 50); 82 } 83} 84 85function RSGoPro_SimpleScrollInit(selector) { 86 var $scroll = $(selector); 87 if( $scroll.length>0 ) 88 { 89 var count=0,elemWidth=0; 90 if( $scroll.parents(RSGoPro_JSPParentSelector).hasClass('horizontal') ) 91 { 92 $scroll.each(function(i){ 93 count = $(this).find(RSGoPro_JSPAllChildrensSelector).find(RSGoPro_JSPOneChildrenSelector).length; 94 elemSize = $(this).find(RSGoPro_JSPAllChildrensSelector).find(RSGoPro_JSPOneChildrenSelector).filter(':first').outerWidth(true); 95 $(this).css({overflowX:'auto',overflowY:'hidden'}).find(RSGoPro_JSPAllChildrensSelector).css({width:(count*elemSize)+'px'}); 96 if( $(this).hasScrollBarX() ) 97 { 98 $(this).parents(RSGoPro_JSPParentSelector).addClass('jspHasScroll'); 99 } 100 }); 101 } else { 102 $scroll.each(function(i){ 103 count = $(this).find(RSGoPro_JSPAllChildrensSelector).find(RSGoPro_JSPOneChildrenSelector).length; 104 elemSize = $(this).find(RSGoPro_JSPAllChildrensSelector).find(RSGoPro_JSPOneChildrenSelector).filter(':first').outerHeight(true); 105 //$(this).css({overflowX:'hidden',overflowY:'auto'}).find(RSGoPro_JSPAllChildrensSelector).css({width:(count*elemSize)+'px'}); 106 if( $(this).hasScrollBarY() ) 107 { 108 $(this).parents(RSGoPro_JSPParentSelector).addClass('jspHasScroll'); 109 } 110 }); 111 } 112 $scroll.parents(RSGoPro_JSPParentSelector).addClass('simple'); 113 } 114} 115function RSGoPro_SimpleScrollReinit(selector) 116{ 117 $(selector).each(function(i){ 118 if( $(this).hasScrollBarY() ) 119 { 120 $(this).parents(RSGoPro_JSPParentSelector).addClass('jspHasScroll'); 121 } 122 }); 123} 124 125function RSGoPro_ScrollInit(selector) 126{ 127 if(RSDevFunc_PHONETABLET) // this is tablet or phone 128 { 129 // init 130 RSGoPro_SimpleScrollInit(selector); 131 } else { // this is PC 132 // init 133 RSGoPro_JSPInit(selector); 134 } 135} 136function RSGoPro_ScrollReinit(selector,needDestroy) 137{ 138 if(RSDevFunc_PHONETABLET) // this is tablet or phone 139 { 140 // reinit 141 RSGoPro_SimpleScrollReinit(selector); 142 } else { 143 // reinit 144 RSGoPro_JSPReinit(selector,needDestroy); 145 } 146} 147function RSGoPro_ScrollPressButton($btn) 148{ 149 var $scroll = $btn.parents(RSGoPro_JSPParentSelector).find(RSGoPro_JSPScrollSelector); 150 if( $btn.parents(RSGoPro_JSPParentSelector).hasClass('horizontal') ) 151 { 152 var elemSize = $scroll.find(RSGoPro_JSPAllChildrensSelector).find(RSGoPro_JSPOneChildrenSelector).filter(':first').outerWidth(true); 153 } else { 154 var elemSize = $scroll.find(RSGoPro_JSPAllChildrensSelector).find(RSGoPro_JSPOneChildrenSelector).filter(':first').outerHeight(true); 155 } 156 if( $btn.parents(RSGoPro_JSPParentSelector).hasClass('horizontal') && $btn.hasClass('prev') && $btn.parents(RSGoPro_JSPParentSelector).hasClass('jsp') ) 157 { 158 $scroll.data('jsp').scrollByX( -(elemSize) ); 159 } else if( $btn.parents(RSGoPro_JSPParentSelector).hasClass('horizontal') && $btn.hasClass('prev') && $btn.parents(RSGoPro_JSPParentSelector).hasClass('simple') ) 160 { 161 $scroll.stop().scrollTo( {top:'+=0px',left:'-='+(elemSize)}, RSGoPro_SimpleScrollScrollSpeed ); 162 } else if( $btn.parents(RSGoPro_JSPParentSelector).hasClass('horizontal') && $btn.hasClass('next') && $btn.parents(RSGoPro_JSPParentSelector).hasClass('jsp') ) 163 { 164 $scroll.data('jsp').scrollByX( (elemSize) ); 165 } else if( $btn.parents(RSGoPro_JSPParentSelector).hasClass('horizontal') && $btn.hasClass('next') && $btn.parents(RSGoPro_JSPParentSelector).hasClass('simple') ) 166 { 167 $scroll.stop().scrollTo( {top:'+=0px',left:'+='+(elemSize)}, RSGoPro_SimpleScrollScrollSpeed ); 168 } else if( $btn.parents(RSGoPro_JSPParentSelector).hasClass('vertical') && $btn.hasClass('prev') && $btn.parents(RSGoPro_JSPParentSelector).hasClass('jsp') ) 169 { 170 $scroll.data('jsp').scrollByY( -(elemSize) ); 171 } else if( $btn.parents(RSGoPro_JSPParentSelector).hasClass('vertical') && $btn.hasClass('prev') && $btn.parents(RSGoPro_JSPParentSelector).hasClass('simple') ) 172 { 173 $scroll.stop().scrollTo( {top:'-='+(elemSize),left:'+=0px'}, RSGoPro_SimpleScrollScrollSpeed ); 174 } else if( $btn.parents(RSGoPro_JSPParentSelector).hasClass('vertical') && $btn.hasClass('next') && $btn.parents(RSGoPro_JSPParentSelector).hasClass('jsp') ) 175 { 176 $scroll.data('jsp').scrollByY( (elemSize) ); 177 } else if( $btn.parents(RSGoPro_JSPParentSelector).hasClass('vertical') && $btn.hasClass('next') && $btn.parents(RSGoPro_JSPParentSelector).hasClass('simple') ) 178 { 179 $scroll.stop().scrollTo( {top:'+='+(elemSize),left:'+=0px'}, RSGoPro_SimpleScrollScrollSpeed ); 180 } 181} 182 183function RSGoPro_ScrollGoToElement($element) { 184 var $scroll = $element.parents(RSGoPro_JSPParentSelector).find(RSGoPro_JSPScrollSelector); 185 if ($element.parents(RSGoPro_JSPParentSelector).hasClass('jsp')) { 186 var pane2api = $scroll.data('jsp'); 187 if (!!pane2api) { 188 $scroll.data('jsp').scrollToElement($element, false); 189 } 190 } else if ($element.parents(RSGoPro_JSPParentSelector).hasClass('simple')) { 191 $scroll.stop().scrollTo($element, RSGoPro_SimpleScrollScrollSpeed); 192 } 193} 194 195$(document).ready(function(){ 196 197 // press button 198 $(document).on('click',RSGoPro_JSPParentSelector+' '+RSGoPro_JSPButtonsSelector,function(){ 199 var $btn = $(this); 200 if ($btn.parents(RSGoPro_JSPParentSelector).length > 0) { 201 RSGoPro_ScrollPressButton($btn); 202 } 203 return false;
204 }); 205 206});
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.