diff --git a/dist/jquery.mobile.lazyloader.js b/dist/jquery.mobile.lazyloader.js index 057ae1e..7c7340e 100644 --- a/dist/jquery.mobile.lazyloader.js +++ b/dist/jquery.mobile.lazyloader.js @@ -262,7 +262,7 @@ $.widget( "mobile." + widgetName, $.mobile.listview, { */ _load: function( timeout, reset ) { var self = this, - options = self.options; + options = $.extend( {}, self.options ); // Make sure the plugin is not already lazy loading some items and has not loaded // all items already. diff --git a/dist/jquery.mobile.lazyloader.min.js b/dist/jquery.mobile.lazyloader.min.js index a5d7cd8..360e98b 100644 --- a/dist/jquery.mobile.lazyloader.min.js +++ b/dist/jquery.mobile.lazyloader.min.js @@ -1 +1 @@ -!function(e,t){"use strict";var r=e(t),i=e.mobile.filterable;i&&e.widget("mobile.filterable",i,{_filterItems:function(e){var t=this,r=t.element,i=r.data("mobile-lazyloader");if(i){if(i.option("searchQuery")!==e){var o=function(){r.off("lazyloaderdoneloading lazyloadererror",o),t._trigger("filter",null,{items:t._getFilterableItems()})};r.one("lazyloaderdoneloading lazyloadererror",o),i.option("searchQuery",e)}}else t._super(e)}}),e.widget("mobile.lazyloader",e.mobile.listview,{options:{url:"",$progress:"",templateId:""},defaults:{searchQuery:null,retrieved:0,retrieve:20,eventTimeout:100,searchTimeout:300,postData:{},threshold:100,ajaxType:"POST",ajaxSettings:{type:"POST"}},_create:function(){this._done=!1,this._lastRequestTime=0,this.options=e.extend({},this.defaults,this.options),r.on("scrollstart scrollstop wheel",this._handleEventProxy=e.proxy(this._handleEvent,this)),this._super(),this.options.filter||this._load()},loadMore:function(e){this._load(e)},reset:function(e){this.options.retrieved=0,this._done=!1,this.element.empty(),this._load(e,!0)},_load:function(t,r){var i=this,o=i.options;i._done||(isNaN(t)&&(t=0),clearTimeout(i._loadTimeout),i._loadTimeout=setTimeout(function(){var t=i.element;t.height()+t.offset().top-o.thresholdg;(_||d)&&e(s.$progress).hide(),this._done=d,d?(this._trigger("doneloading"),this._trigger("alldone")):_?this._trigger("doneloading"):this._load()}else this._handleError(2,t)}},_getScrollParent:function(){for(var e=this.element.scrollParent();e[0].scrollHeight<=e[0].clientHeight;)e=e.scrollParent();return e},_handleEvent:function(){!this._eventTriggered&&this.element.is(":visible")&&(this._eventTriggered=!0,this._load(this.options.eventTimeout))},_handleError:function(t,r){e(this.options.$progress).hide(),this._trigger("error",{},{errorCode:t,errorData:r})},_getWindowHeight:function(){return r.height()},_setOption:function(e,t){this._super(e,t),"searchQuery"===e&&this.reset(this.options.searchTimeout)},destroy:function(){r.off("scrollstart scrollstop wheel",this._handleEventProxy),clearTimeout(this._loadTimeout),this._super()}})}(jQuery,window); \ No newline at end of file +!function(e,t){"use strict";var r=e(t),i=e.mobile.filterable;i&&e.widget("mobile.filterable",i,{_filterItems:function(e){var t=this,r=t.element,i=r.data("mobile-lazyloader");if(i){if(i.option("searchQuery")!==e){var o=function(){r.off("lazyloaderdoneloading lazyloadererror",o),t._trigger("filter",null,{items:t._getFilterableItems()})};r.one("lazyloaderdoneloading lazyloadererror",o),i.option("searchQuery",e)}}else t._super(e)}}),e.widget("mobile.lazyloader",e.mobile.listview,{options:{url:"",$progress:"",templateId:""},defaults:{searchQuery:null,retrieved:0,retrieve:20,eventTimeout:100,searchTimeout:300,postData:{},threshold:100,ajaxType:"POST",ajaxSettings:{type:"POST"}},_create:function(){this._done=!1,this._lastRequestTime=0,this.options=e.extend({},this.defaults,this.options),r.on("scrollstart scrollstop wheel",this._handleEventProxy=e.proxy(this._handleEvent,this)),this._super(),this.options.filter||this._load()},loadMore:function(e){this._load(e)},reset:function(e){this.options.retrieved=0,this._done=!1,this.element.empty(),this._load(e,!0)},_load:function(t,r){var i=this,o=e.extend({},i.options);i._done||(isNaN(t)&&(t=0),clearTimeout(i._loadTimeout),i._loadTimeout=setTimeout(function(){var t=i.element;t.height()+t.offset().top-o.thresholdg;(_||d)&&e(s.$progress).hide(),this._done=d,d?(this._trigger("doneloading"),this._trigger("alldone")):_?this._trigger("doneloading"):this._load()}else this._handleError(2,t)}},_getScrollParent:function(){for(var e=this.element.scrollParent();e[0].scrollHeight<=e[0].clientHeight;)e=e.scrollParent();return e},_handleEvent:function(){!this._eventTriggered&&this.element.is(":visible")&&(this._eventTriggered=!0,this._load(this.options.eventTimeout))},_handleError:function(t,r){e(this.options.$progress).hide(),this._trigger("error",{},{errorCode:t,errorData:r})},_getWindowHeight:function(){return r.height()},_setOption:function(e,t){this._super(e,t),"searchQuery"===e&&this.reset(this.options.searchTimeout)},destroy:function(){r.off("scrollstart scrollstop wheel",this._handleEventProxy),clearTimeout(this._loadTimeout),this._super()}})}(jQuery,window); \ No newline at end of file