diff --git a/public/scripts/ntfy.js b/public/scripts/ntfy.js index 17f3e32..78e218b 100644 --- a/public/scripts/ntfy.js +++ b/public/scripts/ntfy.js @@ -2,6 +2,7 @@ const ntfyEndpoint = "https://ntfy.ouroboros.group/beep"; const meowEndpoint = "https://ntfy.ouroboros.group/meow"; +// text fields and buttons const ntfyMessage = document.getElementById("ntfy-message"); const ntfyTitle = document.getElementById("ntfy-title"); const ntfyAttach = document.getElementById("ntfy-attach"); @@ -9,26 +10,32 @@ const ntfyClickAction = document.getElementById("ntfy-click"); const ntfyButton = document.getElementById("ntfy-button"); const meowButton = document.getElementById("meow-button"); +// options checkboxes const optionsCheck = document.getElementById("optionsCheckbox"); const titleCheck = document.getElementById("titleCheckbox"); const attachmentCheck = document.getElementById("attachmentCheckbox"); const clickCheck = document.getElementById("clickCheckbox"); +// labels const titleBoxLabel = document.getElementById("titleBoxLabel"); const attachmentBoxLabel = document.getElementById("attachBoxLabel"); const clickBoxLabel = document.getElementById("clickBoxLabel"); const justMeowed = document.getElementById("justMeowed"); +// Options storage variables const optionsEnabled = sessionStorage.getItem("optionsEnabled"); const titleEnabled = sessionStorage.getItem("optionsEnabled"); const attachmentEnabled = sessionStorage.getItem("optionsEnabled"); const clickEnabled = sessionStorage.getItem("optionsEnabled"); +// Prefixs for placeholders const titlePFX = "title: "; const msgPFX = "message: "; const attachPFX = "attachment: "; const clickPFX = "click-action: "; + +// Ctrl + Enter to send document.addEventListener("keydown", (event) => { if (event.ctrlKey && event.key == "Enter") { ntfyClick()