www/themes/LoveIt/assets/js/theme.min.js

3 Zeilen
22 KiB
JavaScript

2020-05-28 14:55:57 +02:00
"use strict";function _objectDestructuringEmpty(a){if(null==a)throw new TypeError("Cannot destructure undefined")}function _createForOfIteratorHelper(a){if("undefined"==typeof Symbol||null==a[Symbol.iterator]){if(Array.isArray(a)||(a=_unsupportedIterableToArray(a))){var b=0,c=function(){};return{s:c,n:function n(){return b>=a.length?{done:!0}:{done:!1,value:a[b++]}},e:function e(a){throw a},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var d,e,f=!0,g=!1;return{s:function s(){d=a[Symbol.iterator]()},n:function n(){var a=d.next();return f=a.done,a},e:function e(a){g=!0,e=a},f:function f(){try{f||null==d.return||d.return()}finally{if(g)throw e}}}}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(c):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _iterableToArray(a){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(a))return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}var Util=/*#__PURE__*/function(){function a(){_classCallCheck(this,a)}return _createClass(a,[{key:"forEach",value:function forEach(a,b){a=a||[];for(var c=0;c<a.length;c++)b(a[c])}},{key:"getScrollTop",value:function getScrollTop(){return document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop}},{key:"isMobile",value:function isMobile(){return window.matchMedia("only screen and (max-width: 680px)").matches}},{key:"isTocStatic",value:function isTocStatic(){return window.matchMedia("only screen and (max-width: 960px)").matches}},{key:"animateCSS",value:function animateCSS(a,b,c,d){var e;Array.isArray(b)||(b=[b]),(e=a.classList).add.apply(e,["animated"].concat(_toConsumableArray(b)));var f=function(){var c;(c=a.classList).remove.apply(c,["animated"].concat(_toConsumableArray(b))),a.removeEventListener("animationend",f),"function"==typeof d&&d()};c||a.addEventListener("animationend",f,!1)}}]),a}(),Theme=/*#__PURE__*/function(){function a(){_classCallCheck(this,a),this.config=window.config,this.data=this.config.data,this.isDark="dark"===document.body.getAttribute("theme"),this.util=new Util,this.newScrollTop=this.util.getScrollTop(),this.oldScrollTop=this.newScrollTop,this.scrollEventSet=new Set,this.resizeEventSet=new Set,this.switchThemeEventSet=new Set,this.clickMaskEventSet=new Set,window.objectFitImages&&objectFitImages()}return _createClass(a,[{key:"initSVGIcon",value:function initSVGIcon(){this.util.forEach(document.querySelectorAll("[data-svg-src]"),function(a){fetch(a.getAttribute("data-svg-src")).then(function(a){return a.text()}).then(function(b){var c=document.createElement("div");c.insertAdjacentHTML("afterbegin",b);var d=c.firstChild;d.setAttribute("data-svg-src",a.getAttribute("data-svg-src")),d.classList.add("icon");var e=d.getElementsByTagName("title");e.length&&d.removeChild(e[0]),a.parentElement.replaceChild(d,a)}).catch(function(a){console.error(a)})})}},{key:"initTwemoji",value:function init
//# sourceMappingURL=theme.min.js.map