From a4a692b86e63d8e98b6163859392cefd1c13301c Mon Sep 17 00:00:00 2001 From: CodeDevMLH Date: Mon, 16 Dec 2024 02:28:42 +0100 Subject: [PATCH] remove self --- seasonals.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/seasonals.js b/seasonals.js index b443f13..3a65c97 100644 --- a/seasonals.js +++ b/seasonals.js @@ -74,7 +74,7 @@ function loadThemeCSS(cssPath) { console.error(`Failed to load CSS: ${cssPath}`); }; - document.head.appendChild(link); + document.body.appendChild(link); console.log(`CSS file "${cssPath}" loaded.`); } @@ -104,6 +104,12 @@ function updateThemeContainer(containerClass) { console.log(`Seasonals-Container class updated to "${containerClass}".`); } +function removeSelf() { + const script = document.currentScript; + if (script) script.parentNode.removeChild(script); + console.log('External script removed:', script.src); +} + // initialize theme function initializeTheme() { let currentTheme; @@ -127,6 +133,8 @@ function initializeTheme() { if (theme.js) loadThemeJS(theme.js); console.log(`Theme "${currentTheme}" loaded.`); + + removeSelf(); }