auto-apply settings when extension installed

This commit is contained in:
2026-09-24 13:19:50 -07:00
parent 4138cd64b8
commit 832168e845

View File

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