2024-08-18 19:50:35 -06:00
|
|
|
const ntfyInput = document.getElementById("ntfy-input");
|
|
|
|
const ntfyButton = document.getElementById("ntfy-send");
|
|
|
|
|
2024-08-12 01:26:18 -06:00
|
|
|
// both
|
|
|
|
function send(message) {
|
2024-08-18 01:37:10 -06:00
|
|
|
const r = new XMLHttpRequest();
|
2024-08-12 01:26:18 -06:00
|
|
|
r.open("POST", "https://ntfy.ouroboros.group/beep", true);
|
|
|
|
r.setRequestHeader("Content-Type", "text/plain");
|
|
|
|
r.send(message);
|
|
|
|
}
|
2024-08-18 19:50:35 -06:00
|
|
|
|
2024-08-12 01:26:18 -06:00
|
|
|
// send notification
|
|
|
|
function sendNotification() {
|
|
|
|
send(ntfyInput.value);
|
|
|
|
ntfyInput.value = "";
|
|
|
|
}
|
2024-08-18 19:50:35 -06:00
|
|
|
|
|
|
|
async function ntfyClick() {
|
|
|
|
if (ntfyInput.value.length >= 0) {
|
2024-08-18 20:08:42 -06:00
|
|
|
ntfyButton.innerHTML = "<span>ಠ﹏ಠ</span>";
|
2024-08-18 19:50:35 -06:00
|
|
|
setTimeout(()=> {
|
2024-08-18 20:08:42 -06:00
|
|
|
ntfyButton.innerHTML = "<span>Send</span>";
|
2024-08-18 19:50:35 -06:00
|
|
|
return;
|
|
|
|
}, 1000);
|
|
|
|
}
|
|
|
|
if (ntfyInput.value === ' ') {
|
2024-08-18 20:08:42 -06:00
|
|
|
ntfyButton.innerHTML = "<span>ಠ﹏ಠ</span>";
|
2024-08-18 19:50:35 -06:00
|
|
|
setTimeout(()=> {
|
2024-08-18 20:08:42 -06:00
|
|
|
ntfyButton.innerHTML = "<span>Send</span>";
|
2024-08-18 19:50:35 -06:00
|
|
|
return;
|
|
|
|
}, 1000);
|
|
|
|
}
|
|
|
|
if (ntfyInput.value.length >= 1 && ntfyInput.value !== " ") {
|
2024-08-18 20:08:42 -06:00
|
|
|
ntfyButton.innerHTML = "<span>Sent! ( ꈍᴗꈍ)</span>";
|
2024-08-18 19:50:35 -06:00
|
|
|
sendNotification();
|
|
|
|
setTimeout(()=> {
|
2024-08-18 20:08:42 -06:00
|
|
|
ntfyButton.innerHTML = "<span>Send</span>";
|
2024-08-18 19:50:35 -06:00
|
|
|
}, 1000);
|
|
|
|
}
|
|
|
|
}
|