diff --git a/assets/jquery-lazy/jquery.lazy.plugins.js b/assets/jquery-lazy/jquery.lazy.plugins.js index 311f92a..6ce7044 100644 --- a/assets/jquery-lazy/jquery.lazy.plugins.js +++ b/assets/jquery-lazy/jquery.lazy.plugins.js @@ -603,4 +603,31 @@ response(false); } }); +})(window.jQuery || window.Zepto); + +/*! + * jQuery & Zepto Lazy - YouTube Plugin - v1.5 + * http://jquery.eisbehr.de/lazy/ + * + * Copyright 2012 - 2018, Daniel 'Eisbehr' Kern + * + * Dual licensed under the MIT and GPL-2.0 licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl-2.0.html + */ +;(function($) { + // load youtube video iframe, like: + // + $.lazy(['do'], function(element, response) { + var callback = element.attr('data-callback'); + if (typeof window[callback] === 'function') { + window[callback](element, response); + // remove attribute + if (this.config('removeAttribute')) { + element.removeAttr('data-callback'); + } + } else { + response(false); + } + }); })(window.jQuery || window.Zepto); \ No newline at end of file diff --git a/assets/jquery-lazy/jquery.lazy.plugins.min.js b/assets/jquery-lazy/jquery.lazy.plugins.min.js index 90a0b1a..f2e32dd 100644 --- a/assets/jquery-lazy/jquery.lazy.plugins.min.js +++ b/assets/jquery-lazy/jquery.lazy.plugins.min.js @@ -1,2 +1,11 @@ -/*! jQuery & Zepto Lazy - All Plugins v1.7.10 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */ -!function(t){function a(a,e,r,o){o=o?o.toUpperCase():"GET";var i;"POST"!==o&&"PUT"!==o||!a.config("ajaxCreateData")||(i=a.config("ajaxCreateData").apply(a,[e])),t.ajax({url:e.attr("data-src"),type:"POST"===o||"PUT"===o?o:"GET",data:i,dataType:e.attr("data-type")||"html",success:function(t){e.html(t),r(!0),a.config("removeAttribute")&&e.removeAttr("data-src data-method data-type")},error:function(){r(!1)}})}t.lazy("ajax",function(t,e){a(this,t,e,t.attr("data-method"))}),t.lazy("get",function(t,e){a(this,t,e,"GET")}),t.lazy("post",function(t,e){a(this,t,e,"POST")}),t.lazy("put",function(t,e){a(this,t,e,"PUT")})}(window.jQuery||window.Zepto),function(t){t.lazy(["av","audio","video"],["audio","video"],function(a,e){var r=a[0].tagName.toLowerCase();if("audio"===r||"video"===r){var o=a.find("data-src"),i=a.find("data-track"),n=0,c=function(){++n===o.length&&e(!1)},s=function(){var a=t(this),e=a[0].tagName.toLowerCase(),r=a.prop("attributes"),o=t("data-src"===e?"":"");"data-src"===e&&o.one("error",c),t.each(r,function(t,a){o.attr(a.name,a.value)}),a.replaceWith(o)};a.one("loadedmetadata",function(){e(!0)}).off("load error").attr("poster",a.attr("data-poster")),o.length?o.each(s):a.attr("data-src")?(t.each(a.attr("data-src").split(","),function(e,r){var o=r.split("|");a.append(t("").one("error",c).attr({src:o[0].trim(),type:o[1].trim()}))}),this.config("removeAttribute")&&a.removeAttr("data-src")):e(!1),i.length&&i.each(s)}else e(!1)})}(window.jQuery||window.Zepto),function(t){t.lazy(["frame","iframe"],"iframe",function(a,e){var r=this;if("iframe"===a[0].tagName.toLowerCase()){var o=a.attr("data-error-detect");"true"!==o&&"1"!==o?(a.attr("src",a.attr("data-src")),r.config("removeAttribute")&&a.removeAttr("data-src data-error-detect")):t.ajax({url:a.attr("data-src"),dataType:"html",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(t){a.html(t).attr("src",a.attr("data-src")),r.config("removeAttribute")&&a.removeAttr("data-src data-error-detect")},error:function(){e(!1)}})}else e(!1)})}(window.jQuery||window.Zepto),function(t){t.lazy("noop",function(){}),t.lazy("noop-success",function(t,a){a(!0)}),t.lazy("noop-error",function(t,a){a(!1)})}(window.jQuery||window.Zepto),function(t){function a(a,e,i){var n=a.prop("attributes"),c=t("<"+e+">");return t.each(n,function(t,a){"srcset"!==a.name&&a.name!==o||(a.value=r(a.value,i)),c.attr(a.name,a.value)}),a.replaceWith(c),c}function e(a,e,r){var o=t("").one("load",function(){r(!0)}).one("error",function(){r(!1)}).appendTo(a).attr("src",e);o.complete&&o.load()}function r(t,a){if(a){var e=t.split(",");t="";for(var r=0,o=e.length;r").attr({media:i.attr("data-media"),sizes:i.attr("data-sizes"),type:i.attr("data-type"),srcset:r(i.attr("data-srcset"),d)}).appendTo(i),e(i,d+i.attr(o),n),this.config("removeAttribute")&&i.removeAttr(o+" data-srcset data-media data-sizes data-type")):n(!1)}else n(!1)})}(window.jQuery||window.Zepto),function(t){t.lazy(["js","javascript","script"],"script",function(t,a){"script"===t[0].tagName.toLowerCase()?(t.attr("src",t.attr("data-src")),this.config("removeAttribute")&&t.removeAttr("data-src")):a(!1)})}(window.jQuery||window.Zepto),function(t){t.lazy("vimeo",function(t,a){"iframe"===t[0].tagName.toLowerCase()?(t.attr("src","https://player.vimeo.com/video/"+t.attr("data-src")),this.config("removeAttribute")&&t.removeAttr("data-src")):a(!1)})}(window.jQuery||window.Zepto),function(t){t.lazy(["yt","youtube"],function(t,a){if("iframe"===t[0].tagName.toLowerCase()){var e=/1|true/.test(t.attr("data-nocookie"));t.attr("src","https://www.youtube"+(e?"-nocookie":"")+".com/embed/"+t.attr("data-src")+"?rel=0&showinfo=0"),this.config("removeAttribute")&&t.removeAttr("data-src")}else a(!1)})}(window.jQuery||window.Zepto); \ No newline at end of file +/*! + * jQuery & Zepto Lazy - AJAX Plugin - v1.4 + * http://jquery.eisbehr.de/lazy/ + * + * Copyright 2012 - 2018, Daniel 'Eisbehr' Kern + * + * Dual licensed under the MIT and GPL-2.0 licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl-2.0.html + */ +!function(t){function e(e,a,r,o){var i;"POST"!==(o=o?o.toUpperCase():"GET")&&"PUT"!==o||!e.config("ajaxCreateData")||(i=e.config("ajaxCreateData").apply(e,[a])),t.ajax({url:a.attr("data-src"),type:"POST"===o||"PUT"===o?o:"GET",data:i,dataType:a.attr("data-type")||"html",success:function(t){a.html(t),r(!0),e.config("removeAttribute")&&a.removeAttr("data-src data-method data-type")},error:function(){r(!1)}})}t.lazy("ajax",(function(t,a){e(this,t,a,t.attr("data-method"))})),t.lazy("get",(function(t,a){e(this,t,a,"GET")})),t.lazy("post",(function(t,a){e(this,t,a,"POST")})),t.lazy("put",(function(t,a){e(this,t,a,"PUT")}))}(window.jQuery||window.Zepto),function(t){t.lazy(["av","audio","video"],["audio","video"],(function(e,a){var r=e[0].tagName.toLowerCase();if("audio"===r||"video"===r){var o="data-src",i=e.find(o),n=e.find("data-track"),c=0,s=function(){++c===i.length&&a(!1)},u=function(){var e=t(this),a=e[0].tagName.toLowerCase(),r=e.prop("attributes"),i=t(a===o?"":"");a===o&&i.one("error",s),t.each(r,(function(t,e){i.attr(e.name,e.value)})),e.replaceWith(i)};e.one("loadedmetadata",(function(){a(!0)})).off("load error").attr("poster",e.attr("data-poster")),i.length?i.each(u):e.attr(o)?(t.each(e.attr(o).split(","),(function(a,r){var o=r.split("|");e.append(t("").one("error",s).attr({src:o[0].trim(),type:o[1].trim()}))})),this.config("removeAttribute")&&e.removeAttr(o)):a(!1),n.length&&n.each(u)}else a(!1)}))}(window.jQuery||window.Zepto),function(t){t.lazy(["frame","iframe"],"iframe",(function(e,a){var r=this;if("iframe"===e[0].tagName.toLowerCase()){var o="data-src",i="data-error-detect",n=e.attr(i);"true"!==n&&"1"!==n?(e.attr("src",e.attr(o)),r.config("removeAttribute")&&e.removeAttr(o+" "+i)):t.ajax({url:e.attr(o),dataType:"html",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(t){e.html(t).attr("src",e.attr(o)),r.config("removeAttribute")&&e.removeAttr(o+" "+i)},error:function(){a(!1)}})}else a(!1)}))}(window.jQuery||window.Zepto),function(t){t.lazy("noop",(function(){})),t.lazy("noop-success",(function(t,e){e(!0)})),t.lazy("noop-error",(function(t,e){e(!1)}))}(window.jQuery||window.Zepto),function(t){var e="data-src",a="data-srcset",r="data-media",o="data-sizes",i="data-type";function n(a,r,o){var i=a.prop("attributes"),n=t("<"+r+">");return t.each(i,(function(t,a){"srcset"!==a.name&&a.name!==e||(a.value=s(a.value,o)),n.attr(a.name,a.value)})),a.replaceWith(n),n}function c(e,a,r){var o=t("").one("load",(function(){r(!0)})).one("error",(function(){r(!1)})).appendTo(e).attr("src",a);o.complete&&o.load()}function s(t,e){if(e){var a=t.split(",");t="";for(var r=0,o=a.length;r").attr({media:u.attr(r),sizes:u.attr(o),type:u.attr(i),srcset:s(u.attr(a),p)}).appendTo(u),c(u,p+u.attr(e),d),this.config("removeAttribute")&&u.removeAttr(e+" "+a+" "+r+" "+o+" "+i)):d(!1)}else d(!1)}))}(window.jQuery||window.Zepto),(window.jQuery||window.Zepto).lazy(["js","javascript","script"],"script",(function(t,e){"script"===t[0].tagName.toLowerCase()?(t.attr("src",t.attr("data-src")),this.config("removeAttribute")&&t.removeAttr("data-src")):e(!1)})),(window.jQuery||window.Zepto).lazy("vimeo",(function(t,e){"iframe"===t[0].tagName.toLowerCase()?(t.attr("src","https://player.vimeo.com/video/"+t.attr("data-src")),this.config("removeAttribute")&&t.removeAttr("data-src")):e(!1)})),(window.jQuery||window.Zepto).lazy(["yt","youtube"],(function(t,e){if("iframe"===t[0].tagName.toLowerCase()){var a=/1|true/.test(t.attr("data-nocookie"));t.attr("src","https://www.youtube"+(a?"-nocookie":"")+".com/embed/"+t.attr("data-src")+"?rel=0&showinfo=0"),this.config("removeAttribute")&&t.removeAttr("data-src")}else e(!1)})),(window.jQuery||window.Zepto).lazy(["do"],(function(t,e){var a=t.attr("data-callback");"function"==typeof window[a]?(window[a](t,e),this.config("removeAttribute")&&t.removeAttr("data-callback")):e(!1)})); \ No newline at end of file diff --git a/assets/jquery-lazy/plugins/jquery.lazy.do.js b/assets/jquery-lazy/plugins/jquery.lazy.do.js new file mode 100644 index 0000000..a5817d8 --- /dev/null +++ b/assets/jquery-lazy/plugins/jquery.lazy.do.js @@ -0,0 +1,26 @@ +/*! + * jQuery & Zepto Lazy - YouTube Plugin - v1.5 + * http://jquery.eisbehr.de/lazy/ + * + * Copyright 2012 - 2018, Daniel 'Eisbehr' Kern + * + * Dual licensed under the MIT and GPL-2.0 licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl-2.0.html + */ +;(function($) { + // load youtube video iframe, like: + // + $.lazy(['do'], function(element, response) { + var callback = element.attr('data-callback'); + if (typeof window[callback] === 'function') { + window[callback](element, response); + // remove attribute + if (this.config('removeAttribute')) { + element.removeAttr('data-callback'); + } + } else { + response(false); + } + }); +})(window.jQuery || window.Zepto); \ No newline at end of file