This commit is contained in:
2024-12-14 20:41:41 +03:00
parent 74cd10de8a
commit 0f779b7ebf
103 changed files with 3212 additions and 1387 deletions
+13
View File
@@ -0,0 +1,13 @@
/*!
* jQuery & Zepto Lazy - v1.7.10
* 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
*
* $("img.lazy").lazy();
*/
!function(t,e){"use strict";var r=t.jQuery||t.Zepto,a=0,n=!1;function i(a,i,o,l,u){var c=0,f=-1,s=-1,d=!1,A="afterLoad",h="load",m="error",g="img",b="src",v="srcset",p="sizes",y="background-image";function z(){var e,n,c,A;d=t.devicePixelRatio>1,o=w(o),i.delay>=0&&setTimeout((function(){B(!0)}),i.delay),(i.delay<0||i.combined)&&(l.e=(e=i.throttle,n=function(t){"resize"===t.type&&(f=s=-1),B(t.all)},A=0,function(t,r){var o=+new Date-A;function l(){A=+new Date,n.call(a,t)}c&&clearTimeout(c),o>e||!i.enableThrottle||r?l():c=setTimeout(l,e-o)}),l.a=function(t){t=w(t),o.push.apply(o,t)},l.g=function(){return o=r(o).filter((function(){return!r(this).data(i.loadedName)}))},l.f=function(t){for(var e=0;e<t.length;e++){var r=o.filter((function(){return this===t[e]}));r.length&&B(!1,r)}},B(),r(i.appendScroll).on("scroll."+u+" resize."+u,l.e))}function w(t){var n=i.defaultImage,o=i.placeholder,l=i.imageBase,u=i.srcsetAttribute,c=i.loaderAttribute,f=i._f||{};t=r(t).filter((function(){var t=r(this),a=E(this);return!t.data(i.handledName)&&(t.attr(i.attribute)||t.attr(u)||t.attr(c)||f[a]!==e)})).data("plugin_"+i.name,a);for(var s=0,d=t.length;s<d;s++){var A=r(t[s]),h=E(t[s]),m=A.attr(i.imageBaseAttribute)||l;h===g&&m&&A.attr(u)&&A.attr(u,T(A.attr(u),m)),f[h]===e||A.attr(c)||A.attr(c,f[h]),h===g&&n&&!A.attr(b)?A.attr(b,n):h===g||!o||A.css(y)&&"none"!==A.css(y)||A.css(y,"url('"+o+"')")}return t}function B(t,e){if(o.length){for(var n=e||o,l=!1,u=i.imageBase||"",c=i.srcsetAttribute,f=i.handledName,s=0;s<n.length;s++)if(t||e||D(n[s])){var d=r(n[s]),A=E(n[s]),h=d.attr(i.attribute),m=d.attr(i.imageBaseAttribute)||u,p=d.attr(i.loaderAttribute);d.data(f)||i.visibleOnly&&!d.is(":visible")||!((h||d.attr(c))&&(A===g&&(m+h!==d.attr(b)||d.attr(c)!==d.attr(v))||A!==g&&m+h!==d.css(y))||p)||(l=!0,d.data(f,!0),L(d,A,m,p))}l&&(o=r(o).filter((function(){return!r(this).data(f)})))}else i.autoDestroy&&a.destroy()}function L(t,e,a,n){++c;var o=function(){N("onError",t),I(),o=r.noop};N("beforeLoad",t);var l=i.attribute,u=i.srcsetAttribute,f=i.sizesAttribute,s=i.retinaAttribute,z=i.removeAttribute,w=i.loadedName,B=t.attr(s);if(n){var L=function(){z&&t.removeAttr(i.loaderAttribute),t.data(w,!0),N(A,t),setTimeout(I,1),L=r.noop};t.off(m).one(m,o).one(h,L),N(n,t,(function(e){e?(t.off(h),L()):(t.off(m),o())}))||t.trigger(m)}else{var D=r(new Image);D.one(m,o).one(h,(function(){t.hide(),e===g?t.attr(p,D.attr(p)).attr(v,D.attr(v)).attr(b,D.attr(b)):t.css(y,"url('"+D.attr(b)+"')"),t[i.effect](i.effectTime),z&&(t.removeAttr(l+" "+u+" "+s+" "+i.imageBaseAttribute),f!==p&&t.removeAttr(f)),t.data(w,!0),N(A,t),D.remove(),I()}));var E=(d&&B?B:t.attr(l))||"";D.attr(p,t.attr(f)).attr(v,t.attr(u)).attr(b,E?a+E:null),D.complete&&D.trigger(h)}}function D(e){var a=e.getBoundingClientRect(),n=i.scrollDirection,o=i.threshold,l=(s>=0?s:s=r(t).height())+o>a.top&&-o<a.bottom,u=(f>=0?f:f=r(t).width())+o>a.left&&-o<a.right;return"vertical"===n?l:("horizontal"===n||l)&&u}function E(t){return t.tagName.toLowerCase()}function T(t,e){if(e){var r=t.split(",");t="";for(var a=0,n=r.length;a<n;a++)t+=e+r[a].trim()+(a!==n-1?",":"")}return t}function I(){--c,o.length||c||N("onFinishedAll")}function N(t,e,r){return!!(t=i[t])&&(t.apply(a,[].slice.call(arguments,1)),!0)}"event"===i.bind||n?z():r(t).on(h+"."+u,z)}function o(n,o){var l=this,u=r.extend({},l.config,o),c={},f=u.name+"-"+ ++a;return l.config=function(t,r){return r===e?u[t]:(u[t]=r,l)},l.addItems=function(t){return c.a&&c.a("string"===r.type(t)?r(t):t),l},l.getItems=function(){return c.g?c.g():{}},l.update=function(t){return c.e&&c.e({},!t),l},l.force=function(t){return c.f&&c.f("string"===r.type(t)?r(t):t),l},l.loadAll=function(){return c.e&&c.e({all:!0},!0),l},l.destroy=function(){return r(u.appendScroll).off("."+f,c.e),r(t).off("."+f),c={},e},i(l,u,n,c,f),u.chainable?n:l}r.fn.Lazy=r.fn.lazy=function(t){return new o(this,t)},r.Lazy=r.lazy=function(t,a,n){if(r.isFunction(a)&&(n=a,a=[]),r.isFunction(n)){t=r.isArray(t)?t:[t],a=r.isArray(a)?a:[a];for(var i=o.prototype.config,l=i._f||(i._f={}),u=0,c=t.length;u<c;u++)(i[t[u]]===e||r.isFunction(i[t[u]]))&&(i[t[u]]=n);for(var f=0,s=a.length;f<s;f++)l[a[f]]=t[0]}},o.prototype.config={name:"lazy",chainable:!0,autoDestroy:!0,bind:"load",threshold:500,visibleOnly:!1,appendScroll:t,scrollDirection:"both",imageBase:null,defaultImage:"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",placeholder:null,delay:-1,combined:!1,attribute:"data-src",srcsetAttribute:"data-srcset",sizesAttribute:"data-sizes",retinaAttribute:"data-retina",loaderAttribute:"data-loader",imageBaseAttribute:"data-imagebase",removeAttribute:!0,handledName:"handled",loadedName:"loaded",effect:"show",effectTime:0,enableThrottle:!0,throttle:250,beforeLoad:e,afterLoad:e,onError:e,onFinishedAll:e};var l=function(){n=!0};/complete|interactive|loaded/.test(document.readyState)?l():t.attachEvent?t.attachEvent("onload",l):document.addEventListener("DOMContentLoaded",l)}(window);