add ntfy box

This commit is contained in:
nelle 2024-08-12 01:26:18 -06:00
parent 7d1685fd33
commit e642e9dd16
3 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,14 @@
// both
function send(message) {
let r = new XMLHttpRequest();
r.open("POST", "https://ntfy.ouroboros.group/beep", true);
r.setRequestHeader("Content-Type", "text/plain");
r.send(message);
}
// send notification
let ntfyInput = document.getElementById("ntfy-input");
function sendNotification() {
if (ntfyInput.value.length <= 0) return;
send(ntfyInput.value);
ntfyInput.value = "";
}

View file

@ -25,6 +25,7 @@ const { title } = Astro.props;
<script type="text/javascript" src="/scripts/sga.js"></script>
<script type="text/javascript" src="/scripts/lastfm.js"></script>
<script type="text/javascript" src="/scripts/sound.js"></script>
<script type="text/javascript" src="/scripts/ntfy.js"></script>
<audio
id="clickSound"
src="/assets/sounds/ui/zapsplat_multimedia_button_click_004_68776.mp3">

View file

@ -26,6 +26,18 @@ import Layout from "../layouts/Layout.astro";
></span
>
</div>
<br>
<div class="ntfy-box">
<h4 style="margin-bottom: 0px;">send me a notification! type words and press send</h4>
<small style="font-size: 15px;">music recs, questions, jokes, confessions of your sins, etc, welcome, I respond to all or most as vagueposts on the fediverse</small>
<br style="margin-bottom: 10px;">
<textarea id="ntfy-input" placeholder="Hi nelle~!"></textarea><button
class="ntfy-send nob4 custom-btn btn-1"
onclick="javascript:sendNotification()"
style="margin-left:10px;">Send</button
>
</div>
</section>
</main>
</Layout>