X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FInfiniteScroll%2Fjquery.infinitescroll.js;h=dd61f8b18af9a49f43b0edf2f1edfac6849fd9a2;hb=cb183359e23ae7a5cfb483fa06c6c4b7a8b05fff;hp=670686b0e69578aa2989dc92998ad6bd281d5bb5;hpb=a809c200a64e4bb6d6ca3f21c63fe7ce962c5ae1;p=quix0rs-gnu-social.git diff --git a/plugins/InfiniteScroll/jquery.infinitescroll.js b/plugins/InfiniteScroll/jquery.infinitescroll.js index 670686b0e6..dd61f8b18a 100644 --- a/plugins/InfiniteScroll/jquery.infinitescroll.js +++ b/plugins/InfiniteScroll/jquery.infinitescroll.js @@ -21,7 +21,7 @@ // grab each selector option and see if any fail. function areSelectorsValid(opts){ for (var key in opts){ - if (key.indexOf && key.indexOf('Selector') && $(opts[key]).length === 0){ + if (key.indexOf && (key.indexOf('Selector') != -1) && $(opts[key]).length === 0){ debug('Your ' + key + ' found no elements.'); return false; } @@ -92,14 +92,14 @@ 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++; @@ -205,10 +205,19 @@ } }); - // 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; @@ -222,6 +231,7 @@ $.infinitescroll = { defaults : { debug : false, + infiniteScroll : true, preload : false, nextSelector : "div.navigation a:first", loadingImg : "http://www.infinite-scroll.com/loading.gif",