Fix settings UI blocking the screen on load; other minor changes

This commit is contained in:
00Fjongl 2024-07-16 20:39:40 -05:00
parent 7307bbbd84
commit aed0911e70
3 changed files with 12 additions and 6 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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 }]);
}