2 lines
No EOL
6 KiB
JavaScript
2 lines
No EOL
6 KiB
JavaScript
/*! For license information please see thumbnails.min.js.LICENSE.txt */
|
|
!function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=6)}({4:function(t,e,o){var n,r;void 0===(r="function"==typeof(n=function(){"use strict";var t,e,o,n,r="src",i="srcset";return function(r){if(!document.querySelectorAll){var i=document.createStyleSheet();document.querySelectorAll=function(t,e,o,n,r){for(r=document.all,e=[],o=(t=t.replace(/\[for\b/gi,"[htmlFor").split(",")).length;o--;){for(i.addRule(t[o],"k:v"),n=r.length;n--;)r[n].currentStyle.k&&e.push(r[n]);i.removeRule(0)}return e}}var a=this,l=a._util={};l.elements=[],l.destroyed=!0,a.options=r||{},a.options.error=a.options.error||!1,a.options.offset=a.options.offset||100,a.options.root=a.options.root||document,a.options.success=a.options.success||!1,a.options.selector=a.options.selector||".b-lazy",a.options.separator=a.options.separator||"|",a.options.containerClass=a.options.container,a.options.container=!!a.options.containerClass&&document.querySelectorAll(a.options.containerClass),a.options.errorClass=a.options.errorClass||"b-error",a.options.breakpoints=a.options.breakpoints||!1,a.options.loadInvisible=a.options.loadInvisible||!1,a.options.successClass=a.options.successClass||"b-loaded",a.options.validateDelay=a.options.validateDelay||25,a.options.saveViewportOffsetDelay=a.options.saveViewportOffsetDelay||50,a.options.srcset=a.options.srcset||"data-srcset",a.options.src=t=a.options.src||"data-src",n=Element.prototype.closest,o=window.devicePixelRatio>1,(e={}).top=0-a.options.offset,e.left=0-a.options.offset,a.revalidate=function(){s(a)},a.load=function(t,e){var o=this.options;t&&void 0===t.length?u(t,e,o):E(t,(function(t){u(t,e,o)}))},a.destroy=function(){var t=a._util;a.options.container&&E(a.options.container,(function(e){O(e,"scroll",t.validateT)})),O(window,"scroll",t.validateT),O(window,"resize",t.validateT),O(window,"resize",t.saveViewportOffsetT),t.count=0,t.elements.length=0,t.destroyed=!0},l.validateT=S((function(){c(a)}),a.options.validateDelay,a),l.saveViewportOffsetT=S((function(){C(a.options.offset)}),a.options.saveViewportOffsetDelay,a),C(a.options.offset),E(a.options.breakpoints,(function(e){if(e.width>=window.screen.width)return t=e.src,!1})),setTimeout((function(){s(a)}))};function s(t){var e=t._util;e.elements=w(t.options),e.count=e.elements.length,e.destroyed&&(e.destroyed=!1,t.options.container&&E(t.options.container,(function(t){T(t,"scroll",e.validateT)})),T(window,"resize",e.saveViewportOffsetT),T(window,"resize",e.validateT),T(window,"scroll",e.validateT)),c(t)}function c(t){for(var e=t._util,o=0;o<e.count;o++){var n=e.elements[o];(a(n,t.options)||h(n,t.options.successClass))&&(t.load(n),e.elements.splice(o,1),e.count--,o--)}0===e.count&&t.destroy()}function a(t,o){var r=t.getBoundingClientRect();if(o.container&&n){var i=t.closest(o.containerClass);if(i){var s=i.getBoundingClientRect();if(l(s,e)){var c=s.top-o.offset,a=s.right+o.offset,u=s.bottom+o.offset,f=s.left-o.offset;return l(r,{top:c>e.top?c:e.top,right:a<e.right?a:e.right,bottom:u<e.bottom?u:e.bottom,left:f>e.left?f:e.left})}return!1}}return l(r,e)}function l(t,e){return t.right>=e.left&&t.bottom>=e.top&&t.left<=e.right&&t.top<=e.bottom}function u(e,n,s){if(!h(e,s.successClass)&&(n||s.loadInvisible||e.offsetWidth>0&&e.offsetHeight>0)){var c=m(e,t)||m(e,s.src);if(c){var a=c.split(s.separator),l=a[o&&a.length>1?1:0],u=m(e,s.srcset),v=y(e,"img"),g=e.parentNode,w=g&&y(g,"picture");if(v||void 0===e.src){var C=new Image,S=function(){s.error&&s.error(e,"invalid"),b(e,s.errorClass),O(C,"error",S),O(C,"load",_)},_=function(){v?w||d(e,l,u):e.style.backgroundImage='url("'+l+'")',f(e,s),O(C,"load",_),O(C,"error",S)};w&&(C=e,E(g.getElementsByTagName("source"),(function(t){p(t,i,s.srcset)}))),T(C,"error",S),T(C,"load",_),d(C,l,u)}else e.src=l,f(e,s)}else y(e,"video")?(E(e.getElementsByTagName("source"),(function(t){p(t,r,s.src)})),e.load(),f(e,s)):(s.error&&s.error(e,"missing"),b(e,s.errorClass))}}function f(t,e){b(t,e.successClass),e.success&&e.success(t),g(t,e.src),g(t,e.srcset),E(e.breakpoints,(function(e){g(t,e.src)}))}function p(t,e,o){var n=m(t,o);n&&(v(t,e,n),g(t,o))}function d(t,e,o){o&&v(t,i,o),t.src=e}function v(t,e,o){t.setAttribute(e,o)}function m(t,e){return t.getAttribute(e)}function g(t,e){t.removeAttribute(e)}function y(t,e){return t.nodeName.toLowerCase()===e}function h(t,e){return-1!==(" "+t.className+" ").indexOf(" "+e+" ")}function b(t,e){h(t,e)||(t.className+=" "+e)}function w(t){for(var e=[],o=t.root.querySelectorAll(t.selector),n=o.length;n--;e.unshift(o[n]));return e}function C(t){e.bottom=(window.innerHeight||document.documentElement.clientHeight)+t,e.right=(window.innerWidth||document.documentElement.clientWidth)+t}function T(t,e,o){t.attachEvent?t.attachEvent&&t.attachEvent("on"+e,o):t.addEventListener(e,o,{capture:!1,passive:!0})}function O(t,e,o){t.detachEvent?t.detachEvent&&t.detachEvent("on"+e,o):t.removeEventListener(e,o,{capture:!1,passive:!0})}function E(t,e){if(t&&e)for(var o=t.length,n=0;n<o&&!1!==e(t[n],n);n++);}function S(t,e,o){var n=0;return function(){var r=+new Date;r-n<e||(n=r,t.apply(o,arguments))}}})?n.call(e,o,e,t):n)||(t.exports=r)},6:function(t,e,o){"use strict";o.r(e);var n=o(4);new(o.n(n).a)}}); |