Plugin Directory

Changeset 406362


Ignore:
Timestamp:
07/07/2011 06:13:54 PM (15 years ago)
Author:
Beaver6813
Message:
  • HTTPS loading image fix.
  • Better debug support (switches between minified and non).
Location:
infinite-scroll/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • infinite-scroll/trunk/jquery.infinitescroll.js

    r402198 r406362  
    44    --------------------------------
    55    + https://github.com/paulirish/infinitescroll
    6     + version 2.0b2.110628
     6    + version 2.0b2.110706
    77    + Copyright 2011 Paul Irish & Luke Shumard
    88    + Licensed under the MIT license
     
    2222   
    2323    $.infinitescroll.defaults = {
     24        loading: {
     25            finished: undefined,
     26            finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
     27            img: "http://www.infinite-scroll.com/loading.gif",
     28            msg: null,
     29            msgText: "<em>Loading the next set of posts...</em>",
     30            selector: null,
     31            speed: 'fast',
     32            start: undefined
     33        },
     34        state: {
     35            isDuringAjax: false,
     36            isInvalidPage: false,
     37            isDestroyed: false,
     38            isDone: false, // For when it goes all the way through the archive.
     39            isPaused: false,
     40            currPage: 1
     41        },
    2442        callback: undefined,
    2543        debug: false,
     
    2745        binder: $(window), // used to cache the selector
    2846        nextSelector: "div.navigation a:first",
    29         loadMsgSelector: null,
    30         loadingMsgRevealSpeed: 'fast', // controls how fast you want the loading message to come in, ex: 'fast', 'slow', 200 (milliseconds)
    31         loadingImg: "http://www.infinite-scroll.com/loading.gif",
    32         loadingText: "<em>Loading the next set of posts...</em>",
    33         loadingStart: undefined,
    34         loadingEnd: undefined,
    35         donetext: "<em>Congratulations, you've reached the end of the internet.</em>",
    3647        navSelector: "div.navigation",
    3748        contentSelector: null, // rename to pageFragment
     
    4354        appendCallback: true,
    4455        bufferPx: 40,
    45         orientation: 'height',
    4656        errorCallback: function () { },
    47         currPage: 1,
    4857        infid: 0, //Instance ID
    49         isDuringAjax: false,
    50         isInvalidPage: false,
    51         isDestroyed: false,
    52         isDone: false, // For when it goes all the way through the archive.
    53         isPaused: false,
    5458        pixelsFromNavToBottom: undefined,
    55         pagesLoaded: null,
    56         path: undefined,
    57         loadingMsg: undefined
     59        path: undefined
    5860    };
    5961
     
    115117            opts.contentSelector = opts.contentSelector || this.element;
    116118
    117             // loadMsgSelector - if we want to place the load message in a specific selector, defaulted to the contentSelector
    118             opts.loadMsgSelector = opts.loadMsgSelector || opts.contentSelector;
     119            // loading.selector - if we want to place the load message in a specific selector, defaulted to the contentSelector
     120            opts.loading.selector = opts.loading.selector || opts.contentSelector;
    119121
    120122            // if there's not path, return
     
    124126            opts.path = this._determinepath(path);
    125127
    126             // Define loadingMsg
    127             opts.loadingMsg = $('<div id="infscr-loading"><img alt="Loading..." src="' + opts.loadingImg + '" /><div>' + opts.loadingText + '</div></div>');
    128 
    129             // Preload loadingImg
    130             (new Image()).src = opts.loadingImg;
     128            // Define loading.msg
     129            opts.loading.msg = $('<div id="infscr-loading"><img alt="Loading..." src="' + opts.loading.img + '" /><div>' + opts.loading.msgText + '</div></div>');
     130
     131            // Preload loading.img
     132            (new Image()).src = opts.loading.img;
    131133
    132134            // distance from nav links to bottom
     
    134136            opts.pixelsFromNavToBottom = $(document).height() - $(opts.navSelector).offset().top;
    135137
    136             // determine loadingStart actions
    137             opts.loadingStart = opts.loadingStart || function() {
     138            // determine loading.start actions
     139            opts.loading.start = opts.loading.start || function() {
    138140               
    139141                $(opts.navSelector).hide();
    140142
    141                 opts.loadingMsg
    142                     .appendTo(opts.loadMsgSelector)
    143                     .show(opts.loadingMsgRevealSpeed, function () {
     143                opts.loading.msg
     144                    .appendTo(opts.loading.selector)
     145                    .show(opts.loading.speed, function () {
    144146                        beginAjax(opts);
    145147                });
    146148            };
    147149           
    148             // determine loadingEnd actions
    149             opts.loadingEnd = opts.loadingEnd || function() {
    150                 opts.loadingMsg.fadeOut('normal');
     150            // determine loading.finished actions
     151            opts.loading.finished = opts.loading.finished || function() {
     152                opts.loading.msg.fadeOut('normal');
    151153            };
    152154
    153155            // callback loading
    154             opts.callback = opts.callback || callback || function () { };
     156            opts.callback = function(instance,data) {
     157                if (!!opts.behavior && instance['_callback_'+opts.behavior] !== undefined) {
     158                    instance['_callback_'+opts.behavior].call($(opts.contentSelector)[0], data);
     159                }
     160                if (callback) {
     161                    callback.call($(opts.contentSelector)[0], data);
     162                }
     163            };
    155164
    156165            this._setup();
     
    208217                    this._debug('Sorry, we couldn\'t parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com.');
    209218                    // Get rid of isInvalidPage to allow permalink to state
    210                     opts.isInvalidPage = true;  //prevent it from running on this page.
     219                    opts.state.isInvalidPage = true;  //prevent it from running on this page.
    211220                }
    212221            }
     
    237246            }
    238247
    239             opts.isDone = true;
    240             opts.currPage = 1; // if you need to go back to this instance
    241             opts.isPaused = false;
    242 
     248            opts.state.isDone = true;
     249            opts.state.currPage = 1; // if you need to go back to this instance
     250            opts.state.isPaused = false;
    243251            this._binding('unbind');
    244252
     
    250258            var opts = this.options,
    251259                callback = this.options.callback, // GLOBAL OBJECT FOR CALLBACK
    252                 result = (opts.isDone) ? 'done' : (!opts.appendCallback) ? 'no-append' : 'append',
     260                result = (opts.state.isDone) ? 'done' : (!opts.appendCallback) ? 'no-append' : 'append',
    253261                frag;
    254262   
     
    308316
    309317            // loadingEnd function
    310             opts.loadingEnd.call($(opts.contentSelector)[0],opts)
     318            opts.loading.finished.call($(opts.contentSelector)[0],opts)
    311319           
    312320
     
    314322            if (opts.animate) {
    315323                var scrollTo = $(window).scrollTop() + $('#infscr-loading').height() + opts.extraScrollPx + 'px';
    316                 $('html,body').animate({ scrollTop: scrollTo }, 800, function () { opts.isDuringAjax = false; });
    317             }
    318 
    319             if (!opts.animate) opts.isDuringAjax = false; // once the call is done, we can allow it again.
    320 
    321             callback.call($(opts.contentSelector)[0], data);
     324                $('html,body').animate({ scrollTop: scrollTo }, 800, function () { opts.state.isDuringAjax = false; });
     325            }
     326
     327            if (!opts.animate) opts.state.isDuringAjax = false; // once the call is done, we can allow it again.
     328
     329            callback(this,data);
    322330
    323331        },
     
    361369            switch (pause) {
    362370                case 'pause':
    363                     opts.isPaused = true;
     371                    opts.state.isPaused = true;
    364372                    break;
    365373
    366374                case 'resume':
    367                     opts.isPaused = false;
     375                    opts.state.isPaused = false;
    368376                    break;
    369377
    370378                case 'toggle':
    371                     opts.isPaused = !opts.isPaused;
     379                    opts.state.isPaused = !opts.state.isPaused;
    372380                    break;
    373381            }
    374382
    375             this._debug('Paused', opts.isPaused);
     383            this._debug('Paused', opts.state.isPaused);
    376384            return false;
    377385
     
    407415            }
    408416
    409             opts.loadingMsg
     417            opts.loading.msg
    410418                .find('img')
    411419                .hide()
    412420                .parent()
    413                 .find('div').html(opts.donetext).animate({ opacity: 1 }, 2000, function () {
     421                .find('div').html(opts.loading.finishedMsg).animate({ opacity: 1 }, 2000, function () {
    414422                    $(this).parent().fadeOut('normal');
    415423                });
     
    447455        destroy: function infscr_destroy() {
    448456
    449             this.options.isDestroyed = true;
     457            this.options.state.isDestroyed = true;
    450458            return this._error('destroy');
    451459
     
    470478                box, frag, desturl, method, condition,
    471479                pageNum = pageNum || null,
    472                 getPage = (!!pageNum) ? pageNum : opts.currPage;
     480                getPage = (!!pageNum) ? pageNum : opts.state.currPage;
    473481                beginAjax = function infscr_ajax(opts) {
    474482                   
    475483                    // increment the URL bit. e.g. /page/3/
    476                     opts.currPage++;
     484                    opts.state.currPage++;
    477485
    478486                    instance._debug('heading into ajax', path);
     
    481489                    box = $(opts.contentSelector).is('table') ? $('<tbody/>') : $('<div/>');
    482490
    483                     desturl = path.join(opts.currPage);
     491                    desturl = path.join(opts.state.currPage);
    484492
    485493                    method = (opts.dataType == 'html' || opts.dataType == 'json') ? opts.dataType : 'html+callback';
     
    489497
    490498                        case 'html+callback':
    491 
    492499
    493500                            instance._debug('Using HTML via .load() method');
     
    524531           
    525532            // for manual triggers, if destroyed, get out of here
    526             if (opts.isDestroyed) {
     533            if (opts.state.isDestroyed) {
    527534                this._debug('Instance is destroyed');
    528535                return false;
     
    530537
    531538            // we dont want to fire the ajax multiple times
    532             opts.isDuringAjax = true;
    533 
    534             opts.loadingStart.call($(opts.contentSelector)[0],opts);
     539            opts.state.isDuringAjax = true;
     540
     541            opts.loading.start.call($(opts.contentSelector)[0],opts);
    535542
    536543        },
     
    539546        scroll: function infscr_scroll() {
    540547
    541             var opts = this.options;
     548            var opts = this.options,
     549                state = opts.state;
    542550
    543551            // if behavior is defined and this function is extended, call that instead of default
     
    547555            }
    548556
    549             if (opts.isDuringAjax || opts.isInvalidPage || opts.isDone || opts.isDestroyed || opts.isPaused) return;
     557            if (state.isDuringAjax || state.isInvalidPage || state.isDone || state.isDestroyed || state.isPaused) return;
    550558
    551559            if (!this._nearbottom()) return;
  • infinite-scroll/trunk/jquery.infinitescroll.min.js

    r402198 r406362  
    44    --------------------------------
    55    + https://github.com/paulirish/infinitescroll
    6     + version 2.0b2.110628
     6    + version 2.0b2.110706
    77    + Copyright 2011 Paul Irish & Luke Shumard
    88    + Licensed under the MIT license
     
    1212*/
    1313
    14 (function(window,$,undefined){$.infinitescroll=function infscr(options,callback,element){this.element=$(element);this._create(options,callback);};$.infinitescroll.defaults={callback:undefined,debug:false,behavior:undefined,binder:$(window),nextSelector:"div.navigation a:first",loadMsgSelector:null,loadingMsgRevealSpeed:'fast',loadingImg:"http://www.infinite-scroll.com/loading.gif",loadingText:"<em>Loading the next set of posts...</em>",loadingStart:undefined,loadingEnd:undefined,donetext:"<em>Congratulations, you've reached the end of the internet.</em>",navSelector:"div.navigation",contentSelector:null,extraScrollPx:150,itemSelector:"div.post",animate:false,pathParse:undefined,dataType:'html',appendCallback:true,bufferPx:40,orientation:'height',errorCallback:function(){},currPage:1,infid:0,isDuringAjax:false,isInvalidPage:false,isDestroyed:false,isDone:false,isPaused:false,pixelsFromNavToBottom:undefined,pagesLoaded:null,path:undefined,loadingMsg:undefined};$.infinitescroll.prototype={_binding:function infscr_binding(binding){var instance=this,opts=instance.options;if(!!opts.behavior&&this['_binding_'+opts.behavior]!==undefined){this['_binding_'+opts.behavior].call(this);return;}
     14(function(window,$,undefined){$.infinitescroll=function infscr(options,callback,element){this.element=$(element);this._create(options,callback);};$.infinitescroll.defaults={loading:{finished:undefined,finishedMsg:"<em>Congratulations, you've reached the end of the internet.</em>",img:"http://www.infinite-scroll.com/loading.gif",msg:null,msgText:"<em>Loading the next set of posts...</em>",selector:null,speed:'fast',start:undefined},state:{isDuringAjax:false,isInvalidPage:false,isDestroyed:false,isDone:false,isPaused:false,currPage:1},callback:undefined,debug:false,behavior:undefined,binder:$(window),nextSelector:"div.navigation a:first",navSelector:"div.navigation",contentSelector:null,extraScrollPx:150,itemSelector:"div.post",animate:false,pathParse:undefined,dataType:'html',appendCallback:true,bufferPx:40,errorCallback:function(){},infid:0,pixelsFromNavToBottom:undefined,path:undefined};$.infinitescroll.prototype={_binding:function infscr_binding(binding){var instance=this,opts=instance.options;if(!!opts.behavior&&this['_binding_'+opts.behavior]!==undefined){this['_binding_'+opts.behavior].call(this);return;}
    1515if(binding!=='bind'&&binding!=='unbind'){this._debug('Binding value  '+binding+' not valid')
    1616return false;}
    1717if(binding=='unbind'){(this.options.binder).unbind('smartscroll.infscr.'+instance.options.infid);}else{(this.options.binder)[binding]('smartscroll.infscr.'+instance.options.infid,function(){instance.scroll();});};this._debug('Binding',binding);},_create:function infscr_create(options,callback){if(!this._validate(options)){return false;}
    18 var opts=this.options=$.extend({},$.infinitescroll.defaults,options),relurl=/(.*?\/\/).*?(\/.*)/,path=$(opts.nextSelector).attr('href');opts.contentSelector=opts.contentSelector||this.element;opts.loadMsgSelector=opts.loadMsgSelector||opts.contentSelector;if(!path){this._debug('Navigation selector not found');return;}
    19 opts.path=this._determinepath(path);opts.loadingMsg=$('<div id="infscr-loading"><img alt="Loading..." src="'+opts.loadingImg+'" /><div>'+opts.loadingText+'</div></div>');(new Image()).src=opts.loadingImg;opts.pixelsFromNavToBottom=$(document).height()-$(opts.navSelector).offset().top;opts.loadingStart=opts.loadingStart||function(){$(opts.navSelector).hide();opts.loadingMsg.appendTo(opts.loadMsgSelector).show(opts.loadingMsgRevealSpeed,function(){beginAjax(opts);});};opts.loadingEnd=opts.loadingEnd||function(){opts.loadingMsg.fadeOut('normal');};opts.callback=opts.callback||callback||function(){};this._setup();},_debug:function infscr_debug(){if(this.options.debug){return window.console&&console.log.call(console,arguments);}},_determinepath:function infscr_determinepath(path){var opts=this.options;if(!!opts.behavior&&this['_determinepath_'+opts.behavior]!==undefined){this['_determinepath_'+opts.behavior].call(this,path);return;}
     18var opts=this.options=$.extend({},$.infinitescroll.defaults,options),relurl=/(.*?\/\/).*?(\/.*)/,path=$(opts.nextSelector).attr('href');opts.contentSelector=opts.contentSelector||this.element;opts.loading.selector=opts.loading.selector||opts.contentSelector;if(!path){this._debug('Navigation selector not found');return;}
     19opts.path=this._determinepath(path);opts.loading.msg=$('<div id="infscr-loading"><img alt="Loading..." src="'+opts.loading.img+'" /><div>'+opts.loading.msgText+'</div></div>');(new Image()).src=opts.loading.img;opts.pixelsFromNavToBottom=$(document).height()-$(opts.navSelector).offset().top;opts.loading.start=opts.loading.start||function(){$(opts.navSelector).hide();opts.loading.msg.appendTo(opts.loading.selector).show(opts.loading.speed,function(){beginAjax(opts);});};opts.loading.finished=opts.loading.finished||function(){opts.loading.msg.fadeOut('normal');};opts.callback=function(instance,data){if(!!opts.behavior&&instance['_callback_'+opts.behavior]!==undefined){instance['_callback_'+opts.behavior].call($(opts.contentSelector)[0],data);}
     20if(callback){callback.call($(opts.contentSelector)[0],data);}};this._setup();},_debug:function infscr_debug(){if(this.options.debug){return window.console&&console.log.call(console,arguments);}},_determinepath:function infscr_determinepath(path){var opts=this.options;if(!!opts.behavior&&this['_determinepath_'+opts.behavior]!==undefined){this['_determinepath_'+opts.behavior].call(this,path);return;}
    2021if(!!opts.pathParse){this._debug('pathParse manual');return opts.pathParse;}else if(path.match(/^(.*?)\b2\b(.*?$)/)){path=path.match(/^(.*?)\b2\b(.*?$)/).slice(1);}else if(path.match(/^(.*?)2(.*?$)/)){if(path.match(/^(.*?page=)2(\/.*|$)/)){path=path.match(/^(.*?page=)2(\/.*|$)/).slice(1);return path;}
    21 path=path.match(/^(.*?)2(.*?$)/).slice(1);}else{if(path.match(/^(.*?page=)1(\/.*|$)/)){path=path.match(/^(.*?page=)1(\/.*|$)/).slice(1);return path;}else{this._debug('Sorry, we couldn\'t parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com.');opts.isInvalidPage=true;}}
     22path=path.match(/^(.*?)2(.*?$)/).slice(1);}else{if(path.match(/^(.*?page=)1(\/.*|$)/)){path=path.match(/^(.*?page=)1(\/.*|$)/).slice(1);return path;}else{this._debug('Sorry, we couldn\'t parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com.');opts.state.isInvalidPage=true;}}
    2223this._debug('determinePath',path);return path;},_error:function infscr_error(xhr){var opts=this.options;if(!!opts.behavior&&this['_error_'+opts.behavior]!==undefined){this['_error_'+opts.behavior].call(this,xhr);return;}
    2324if(xhr!=='destroy'&&xhr!=='end'){xhr='unknown';}
    2425this._debug('Error',xhr);if(xhr=='end'){this._showdonemsg();}
    25 opts.isDone=true;opts.currPage=1;opts.isPaused=false;this._binding('unbind');},_loadcallback:function infscr_loadcallback(box,data){var opts=this.options,callback=this.options.callback,result=(opts.isDone)?'done':(!opts.appendCallback)?'no-append':'append',frag;if(!!opts.behavior&&this['_loadcallback_'+opts.behavior]!==undefined){this['_loadcallback_'+opts.behavior].call(this,box,data);return;}
     26opts.state.isDone=true;opts.state.currPage=1;opts.state.isPaused=false;this._binding('unbind');},_loadcallback:function infscr_loadcallback(box,data){var opts=this.options,callback=this.options.callback,result=(opts.state.isDone)?'done':(!opts.appendCallback)?'no-append':'append',frag;if(!!opts.behavior&&this['_loadcallback_'+opts.behavior]!==undefined){this['_loadcallback_'+opts.behavior].call(this,box,data);return;}
    2627switch(result){case'done':this._showdonemsg();return false;break;case'no-append':if(opts.dataType=='html'){data='<div>'+data+'</div>';data=$(data).find(opts.itemSelector);};break;case'append':var children=box.children();if(children.length==0){return this._error('end');}
    2728frag=document.createDocumentFragment();while(box[0].firstChild){frag.appendChild(box[0].firstChild);}
    2829this._debug('contentSelector',$(opts.contentSelector)[0])
    2930$(opts.contentSelector)[0].appendChild(frag);data=children.get();break;}
    30 opts.loadingEnd.call($(opts.contentSelector)[0],opts)
    31 if(opts.animate){var scrollTo=$(window).scrollTop()+$('#infscr-loading').height()+opts.extraScrollPx+'px';$('html,body').animate({scrollTop:scrollTo},800,function(){opts.isDuringAjax=false;});}
    32 if(!opts.animate)opts.isDuringAjax=false;callback.call($(opts.contentSelector)[0],data);},_nearbottom:function infscr_nearbottom(){var opts=this.options,pixelsFromWindowBottomToBottom=0+$(document).height()-(opts.binder.scrollTop())-$(window).height();if(!!opts.behavior&&this['_nearbottom_'+opts.behavior]!==undefined){this['_nearbottom_'+opts.behavior].call(this);return;}
     31opts.loading.finished.call($(opts.contentSelector)[0],opts)
     32if(opts.animate){var scrollTo=$(window).scrollTop()+$('#infscr-loading').height()+opts.extraScrollPx+'px';$('html,body').animate({scrollTop:scrollTo},800,function(){opts.state.isDuringAjax=false;});}
     33if(!opts.animate)opts.state.isDuringAjax=false;callback(this,data);},_nearbottom:function infscr_nearbottom(){var opts=this.options,pixelsFromWindowBottomToBottom=0+$(document).height()-(opts.binder.scrollTop())-$(window).height();if(!!opts.behavior&&this['_nearbottom_'+opts.behavior]!==undefined){this['_nearbottom_'+opts.behavior].call(this);return;}
    3334this._debug('math:',pixelsFromWindowBottomToBottom,opts.pixelsFromNavToBottom);return(pixelsFromWindowBottomToBottom-opts.bufferPx<opts.pixelsFromNavToBottom);},_pausing:function infscr_pausing(pause){var opts=this.options;if(!!opts.behavior&&this['_pausing_'+opts.behavior]!==undefined){this['_pausing_'+opts.behavior].call(this,pause);return;}
    34 if(pause!=='pause'&&pause!=='resume'&&pause!==null){this._debug('Invalid argument. Toggling pause value instead');};pause=(pause&&(pause=='pause'||pause=='resume'))?pause:'toggle';switch(pause){case'pause':opts.isPaused=true;break;case'resume':opts.isPaused=false;break;case'toggle':opts.isPaused=!opts.isPaused;break;}
    35 this._debug('Paused',opts.isPaused);return false;},_setup:function infscr_setup(){var opts=this.options;if(!!opts.behavior&&this['_setup_'+opts.behavior]!==undefined){this['_setup_'+opts.behavior].call(this);return;}
     35if(pause!=='pause'&&pause!=='resume'&&pause!==null){this._debug('Invalid argument. Toggling pause value instead');};pause=(pause&&(pause=='pause'||pause=='resume'))?pause:'toggle';switch(pause){case'pause':opts.state.isPaused=true;break;case'resume':opts.state.isPaused=false;break;case'toggle':opts.state.isPaused=!opts.state.isPaused;break;}
     36this._debug('Paused',opts.state.isPaused);return false;},_setup:function infscr_setup(){var opts=this.options;if(!!opts.behavior&&this['_setup_'+opts.behavior]!==undefined){this['_setup_'+opts.behavior].call(this);return;}
    3637this._binding('bind');return false;},_showdonemsg:function infscr_showdonemsg(){var opts=this.options;if(!!opts.behavior&&this['_showdonemsg_'+opts.behavior]!==undefined){this['_showdonemsg_'+opts.behavior].call(this);return;}
    37 opts.loadingMsg.find('img').hide().parent().find('div').html(opts.donetext).animate({opacity:1},2000,function(){$(this).parent().fadeOut('normal');});opts.errorCallback.call($(opts.contentSelector)[0],'done');},_validate:function infscr_validate(opts){for(var key in opts){if(key.indexOf&&key.indexOf('Selector')>-1&&$(opts[key]).length===0){this._debug('Your '+key+' found no elements.');return false;}
    38 return true;}},bind:function infscr_bind(){this._binding('bind');},destroy:function infscr_destroy(){this.options.isDestroyed=true;return this._error('destroy');},pause:function infscr_pause(){this._pausing('pause');},resume:function infscr_resume(){this._pausing('resume');},retrieve:function infscr_retrieve(pageNum){var instance=this,opts=instance.options,path=opts.path,box,frag,desturl,method,condition,pageNum=pageNum||null,getPage=(!!pageNum)?pageNum:opts.currPage;beginAjax=function infscr_ajax(opts){opts.currPage++;instance._debug('heading into ajax',path);box=$(opts.contentSelector).is('table')?$('<tbody/>'):$('<div/>');desturl=path.join(opts.currPage);method=(opts.dataType=='html'||opts.dataType=='json')?opts.dataType:'html+callback';if(opts.appendCallback&&opts.dataType=='html')method+='+callback'
     38opts.loading.msg.find('img').hide().parent().find('div').html(opts.loading.finishedMsg).animate({opacity:1},2000,function(){$(this).parent().fadeOut('normal');});opts.errorCallback.call($(opts.contentSelector)[0],'done');},_validate:function infscr_validate(opts){for(var key in opts){if(key.indexOf&&key.indexOf('Selector')>-1&&$(opts[key]).length===0){this._debug('Your '+key+' found no elements.');return false;}
     39return true;}},bind:function infscr_bind(){this._binding('bind');},destroy:function infscr_destroy(){this.options.state.isDestroyed=true;return this._error('destroy');},pause:function infscr_pause(){this._pausing('pause');},resume:function infscr_resume(){this._pausing('resume');},retrieve:function infscr_retrieve(pageNum){var instance=this,opts=instance.options,path=opts.path,box,frag,desturl,method,condition,pageNum=pageNum||null,getPage=(!!pageNum)?pageNum:opts.state.currPage;beginAjax=function infscr_ajax(opts){opts.state.currPage++;instance._debug('heading into ajax',path);box=$(opts.contentSelector).is('table')?$('<tbody/>'):$('<div/>');desturl=path.join(opts.state.currPage);method=(opts.dataType=='html'||opts.dataType=='json')?opts.dataType:'html+callback';if(opts.appendCallback&&opts.dataType=='html')method+='+callback'
    3940switch(method){case'html+callback':instance._debug('Using HTML via .load() method');box.load(desturl+' '+opts.itemSelector,null,function infscr_ajax_callback(responseText){instance._loadcallback(box,responseText);});break;case'html':case'json':instance._debug('Using '+(method.toUpperCase())+' via $.ajax() method');$.ajax({url:desturl,dataType:opts.dataType,complete:function infscr_ajax_callback(jqXHR,textStatus){condition=(typeof(jqXHR.isResolved)!=='undefined')?(jqXHR.isResolved()):(textStatus==="success"||textStatus==="notmodified");(condition)?instance._loadcallback(box,jqXHR.responseText):instance._error('end');}});break;}};if(!!opts.behavior&&this['retrieve_'+opts.behavior]!==undefined){this['retrieve_'+opts.behavior].call(this,pageNum);return;}
    40 if(opts.isDestroyed){this._debug('Instance is destroyed');return false;};opts.isDuringAjax=true;opts.loadingStart.call($(opts.contentSelector)[0],opts);},scroll:function infscr_scroll(){var opts=this.options;if(!!opts.behavior&&this['scroll_'+opts.behavior]!==undefined){this['scroll_'+opts.behavior].call(this);return;}
    41 if(opts.isDuringAjax||opts.isInvalidPage||opts.isDone||opts.isDestroyed||opts.isPaused)return;if(!this._nearbottom())return;this.retrieve();},toggle:function infscr_toggle(){this._pausing();},unbind:function infscr_unbind(){this._binding('unbind');},update:function infscr_options(key){if($.isPlainObject(key)){this.options=$.extend(true,this.options,key);}}}
     41if(opts.state.isDestroyed){this._debug('Instance is destroyed');return false;};opts.state.isDuringAjax=true;opts.loading.start.call($(opts.contentSelector)[0],opts);},scroll:function infscr_scroll(){var opts=this.options,state=opts.state;if(!!opts.behavior&&this['scroll_'+opts.behavior]!==undefined){this['scroll_'+opts.behavior].call(this);return;}
     42if(state.isDuringAjax||state.isInvalidPage||state.isDone||state.isDestroyed||state.isPaused)return;if(!this._nearbottom())return;this.retrieve();},toggle:function infscr_toggle(){this._pausing();},unbind:function infscr_unbind(){this._binding('unbind');},update:function infscr_options(key){if($.isPlainObject(key)){this.options=$.extend(true,this.options,key);}}}
    4243$.fn.infinitescroll=function infscr_init(options,callback){var thisCall=typeof options;switch(thisCall){case'string':var args=Array.prototype.slice.call(arguments,1);this.each(function(){var instance=$.data(this,'infinitescroll');if(!instance){return false;}
    4344if(!$.isFunction(instance[options])||options.charAt(0)==="_"){return false;}
  • infinite-scroll/trunk/readme.txt

    r402198 r406362  
    44Tags: ajax, pagination, scrolling, scroll, endless, reading
    55Requires at least: 2.6
    6 Tested up to: 3.1.3
     6Tested up to: 3.2
    77Stable tag: 2.0b
    88
     
    4949
    5050== Changelog ==
     51= 2.0b2.110706 =
     52* HTTPS loading image fix.
     53* Better debug support (switches between minified and non).
     54
    5155= 2.0b2.110629 =
    5256* Callback (custom javascript) fix.
  • infinite-scroll/trunk/wp_infinite_scroll.php

    r402198 r406362  
    22/*
    33Plugin Name: Infinite Scroll
    4 Version: 2.0b2.110629
     4Version: 2.0b2.110706
    55Plugin URI: http://www.infinite-scroll.com
    66Description: Automatically loads the next page of posts into the bottom of the initial page.
     
    190190        $plugin_dir         = plugins_url('infinite-scroll');
    191191        $js_calls           = stripslashes(get_option(key_infscr_js_calls));
    192         $loading_image      = stripslashes(get_option(key_infscr_image));
     192        //Fancy stuff (not) to detect https or http
     193        $noscheme           = parse_url(stripslashes(get_option(key_infscr_image)));
     194        if (is_ssl())
     195            $scheme         = "https://";
     196        else
     197            $scheme         = "http://";
     198        $loading_image      = $scheme.$noscheme['host'].$noscheme['path']; 
    193199        $loading_text       = stripslashes(get_option(key_infscr_text));
    194200        $donetext           = stripslashes(get_option(key_infscr_donetext));
Note: See TracChangeset for help on using the changeset viewer.