[16787] | 1 | /* |
---|
| 2 | Don't use directly. Compile on http://closure-compiler.appspot.com/home |
---|
| 3 | */ |
---|
[16788] | 4 | RVTS.doAutoScroll = undefined; |
---|
| 5 | RVTS.checkAutoScroll = undefined; |
---|
| 6 | RVTS.engage = undefined; |
---|
| 7 | RVTS.loadUp = undefined; |
---|
| 8 | |
---|
[16787] | 9 | if (window.jQuery && window.RVTS) |
---|
| 10 | (function($){ |
---|
| 11 | $('.navigationBar').hide(); |
---|
| 12 | if (RVTS.start>0) { |
---|
| 13 | var $f = $('.navigationBar A[rel=first]'); |
---|
| 14 | var f = '<a href="'+$f.attr("href")+'">'+$f.html()+'</a> | '; |
---|
| 15 | $('#content_cell').before( '<div id=rvtsUp_sc style="text-align:center;font-size:120%;margin:10px">'+f+'<a href="javascript:RVTS.loadUp()">'+RVTS.prevMsg+"</a></div>" ); |
---|
| 16 | $(window).trigger('rvtsUp'); |
---|
| 17 | } |
---|
| 18 | RVTS.doAutoScroll = undefined; |
---|
| 19 | RVTS.checkAutoScroll = undefined; |
---|
| 20 | RVTS.engage = undefined; |
---|
| 21 | RVTS.loadUp = undefined; |
---|
| 22 | |
---|
| 23 | RVTS = $.fn.extend( RVTS, { |
---|
| 24 | loading: 0, |
---|
| 25 | loadingUp: 0, |
---|
| 26 | adjust: 0, |
---|
| 27 | |
---|
| 28 | loadUp: function() { |
---|
| 29 | if (RVTS.loadingUp || RVTS.start <= 0) return; |
---|
| 30 | var newStart = RVTS.start-RVTS.perPage, |
---|
| 31 | reqCount = RVTS.perPage; |
---|
| 32 | if (newStart<0) |
---|
| 33 | { |
---|
| 34 | reqCount += newStart; |
---|
| 35 | newStart = 0; |
---|
| 36 | } |
---|
| 37 | var url = RVTS.ajaxUrlModel.replace('%start%', newStart).replace('%per%', reqCount); |
---|
| 38 | $('#ajaxLoader').show(); |
---|
| 39 | RVTS.loadingUp = 1; |
---|
| 40 | $.ajax({ |
---|
| 41 | type:'GET', dataType:'html', 'url': url, |
---|
| 42 | success: function(htm) { |
---|
| 43 | RVTS.start = newStart; |
---|
| 44 | //RVTS.$thumbs.prepend(htm); |
---|
| 45 | var $newItems = $(htm); |
---|
| 46 | //$('#content_cell').prepend( $newItems ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); |
---|
| 47 | $('#thumbnails').prepend( $newItems ); |
---|
| 48 | $('#content_cell').isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); |
---|
| 49 | if (RVTS.start<=0) |
---|
| 50 | $("#rvtsUp").remove(); |
---|
| 51 | }, |
---|
| 52 | complete: function() { |
---|
| 53 | RVTS.loadingUp = 0; |
---|
| 54 | RVTS.loading || $('#ajaxLoader').hide(); |
---|
| 55 | $(window).trigger('RVTS_loaded'); |
---|
| 56 | if (typeof pwg_ajax_thumbnails_loader != 'undefined') |
---|
| 57 | pwg_ajax_thumbnails_loader(); |
---|
| 58 | } |
---|
| 59 | }); |
---|
| 60 | }, |
---|
| 61 | |
---|
| 62 | doAutoScroll: function() { |
---|
| 63 | if (RVTS.loading || RVTS.next >= RVTS.total) return; |
---|
| 64 | var url = RVTS.ajaxUrlModel.replace('%start%', RVTS.next).replace('%per%', RVTS.perPage); |
---|
| 65 | if (RVTS.adjust) { |
---|
| 66 | url += '&adj=' + RVTS.adjust; |
---|
| 67 | RVTS.adjust=0; |
---|
| 68 | } |
---|
| 69 | $('#ajaxLoader').show(); |
---|
| 70 | RVTS.loading = 1; |
---|
| 71 | $.ajax({ |
---|
| 72 | type:'GET', dataType:'html', 'url': url, |
---|
| 73 | success: function(htm) { |
---|
| 74 | RVTS.next+=RVTS.perPage; |
---|
| 75 | //RVTS.$thumbs.append(htm); |
---|
| 76 | var $newItems = $(htm); |
---|
| 77 | $('#content_cell').append( $newItems ).isotope( 'appended', $newItems ); |
---|
| 78 | |
---|
| 79 | if (RVTS.next-RVTS.start>500 && RVTS.total-RVTS.next>50) { |
---|
| 80 | RVTS.$thumbs.after( |
---|
| 81 | '<div style="text-align:center;font-size:180%;margin:0 0 20px"><a href="' |
---|
| 82 | +RVTS.moreUrlModel.replace('%start%', RVTS.next)+'">' |
---|
| 83 | +RVTS.moreMsg.replace('%d', RVTS.total-RVTS.next) |
---|
| 84 | +'</a></div>'); |
---|
| 85 | RVTS.total = 0; |
---|
| 86 | } |
---|
| 87 | }, |
---|
| 88 | complete: function() { |
---|
| 89 | RVTS.loading = 0; |
---|
| 90 | RVTS.loadingUp || $('#ajaxLoader').hide(); |
---|
| 91 | $(window).trigger('RVTS_loaded'); |
---|
| 92 | if (typeof pwg_ajax_thumbnails_loader != 'undefined') |
---|
| 93 | pwg_ajax_thumbnails_loader(); |
---|
| 94 | } |
---|
| 95 | }); |
---|
| 96 | }, |
---|
| 97 | |
---|
| 98 | checkAutoScroll: function(evt) { |
---|
| 99 | var tBot=$('#content_cell').position().top+$('#content_cell').outerHeight() |
---|
| 100 | ,wBot=$(window).scrollTop()+$(window).height(); |
---|
| 101 | tBot -= !evt ? 0:100; //begin 100 pixels before end |
---|
| 102 | return tBot <= wBot ? (RVTS.doAutoScroll(),1) : 0; |
---|
| 103 | }, |
---|
| 104 | |
---|
| 105 | engage: function() { |
---|
| 106 | var $w = $(window); |
---|
| 107 | RVTS.$thumbs = $('#thumbnails'); |
---|
| 108 | 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>'); |
---|
| 109 | |
---|
| 110 | $w.scrollTop(0); |
---|
| 111 | if ( RVTS.$thumbs.outerHeight() < $w.height() ) |
---|
| 112 | RVTS.adjust = 1; |
---|
| 113 | else if ( RVTS.$thumbs.height() > 2*$w.height() ) |
---|
| 114 | RVTS.adjust = -1; |
---|
| 115 | $w.bind('scroll resize', RVTS.checkAutoScroll); |
---|
| 116 | if (RVTS.checkAutoScroll()) |
---|
| 117 | window.setTimeout(RVTS.checkAutoScroll,1500); |
---|
| 118 | } |
---|
| 119 | } );//end extend |
---|
| 120 | |
---|
| 121 | $(document).ready( function() { |
---|
| 122 | window.setTimeout(RVTS.engage,250); |
---|
| 123 | }); |
---|
| 124 | |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | })(jQuery); |
---|