mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2024-12-22 08:04:10 +01:00
1 line
2.3 KiB
JavaScript
1 line
2.3 KiB
JavaScript
!function(){"use strict";var n,t=!1,o=[],d=!1;function e(){window.WebComponents.ready=!0,document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))}function i(){window.customElements&&customElements.polyfillWrapFlushCallback&&customElements.polyfillWrapFlushCallback(function(e){n=e,d&&n()})}function r(){window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(window.document),t=!0,c().then(e)}function c(){d=!1;var e=o.map(function(e){return e instanceof Function?e():e});return o=[],Promise.all(e).then(function(){d=!0,n&&n()}).catch(function(e){console.error(e)})}window.WebComponents=window.WebComponents||{},window.WebComponents.ready=window.WebComponents.ready||!1,window.WebComponents.waitFor=window.WebComponents.waitFor||function(e){e&&(o.push(e),t&&c())},window.WebComponents._batchCustomElements=i;var a="webcomponents-loader.js",l=[];"attachShadow"in Element.prototype&&"getRootNode"in Element.prototype&&(!window.ShadyDOM||!window.ShadyDOM.force)||l.push("sd"),window.customElements&&!window.customElements.forcePolyfill||l.push("ce");var s,m,w,u=function(){var e=document.createElement("template");if(!("content"in e))return!0;if(!(e.content.cloneNode()instanceof DocumentFragment))return!0;var n=document.createElement("template");n.content.appendChild(document.createElement("div")),e.content.appendChild(n);var t=e.cloneNode(!0);return 0===t.content.childNodes.length||0===t.content.firstChild.content.childNodes.length}();window.Promise&&Array.from&&window.URL&&window.Symbol&&!u||(l=["sd-ce-pf"]),l.length?(s="bundles/webcomponents-"+l.join("-")+".js",m=window.WebComponents.root?window.WebComponents.root+s:document.querySelector('script[src*="'+a+'"]').src.replace(a,s),(w=document.createElement("script")).src=m,"loading"===document.readyState?(w.setAttribute("onload","window.WebComponents._batchCustomElements()"),document.write(w.outerHTML),document.addEventListener("DOMContentLoaded",r)):(w.addEventListener("load",function(){i(),r()}),w.addEventListener("error",function(){throw new Error("Could not load polyfill bundle"+m)}),document.head.appendChild(w))):"complete"===document.readyState?(t=!0,e()):(window.addEventListener("load",r),window.addEventListener("DOMContentLoaded",function(){window.removeEventListener("load",r),r()}))}(); |