auto-apply settings when extension installed
This commit is contained in:
@@ -300,11 +300,17 @@ function showTools() {
|
|||||||
if (slowInterval) clearInterval(slowInterval), slowInterval = null;
|
if (slowInterval) clearInterval(slowInterval), slowInterval = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function applySettings() {
|
||||||
|
window.postMessage({ kind: "snotes-settings", serverUrl: window.location.origin }, "*");
|
||||||
|
}
|
||||||
|
|
||||||
function onDetected() {
|
function onDetected() {
|
||||||
|
const wasDetected = detected;
|
||||||
detected = true;
|
detected = true;
|
||||||
stopPing();
|
stopPing();
|
||||||
extStatus.textContent = "✓ Extension detected";
|
extStatus.textContent = "✓ Extension detected";
|
||||||
installBtn.textContent = "Extension installed";
|
installBtn.textContent = "Extension installed";
|
||||||
|
if (!wasDetected) setTimeout(applySettings, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
function doPing() {
|
function doPing() {
|
||||||
@@ -330,7 +336,7 @@ function showTools() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
qsApply.addEventListener("click", () => {
|
qsApply.addEventListener("click", () => {
|
||||||
window.postMessage({ kind: "snotes-settings", serverUrl: window.location.origin }, "*");
|
applySettings();
|
||||||
qsStatus.textContent = "Applying…";
|
qsStatus.textContent = "Applying…";
|
||||||
setTimeout(() => { if (qsStatus.textContent === "Applying…") qsStatus.textContent = "No response — is the extension installed?"; }, 5000);
|
setTimeout(() => { if (qsStatus.textContent === "Applying…") qsStatus.textContent = "No response — is the extension installed?"; }, 5000);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user