Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed an issue that was preventing externally defined templates from …

…retaining inline functions
  • Loading branch information...
commit 8738a005199a8b4d2d289a33bc7114f7575a406c 1 parent 631a86c
@dcarrith authored
Showing with 42 additions and 47 deletions.
  1. +23 −28 jquery.mobile.lazyloader.js
  2. +19 −19 jquery.mobile.lazyloader.min.js
View
51 jquery.mobile.lazyloader.js
@@ -180,54 +180,49 @@
// First check to see if we are already tracking an instance for the page being re-initialized before storing the defaults
if ( !this._instances[newPageId] ) {
- // create a copy to be stored along with the instance
- optionsAsString = JSON.stringify(this.options);
+ // Only try to retrieve the template from the DOM if it has not already been set externally by the user
+ if ( ( typeof this._settings.template == 'undefined' ) || ( this._settings.template == '' ) ) {
- // retrieve the template from the DOM so we can store it along with the instance
- if ( ( typeof this._settings.templateId != 'undefined' ) && ( this._settings.templateId != '') ) {
+ // retrieve the template from the DOM so we can store it along with the instance
+ if ( ( typeof this._settings.templateId != 'undefined' ) && ( this._settings.templateId != '') ) {
- // retrieve the template from the DOM
- var template = $( "#"+this._settings.templateId ).html();
+ // retrieve the template from the DOM
+ var template = $( "#"+this._settings.templateId ).html();
- var templateType = "";
+ var templateType = "";
- var templatePrecompiled = this._settings.templatePrecompiled;
+ var templatePrecompiled = this._settings.templatePrecompiled;
- if (( typeof this._settings.templateType != 'undefined' ) && ( this._settings.templateType != '') ) {
+ if (( typeof this._settings.templateType != 'undefined' ) && ( this._settings.templateType != '') ) {
- templateType = this._settings.templateType;
- }
+ templateType = this._settings.templateType;
+ }
- // Dust templates seem to be the only ones that can be pre-compiled at initialization and then loaded when needed at runtime
- if ( ( templateType === "dust" ) && ( template !== "" ) && ( !templatePrecompiled ) ) {
+ // Dust templates seem to be the only ones that can be pre-compiled at initialization and then loaded when needed at runtime
+ if ( ( templateType === "dust" ) && ( template !== "" ) && ( !templatePrecompiled ) ) {
- // add the pre-compiled template to the settings object
- this._settings.template = dust.compile( template, this._settings.templateId );
+ // add the pre-compiled template to the settings object
+ this._settings.template = dust.compile( template, this._settings.templateId );
- } else {
+ } else {
- // add it to the settings object
- this._settings.template = template;
+ // add it to the settings object
+ this._settings.template = template;
+ }
}
}
- // create a copy to be stored along with the instance
- settingsAsString = JSON.stringify( this._settings );
-
- // create a copy to be stored along with the instance
- selectorsAsString = JSON.stringify( this._selectors );
-
// initialize a new object for this newPageId
this._instances[newPageId] = [];
// Store the merged options object as a new instance for later modifications and retrieval
- this._instances[newPageId]['options'] = $.parseJSON( optionsAsString );
+ this._instances[newPageId]['options'] = $.extend( true, {}, this.options );
// Store the merged settings object as a new instance for later retrieval
- this._instances[newPageId]['settings'] = $.parseJSON( settingsAsString );
+ this._instances[newPageId]['settings'] = $.extend( true, {}, this._settings );
// Store the merged selectors object as a new instance for later retrieval
- this._instances[newPageId]['selectors'] = $.parseJSON( selectorsAsString );
+ this._instances[newPageId]['selectors'] = $.extend( true, {}, this._selectors );
}
}
}
@@ -600,7 +595,7 @@
}
// Transform the retrieved json data into HTML using the transform template that was set at re-initialization for this page
- $( mainElementSelector ).json2html( json, $.parseJSON( template ) );
+ $( mainElementSelector ).json2html( json, template );
// first make sure there was a list-divider
if ( $bottomElement ) {
View
38 jquery.mobile.lazyloader.min.js
@@ -2,25 +2,25 @@
_mouseWheelEventJustFired:!1,_handleScrollStartTimeoutId:null,_handleScrollStopTimeoutId:null,_mouseWheelTimeoutId:null,_instances:{},_moreOutstandingPageId:null,_parameters:null,_settings:null,_selectors:null,timeoutOptions:{mousewheel:350,scrollstart:500,scrollstop:50,showprogress:200,scrolldown:400,immediately:0},_widgetName:"lazyloader",_widgetState:{busy:!1,done:!1},_create:function(){this._initialize(this._defaultOptions,this._defaultSettings,this._defaultParameters,this._defaultSelectors);
this._bind()},_init:function(){},_initialize:function(b,d,c,e){if("undefined"!=typeof b&&""!=b&&(this._widgetState.busy=!1,this._widgetState.done=!1,this._settings=a.extend(!0,this._settings,this._defaultSettings),this._settings=a.extend(!0,this._settings,d),"undefined"!==typeof this._settings.mainId&&""!==this._settings.mainId&&(this._defaultSelectors.main="#"+this._settings.mainId,this._defaultSelectors.single="#"+this._settings.mainId+" li",this._defaultSelectors.bottom='[data-role="list-divider"]'),
"undefined"!==typeof this._settings.pageId&&""!==this._settings.pageId&&(this._settings.totalHeight=a("#"+this._settings.pageId).height()),this._selectors=a.extend(!0,this._selectors,this._defaultSelectors),this._selectors=a.extend(!0,this._selectors,e),this._parameters=a.extend(!0,this._parameters,this._defaultParameters),this._parameters=a.extend(!0,this._parameters,c),this.options=a.extend(!0,this.options,this._defaultOptions),this.options=a.extend(!0,this.options,b),b=d.pageId,"undefined "!=typeof b&&
-""!=b&&!this._instances[b]))optionsAsString=JSON.stringify(this.options),"undefined"!=typeof this._settings.templateId&&""!=this._settings.templateId&&(d=a("#"+this._settings.templateId).html(),c="",e=this._settings.templatePrecompiled,"undefined"!=typeof this._settings.templateType&&""!=this._settings.templateType&&(c=this._settings.templateType),this._settings.template="dust"===c&&""!==d&&!e?dust.compile(d,this._settings.templateId):d),settingsAsString=JSON.stringify(this._settings),selectorsAsString=
-JSON.stringify(this._selectors),this._instances[b]=[],this._instances[b].options=a.parseJSON(optionsAsString),this._instances[b].settings=a.parseJSON(settingsAsString),this._instances[b].selectors=a.parseJSON(selectorsAsString)},_bind:function(){a("body").bind("scrollstart",a.proxy(this._handleScrollStart,this));a("body").bind("scrollstop",a.proxy(this._handleScrollStop,this));/Firefox/i.test(navigator.userAgent)?a(window).bind("DOMMouseScroll",a.proxy(this._handleMouseWheelEvent,this)):"undefined"!=
-typeof this._selectors&&null!=this._selectors&&""!=this._selectors&&"undefined"!=typeof this._selectors.main&&(a(this._selectors.main).attachEvent?a(window).bind("onmousewheel",a.proxy(this._handleMouseWheelEvent,this)):a(window).bind("mousewheel",a.proxy(this._handleMouseWheelEvent,this)))},_unbind:function(){a("body").unbind("scrollstart",this._handleScrollStart);a("body").unbind("scrollstop",this._handleScrollStop);/Firefox/i.test(navigator.userAgent)?a(window).unbind("DOMMouseScroll",this._handleMouseWheelEvent):
-"undefined"!=typeof this._selectors&&null!=this._selectors&&""!=this._selectors&&"undefined"!=typeof this._selectors.main&&(a(this._selectors.main).attachEvent?a(window).unbind("onmousewheel",this._handleMouseWheelEvent):a(window).unbind("mousewheel",this._handleMouseWheelEvent))},destroy:function(){this._unbind();this._defaultParameters=this._defaultSettings=this._defaultOptions=this._widgetState=this._mouseWheelTimeoutId=this._handleScrollStopTimeoutId=this._handleScrollStartTimeoutId=this._mouseWheelEventJustFired=
-this._handleScrollStopJustFired=this._handleScrollStartJustFired=this._instances=this._parameters=this._settings=this.timeoutOptions=this.options=null;a.Widget.prototype.destroy.apply(this)},_check:function(b){var b=this.options.threshold||b,d,c,e;c=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;d=this._instances[this._settings.pageId]?this._instances[this._settings.pageId].settings.totalHeight:this._settings.totalHeight;e=a(window).height();return d-
-b<=c+e},_load:function(b){typeof this._settings.pageId!=q&&""!=this._settings.pageId&&(a(".ui-page-active").attr("id")==this._settings.pageId?!this._widgetState.busy&&!this._widgetState.done?(this._moreOutstandingPageId=this._settings.pageId,$that=this,setTimeout(function(){$that._moreOutstandingPageId==$that._settings.pageId&&($that._check($that.options.threshold)||0===b)&&a("#"+$that._settings.progressDivId).show($that.timeoutOptions.showprogress,function(){moreUrl=$that._settings.moreUrl;var b=
-"POST",c="json",e="",n=!1,o="",h=0;$that._instances[$that._settings.pageId]?($that._parameters.retrieve=$that._instances[$that._settings.pageId].options.retrieve,$that._parameters.retrieved=$that._instances[$that._settings.pageId].options.retrieved,$that._parameters.offset=$that._instances[$that._settings.pageId].options.offset,$that._instances[$that._settings.pageId].settings.JSONP&&(n=!0,o=$that._instances[$that._settings.pageId].settings.JSONPCallback)):($that._parameters.retrieve=$that.options.retrieve,
-$that._parameters.retrieved=$that.options.retrieved,$that._parameters.offset=$that.options.offset);if("undefined"!=typeof $that._settings.pageId&&""!=$that._settings.pageId){var p=a("#"+$that._settings.pageId).find('[type="hidden"]');for(i=0;i<p.length;i++){var k=a(p).get(i);"undefined"!=typeof a(k).attr("id")&&""!=a(k).attr("id")&&($that._parameters[a(k).attr("id")]=escape(a(k).val()))}}if(n){b="GET";c="jsonp";e="";for(f in $that._parameters)e=0==h?e+('"'+f+'": "'+$that._parameters[f]+'"'):e+(', "'+
-f+'": "'+$that._parameters[f]+'"'),h+=1;e=a.parseJSON("{ "+e+" }")}else for(var f in $that._parameters)e=0==h?e+(f+"="+$that._parameters[f]):e+("&"+f+"="+$that._parameters[f]),h+=1;a.ajax({type:b,url:moreUrl,dataType:c,jsonpCallback:o,data:e,success:function(b){more=b;if(typeof b!=="object")try{more=a.parseJSON(b)}catch(c){$that._triggerEvent("error","_load",c.message);a("#"+$that._settings.progressDivId).hide(250,function(){$that._widgetState.busy=false});return false}try{var d=more.data[0].count,
-e="",g="",j="",f="",h="",k=false,m="",n=b="",l="";if(d>0){m=$that._selectors.main;b=$that._selectors.single;n=$that._selectors.bottom;l=$that._getBottomElement(m,n);if(typeof more.data[0].html!="undefined"&&more.data[0].html!=""){e=more.data[0].html;l?a(b).last().before(e):a(m).append(e)}else{if($that._instances[$that._settings.pageId]){if(typeof $that._instances[$that._settings.pageId].settings.templateId!="undefined"&&$that._instances[$that._settings.pageId].settings.templateId!=""){f=$that._instances[$that._settings.pageId].settings.templateId;
-if(typeof $that._instances[$that._settings.pageId].settings.templateType!="undefined"&&$that._instances[$that._settings.pageId].settings.templateType!="")h=$that._instances[$that._settings.pageId].settings.templateType;if(typeof $that._instances[$that._settings.pageId].settings.template!="undefined"&&$that._instances[$that._settings.pageId].settings.template!="")j=$that._instances[$that._settings.pageId].settings.template}k=$that._instances[$that._settings.pageId].settings.templatePrecompiled}else{if(typeof $that._settings.templateId!=
-"undefined"&&$that._settings.templateId!=""){f=$that._settings.templateId;if(typeof $that._settings.templateType!="undefined"&&$that._settings.templateType!="")h=$that._settings.templateType;if(typeof $that._settings.template!="undefined"&&$that._settings.template!="")j=$that._settings.template}k=$that._settings.templatePrecompiled}if(h!==""&&f!==""&&j!=="")if(h==="json2html"){g=more.data[0].json;l&&l.remove();a(m).json2html(g,a.parseJSON(j));l&&a(b).last().append(l)}else{g=more.data[0];switch(h){case "handlebars":j=
-k?Handlebars.templates[f+".tmpl"]:Handlebars.compile(j);e=j(g);break;case "icanhaz":ich.addTemplate("listitem",j);e=ich.listitem(g,true);ich.clearAll();break;case "dust":if(k)dust.render(f,g,function(b,a){e=a});else{dust.loadSource(j);dust.render(f,g,function(b,a){e=a})}break;case "dot":j=doT.template(j);e=j(g)}l?a(b).last().before(e):a(m).append(e)}}a(m).listview("refresh");g=0;d=parseInt(d);if($that._instances[$that._settings.pageId]){var o=$that._instances[$that._settings.pageId].settings.totalHeight;
-if(typeof $that._instances[$that._settings.pageId].settings.singleItemHeight!=="undefined")g=$that._instances[$that._settings.pageId].settings.singleItemHeight;else{g=a(b).first().next().height();$that._instances[$that._settings.pageId].settings.singleItemHeight=g}$that._instances[$that._settings.pageId].settings.totalHeight=o+g*d}else{if(typeof $that._settings.singleItemHeight!=="undefined")g=$that._settings.singleItemHeight;else{g=a(b).first().next().height();$that._settings.singleItemHeight=g}$that._settings.totalHeight=
-$that._settings.totalHeight+$that._settings.singleItemHeight*d}$that._instances[$that._settings.pageId].options.retrieved=$that._instances[$that._settings.pageId].options.retrieved+d;if(d<$that.options.retrieve||$that.options.retrieve=="all"){$that._widgetState.done=true;$that._triggerEvent("alldone","_load")}}else{$that._widgetState.done=true;$that._triggerEvent("alldone","_load")}a("#"+$that._settings.progressDivId).hide(250,function(){$that._widgetState.busy=false});$that._triggerEvent("doneloading",
-"_load")}catch(p){$that._triggerEvent("error","_load",p.message);a("#"+$that._settings.progressDivId).hide(250,function(){$that._widgetState.busy=false});return false}},error:function(b){$that._triggerEvent("error","_load",b);a("#"+$that._settings.progressDivId).hide(250,function(){$that._widgetState.busy=false})},complete:function(){}})})},b)):this._widgetState.done?$that._triggerEvent("alldone","_load"):this._widgetState.busy&&$that._triggerEvent("busy","_load"):a("#"+this._settings.progressDivId).hide(250,
-function(){"undefined"!=typeof this._widgetState&&(this._widgetState.busy=!1)}))},_getBottomElement:function(b,d){var c=a(b).last().find(d);switch(c.length){case 2:c=c.last();break;default:c=null}return"undefined"!=typeof c&&null!=c&&""!=c&&"null"!=c?c:!1},_handleMouseWheelEvent:function(){if(!this._mouseWheelEventJustFired&&!this._handleScrollStopJustFired&&!this._handleScrollStartJustFired){this._mouseWheelEventJustFired=!0;this._load(this.timeoutOptions.mousewheel);var b=this;this._mouseWheelTimeoutId=
-setTimeout(function(){b._mouseWheelEventJustFired=!1},1E3)}},_handleScrollStart:function(){if(!this._mouseWheelEventJustFired&&!this._handleScrollStopJustFired&&!this._handleScrollStartJustFired){this._handleScrollStartJustFired=!0;this._load(this.timeoutOptions.scrollstart);var b=this;this._handleScrollStartTimeoutId=setTimeout(function(){b._handleScrollStartJustFired=!1},1200)}},_handleScrollStop:function(){if(!this._mouseWheelEventJustFired&&!this._handleScrollStopJustFired&&!this._handleScrollStartJustFired){this._handleScrollStopJustFired=
-!0;this._load(this.timeoutOptions.scrollstop);var b=this;this._handleScrollStopTimeoutId=setTimeout(function(){b._handleScrollStopJustFired=!1},1200)}},loadMore:function(b){0===b?this._load(this.timeoutOptions.immediately):this._load(this.timeoutOptions.scrolldown)},_setOption:function(b,d){this._instances[this._settings.pageId]&&this._instances[this._settings.pageId].options[b]&&(this._instances[this._settings.pageId].options[b]=d);a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(b,
+""!=b&&!this._instances[b])){if(("undefined"==typeof this._settings.template||""==this._settings.template)&&"undefined"!=typeof this._settings.templateId&&""!=this._settings.templateId)d=a("#"+this._settings.templateId).html(),c="",e=this._settings.templatePrecompiled,"undefined"!=typeof this._settings.templateType&&""!=this._settings.templateType&&(c=this._settings.templateType),this._settings.template="dust"===c&&""!==d&&!e?dust.compile(d,this._settings.templateId):d;this._instances[b]=[];this._instances[b].options=
+a.extend(!0,{},this.options);this._instances[b].settings=a.extend(!0,{},this._settings);this._instances[b].selectors=a.extend(!0,{},this._selectors)}},_bind:function(){a("body").bind("scrollstart",a.proxy(this._handleScrollStart,this));a("body").bind("scrollstop",a.proxy(this._handleScrollStop,this));/Firefox/i.test(navigator.userAgent)?a(window).bind("DOMMouseScroll",a.proxy(this._handleMouseWheelEvent,this)):"undefined"!=typeof this._selectors&&null!=this._selectors&&""!=this._selectors&&"undefined"!=
+typeof this._selectors.main&&(a(this._selectors.main).attachEvent?a(window).bind("onmousewheel",a.proxy(this._handleMouseWheelEvent,this)):a(window).bind("mousewheel",a.proxy(this._handleMouseWheelEvent,this)))},_unbind:function(){a("body").unbind("scrollstart",this._handleScrollStart);a("body").unbind("scrollstop",this._handleScrollStop);/Firefox/i.test(navigator.userAgent)?a(window).unbind("DOMMouseScroll",this._handleMouseWheelEvent):"undefined"!=typeof this._selectors&&null!=this._selectors&&
+""!=this._selectors&&"undefined"!=typeof this._selectors.main&&(a(this._selectors.main).attachEvent?a(window).unbind("onmousewheel",this._handleMouseWheelEvent):a(window).unbind("mousewheel",this._handleMouseWheelEvent))},destroy:function(){this._unbind();this._defaultParameters=this._defaultSettings=this._defaultOptions=this._widgetState=this._mouseWheelTimeoutId=this._handleScrollStopTimeoutId=this._handleScrollStartTimeoutId=this._mouseWheelEventJustFired=this._handleScrollStopJustFired=this._handleScrollStartJustFired=
+this._instances=this._parameters=this._settings=this.timeoutOptions=this.options=null;a.Widget.prototype.destroy.apply(this)},_check:function(b){var b=this.options.threshold||b,d,c,e;c=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;d=this._instances[this._settings.pageId]?this._instances[this._settings.pageId].settings.totalHeight:this._settings.totalHeight;e=a(window).height();return d-b<=c+e},_load:function(b){typeof this._settings.pageId!=q&&""!=this._settings.pageId&&
+(a(".ui-page-active").attr("id")==this._settings.pageId?!this._widgetState.busy&&!this._widgetState.done?(this._moreOutstandingPageId=this._settings.pageId,$that=this,setTimeout(function(){$that._moreOutstandingPageId==$that._settings.pageId&&($that._check($that.options.threshold)||0===b)&&a("#"+$that._settings.progressDivId).show($that.timeoutOptions.showprogress,function(){moreUrl=$that._settings.moreUrl;var b="POST",c="json",e="",n=!1,o="",h=0;$that._instances[$that._settings.pageId]?($that._parameters.retrieve=
+$that._instances[$that._settings.pageId].options.retrieve,$that._parameters.retrieved=$that._instances[$that._settings.pageId].options.retrieved,$that._parameters.offset=$that._instances[$that._settings.pageId].options.offset,$that._instances[$that._settings.pageId].settings.JSONP&&(n=!0,o=$that._instances[$that._settings.pageId].settings.JSONPCallback)):($that._parameters.retrieve=$that.options.retrieve,$that._parameters.retrieved=$that.options.retrieved,$that._parameters.offset=$that.options.offset);
+if("undefined"!=typeof $that._settings.pageId&&""!=$that._settings.pageId){var p=a("#"+$that._settings.pageId).find('[type="hidden"]');for(i=0;i<p.length;i++){var k=a(p).get(i);"undefined"!=typeof a(k).attr("id")&&""!=a(k).attr("id")&&($that._parameters[a(k).attr("id")]=escape(a(k).val()))}}if(n){b="GET";c="jsonp";e="";for(f in $that._parameters)e=0==h?e+('"'+f+'": "'+$that._parameters[f]+'"'):e+(', "'+f+'": "'+$that._parameters[f]+'"'),h+=1;e=a.parseJSON("{ "+e+" }")}else for(var f in $that._parameters)e=
+0==h?e+(f+"="+$that._parameters[f]):e+("&"+f+"="+$that._parameters[f]),h+=1;a.ajax({type:b,url:moreUrl,dataType:c,jsonpCallback:o,data:e,success:function(b){more=b;if(typeof b!=="object")try{more=a.parseJSON(b)}catch(c){$that._triggerEvent("error","_load",c.message);a("#"+$that._settings.progressDivId).hide(250,function(){$that._widgetState.busy=false});return false}try{var d=more.data[0].count,e="",g="",j="",f="",h="",k=false,m="",n=b="",l="";if(d>0){m=$that._selectors.main;b=$that._selectors.single;
+n=$that._selectors.bottom;l=$that._getBottomElement(m,n);if(typeof more.data[0].html!="undefined"&&more.data[0].html!=""){e=more.data[0].html;l?a(b).last().before(e):a(m).append(e)}else{if($that._instances[$that._settings.pageId]){if(typeof $that._instances[$that._settings.pageId].settings.templateId!="undefined"&&$that._instances[$that._settings.pageId].settings.templateId!=""){f=$that._instances[$that._settings.pageId].settings.templateId;if(typeof $that._instances[$that._settings.pageId].settings.templateType!=
+"undefined"&&$that._instances[$that._settings.pageId].settings.templateType!="")h=$that._instances[$that._settings.pageId].settings.templateType;if(typeof $that._instances[$that._settings.pageId].settings.template!="undefined"&&$that._instances[$that._settings.pageId].settings.template!="")j=$that._instances[$that._settings.pageId].settings.template}k=$that._instances[$that._settings.pageId].settings.templatePrecompiled}else{if(typeof $that._settings.templateId!="undefined"&&$that._settings.templateId!=
+""){f=$that._settings.templateId;if(typeof $that._settings.templateType!="undefined"&&$that._settings.templateType!="")h=$that._settings.templateType;if(typeof $that._settings.template!="undefined"&&$that._settings.template!="")j=$that._settings.template}k=$that._settings.templatePrecompiled}if(h!==""&&f!==""&&j!=="")if(h==="json2html"){g=more.data[0].json;l&&l.remove();a(m).json2html(g,j);l&&a(b).last().append(l)}else{g=more.data[0];switch(h){case "handlebars":j=k?Handlebars.templates[f+".tmpl"]:
+Handlebars.compile(j);e=j(g);break;case "icanhaz":ich.addTemplate("listitem",j);e=ich.listitem(g,true);ich.clearAll();break;case "dust":if(k)dust.render(f,g,function(b,a){e=a});else{dust.loadSource(j);dust.render(f,g,function(b,a){e=a})}break;case "dot":j=doT.template(j);e=j(g)}l?a(b).last().before(e):a(m).append(e)}}a(m).listview("refresh");g=0;d=parseInt(d);if($that._instances[$that._settings.pageId]){var o=$that._instances[$that._settings.pageId].settings.totalHeight;if(typeof $that._instances[$that._settings.pageId].settings.singleItemHeight!==
+"undefined")g=$that._instances[$that._settings.pageId].settings.singleItemHeight;else{g=a(b).first().next().height();$that._instances[$that._settings.pageId].settings.singleItemHeight=g}$that._instances[$that._settings.pageId].settings.totalHeight=o+g*d}else{if(typeof $that._settings.singleItemHeight!=="undefined")g=$that._settings.singleItemHeight;else{g=a(b).first().next().height();$that._settings.singleItemHeight=g}$that._settings.totalHeight=$that._settings.totalHeight+$that._settings.singleItemHeight*
+d}$that._instances[$that._settings.pageId].options.retrieved=$that._instances[$that._settings.pageId].options.retrieved+d;if(d<$that.options.retrieve||$that.options.retrieve=="all"){$that._widgetState.done=true;$that._triggerEvent("alldone","_load")}}else{$that._widgetState.done=true;$that._triggerEvent("alldone","_load")}a("#"+$that._settings.progressDivId).hide(250,function(){$that._widgetState.busy=false});$that._triggerEvent("doneloading","_load")}catch(p){$that._triggerEvent("error","_load",
+p.message);a("#"+$that._settings.progressDivId).hide(250,function(){$that._widgetState.busy=false});return false}},error:function(b){$that._triggerEvent("error","_load",b);a("#"+$that._settings.progressDivId).hide(250,function(){$that._widgetState.busy=false})},complete:function(){}})})},b)):this._widgetState.done?$that._triggerEvent("alldone","_load"):this._widgetState.busy&&$that._triggerEvent("busy","_load"):a("#"+this._settings.progressDivId).hide(250,function(){"undefined"!=typeof this._widgetState&&
+(this._widgetState.busy=!1)}))},_getBottomElement:function(b,d){var c=a(b).last().find(d);switch(c.length){case 2:c=c.last();break;default:c=null}return"undefined"!=typeof c&&null!=c&&""!=c&&"null"!=c?c:!1},_handleMouseWheelEvent:function(){if(!this._mouseWheelEventJustFired&&!this._handleScrollStopJustFired&&!this._handleScrollStartJustFired){this._mouseWheelEventJustFired=!0;this._load(this.timeoutOptions.mousewheel);var b=this;this._mouseWheelTimeoutId=setTimeout(function(){b._mouseWheelEventJustFired=
+!1},1E3)}},_handleScrollStart:function(){if(!this._mouseWheelEventJustFired&&!this._handleScrollStopJustFired&&!this._handleScrollStartJustFired){this._handleScrollStartJustFired=!0;this._load(this.timeoutOptions.scrollstart);var b=this;this._handleScrollStartTimeoutId=setTimeout(function(){b._handleScrollStartJustFired=!1},1200)}},_handleScrollStop:function(){if(!this._mouseWheelEventJustFired&&!this._handleScrollStopJustFired&&!this._handleScrollStartJustFired){this._handleScrollStopJustFired=!0;
+this._load(this.timeoutOptions.scrollstop);var b=this;this._handleScrollStopTimeoutId=setTimeout(function(){b._handleScrollStopJustFired=!1},1200)}},loadMore:function(b){0===b?this._load(this.timeoutOptions.immediately):this._load(this.timeoutOptions.scrolldown)},_setOption:function(b,d){this._instances[this._settings.pageId]&&this._instances[this._settings.pageId].options[b]&&(this._instances[this._settings.pageId].options[b]=d);a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(b,
d){if("parameters"==b){if("undefined"!=typeof this.options)for(var c in this._parameters)"undefined"!=typeof this.options[c]&&(this._parameters[c]=this.options[c])}else"parameter"==b&&(c=d,"undefined"!=typeof this.options[c]&&(this._parameters[c]=this.options[c]));c=JSON.stringify(this._parameters);this._parameters=a.parseJSON(c)},reInitialize:function(b,a,c,e){this._initialize(b,a,c,e)},reset:function(b){var d=this;a.ajax({type:"POST",url:d._settings.clearUrl,async:!0,data:"section="+b,success:function(a){parseInt(a)&&
(d.options.retrieved=d._defaultOptions.retrieved,d._widgetState.done=!1,"undefined"!=typeof d._instances[b]&&delete d._instances[b],d._triggerEvent("reset","reset","All session variables for the '"+b+"' page and the lazyloader instance variables have been cleared."))},error:function(b){d._triggerEvent("error","reset",b);a("#"+d._settings.progressDivId).hide(250,function(){d._widgetState.busy=!1})}})},resetAll:function(){var b=this;a.ajax({type:"POST",url:b._settings.clearUrl,async:!0,data:"",success:function(a){if(parseInt(a)){for(pageId in b._instances)delete b._instances[pageId];
b.options.retrieved=b._defaultOptions.retrieved;b._widgetState.done=!1;b._widgetState.busy=!1;b._triggerEvent("resetall","resetAll","All session variables for all pages currently being tracked by the lazyloader have been cleared.")}}})},_triggerEvent:function(a,d,c){c=c||"";switch(a){case "error":case "resetall":this._trigger(a,{type:"lazyloader"+a,"function":d,message:c,settings:this._settings,options:this.options,parameters:this._parameters});break;default:this._trigger(a,{type:"lazyloader"+a,"function":d,
Please sign in to comment.
Something went wrong with that request. Please try again.