diff --git a/static/app.js b/static/app.js index d43ccbe..c07c95f 100644 --- a/static/app.js +++ b/static/app.js @@ -300,11 +300,17 @@ function showTools() { if (slowInterval) clearInterval(slowInterval), slowInterval = null; } + function applySettings() { + window.postMessage({ kind: "snotes-settings", serverUrl: window.location.origin }, "*"); + } + function onDetected() { + const wasDetected = detected; detected = true; stopPing(); extStatus.textContent = "✓ Extension detected"; installBtn.textContent = "Extension installed"; + if (!wasDetected) setTimeout(applySettings, 300); } function doPing() { @@ -330,7 +336,7 @@ function showTools() { }); qsApply.addEventListener("click", () => { - window.postMessage({ kind: "snotes-settings", serverUrl: window.location.origin }, "*"); + applySettings(); qsStatus.textContent = "Applying…"; setTimeout(() => { if (qsStatus.textContent === "Applying…") qsStatus.textContent = "No response — is the extension installed?"; }, 5000); });