Add send lock to ntfy message box
This commit is contained in:
parent
584a6d2fc9
commit
dcd7428687
2 changed files with 10 additions and 1 deletions
|
@ -5,7 +5,10 @@
|
||||||
|
|
||||||
const pages = getPages();
|
const pages = getPages();
|
||||||
|
|
||||||
|
let ntfyLock = false;
|
||||||
async function sendNtfyMessage() {
|
async function sendNtfyMessage() {
|
||||||
|
if (ntfyLock) return;
|
||||||
|
ntfyLock = true;
|
||||||
const message = document.getElementById("ntfy-message").value;
|
const message = document.getElementById("ntfy-message").value;
|
||||||
if (message.length < 15)
|
if (message.length < 15)
|
||||||
return alert(
|
return alert(
|
||||||
|
@ -21,6 +24,7 @@
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (resp.ok) alert(`Sent: ${message}`);
|
if (resp.ok) alert(`Sent: ${message}`);
|
||||||
|
ntfyLock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateNtfyCharCount(_) {
|
function updateNtfyCharCount(_) {
|
||||||
|
@ -404,7 +408,7 @@
|
||||||
128
|
128
|
||||||
</label>
|
</label>
|
||||||
<br />
|
<br />
|
||||||
<button on:click={sendNtfyMessage} style="margin-top: 1rem;"> Send </button>
|
<button on:click={sendNtfyMessage} style="margin-top: 1rem;" disabled={ntfyLock}> Send </button>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -409,6 +409,11 @@ input[type="submit"] {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button[disabled],
|
||||||
|
input[type="submit"][disabled] {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
input[type="text"] {
|
input[type="text"] {
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue