random ntfyInput placeholders

This commit is contained in:
nelle 2024-09-01 21:27:52 -06:00
parent dbb5f10092
commit 09d43804b7
3 changed files with 42 additions and 4 deletions

View file

@ -1,7 +1,44 @@
const ntfyInput = document.getElementById("ntfy-input");
const ntfyButton = document.getElementById("ntfy-send");
// both
// Random placeholder
function getPlaceholder() {
placeholderSelector = (Math.floor(Math.random()*8) +1);
switch(placeholderSelector) {
case 1:
ntfyInput.placeholder='hi nelle! (。><。)';
break;
case 2:
ntfyInput.placeholder='(╹◡╹)凸';
break;
case 3:
ntfyInput.placeholder='Confession of sin: I dont like SciAdv';
break;
case 4:
ntfyInput.placeholder='Knock Knock...';
break;
case 5:
ntfyInput.placeholder='El. Psy. Kongroo.';
break;
case 6:
ntfyInput.placeholder='the organization is after you.';
break;
case 7:
ntfyInput.placeholder='you wouldnt happen to know where an IBN5100 is, would you?';
break;
case 8:
ntfyInput.placeholder='if you had to choose, between: bacon, unlimited bacon, but no games. or. games. unlimited games, but no games. which would you pick?';
break;
case 9:
ntfyInput.placeholder='time travel?';
break;
default:
ntfyInput.placeholder='type some words and hit send';
}
}
// send function
function send(message) {
const r = new XMLHttpRequest();
r.open("POST", "https://ntfy.ouroboros.group/beep", true);
@ -15,6 +52,7 @@ function sendNotification() {
ntfyInput.value = "";
}
// on send button click
async function ntfyClick() {
if (!ntfyInput.value.replace(/\s/g, "").length) {
ntfyButton.innerHTML = "<span>ಠ﹏ಠ</span>";

View file

@ -10,7 +10,7 @@
></span
>
</div>
<hr>
<hr> <!-- NTFY BOX -->
<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>
@ -22,7 +22,7 @@
<br>
<div class="ntfyForm">
<br style="margin-bottom: 10px;">
<textarea id="ntfy-input" placeholder="Hi nelle! (。><。)" rows=2></textarea>
<textarea id="ntfy-input" placeholder="type some words and hit send" rows=2></textarea>
<button
class="custom-btn btn-1"
onclick="ntfyClick()"

View file

@ -16,7 +16,7 @@ const { title } = Astro.props;
<head>
<Head title={title} />
</head>
<body onload="onload(), redirect()" id="body">
<body onload="onload(), redirect(), getPlaceholder()" id="body">
<Header />
<section class="content center">
<h1 class="title">{title}</h1>