auto-apply settings when extension installed
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user