From 832168e845ae2eb08be3b318754c6ee839294fc4 Mon Sep 17 00:00:00 2001 From: schmeeve Date: Thu, 24 Sep 2026 13:19:50 -0700 Subject: [PATCH] auto-apply settings when extension installed --- static/app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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); });