diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-03-29 22:05:35 +0100 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2024-03-29 22:05:35 +0100 |
commit | 5860551daa0f60103ad24e93da29f401a653f144 (patch) | |
tree | 9ad97e04152a6edc11d5096c87880978df39086a /includes/components/emergency.inc | |
parent | a51979ad60074db84af78a06d30fcb888ccb0b03 (diff) | |
download | pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.gz pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.bz2 pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.zip |
Updated 20 files, added 6 files, deleted 144 files and renamed .idea/ponycule.iml (automated)
Diffstat (limited to 'includes/components/emergency.inc')
-rw-r--r-- | includes/components/emergency.inc | 156 |
1 files changed, 0 insertions, 156 deletions
diff --git a/includes/components/emergency.inc b/includes/components/emergency.inc deleted file mode 100644 index 67f4422..0000000 --- a/includes/components/emergency.inc +++ /dev/null @@ -1,156 +0,0 @@ -<h2>Emergency alert - <details style="display: inline-block;font-size:12px;"> - <summary class="text-muted" style="opacity:.5;"></summary> - <label><input id="test-mode" type="checkbox"> Test Mode</label> ยท <label><input id="fake-requests" type="checkbox"> Fake Requests</label> - </details> -</h2> - -<span data-bs-toggle="modal" data-bs-target="#turn-on" id="btn-on" style="background: #7f0000;font-size: 48px;padding: 10px 50px;border-radius: 10px;width: max-content;display: block;margin-left: auto;margin-right: auto;cursor: pointer;">Turn <b>ON</b></span> -<span data-bs-toggle="modal" onclick="disableAlert();" id="btn-off" style="display:none;background: #007f0b;font-size: 48px;padding: 10px 50px;border-radius: 10px;width: max-content;margin-left: auto;margin-right: auto;cursor: pointer;">Turn <b>OFF</b></span> -<p style="text-align:center;margin-top:10px;">Sending the next notification <b><span id="next-notification">never</span></b></p> - -<hr> - -<div style="margin-bottom: 10px;"> - <b>Targets:</b> -</div> - -<label style="display: block; margin-left: 10px;"> - <input type="checkbox" checked id="enable-raindrops"> Raindrops System -</label> -<label style="display: block; margin-left: 10px;"> - <input type="checkbox" id="enable-<?= $GLOBALS["ColdHazeApp"]["other"]["slug"] ?>"> <?= $GLOBALS["ColdHazeApp"]["other"]["name"] ?> -</label> -<label style="display: block; margin-left: 10px;"> - <input type="checkbox" id="enable-moonglow"> Moonglow -</label> -<!--<label style="display: block; margin-left: 10px;"> - <input type="checkbox" id="enable-hailstorm"> Hailstorm -</label>--> - -<style> - <?php global $use2023UI; if (!$use2023UI): ?> - .modal-header { - border-bottom: 1px solid #353738; - } - - .modal-content { - border: 1px solid rgba(255, 255, 255, .2); - background-color: #111; - } - - .btn-close { - filter: invert(1); - } - <?php endif; ?> - - #btn-on.disabled, #btn-off.disabled { - opacity: .5; - pointer-events: none; - } -</style> - -<div class="modal fade" id="turn-on"> - <div class="modal-dialog"> - <div class="modal-content"> - - <div class="modal-header"> - <h4 class="modal-title">Important notice</h4> - <button type="button" class="btn-close" data-bs-dismiss="modal"></button> - </div> - - <div class="modal-body"> - <div class="alert alert-danger"> - Keep this page open until you receive help. If you close the page, alert notifications will not be sent. - </div> - - <button onclick="enableAlert();" data-bs-dismiss="modal" class="btn btn-danger" style="font-size:20px;font-weight:bold;display:block;width:100%;">Enable the alert now.</button> - - <div class="alert alert-light" style="margin-top: 20px;"> - <b>Disclaimer:</b> This alert should be used <b>if and only if</b> you are in a situation that requires immediate help from a loved one. If your life is at immediate risk, please do not use this emergency system and call your local emergency services. - </div> - </div> - </div> - </div> -</div> - -<script> - window.alertInterval = null; - window.alertInterval = null; - window.alertIntervalAmount = 15; - window.alertIntervalCounter = window.alertIntervalAmount; - - function buildTargets() { - let targets = [ - document.getElementById("enable-<?= $GLOBALS["ColdHazeApp"]["other"]["slug"] ?>").checked ? "<?= $GLOBALS["ColdHazeApp"]["other"]["slug"] ?>" : null, - document.getElementById("enable-raindrops").checked ? "raindrops" : null, - document.getElementById("enable-moonglow").checked ? "moonglow" : null, - //document.getElementById("enable-hailstorm").checked ? "hailstorm" : null, - ].filter(i => i); - return "?" + targets.join("&"); - } - - function sendNotification() { - window.alertIntervalCounter = -1; - - if (document.getElementById("test-mode").checked) { - document.getElementById("next-notification").innerText = "now"; - if (document.getElementById("fake-requests").checked) { - window.alertIntervalCounter = window.alertIntervalAmount; - document.getElementById("next-notification").innerText = "in " + window.alertIntervalAmount + " seconds"; - } else { - window.fetch("/api/emergency" + buildTargets()).then(() => { - window.alertIntervalCounter = window.alertIntervalAmount; - document.getElementById("next-notification").innerText = "in " + window.alertIntervalAmount + " seconds"; - }) - } - } else { - document.getElementById("next-notification").innerText = "now"; - if (document.getElementById("fake-requests").checked) { - window.alertIntervalCounter = window.alertIntervalAmount; - document.getElementById("next-notification").innerText = "in " + window.alertIntervalAmount + " seconds"; - } else { - window.fetch("/api/emergency-real" + buildTargets()).then(() => { - window.alertIntervalCounter = window.alertIntervalAmount; - document.getElementById("next-notification").innerText = "in " + window.alertIntervalAmount + " seconds"; - }) - } - } - } - - function enableAlert() { - sendNotification(); - document.getElementById("btn-on").style.display = "none"; - document.getElementById("btn-off").style.display = "block"; - document.getElementById("test-mode").disabled = true; - document.getElementById("fake-requests").disabled = true; - document.getElementById("enable-<?= $GLOBALS["ColdHazeApp"]["other"]["slug"] ?>").disabled = true; - document.getElementById("enable-raindrops").disabled = true; - document.getElementById("enable-moonglow").disabled = true; - //document.getElementById("enable-hailstorm").disabled = true; - - window.alertInterval = setInterval(() => { - window.alertIntervalCounter--; - - if (window.alertIntervalCounter === 0) { - sendNotification(); - } else if (window.alertIntervalCounter > -1) { - document.getElementById("next-notification").innerText = "in " + window.alertIntervalCounter + " second" + (window.alertIntervalCounter > 1 ? "s" : ""); - } - }, 1000); - } - - function disableAlert() { - clearInterval(window.alertInterval); - window.alertIntervalCounter = 15; - document.getElementById("next-notification").innerText = "never"; - document.getElementById("btn-on").style.display = "block"; - document.getElementById("btn-off").style.display = "none"; - document.getElementById("test-mode").disabled = false; - document.getElementById("fake-requests").disabled = false; - document.getElementById("enable-<?= $GLOBALS["ColdHazeApp"]["other"]["slug"] ?>").disabled = false; - document.getElementById("enable-raindrops").disabled = false; - document.getElementById("enable-moonglow").disabled = false; - //document.getElementById("enable-hailstorm").disabled = false; - } -</script>
\ No newline at end of file |