From d9587d3e9d5aeaa0db11d0b3020a3f3d383ac5c1 Mon Sep 17 00:00:00 2001 From: Astrian Zheng Date: Fri, 23 May 2025 20:45:16 +1000 Subject: [PATCH] refactor: remove existing content --- src/main.ts | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/main.ts b/src/main.ts index 7aaf85e..a98c6ef 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,29 +4,23 @@ import App from './App.vue' // Replace the body content with the Vue app // Remove existing body content -document.body.innerHTML = '' -// Create a new container for the Vue app -const container = document.createElement('div') -container.id = 'app' -document.body.appendChild(container) +document.getElementsByTagName('html')[0].innerHTML = ` + + + + Popup + + +
+ +` -// remove all script and link tags -const scripts = document.getElementsByTagName('script') -console.log(scripts) -const links = document.getElementsByTagName('link') -for (let i in scripts) { - console.log(scripts[i]) - console.log(typeof scripts[i]) - if (typeof scripts[i] === 'object') { - scripts[i].remove() - } -} -for (let i in links) { - console.log(links[i]) - console.log(typeof links[i]) - if (typeof links[i] === 'object') { - links[i].remove() - } +if ('serviceWorker' in navigator) { + navigator.serviceWorker.getRegistrations().then(registrations => { + for (let registration of registrations) { + registration.unregister() + } + }) } // mount Vue app