Changeset 27448
- Timestamp:
- Feb 22, 2014, 7:38:56 AM (10 years ago)
- Location:
- extensions/rv_tscroller
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rv_tscroller/main.inc.php
r25974 r27448 1 1 <?php /* 2 2 Plugin Name: RV Thumb Scroller 3 Version: 2.6. a3 Version: 2.6.b 4 4 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=493 5 5 Description: Infinite scroll - loads thumbnails on index page as you scroll down the page … … 7 7 Author URI: http://www.modusoptimus.com 8 8 */ 9 define('RVTS_VERSION', '2 5a');9 define('RVTS_VERSION', '26'); 10 10 11 11 class RVTS … … 100 100 next: ".($start+$per_page).", 101 101 total: $total, 102 moreUrlModel: String.fromCharCode(".ord($url_model[0]).")+'".substr($url_model,1)."',102 urlModel: String.fromCharCode(".ord($url_model[0]).")+'".substr($url_model,1)."', 103 103 moreMsg: '$moreMsg', 104 104 prevMsg: '".l10n("Previous")."', -
extensions/rv_tscroller/rv_tscroller.js
r18904 r27448 6 6 if (RVTS.start>0) { 7 7 var $f = $('.navigationBar A[rel=first]'); 8 var f = '<a href="'+$f.attr("href")+'">'+$f.html()+'</a> | '; 9 $('#thumbnails').before( '<div id=rvtsUp style="text-align:center;font-size:120%;margin:10px">'+f+'<a href="javascript:RVTS.loadUp()">'+RVTS.prevMsg+"</a></div>" ); 8 $('#thumbnails').before( '<div id=rvtsUp style="text-align:center;font-size:120%;margin:10px"><a href="'+$f.attr("href")+'">'+$f.html()+'</a> | <a href="javascript:RVTS.loadUp()">'+RVTS.prevMsg+"</a></div>" ); 10 9 } 11 10 … … 62 61 RVTS.$thumbs.after( 63 62 '<div style="text-align:center;font-size:180%;margin:0 0 20px"><a href="' 64 +RVTS. moreUrlModel.replace('%start%', RVTS.next)+'">'63 +RVTS.urlModel.replace('%start%', RVTS.next)+'">' 65 64 +RVTS.moreMsg.replace('%d', RVTS.total-RVTS.next) 66 65 +'</a></div>'); … … 90 89 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>'); 91 90 92 $w.scrollTop(0); 91 if ("#top" == window.location.hash) 92 window.scrollTo(0,0); 93 93 94 if ( RVTS.$thumbs.outerHeight() < $w.height() ) 94 95 RVTS.adjust = 1; 95 96 else if ( RVTS.$thumbs.height() > 2*$w.height() ) 96 97 RVTS.adjust = -1; 97 $w. bind('scroll resize', RVTS.checkAutoScroll);98 $w.on('scroll resize', RVTS.checkAutoScroll); 98 99 if (RVTS.checkAutoScroll()) 99 100 window.setTimeout(RVTS.checkAutoScroll,1500); … … 102 103 103 104 $(document).ready( function() { 104 window.setTimeout(RVTS.engage,250); 105 if ("#top" == window.location.hash) 106 window.scrollTo(0,0); 107 window.setTimeout(RVTS.engage,150); 105 108 }); 106 109 107 108 110 if (window.history.replaceState) { 111 var iniStart = RVTS.start; 112 $(window).one("RVTS_loaded", function() { 113 $(window).on("unload", function() { 114 var threshold = Math.max(0, $(window).scrollTop() - 60), 115 elts = RVTS.$thumbs.children("li"); 116 for (var i=0; i<elts.length; i++) { 117 var offset = $(elts[i]).offset(); 118 if (offset.top >= threshold) { 119 var start = RVTS.start+i, 120 delta = start-iniStart; 121 if (delta<0 || delta>=RVTS.perPage) { 122 var url = start ? RVTS.urlModel.replace("%start%", start) : RVTS.urlModel.replace("/start-%start%", ""); 123 window.history.replaceState(null, "", url+ "#top"); 124 } 125 break; 126 } 127 } 128 }); 129 }); 130 } 109 131 })(jQuery); -
extensions/rv_tscroller/rv_tscroller.min.js
r18904 r27448 1 window.jQuery&&window.RVTS&&function(a){if(0<RVTS.start){var d=a(".navigationBar A[rel=first]"),d='<a href="'+d.attr("href")+'">'+d.html()+"</a> | ";a("#thumbnails").before('<div id=rvtsUp style="text-align:center;font-size:120%;margin:10px">'+d+'<a href="javascript:RVTS.loadUp()">'+RVTS.prevMsg+"</a></div>")}RVTS=a.fn.extend(RVTS,{loading:0,loadingUp:0,adjust:0,loadUp:function(){if(!(RVTS.loadingUp||0>=RVTS.start)){var b=RVTS.start-RVTS.perPage,c=RVTS.perPage;0>b&&(c+=b,b=0);c=RVTS.ajaxUrlModel.replace("%start%", b).replace("%per%",c);a("#ajaxLoader").show();RVTS.loadingUp=1;a.ajax({type:"GET",dataType:"html",url:c,success:function(c){RVTS.start=b;RVTS.$thumbs.prepend(c);0>=RVTS.start&&a("#rvtsUp").remove()},complete:function(){RVTS.loadingUp=0;RVTS.loading||a("#ajaxLoader").hide();a(window).trigger("RVTS_loaded",0);"undefined"!=typeof pwg_ajax_thumbnails_loader&&pwg_ajax_thumbnails_loader()}})}},doAutoScroll:function(){if(!(RVTS.loading||RVTS.next>=RVTS.total)){var b=RVTS.ajaxUrlModel.replace("%start%",RVTS.next).replace("%per%", RVTS.perPage);RVTS.adjust&&(b+="&adj="+RVTS.adjust,RVTS.adjust=0);a("#ajaxLoader").show();RVTS.loading=1;a.ajax({type:"GET",dataType:"html",url:b,success:function(a){RVTS.next+=RVTS.perPage;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="'+RVTS.moreUrlModel.replace("%start%",RVTS.next)+'">'+RVTS.moreMsg.replace("%d",RVTS.total-RVTS.next)+"</a></div>"),RVTS.total=0)},complete:function(){RVTS.loading= 0;RVTS.loadingUp||a("#ajaxLoader").hide();a(window).trigger("RVTS_loaded",1);"undefined"!=typeof pwg_ajax_thumbnails_loader&&pwg_ajax_thumbnails_loader()}})}},checkAutoScroll:function(b){var c=RVTS.$thumbs.position().top+RVTS.$thumbs.outerHeight(),d=a(window).scrollTop()+a(window).height();return c-(!b?0:100)<=d?(RVTS.doAutoScroll(),1):0},engage:function(){var b=a(window);RVTS.$thumbs=a("#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>');b.scrollTop(0);RVTS.$thumbs.outerHeight()<b.height()?RVTS.adjust=1:RVTS.$thumbs.height()>2*b.height()&&(RVTS.adjust=-1);b.bind("scroll resize",RVTS.checkAutoScroll);RVTS.checkAutoScroll()&&window.setTimeout(RVTS.checkAutoScroll,1500)}});a(document).ready(function(){window.setTimeout(RVTS.engage,250)})}(jQuery); 1 window.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%", 2 a).replace("%per%",c);b("#ajaxLoader").show();RVTS.loadingUp=1;b.ajax({type:"GET",dataType:"html",url:c,success:function(c){RVTS.start=a;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||RVTS.next>=RVTS.total)){var a=RVTS.ajaxUrlModel.replace("%start%",RVTS.next).replace("%per%", 3 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;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="'+RVTS.urlModel.replace("%start%",RVTS.next)+'">'+RVTS.moreMsg.replace("%d",RVTS.total-RVTS.next)+"</a></div>"),RVTS.total=0)},complete:function(){RVTS.loading= 4 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=b(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="'+ 5 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"==window.location.hash&&window.scrollTo(0,0);window.setTimeout(RVTS.engage,150)});if(window.history.replaceState){var f=RVTS.start; 6 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 TracChangeset
for help on using the changeset viewer.