source: extensions/rv_tscroller/rv_tscroller.min.js @ 32124

Last change on this file since 32124 was 29023, checked in by rvelices, 10 years ago

rv_tscroller allow other plugins to insert dynamic html somewhere else ...

  • Property svn:eol-style set to LF
File size: 3.1 KB
Line 
1window.jQuery&&window.RVTS&&function(b){if(0<RVTS.start){var e=b(".navigationBar A[rel=first]");b("#thumbnails").before('<div id=rvtsUp style="text-align:center;font-size:120%;margin:10px"><a href="'+e.attr("href")+'">'+e.html()+'</a> | <a href="javascript:RVTS.loadUp()">'+RVTS.prevMsg+"</a></div>")}RVTS=b.fn.extend(RVTS,{loading:0,loadingUp:0,adjust:0,loadUp:function(){if(!(RVTS.loadingUp||0>=RVTS.start)){var a=RVTS.start-RVTS.perPage,c=RVTS.perPage;0>a&&(c+=a,a=0);c=RVTS.ajaxUrlModel.replace("%start%",
2a).replace("%per%",c);b("#ajaxLoader").show();RVTS.loadingUp=1;b.ajax({type:"GET",dataType:"html",url:c,success:function(c){RVTS.start=a;var e=jQuery.Event("RVTS_add");b(window).trigger(e,[c,!1]);e.isDefaultPrevented()||RVTS.$thumbs.prepend(c);0>=RVTS.start&&b("#rvtsUp").remove()},complete:function(){RVTS.loadingUp=0;RVTS.loading||b("#ajaxLoader").hide();b(window).trigger("RVTS_loaded",0);"undefined"!=typeof pwg_ajax_thumbnails_loader&&pwg_ajax_thumbnails_loader()}})}},doAutoScroll:function(){if(!(RVTS.loading||
3RVTS.next>=RVTS.total)){var a=RVTS.ajaxUrlModel.replace("%start%",RVTS.next).replace("%per%",RVTS.perPage);RVTS.adjust&&(a+="&adj="+RVTS.adjust,RVTS.adjust=0);b("#ajaxLoader").show();RVTS.loading=1;b.ajax({type:"GET",dataType:"html",url:a,success:function(a){RVTS.next+=RVTS.perPage;var d=jQuery.Event("RVTS_add");b(window).trigger(d,[a,!0]);d.isDefaultPrevented()||RVTS.$thumbs.append(a);500<RVTS.next-RVTS.start&&50<RVTS.total-RVTS.next&&(RVTS.$thumbs.after('<div style="text-align:center;font-size:180%;margin:0 0 20px"><a href="'+
4RVTS.urlModel.replace("%start%",RVTS.next)+'">'+RVTS.moreMsg.replace("%d",RVTS.total-RVTS.next)+"</a></div>"),RVTS.total=0)},complete:function(){RVTS.loading=0;RVTS.loadingUp||b("#ajaxLoader").hide();b(window).trigger("RVTS_loaded",1);"undefined"!=typeof pwg_ajax_thumbnails_loader&&pwg_ajax_thumbnails_loader()}})}},checkAutoScroll:function(a){var c=RVTS.$thumbs.position().top+RVTS.$thumbs.outerHeight(),d=b(window).scrollTop()+b(window).height();return c-(a?100:0)<=d?(RVTS.doAutoScroll(),1):0},engage:function(){var a=
5b(window);RVTS.$thumbs=b("#thumbnails");RVTS.$thumbs.after('<div id="ajaxLoader" style="display:none;position:fixed;bottom:32px;right:1%;z-index:999"><img src="'+RVTS.ajaxLoaderImage+'" width="128" height="15" alt="~"></div>');"#top"==window.location.hash&&window.scrollTo(0,0);RVTS.$thumbs.outerHeight()<a.height()?RVTS.adjust=1:RVTS.$thumbs.height()>2*a.height()&&(RVTS.adjust=-1);a.on("scroll resize",RVTS.checkAutoScroll);RVTS.checkAutoScroll()&&window.setTimeout(RVTS.checkAutoScroll,1500)}});b(document).ready(function(){"#top"==
6window.location.hash&&window.scrollTo(0,0);window.setTimeout(RVTS.engage,150)});if(window.history.replaceState){var f=RVTS.start;b(window).one("RVTS_loaded",function(){b(window).on("unload",function(){for(var a=Math.max(0,b(window).scrollTop()-60),c=RVTS.$thumbs.children("li"),d=0;d<c.length;d++)if(b(c[d]).offset().top>=a){a=RVTS.start+d;c=a-f;if(0>c||c>=RVTS.perPage)a=a?RVTS.urlModel.replace("%start%",a):RVTS.urlModel.replace("/start-%start%",""),window.history.replaceState(null,"",a+"#top");break}})})}}(jQuery);
Note: See TracBrowser for help on using the repository browser.