functioning show/hide system
This commit is contained in:
parent
f69004be1f
commit
6aedbadae1
2 changed files with 26 additions and 23 deletions
|
@ -4,6 +4,11 @@ const ntfyAttach = document.getElementById("ntfy-attach");
|
||||||
const ntfyClickAction = document.getElementById("ntfy-click");
|
const ntfyClickAction = document.getElementById("ntfy-click");
|
||||||
const ntfyButton = document.getElementById("ntfy-button");
|
const ntfyButton = document.getElementById("ntfy-button");
|
||||||
|
|
||||||
|
const titleCheck = document.getElementById("titleCheckbox");
|
||||||
|
const attachmentCheck = document.getElementById("attachmentCheckbox");
|
||||||
|
const clickCheck = document.getElementById("clickCheckbox");
|
||||||
|
|
||||||
|
|
||||||
const msgPFX = "message: "
|
const msgPFX = "message: "
|
||||||
|
|
||||||
// Random placeholder
|
// Random placeholder
|
||||||
|
@ -49,21 +54,19 @@ function getPlaceholder() {
|
||||||
function send(message, title, attachment, click) {
|
function send(message, title, attachment, click) {
|
||||||
const r = new XMLHttpRequest();
|
const r = new XMLHttpRequest();
|
||||||
r.open("POST", "https://ntfy.ouroboros.group/beep", true);
|
r.open("POST", "https://ntfy.ouroboros.group/beep", true);
|
||||||
r.setRequestHeader("Content-Type", "text/plain");/*
|
r.setRequestHeader("Content-Type", "text/plain");
|
||||||
r.setRequestHeader("Title", title);
|
r.setRequestHeader("Title", title);
|
||||||
r.setRequestHeader("Attach", attachment);
|
r.setRequestHeader("Attach", attachment);
|
||||||
r.setRequestHeader("Click", click);*/
|
r.setRequestHeader("Click", click);
|
||||||
r.send(message);
|
r.send(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// send notification
|
// send notification
|
||||||
function sendNotification() {/*
|
function sendNotification() {
|
||||||
send(ntfyTitle.value, ntfyMessage.value, ntfyAttach.value, ntfyClickAction.value);
|
send(ntfyTitle.value, ntfyMessage.value, ntfyAttach.value, ntfyClickAction.value);
|
||||||
ntfyTitle.value = "";
|
ntfyTitle.value = "";
|
||||||
ntfyAttach.value = "";
|
ntfyAttach.value = "";
|
||||||
ntfyClickAction.value = "";*/
|
ntfyClickAction.value = "";
|
||||||
send(ntfyMessage.value);
|
|
||||||
ntfyMessage.value = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// on send button click
|
// on send button click
|
||||||
|
@ -84,28 +87,28 @@ async function ntfyClick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleTitle() {
|
function toggleTitle() {
|
||||||
if (ntfyTitle.style.display === "none") {
|
if (titleCheck.checked) {
|
||||||
ntfyTitle.style.display = "internal"
|
ntfyTitle.style.display = "initial"
|
||||||
}
|
}
|
||||||
if (ntfyTitle.style.display === "internal") {
|
if (!titleCheck.checked) {
|
||||||
ntfyTitle.style.display = "none"
|
ntfyTitle.style.display = "none"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleAttach() {
|
function toggleAttach() {
|
||||||
if (ntfyAttach.style.display === "none") {
|
if (attachmentCheck.checked) {
|
||||||
ntfyAttach.style.display = "internal"
|
ntfyAttach.style.display = "initial"
|
||||||
}
|
}
|
||||||
if (ntfyAttach.style.display === "internal") {
|
if (!attachmentCheck.checked) {
|
||||||
ntfyAttach.style.display = "none"
|
ntfyAttach.style.display = "none"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleClick() {
|
function toggleClick() {
|
||||||
if (ntfyClickAction.style.display === "none") {
|
if (clickCheck.checked) {
|
||||||
ntfyClickAction.style.display = "internal"
|
ntfyClickAction.style.display = "initial"
|
||||||
}
|
}
|
||||||
if (ntfyAttach.style.display === "internal") {
|
if (!clickCheck.checked) {
|
||||||
ntfyAttach.style.display = "none"
|
ntfyClickAction.style.display = "none"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,18 +20,18 @@
|
||||||
</small>
|
</small>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<fieldset style="margin-left: 35%; margin-right: 35%; margin-bottom: 2%; display: none;">
|
<fieldset style="margin-left: 35%; margin-right: 35%; margin-bottom: 2%;">
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" id="title" name="title" onchange="toggleTitle()" />
|
<input type="checkbox" id="titleCheckbox" name="titleCheckbox" onchange="toggleTitle()"/>
|
||||||
<label for="title">Add Title?</label>
|
<label for="titleCheckbox">Add Title?</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" id="attachment" name="attachment" onchange="toggleAttach()" />
|
<input type="checkbox" id="attachmentCheckbox" name="attachmentCheckbox" onchange="toggleAttach()" />
|
||||||
<label for="attachment">Add Attachment?</label>
|
<label for="attachmentCheckbox">Add Attachment?</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" id="click" name="click" onchange="toggleClick()" />
|
<input type="checkbox" id="clickCheckbox" name="clickCheckbox" onchange="toggleClick()" />
|
||||||
<label for="click">Add Click Action?</label>
|
<label for="clickCheckbox">Add Click Action?</label>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<textarea id="ntfy-title" placeholder="title" rows=1 style="resize: none; display: none;"></textarea>
|
<textarea id="ntfy-title" placeholder="title" rows=1 style="resize: none; display: none;"></textarea>
|
||||||
|
|
Loading…
Reference in a new issue