source: extensions/rv_tscroller/rv_tscroller.js @ 12735

Last change on this file since 12735 was 12735, checked in by rvelices, 12 years ago

rv_tscroller version update

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