From d1b5a844f1059f3b046421d10bf2b0b115aebd17 Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Fri, 1 May 2015 10:51:31 -0400 Subject: [PATCH] Running grunt to get the latest in the /dist folder according to the source files. --- dist/jquery.lazyloadxt.autoload.js | 4 ++-- dist/jquery.lazyloadxt.bg.js | 16 ++++++++------ dist/jquery.lazyloadxt.bg.min.js | 2 +- dist/jquery.lazyloadxt.extra.js | 31 +++++++++++++--------------- dist/jquery.lazyloadxt.extra.min.js | 2 +- dist/jquery.lazyloadxt.fadein.css | 4 ++-- dist/jquery.lazyloadxt.js | 31 +++++++++++++--------------- dist/jquery.lazyloadxt.min.js | 2 +- dist/jquery.lazyloadxt.picture.js | 4 ++-- dist/jquery.lazyloadxt.print.js | 4 ++-- dist/jquery.lazyloadxt.script.js | 4 ++-- dist/jquery.lazyloadxt.spinner.css | 4 ++-- dist/jquery.lazyloadxt.srcset.js | 4 ++-- dist/jquery.lazyloadxt.video.js | 4 ++-- dist/jquery.lazyloadxt.widget.js | 15 ++++++++------ dist/jquery.lazyloadxt.widget.min.js | 2 +- 16 files changed, 67 insertions(+), 66 deletions(-) diff --git a/dist/jquery.lazyloadxt.autoload.js b/dist/jquery.lazyloadxt.autoload.js index 2499023..5cdb34f 100644 --- a/dist/jquery.lazyloadxt.autoload.js +++ b/dist/jquery.lazyloadxt.autoload.js @@ -1,6 +1,6 @@ -/*! Lazy Load XT v1.0.6 2014-11-19 +/*! Lazy Load XT v1.0.6 2015-05-01 * http://ressio.github.io/lazy-load-xt - * (C) 2014 RESS.io + * (C) 2015 RESS.io * Licensed under MIT */ (function ($) { diff --git a/dist/jquery.lazyloadxt.bg.js b/dist/jquery.lazyloadxt.bg.js index 251345e..ae060b3 100644 --- a/dist/jquery.lazyloadxt.bg.js +++ b/dist/jquery.lazyloadxt.bg.js @@ -1,6 +1,6 @@ -/*! Lazy Load XT v1.0.6 2014-11-19 +/*! Lazy Load XT v1.0.6 2015-05-01 * http://ressio.github.io/lazy-load-xt - * (C) 2014 RESS.io + * (C) 2015 RESS.io * Licensed under MIT */ (function ($) { @@ -10,10 +10,14 @@ options.selector += ',[' + bgAttr + ']'; $(document).on('lazyshow', function (e) { - var $this = $(e.target); - $this - .css('background-image', "url('" + $this.attr(bgAttr) + "')") - .removeAttr(bgAttr); + var $this = $(e.target), + url = $this.attr(bgAttr); + if (!!url) { + $this + .css('background-image', "url('" + url + "')") + .removeAttr(bgAttr) + .triggerHandler('load'); + } }); })(window.jQuery || window.Zepto || window.$); diff --git a/dist/jquery.lazyloadxt.bg.min.js b/dist/jquery.lazyloadxt.bg.min.js index 823b5e5..1d8616e 100644 --- a/dist/jquery.lazyloadxt.bg.min.js +++ b/dist/jquery.lazyloadxt.bg.min.js @@ -1,2 +1,2 @@ /* Lazy Load XT 1.0.6 | MIT License */ -!function(a){var b=a.lazyLoadXT,c=b.bgAttr||"data-bg";b.selector+=",["+c+"]",a(document).on("lazyshow",function(b){var d=a(b.target);d.css("background-image","url('"+d.attr(c)+"')").removeAttr(c)})}(window.jQuery||window.Zepto||window.$); \ No newline at end of file +!function(a){var b=a.lazyLoadXT,c=b.bgAttr||"data-bg";b.selector+=",["+c+"]",a(document).on("lazyshow",function(b){var d=a(b.target),e=d.attr(c);e&&d.css("background-image","url('"+e+"')").removeAttr(c).triggerHandler("load")})}(window.jQuery||window.Zepto||window.$); \ No newline at end of file diff --git a/dist/jquery.lazyloadxt.extra.js b/dist/jquery.lazyloadxt.extra.js index ad03dcc..c4bfaec 100644 --- a/dist/jquery.lazyloadxt.extra.js +++ b/dist/jquery.lazyloadxt.extra.js @@ -1,6 +1,6 @@ -/*! Lazy Load XT v1.0.6 2014-11-19 +/*! Lazy Load XT v1.0.6 2015-05-01 * http://ressio.github.io/lazy-load-xt - * (C) 2014 RESS.io + * (C) 2015 RESS.io * Licensed under MIT */ (function ($, window, document, undefined) { @@ -45,15 +45,6 @@ $data = $.data || function (el, name) { return $(el).data(name); }, - // $.contains is not included into DOMtastic, so implement it there - $contains = $.contains || function (parent, el) { - while (el = el.parentNode) { - if (el === parent) { - return true; - } - } - return false; - }, elements = [], topLazy = 0, /* @@ -95,6 +86,7 @@ var blankImage = getOrDef(overrides, 'blankImage'), checkDuplicates = getOrDef(overrides, 'checkDuplicates'), scrollContainer = getOrDef(overrides, 'scrollContainer'), + forceShow = getOrDef(overrides, 'show'), elementOptionsOverrides = {}, prop; @@ -109,13 +101,15 @@ if (el === window) { $(options.selector).lazyLoadXT(overrides); } else { + var duplicate = checkDuplicates && $data(el, dataLazied), + $el = $(el).data(dataLazied, forceShow ? -1 : 1); + // prevent duplicates - if (checkDuplicates && $data(el, dataLazied)) { + if (duplicate) { + queueCheckLazyElements(); return; } - var $el = $(el).data(dataLazied, 1); - if (blankImage && el.tagName === 'IMG' && !el.src) { el.src = blankImage; } @@ -126,6 +120,7 @@ triggerEvent('init', $el); elements.push($el); + queueCheckLazyElements(); } }); }; @@ -191,11 +186,11 @@ el = $el[0], objData = $el[lazyLoadXT], removeNode = false, - visible = force, + visible = force || $data(el, dataLazied) < 0, topEdge; // remove items that are not in DOM - if (!$contains(docElement, el)) { + if (!$.contains(docElement, el)) { removeNode = true; } else if (force || !objData.visibleOnly || el.offsetWidth || el.offsetHeight) { @@ -211,12 +206,14 @@ } if (visible) { + $el.on(load_error, triggerLoadOrError); + triggerEvent('show', $el); var srcAttr = objData.srcAttr, src = $isFunction(srcAttr) ? srcAttr($el) : el.getAttribute(srcAttr); + if (src) { - $el.on(load_error, triggerLoadOrError); el.src = src; } diff --git a/dist/jquery.lazyloadxt.extra.min.js b/dist/jquery.lazyloadxt.extra.min.js index 65dcc46..e0eb248 100644 --- a/dist/jquery.lazyloadxt.extra.min.js +++ b/dist/jquery.lazyloadxt.extra.min.js @@ -1,2 +1,2 @@ /* Lazy Load XT 1.0.6 | MIT License */ -!function(a,b,c,d){function e(a,b){return a[b]===d?t[b]:a[b]}function f(){var a=b.pageYOffset;return a===d?r.scrollTop:a}function g(a,b){var c=t["on"+a];c&&(w(c)?c.call(b[0]):(c.addClass&&b.addClass(c.addClass),c.removeClass&&b.removeClass(c.removeClass))),b.trigger("lazy"+a,[b]),k()}function h(b){g(b.type,a(this).off(p,h))}function i(c){if(A.length){c=c||t.forceLoad,B=1/0;var d,e,i=f(),j=b.innerHeight||r.clientHeight,k=b.innerWidth||r.clientWidth;for(d=0,e=A.length;e>d;d++){var l,m=A[d],o=m[0],q=m[n],s=!1,u=c;if(z(r,o)){if(c||!q.visibleOnly||o.offsetWidth||o.offsetHeight){if(!u){var v=o.getBoundingClientRect(),x=q.edgeX,y=q.edgeY;l=v.top+i-y-j,u=i>=l&&v.bottom>-y&&v.left<=k+x&&v.right>-x}if(u){g("show",m);var C=q.srcAttr,D=w(C)?C(m):o.getAttribute(C);D&&(m.on(p,h),o.src=D),s=!0}else B>l&&(B=l)}}else s=!0;s&&(A.splice(d--,1),e--)}e||g("complete",a(r))}}function j(){C>1?(C=1,i(),setTimeout(j,t.throttle)):C=0}function k(a){A.length&&(a&&"scroll"===a.type&&a.currentTarget===b&&B>=f()||(C||setTimeout(j,0),C=2))}function l(){v.lazyLoadXT()}function m(){i(!0)}var n="lazyLoadXT",o="lazied",p="load error",q="lazy-hidden",r=c.documentElement||c.body,s=b.onscroll===d||!!b.operamini||!r.getBoundingClientRect,t={autoInit:!0,selector:"img[data-src]",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",throttle:99,forceLoad:s,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll touchmove focus",forceEvent:"",oninit:{removeClass:"lazy"},onshow:{addClass:q},onload:{removeClass:q,addClass:"lazy-loaded"},onerror:{removeClass:q},checkDuplicates:!0},u={srcAttr:"data-src",edgeX:0,edgeY:0,visibleOnly:!0},v=a(b),w=a.isFunction,x=a.extend,y=a.data||function(b,c){return a(b).data(c)},z=a.contains||function(a,b){for(;b=b.parentNode;)if(b===a)return!0;return!1},A=[],B=0,C=0;a[n]=x(t,u,a[n]),a.fn[n]=function(c){c=c||{};var d,f=e(c,"blankImage"),h=e(c,"checkDuplicates"),i=e(c,"scrollContainer"),j={};a(i).on("scroll",k);for(d in u)j[d]=e(c,d);return this.each(function(d,e){if(e===b)a(t.selector).lazyLoadXT(c);else{if(h&&y(e,o))return;var i=a(e).data(o,1);f&&"IMG"===e.tagName&&!e.src&&(e.src=f),i[n]=x({},j),g("init",i),A.push(i)}})},a(c).ready(function(){g("start",v),v.on(t.loadEvent,l).on(t.updateEvent,k).on(t.forceEvent,m),a(c).on(t.updateEvent,k),t.autoInit&&l()})}(window.jQuery||window.Zepto||window.$,window,document),function(a){var b=a.lazyLoadXT;b.selector+=",video,iframe[data-src]",b.videoPoster="data-poster",a(document).on("lazyshow","video",function(c,d){var e=d.lazyLoadXT.srcAttr,f=a.isFunction(e);d.attr("poster",d.attr(b.videoPoster)).children("source,track").each(function(b,c){var d=a(c);d.attr("src",f?e(d):d.attr(e))}),this.load()})}(window.jQuery||window.Zepto||window.$); \ No newline at end of file +!function(a,b,c,d){function e(a,b){return a[b]===d?t[b]:a[b]}function f(){var a=b.pageYOffset;return a===d?r.scrollTop:a}function g(a,b){var c=t["on"+a];c&&(w(c)?c.call(b[0]):(c.addClass&&b.addClass(c.addClass),c.removeClass&&b.removeClass(c.removeClass))),b.trigger("lazy"+a,[b]),k()}function h(b){g(b.type,a(this).off(p,h))}function i(c){if(z.length){c=c||t.forceLoad,A=1/0;var d,e,i=f(),j=b.innerHeight||r.clientHeight,k=b.innerWidth||r.clientWidth;for(d=0,e=z.length;e>d;d++){var l,m=z[d],q=m[0],s=m[n],u=!1,v=c||y(q,o)<0;if(a.contains(r,q)){if(c||!s.visibleOnly||q.offsetWidth||q.offsetHeight){if(!v){var x=q.getBoundingClientRect(),B=s.edgeX,C=s.edgeY;l=x.top+i-C-j,v=i>=l&&x.bottom>-C&&x.left<=k+B&&x.right>-B}if(v){m.on(p,h),g("show",m);var D=s.srcAttr,E=w(D)?D(m):q.getAttribute(D);E&&(q.src=E),u=!0}else A>l&&(A=l)}}else u=!0;u&&(z.splice(d--,1),e--)}e||g("complete",a(r))}}function j(){B>1?(B=1,i(),setTimeout(j,t.throttle)):B=0}function k(a){z.length&&(a&&"scroll"===a.type&&a.currentTarget===b&&A>=f()||(B||setTimeout(j,0),B=2))}function l(){v.lazyLoadXT()}function m(){i(!0)}var n="lazyLoadXT",o="lazied",p="load error",q="lazy-hidden",r=c.documentElement||c.body,s=b.onscroll===d||!!b.operamini||!r.getBoundingClientRect,t={autoInit:!0,selector:"img[data-src]",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",throttle:99,forceLoad:s,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll touchmove focus",forceEvent:"",oninit:{removeClass:"lazy"},onshow:{addClass:q},onload:{removeClass:q,addClass:"lazy-loaded"},onerror:{removeClass:q},checkDuplicates:!0},u={srcAttr:"data-src",edgeX:0,edgeY:0,visibleOnly:!0},v=a(b),w=a.isFunction,x=a.extend,y=a.data||function(b,c){return a(b).data(c)},z=[],A=0,B=0;a[n]=x(t,u,a[n]),a.fn[n]=function(c){c=c||{};var d,f=e(c,"blankImage"),h=e(c,"checkDuplicates"),i=e(c,"scrollContainer"),j=e(c,"show"),l={};a(i).on("scroll",k);for(d in u)l[d]=e(c,d);return this.each(function(d,e){if(e===b)a(t.selector).lazyLoadXT(c);else{var i=h&&y(e,o),m=a(e).data(o,j?-1:1);if(i)return void k();f&&"IMG"===e.tagName&&!e.src&&(e.src=f),m[n]=x({},l),g("init",m),z.push(m),k()}})},a(c).ready(function(){g("start",v),v.on(t.loadEvent,l).on(t.updateEvent,k).on(t.forceEvent,m),a(c).on(t.updateEvent,k),t.autoInit&&l()})}(window.jQuery||window.Zepto||window.$,window,document),function(a){var b=a.lazyLoadXT;b.selector+=",video,iframe[data-src]",b.videoPoster="data-poster",a(document).on("lazyshow","video",function(c,d){var e=d.lazyLoadXT.srcAttr,f=a.isFunction(e);d.attr("poster",d.attr(b.videoPoster)).children("source,track").each(function(b,c){var d=a(c);d.attr("src",f?e(d):d.attr(e))}),this.load()})}(window.jQuery||window.Zepto||window.$); \ No newline at end of file diff --git a/dist/jquery.lazyloadxt.fadein.css b/dist/jquery.lazyloadxt.fadein.css index 2c4ea7c..69991d3 100644 --- a/dist/jquery.lazyloadxt.fadein.css +++ b/dist/jquery.lazyloadxt.fadein.css @@ -1,6 +1,6 @@ -/*! Lazy Load XT v1.0.6 2014-11-19 +/*! Lazy Load XT v1.0.6 2015-05-01 * http://ressio.github.io/lazy-load-xt - * (C) 2014 RESS.io + * (C) 2015 RESS.io * Licensed under MIT */ .lazy-hidden { opacity: 0; diff --git a/dist/jquery.lazyloadxt.js b/dist/jquery.lazyloadxt.js index 18c5186..9a36809 100644 --- a/dist/jquery.lazyloadxt.js +++ b/dist/jquery.lazyloadxt.js @@ -1,6 +1,6 @@ -/*! Lazy Load XT v1.0.6 2014-11-19 +/*! Lazy Load XT v1.0.6 2015-05-01 * http://ressio.github.io/lazy-load-xt - * (C) 2014 RESS.io + * (C) 2015 RESS.io * Licensed under MIT */ (function ($, window, document, undefined) { @@ -45,15 +45,6 @@ $data = $.data || function (el, name) { return $(el).data(name); }, - // $.contains is not included into DOMtastic, so implement it there - $contains = $.contains || function (parent, el) { - while (el = el.parentNode) { - if (el === parent) { - return true; - } - } - return false; - }, elements = [], topLazy = 0, /* @@ -95,6 +86,7 @@ var blankImage = getOrDef(overrides, 'blankImage'), checkDuplicates = getOrDef(overrides, 'checkDuplicates'), scrollContainer = getOrDef(overrides, 'scrollContainer'), + forceShow = getOrDef(overrides, 'show'), elementOptionsOverrides = {}, prop; @@ -109,13 +101,15 @@ if (el === window) { $(options.selector).lazyLoadXT(overrides); } else { + var duplicate = checkDuplicates && $data(el, dataLazied), + $el = $(el).data(dataLazied, forceShow ? -1 : 1); + // prevent duplicates - if (checkDuplicates && $data(el, dataLazied)) { + if (duplicate) { + queueCheckLazyElements(); return; } - var $el = $(el).data(dataLazied, 1); - if (blankImage && el.tagName === 'IMG' && !el.src) { el.src = blankImage; } @@ -126,6 +120,7 @@ triggerEvent('init', $el); elements.push($el); + queueCheckLazyElements(); } }); }; @@ -191,11 +186,11 @@ el = $el[0], objData = $el[lazyLoadXT], removeNode = false, - visible = force, + visible = force || $data(el, dataLazied) < 0, topEdge; // remove items that are not in DOM - if (!$contains(docElement, el)) { + if (!$.contains(docElement, el)) { removeNode = true; } else if (force || !objData.visibleOnly || el.offsetWidth || el.offsetHeight) { @@ -211,12 +206,14 @@ } if (visible) { + $el.on(load_error, triggerLoadOrError); + triggerEvent('show', $el); var srcAttr = objData.srcAttr, src = $isFunction(srcAttr) ? srcAttr($el) : el.getAttribute(srcAttr); + if (src) { - $el.on(load_error, triggerLoadOrError); el.src = src; } diff --git a/dist/jquery.lazyloadxt.min.js b/dist/jquery.lazyloadxt.min.js index 962d1b0..8c487f5 100644 --- a/dist/jquery.lazyloadxt.min.js +++ b/dist/jquery.lazyloadxt.min.js @@ -1,2 +1,2 @@ /* Lazy Load XT 1.0.6 | MIT License */ -!function(a,b,c,d){function e(a,b){return a[b]===d?t[b]:a[b]}function f(){var a=b.pageYOffset;return a===d?r.scrollTop:a}function g(a,b){var c=t["on"+a];c&&(w(c)?c.call(b[0]):(c.addClass&&b.addClass(c.addClass),c.removeClass&&b.removeClass(c.removeClass))),b.trigger("lazy"+a,[b]),k()}function h(b){g(b.type,a(this).off(p,h))}function i(c){if(A.length){c=c||t.forceLoad,B=1/0;var d,e,i=f(),j=b.innerHeight||r.clientHeight,k=b.innerWidth||r.clientWidth;for(d=0,e=A.length;e>d;d++){var l,m=A[d],o=m[0],q=m[n],s=!1,u=c;if(z(r,o)){if(c||!q.visibleOnly||o.offsetWidth||o.offsetHeight){if(!u){var v=o.getBoundingClientRect(),x=q.edgeX,y=q.edgeY;l=v.top+i-y-j,u=i>=l&&v.bottom>-y&&v.left<=k+x&&v.right>-x}if(u){g("show",m);var C=q.srcAttr,D=w(C)?C(m):o.getAttribute(C);D&&(m.on(p,h),o.src=D),s=!0}else B>l&&(B=l)}}else s=!0;s&&(A.splice(d--,1),e--)}e||g("complete",a(r))}}function j(){C>1?(C=1,i(),setTimeout(j,t.throttle)):C=0}function k(a){A.length&&(a&&"scroll"===a.type&&a.currentTarget===b&&B>=f()||(C||setTimeout(j,0),C=2))}function l(){v.lazyLoadXT()}function m(){i(!0)}var n="lazyLoadXT",o="lazied",p="load error",q="lazy-hidden",r=c.documentElement||c.body,s=b.onscroll===d||!!b.operamini||!r.getBoundingClientRect,t={autoInit:!0,selector:"img[data-src]",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",throttle:99,forceLoad:s,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll touchmove focus",forceEvent:"",oninit:{removeClass:"lazy"},onshow:{addClass:q},onload:{removeClass:q,addClass:"lazy-loaded"},onerror:{removeClass:q},checkDuplicates:!0},u={srcAttr:"data-src",edgeX:0,edgeY:0,visibleOnly:!0},v=a(b),w=a.isFunction,x=a.extend,y=a.data||function(b,c){return a(b).data(c)},z=a.contains||function(a,b){for(;b=b.parentNode;)if(b===a)return!0;return!1},A=[],B=0,C=0;a[n]=x(t,u,a[n]),a.fn[n]=function(c){c=c||{};var d,f=e(c,"blankImage"),h=e(c,"checkDuplicates"),i=e(c,"scrollContainer"),j={};a(i).on("scroll",k);for(d in u)j[d]=e(c,d);return this.each(function(d,e){if(e===b)a(t.selector).lazyLoadXT(c);else{if(h&&y(e,o))return;var i=a(e).data(o,1);f&&"IMG"===e.tagName&&!e.src&&(e.src=f),i[n]=x({},j),g("init",i),A.push(i)}})},a(c).ready(function(){g("start",v),v.on(t.loadEvent,l).on(t.updateEvent,k).on(t.forceEvent,m),a(c).on(t.updateEvent,k),t.autoInit&&l()})}(window.jQuery||window.Zepto||window.$,window,document); \ No newline at end of file +!function(a,b,c,d){function e(a,b){return a[b]===d?t[b]:a[b]}function f(){var a=b.pageYOffset;return a===d?r.scrollTop:a}function g(a,b){var c=t["on"+a];c&&(w(c)?c.call(b[0]):(c.addClass&&b.addClass(c.addClass),c.removeClass&&b.removeClass(c.removeClass))),b.trigger("lazy"+a,[b]),k()}function h(b){g(b.type,a(this).off(p,h))}function i(c){if(z.length){c=c||t.forceLoad,A=1/0;var d,e,i=f(),j=b.innerHeight||r.clientHeight,k=b.innerWidth||r.clientWidth;for(d=0,e=z.length;e>d;d++){var l,m=z[d],q=m[0],s=m[n],u=!1,v=c||y(q,o)<0;if(a.contains(r,q)){if(c||!s.visibleOnly||q.offsetWidth||q.offsetHeight){if(!v){var x=q.getBoundingClientRect(),B=s.edgeX,C=s.edgeY;l=x.top+i-C-j,v=i>=l&&x.bottom>-C&&x.left<=k+B&&x.right>-B}if(v){m.on(p,h),g("show",m);var D=s.srcAttr,E=w(D)?D(m):q.getAttribute(D);E&&(q.src=E),u=!0}else A>l&&(A=l)}}else u=!0;u&&(z.splice(d--,1),e--)}e||g("complete",a(r))}}function j(){B>1?(B=1,i(),setTimeout(j,t.throttle)):B=0}function k(a){z.length&&(a&&"scroll"===a.type&&a.currentTarget===b&&A>=f()||(B||setTimeout(j,0),B=2))}function l(){v.lazyLoadXT()}function m(){i(!0)}var n="lazyLoadXT",o="lazied",p="load error",q="lazy-hidden",r=c.documentElement||c.body,s=b.onscroll===d||!!b.operamini||!r.getBoundingClientRect,t={autoInit:!0,selector:"img[data-src]",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",throttle:99,forceLoad:s,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll touchmove focus",forceEvent:"",oninit:{removeClass:"lazy"},onshow:{addClass:q},onload:{removeClass:q,addClass:"lazy-loaded"},onerror:{removeClass:q},checkDuplicates:!0},u={srcAttr:"data-src",edgeX:0,edgeY:0,visibleOnly:!0},v=a(b),w=a.isFunction,x=a.extend,y=a.data||function(b,c){return a(b).data(c)},z=[],A=0,B=0;a[n]=x(t,u,a[n]),a.fn[n]=function(c){c=c||{};var d,f=e(c,"blankImage"),h=e(c,"checkDuplicates"),i=e(c,"scrollContainer"),j=e(c,"show"),l={};a(i).on("scroll",k);for(d in u)l[d]=e(c,d);return this.each(function(d,e){if(e===b)a(t.selector).lazyLoadXT(c);else{var i=h&&y(e,o),m=a(e).data(o,j?-1:1);if(i)return void k();f&&"IMG"===e.tagName&&!e.src&&(e.src=f),m[n]=x({},l),g("init",m),z.push(m),k()}})},a(c).ready(function(){g("start",v),v.on(t.loadEvent,l).on(t.updateEvent,k).on(t.forceEvent,m),a(c).on(t.updateEvent,k),t.autoInit&&l()})}(window.jQuery||window.Zepto||window.$,window,document); \ No newline at end of file diff --git a/dist/jquery.lazyloadxt.picture.js b/dist/jquery.lazyloadxt.picture.js index e165e4d..dd0fc95 100644 --- a/dist/jquery.lazyloadxt.picture.js +++ b/dist/jquery.lazyloadxt.picture.js @@ -1,6 +1,6 @@ -/*! Lazy Load XT v1.0.6 2014-11-19 +/*! Lazy Load XT v1.0.6 2015-05-01 * http://ressio.github.io/lazy-load-xt - * (C) 2014 RESS.io + * (C) 2015 RESS.io * Licensed under MIT */ (function ($, window, document) { diff --git a/dist/jquery.lazyloadxt.print.js b/dist/jquery.lazyloadxt.print.js index b72f1d2..b05623f 100644 --- a/dist/jquery.lazyloadxt.print.js +++ b/dist/jquery.lazyloadxt.print.js @@ -1,6 +1,6 @@ -/*! Lazy Load XT v1.0.6 2014-11-19 +/*! Lazy Load XT v1.0.6 2015-05-01 * http://ressio.github.io/lazy-load-xt - * (C) 2014 RESS.io + * (C) 2015 RESS.io * Licensed under MIT */ (function ($, window) { diff --git a/dist/jquery.lazyloadxt.script.js b/dist/jquery.lazyloadxt.script.js index 75743c1..866e5cb 100644 --- a/dist/jquery.lazyloadxt.script.js +++ b/dist/jquery.lazyloadxt.script.js @@ -1,6 +1,6 @@ -/*! Lazy Load XT v1.0.6 2014-11-19 +/*! Lazy Load XT v1.0.6 2015-05-01 * http://ressio.github.io/lazy-load-xt - * (C) 2014 RESS.io + * (C) 2015 RESS.io * Licensed under MIT */ (function ($, window, document) { diff --git a/dist/jquery.lazyloadxt.spinner.css b/dist/jquery.lazyloadxt.spinner.css index 7084473..89e3ab4 100644 --- a/dist/jquery.lazyloadxt.spinner.css +++ b/dist/jquery.lazyloadxt.spinner.css @@ -1,6 +1,6 @@ -/*! Lazy Load XT v1.0.6 2014-11-19 +/*! Lazy Load XT v1.0.6 2015-05-01 * http://ressio.github.io/lazy-load-xt - * (C) 2014 RESS.io + * (C) 2015 RESS.io * Licensed under MIT */ .lazy-hidden { background: #eee url('loading.gif') no-repeat 50% 50%; diff --git a/dist/jquery.lazyloadxt.srcset.js b/dist/jquery.lazyloadxt.srcset.js index e6cd78a..f9b449f 100644 --- a/dist/jquery.lazyloadxt.srcset.js +++ b/dist/jquery.lazyloadxt.srcset.js @@ -1,6 +1,6 @@ -/*! Lazy Load XT v1.0.6 2014-11-19 +/*! Lazy Load XT v1.0.6 2015-05-01 * http://ressio.github.io/lazy-load-xt - * (C) 2014 RESS.io + * (C) 2015 RESS.io * Licensed under MIT */ (function ($, window, document, undefined) { diff --git a/dist/jquery.lazyloadxt.video.js b/dist/jquery.lazyloadxt.video.js index 6485152..34b0815 100644 --- a/dist/jquery.lazyloadxt.video.js +++ b/dist/jquery.lazyloadxt.video.js @@ -1,6 +1,6 @@ -/*! Lazy Load XT v1.0.6 2014-11-19 +/*! Lazy Load XT v1.0.6 2015-05-01 * http://ressio.github.io/lazy-load-xt - * (C) 2014 RESS.io + * (C) 2015 RESS.io * Licensed under MIT */ (function ($) { diff --git a/dist/jquery.lazyloadxt.widget.js b/dist/jquery.lazyloadxt.widget.js index b5b3f9f..6f6e5d8 100644 --- a/dist/jquery.lazyloadxt.widget.js +++ b/dist/jquery.lazyloadxt.widget.js @@ -1,6 +1,6 @@ -/*! Lazy Load XT v1.0.6 2014-11-19 +/*! Lazy Load XT v1.0.6 2015-05-01 * http://ressio.github.io/lazy-load-xt - * (C) 2014 RESS.io + * (C) 2015 RESS.io * Licensed under MIT */ (function ($) { @@ -12,19 +12,22 @@ $(document).on('lazyshow', '[' + widgetAttr + ']', function () { var $this = $(this), + $target = $this, id = $this.attr(widgetAttr), match; if (id) { - $this = $('#' + id); + $target = $('#' + id); } - if ($this.length) { - match = reComment.exec($this.html()); + if ($target.length) { + match = reComment.exec($target.html()); if (match) { - $this.replaceWith($.trim(match[1])); + $target.replaceWith($.trim(match[1])); } } + + $this.triggerHandler('load'); }); })(window.jQuery || window.Zepto || window.$); diff --git a/dist/jquery.lazyloadxt.widget.min.js b/dist/jquery.lazyloadxt.widget.min.js index 42bcc52..93712c0 100644 --- a/dist/jquery.lazyloadxt.widget.min.js +++ b/dist/jquery.lazyloadxt.widget.min.js @@ -1,2 +1,2 @@ /* Lazy Load XT 1.0.6 | MIT License */ -!function(a){var b=a.lazyLoadXT,c=b.widgetAttr||"data-lazy-widget",d=//;b.selector+=",["+c+"]",a(document).on("lazyshow","["+c+"]",function(){var b,e=a(this),f=e.attr(c);f&&(e=a("#"+f)),e.length&&(b=d.exec(e.html()),b&&e.replaceWith(a.trim(b[1])))})}(window.jQuery||window.Zepto||window.$); \ No newline at end of file +!function(a){var b=a.lazyLoadXT,c=b.widgetAttr||"data-lazy-widget",d=//;b.selector+=",["+c+"]",a(document).on("lazyshow","["+c+"]",function(){var b,e=a(this),f=e,g=e.attr(c);g&&(f=a("#"+g)),f.length&&(b=d.exec(f.html()),b&&f.replaceWith(a.trim(b[1]))),e.triggerHandler("load")})}(window.jQuery||window.Zepto||window.$); \ No newline at end of file