From aed0911e70460aeae7f4c894e08e07c9771ecfa0 Mon Sep 17 00:00:00 2001 From: 00Fjongl <65314359+00Fjongl@users.noreply.github.com> Date: Tue, 16 Jul 2024 20:39:40 -0500 Subject: [PATCH] Fix settings UI blocking the screen on load; other minor changes --- proxyServiceValidator.js | 6 +++--- views/assets/css/styles-1644738239.css | 8 +++++++- views/assets/js/register-sw.js | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/proxyServiceValidator.js b/proxyServiceValidator.js index 6c38e21b..de6c756b 100644 --- a/proxyServiceValidator.js +++ b/proxyServiceValidator.js @@ -235,10 +235,10 @@ xx xx const waitForDocument = new Promise(resolve => { document.documentElement.appendChild(exampleIFrame); exampleIFrame.addEventListener("load", () => { - result = exampleIFrame.contentWindow.document.title === website.title; - resolve(); + result = exampleIFrame.contentWindow.document.title === website.title; + resolve(); + }); }); - }); exampleIFrame.src = url; exampleIFrame.style.display = "none"; await waitForDocument; diff --git a/views/assets/css/styles-1644738239.css b/views/assets/css/styles-1644738239.css index 10e9248b..c73442f3 100644 --- a/views/assets/css/styles-1644738239.css +++ b/views/assets/css/styles-1644738239.css @@ -409,6 +409,8 @@ details[open] summary { } .navbar .dropdown-settings { + display: none; + pointer-events: none; position: fixed; top: 0; left: 0; @@ -419,10 +421,10 @@ details[open] summary { z-index: 5; /* Ensures it appears above other content */ align-items: center; justify-content: center; - display: flex; /* Flexbox to center content */ } .settings-content { + pointer-events: auto; background-color: var(--nord0); border: 1px solid var(--nord3); border-radius: 10px; @@ -432,6 +434,10 @@ details[open] summary { text-align: center; } +.dropdown-parent:focus-within .dropdown-settings { + display: flex; /* Flexbox to center content */ +} + .dropdown-parent:focus-within .dropdown-child { display: block; } diff --git a/views/assets/js/register-sw.js b/views/assets/js/register-sw.js index 0e1f351f..18aadb50 100644 --- a/views/assets/js/register-sw.js +++ b/views/assets/js/register-sw.js @@ -1,6 +1,7 @@ const stockSW = "/uv/sw.js"; const swAllowedHostnames = ["localhost", "127.0.0.1"]; const connection = new BareMux.BareMuxConnection("/baremux/worker.js"); +const wispUrl = (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/"; async function registerSW() { if (!navigator.serviceWorker) { @@ -13,13 +14,12 @@ async function registerSW() { throw new Error("Your browser doesn't support service workers."); } - let wispUrl = (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/"; await connection.setTransport("/epoxy/index.mjs", [{ wisp: wispUrl }]); await navigator.serviceWorker.register(stockSW); } async function setupTransportOnLoad() { - const conn = new BareMuxConnection("/baremux/worker.js"); + const conn = new BareMux.BareMuxConnection("/baremux/worker.js"); if (await conn.getTransport() !== "/baremux/module.js") { await conn.setTransport("/baremux/module.js", [{ wisp: wispUrl }]); }