Changeset 27448 for extensions/rv_tscroller/rv_tscroller.js
- Timestamp:
- Feb 22, 2014, 7:38:56 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note: See TracChangeset
for help on using the changeset viewer.