]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Make the infinite scroll plugin have a non-infinite scroll (button click to scroll...
authorCraig Andrews <candrews@integralblue.com>
Sun, 20 Sep 2009 02:53:39 +0000 (22:53 -0400)
committerCraig Andrews <candrews@integralblue.com>
Sun, 20 Sep 2009 02:53:39 +0000 (22:53 -0400)
plugins/InfiniteScroll/InfiniteScrollPlugin.php
plugins/InfiniteScroll/infinitescroll.js
plugins/InfiniteScroll/jquery.infinitescroll.js

index c955298cb934f4d1b9f27c146fa3e03e0e8a28bc..5928c007fe1a3991f8fa64290bace4c496329c2b 100644 (file)
@@ -40,7 +40,7 @@ class InfiniteScrollPlugin extends Plugin
 
     function onEndShowScripts($action)
     {
-        $action->script('plugins/InfiniteScroll/jquery.infinitescroll.min.js');
+        $action->script('plugins/InfiniteScroll/jquery.infinitescroll.js');
         $action->script('plugins/InfiniteScroll/infinitescroll.js');
     }
 }
index 6513072d0655e9e7fe3971402ab846bec8c73fa8..ae4d53d09593fc215e65f9f4353e1b71289dd7d5 100644 (file)
@@ -1,6 +1,7 @@
 jQuery(document).ready(function($){
   $('notices_primary').infinitescroll({
     debug: true,
+    infiniteScroll  : false,
     nextSelector    : "li.nav_next a",
     loadingImg      : $('address .url')[0].href+'plugins/InfiniteScroll/ajax-loader.gif',
     text            : "<em>Loading the next set of posts...</em>",
@@ -12,4 +13,3 @@ jQuery(document).ready(function($){
         NoticeAttachments();
     });
 });
-
index 670686b0e69578aa2989dc92998ad6bd281d5bb5..ec31bb0863af40b06a27f6ab18ef408f7dceab8f 100644 (file)
     
         if (props.isDuringAjax || props.isInvalidPage || props.isDone) return; 
     
-               if ( !isNearBottom(opts,props) ) return; 
+               if ( opts.infiniteScroll && !isNearBottom(opts,props) ) return; 
                  
                // we dont want to fire the ajax multiple times
                props.isDuringAjax = true; 
                
                // show the loading message and hide the previous/next links
                props.loadingMsg.appendTo( opts.contentSelector ).show();
-               $( opts.navSelector ).hide(); 
+               if(opts.infiniteScroll) $( opts.navSelector ).hide(); 
                
                // increment the URL bit. e.g. /page/3/
                props.currPage++;
       } 
     });
     
-    // bind scroll handler to element (if its a local scroll) or window  
-    $(opts.localMode ? this : window)
-      .bind('scroll.infscr', function(){ infscrSetup(path,opts,props,callback); } )
-      .trigger('scroll.infscr'); // trigger the event, in case it's a short page
+    if(opts.infiniteScroll){
+      // bind scroll handler to element (if its a local scroll) or window  
+      $(opts.localMode ? this : window)
+        .bind('scroll.infscr', function(){ infscrSetup(path,opts,props,callback); } )
+        .trigger('scroll.infscr'); // trigger the event, in case it's a short page
+    }else{
+      $(opts.nextSelector).click(
+        function(){
+          infscrSetup(path,opts,props,callback);
+          return false;
+        }
+      );
+    }
     
     
     return this;
   $.infinitescroll = {     
         defaults      : {
                           debug           : false,
+                          infiniteScroll  : true,
                           preload         : false,
                           nextSelector    : "div.navigation a:first",
                           loadingImg      : "http://www.infinite-scroll.com/loading.gif",