diff --git a/stackload.js b/stackload.js index c352d95..38289df 100644 --- a/stackload.js +++ b/stackload.js @@ -163,7 +163,7 @@ // s.style.display="none"; s.className=c; document.body.appendChild(s); - x=window.getComputedStyle(s); + x=JSON.parse(JSON.stringify(window.getComputedStyle(s))); s.parentNode.removeChild(s); return x; } diff --git a/stackload.min.js b/stackload.min.js index 8d30664..fda9b6a 100644 --- a/stackload.min.js +++ b/stackload.min.js @@ -6,4 +6,4 @@ * @license GPLv3 https://gitlab.com/lubber/stackload/blob/master/LICENSE */ -!function(window,document){var registry=[],fullStack=[],currentLoadIndex=0,callBacks=[],stopAll=!1,continueStack=function(){++currentLoadIndex===callBacks[0].doneIndex&&(callBacks[0].success(),callBacks.shift()),currentLoadIndex===fullStack.length||stopAll||loadSingle()},stackLoadError=function(e){var t=e.target;console.error("[StackLoad Error] Missing file: "+(t.src?t.src:t.href)),!1===callBacks[0].error(e)&&(stopAll=!0),t.parentNode.removeChild(t),stackLoadDone(e)},stackLoadDone=function(e){var t,r=e.target;r.removeEventListener("error",stackLoadError),r.removeEventListener("load",stackLoadDone),r.jsonp&&r.parentNode&&r.parentNode.removeChild(r),stopAll?(t=callBacks[0].doneIndex-++currentLoadIndex)>0&&(fullStack.splice(currentLoadIndex,t),callBacks.shift(),callBacks.forEach(function(e,r,s){s[r].doneIndex-=t})):(r.href&&searchCssImport(document.styleSheets[document.styleSheets.length-1]),continueStack())},loadSingle=function(){var o=fullStack[currentLoadIndex],s;try{!o.check||""!==o.check&&!eval(o.check)?(o.type&&"css"===o.type?(s=document.createElement("link"),s.type="text/css",s.rel="stylesheet",s.href=o.url):(s=document.createElement("script"),s.type="text/javascript",s.src=o.url,s.async=!1,o.type&&"jsonp"===o.type&&(s.jsonp=!0)),document.head.appendChild(s),s.addEventListener("load",stackLoadDone),s.addEventListener("error",stackLoadError)):continueStack()}catch(e){console.error(e),continueStack()}},setup=function(e){if(void 0!==e&&("string"==typeof e||e.url?e={files:[e]}:Array.isArray(e)&&(e={files:e}),e.files)){var t=[];("string"==typeof e.files||e.files.url)&&(e.files=[e.files]),e.files.forEach(function(e){if("string"==typeof e&&(e={url:e}),e.url&&-1===registry.indexOf(e.url)){if(!e.type){var r=e.url.match(/\.([0-9a-zA-Z]+)(?:[?#]|$)/i);r&&(e.type=r[1].toLowerCase())}if("jsonp"===e.type.toLowerCase()){var s=(new Date).getTime();e.url.match(/\?/)?e.url+="&_="+s:e.url+="?_="+s}t.push(e),registry.push(e.url)}});var r=t.length;if("function"!=typeof e.success&&(e.success=function(){}),r>0){var s=(fullStack=fullStack.concat(t)).length;"function"!=typeof e.error&&(e.error=function(){}),callBacks.push({doneIndex:s,success:e.success,error:e.error}),currentLoadIndex===s-r&&loadSingle()}else e.success()}},searchCssImport=function(e){try{if(e.cssRules)for(var t=0,r=e.cssRules.length;t0&&(fullStack.splice(currentLoadIndex,t),callBacks.shift(),callBacks.forEach(function(e,r,s){s[r].doneIndex-=t})):(r.href&&searchCssImport(document.styleSheets[document.styleSheets.length-1]),continueStack())},loadSingle=function(){var o=fullStack[currentLoadIndex],s;try{!o.check||""!==o.check&&!eval(o.check)?(o.type&&"css"===o.type?(s=document.createElement("link"),s.type="text/css",s.rel="stylesheet",s.href=o.url):(s=document.createElement("script"),s.type="text/javascript",s.src=o.url,s.async=!1,o.type&&"jsonp"===o.type&&(s.jsonp=!0)),document.head.appendChild(s),s.addEventListener("load",stackLoadDone),s.addEventListener("error",stackLoadError)):continueStack()}catch(e){console.error(e),continueStack()}},setup=function(e){if(void 0!==e&&("string"==typeof e||e.url?e={files:[e]}:Array.isArray(e)&&(e={files:e}),e.files)){var t=[];("string"==typeof e.files||e.files.url)&&(e.files=[e.files]),e.files.forEach(function(e){if("string"==typeof e&&(e={url:e}),e.url&&-1===registry.indexOf(e.url)){if(!e.type){var r=e.url.match(/\.([0-9a-zA-Z]+)(?:[?#]|$)/i);r&&(e.type=r[1].toLowerCase())}if("jsonp"===e.type.toLowerCase()){var s=(new Date).getTime();e.url.match(/\?/)?e.url+="&_="+s:e.url+="?_="+s}t.push(e),registry.push(e.url)}});var r=t.length;if("function"!=typeof e.success&&(e.success=function(){}),r>0){var s=(fullStack=fullStack.concat(t)).length;"function"!=typeof e.error&&(e.error=function(){}),callBacks.push({doneIndex:s,success:e.success,error:e.error}),currentLoadIndex===s-r&&loadSingle()}else e.success()}},searchCssImport=function(e){try{if(e.cssRules)for(var t=0,r=e.cssRules.length;t