source: extensions/rv_tscroller/rv_tscroller.js @ 9885

Last change on this file since 9885 was 9813, checked in by rvelices, 13 years ago

2.2.b avoid google bot retrieving ajax pages used by rv_tscroller

  • Property svn:eol-style set to LF
File size: 1.8 KB
Line 
1if (window.jQuery && window.RVTS)
2(function($){
3$('.navigationBar').hide();
4
5RVTS = $.fn.extend( RVTS, {
6loading: 0,
7adjust: 0,
8
9doAutoScroll: function() {
10        if (RVTS.loading || RVTS.start >= RVTS.total) return;
11        var url = RVTS.ajaxUrlModel.replace('%start%', RVTS.start).replace('%per%', RVTS.perPage);
12        if (RVTS.adjust) {
13                url += '&adj=' + RVTS.adjust;
14                RVTS.adjust=0;
15        }
16        $('#ajaxLoader').show();
17        RVTS.loading = 1;
18        $.ajax({
19                type:'GET', dataType:'html', 'url': url,
20                success: function(htm) {
21                        RVTS.start+=RVTS.perPage;
22                        RVTS.$thumbs.append(htm);
23                        if (RVTS.start>500 && RVTS.total>550) {
24                                RVTS.$thumbs.after(
25                                        '<div style="text-align:center;font-size:180%;margin:0 0 20px"><a href="'
26                                        +RVTS.moreUrlModel.replace('%start%', RVTS.start)+'">'
27                                        +RVTS.moreMsg.replace('%d', RVTS.total-RVTS.start)
28                                        +'</a></div>');
29                                RVTS.total = 0;
30                        }
31                },
32                complete: function() {
33                        RVTS.loading = 0;
34                        $('#ajaxLoader').hide();
35                        }
36                });
37},
38
39checkAutoScroll: function(evt) {
40        var tBot=RVTS.$thumbs.position().top+RVTS.$thumbs.outerHeight()
41                ,wBot=$(window).scrollTop()+$(window).height();
42        tBot -= !evt ? 0:90; //begin 90 pixels before end
43        return tBot <= wBot ? (RVTS.doAutoScroll(),1) : 0;
44},
45
46engage: function() {
47        var $w = $(window);
48        RVTS.$thumbs = $('#thumbnails');
49        RVTS.$thumbs.append('<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>');
50
51        $w.scrollTop(0);
52        if ( RVTS.$thumbs.outerHeight() < $w.height() )
53                RVTS.adjust = 1;
54        else if ( RVTS.$thumbs.height() > 2*$w.height() )
55                RVTS.adjust = -1;
56        $w.bind('scroll resize', RVTS.checkAutoScroll);
57        if (RVTS.checkAutoScroll())
58                window.setTimeout(RVTS.checkAutoScroll,1500);
59}
60} );//end extend
61
62$(document).ready( function() {
63        window.setTimeout(RVTS.engage,250);
64});
65
66
67
68})(jQuery);
Note: See TracBrowser for help on using the repository browser.