Zulma-Theme/static/js/zulma_switchcss.js

2 lines
2.6 KiB
JavaScript
Raw Normal View History

!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}({2:function(e,t){!function(e){var t="ZULMA_THEME",n=localStorage.getItem(t),o="stop-blink",r="stylesheet",c=null,l=function e(t){var n=t.currentTarget;n.removeEventListener("load",e),n.removeEventListener("error",i),a(),n.className+=r,c=null,d()},i=function e(n){var o=n.currentTarget;o.removeEventListener("load",l),o.removeEventListener("error",e),localStorage.removeItem(t),s(o.id,!1),o.remove(),c&&document.getElementsByTagName("head")[0].appendChild(c),s(document.querySelectorAll(".".concat(r))[0].id,!0),d()};function u(e,n){var o=document.createElement("link");o.rel="stylesheet",o.type="text/css",o.href="/".concat(e,".css"),o.id=e;var u=document.getElementsByTagName("head")[0].appendChild(o);u.addEventListener("load",l),u.addEventListener("error",i),n&&(c=document.querySelectorAll(".".concat(r))[0],a()),function(e){localStorage.setItem(t,e)}(e)}function a(){document.querySelectorAll(".".concat(r)).forEach((function(e){e.remove()}))}function d(){var e=document.getElementById(o);e&&e.remove()}function s(e,t){var n=document.querySelectorAll("#theme-select>option");n.length?n.forEach((function(n){n.value===e&&(t?n.selected="selected":n.remove())})):window.addEventListener("DOMContentLoaded",(function(){s(e,t)}))}e.init=function(){var e,t,r;n&&!document.getElementById(n)&&(e=document.getElementsByTagName("head")[0],t=document.createElement("style"),r="body{visibility:hidden;}",t.id=o,t.setAttribute("type","text/css"),t.styleSheet?t.styleSheet.cssText=r:t.appendChild(document.createTextNode(r)),e.appendChild(t),u(n,!0),s(n,!0)),window.addEventListener("DOMContentLoaded",(function(){document.getElementById("theme-select").onchange=function(){u(this.value)}}))}}(switch_css=window.switch_css||{}),switch_css.init()}});
//# sourceMappingURL=zulma_switchcss.js.map