add ntfy box
This commit is contained in:
parent
7d1685fd33
commit
e642e9dd16
3 changed files with 27 additions and 0 deletions
14
astro/public/scripts/ntfy.js
Normal file
14
astro/public/scripts/ntfy.js
Normal 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 = "";
|
||||
}
|
|
@ -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">
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue