/[jquery]/no_pager/no_pager.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /no_pager/no_pager.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 16 by dpavlin, Wed Aug 16 21:36:40 2006 UTC revision 18 by dpavlin, Wed Aug 16 23:37:51 2006 UTC
# Line 8  Line 8 
8    
9  var preloadDistance = 1000;  var preloadDistance = 1000;
10  var isUpdating = false;  var isUpdating = false;
11    var isMouseDown = false;
12  var checker;  var checker;
13  var v;  var v;
14  var cookie = 'no_pager';  var cookie = 'no_pager';
# Line 34  function load_page() { Line 35  function load_page() {
35          setCookie(cookie+"_scroll", getScrollHeight() - _getWindowHeight() );          setCookie(cookie+"_scroll", getScrollHeight() - _getWindowHeight() );
36    
37          if ( isUpdating == true          if ( isUpdating == true
38                    || isMouseDown == true
39                  || getPageHeight() - getScrollHeight() > preloadDistance                  || getPageHeight() - getScrollHeight() > preloadDistance
40                  || v.page >= v.max_page                  || v.page >= v.max_page
41          ) return;          ) return;
# Line 60  function load_page() { Line 62  function load_page() {
62                  },                  },
63                  function ( response ) {                  function ( response ) {
64                                                    
65                          if (response.length < 500) {                          $('#next_page').html( response );
                                 $('#footer').show();  
                                 if ( v.page > 0 ) {  
                                         $('#more_history').html('<h2 style="text-align: center; font-style:italic; padding: 2em;">No more results.</h2>');  
                                 } else {  
                                         $('#more_history').html('<h2 style="text-align: center; font-style:italic; padding: 2em;">No results matched your search.</h2>');  
                                 }  
                                 $('#status').html( 'All results shown.' );  
                                 return;  
                         }  
   
                         response += "<div id='more_history'>";  
                         response += "  <strong>More posts are being loaded...</strong> <br />";  
                         response += "  If you are using the scroll bar, release the mouse to see more posts.";  
                         response += "</div>"  
                         $('#more_history').html( response );  
66    
67                          eval( 'v=' + $('#json').val() );                          eval( 'v=' + $('#json').val() );
68    
# Line 117  $(document).ready( function() { Line 104  $(document).ready( function() {
104                  scroll( 0, getCookie(cookie+'_scroll') );                  scroll( 0, getCookie(cookie+'_scroll') );
105          }          }
106    
107            $(window).mousedown( function () {
108                    isMouseDown = true;
109            });
110            $(window).mouseup( function () {
111                    isMouseDown = false;
112            });
113    
114          checker = setInterval(function () {          checker = setInterval(function () {
115                  load_page();                  load_page();

Legend:
Removed from v.16  
changed lines
  Added in v.18

  ViewVC Help
Powered by ViewVC 1.1.26