From 5d2ddea3c30184138a48ba20e9d2e00f963d1bb5 Mon Sep 17 00:00:00 2001 From: trivernis Date: Thu, 27 Jul 2023 17:55:05 +0200 Subject: [PATCH] Add stop using chromium popup --- src/routes/popup/+page.svelte | 77 +++++++++++++++++++++++++++++++++++ static/popup.js | 26 ++++++++++++ static/test.html | 6 +++ 3 files changed, 109 insertions(+) create mode 100644 src/routes/popup/+page.svelte create mode 100644 static/popup.js create mode 100644 static/test.html diff --git a/src/routes/popup/+page.svelte b/src/routes/popup/+page.svelte new file mode 100644 index 0000000..8d981e6 --- /dev/null +++ b/src/routes/popup/+page.svelte @@ -0,0 +1,77 @@ +
+ + + +
+ +
+ + + +
\ No newline at end of file diff --git a/static/popup.js b/static/popup.js new file mode 100644 index 0000000..1b24428 --- /dev/null +++ b/static/popup.js @@ -0,0 +1,26 @@ +async function showNoChromiumPopup() { + if (localStorage.getItem("no-chromium-popup-shown") != "1") { + + const divPage = document.createElement("div"); + const response = await fetch("/popup/"); + divPage.innerHTML = await response.text(); + + for (const child of divPage.querySelectorAll("#no-chromium-head > *")) { + document.head.appendChild(child); + } + + for (const child of divPage.querySelectorAll("#no-chromium-body > *")) { + document.body.appendChild(child); + } + + document.querySelector("#no-chromium-popup").style = ""; + document.querySelector("#no-chromium-hide-button").addEventListener("click", hideNoChromiumPopup); + } +} + +function hideNoChromiumPopup() { + document.querySelector("#no-chromium-popup").remove(); + localStorage.setItem("no-chromium-popup-shown", "1"); +} + +showNoChromiumPopup(); \ No newline at end of file diff --git a/static/test.html b/static/test.html new file mode 100644 index 0000000..475ce27 --- /dev/null +++ b/static/test.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file -- 2.38.5