MyShaarli/tpl/myShaarli/js/thumbnails.min.js

2 lines
6 KiB
JavaScript
Raw Normal View History

2023-05-25 11:13:43 +02:00
/*! 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