MEOW BUTTON POWERUP
This commit is contained in:
parent
36754b0535
commit
e105d40452
9 changed files with 61 additions and 56 deletions
27
public/scripts/api.js
Normal file
27
public/scripts/api.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
function handleErrors(response) {
|
||||
if (!response.ok) {
|
||||
throw Error(response.statusText);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
function sendMeow(endpoint) {
|
||||
const request = new XMLHttpRequest();
|
||||
request.open("POST", endpoint);
|
||||
request.send("superSecret=null");
|
||||
console.warn(request.response.text);
|
||||
}
|
||||
|
||||
async function getMeowTimeout(endpoint) {
|
||||
const response = await fetch(endpoint)
|
||||
if (response.status === 500) {
|
||||
meowButton.disabled=true;
|
||||
meowButton.innerHTML = "<span>sleeping...</span>";
|
||||
console.warn("TIMED OUT")
|
||||
}
|
||||
if (response.status === 200) {
|
||||
meowButton.disabled=false;
|
||||
meowButton.innerHTML = "<span>meow</span>";
|
||||
console.warn("NOT TIMED OUT")
|
||||
}
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
const meowEndpoint = "https://nelle.observer/meow";
|
||||
const timeOutEndpoint = "https://nelle.observer/meowTimeout";
|
||||
|
||||
// loads all the functions to be loaded on load, pretty simple, it loads shit on load.
|
||||
function onLoad() {
|
||||
jsEnabled();
|
||||
|
@ -5,6 +8,7 @@ function onLoad() {
|
|||
redirect();
|
||||
checkBoxes();
|
||||
getPlaceholder();
|
||||
getMeowTimeout(timeOutEndpoint);
|
||||
}
|
||||
|
||||
// if javascript is enabled, this script will load, enabling all site elements that use javascript, by default these are all hidden.
|
||||
|
@ -52,3 +56,16 @@ function redirect() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// meow
|
||||
const meowButton = document.getElementById("meow-button");
|
||||
const justMeowed = document.getElementById("justMeowed");
|
||||
|
||||
let timeout = 1;
|
||||
|
||||
// on send button click
|
||||
async function meowClick() {
|
||||
meowButton.disabled=true;
|
||||
meowButton.innerHTML = "<span>sleeping for 30 minutes...</span>";
|
||||
sendMeow(meowEndpoint);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// i deeply apologize for the horrors within...
|
||||
const ntfyEndpoint = "https://ntfy.ouroboros.group/beep";
|
||||
const meowEndpoint = "https://ntfy.ouroboros.group/meow";
|
||||
|
||||
// text fields and buttons
|
||||
const ntfyMessage = document.getElementById("ntfy-message");
|
||||
|
@ -8,7 +7,6 @@ const ntfyTitle = document.getElementById("ntfy-title");
|
|||
const ntfyAttach = document.getElementById("ntfy-attach");
|
||||
const ntfyClickAction = document.getElementById("ntfy-click");
|
||||
const ntfyButton = document.getElementById("ntfy-button");
|
||||
const meowButton = document.getElementById("meow-button");
|
||||
|
||||
// options checkboxes
|
||||
const optionsCheck = document.getElementById("optionsCheckbox");
|
||||
|
@ -20,7 +18,6 @@ const clickCheck = document.getElementById("clickCheckbox");
|
|||
const titleBoxLabel = document.getElementById("titleBoxLabel");
|
||||
const attachmentBoxLabel = document.getElementById("attachBoxLabel");
|
||||
const clickBoxLabel = document.getElementById("clickBoxLabel");
|
||||
const justMeowed = document.getElementById("justMeowed");
|
||||
|
||||
// Options storage variables
|
||||
const optionsEnabled = sessionStorage.getItem("optionsEnabled");
|
||||
|
@ -159,46 +156,6 @@ function toggleClick() {
|
|||
}
|
||||
}
|
||||
|
||||
// on send button click
|
||||
async function meowClick() { meowButton.disabled=true;
|
||||
setTimeout('meowButton.disabled=false;',11000);
|
||||
meowButton.innerHTML = "<span>Sent! :3</span>";
|
||||
sendNone(meowEndpoint, "meow");
|
||||
setTimeout(() => {
|
||||
meowButton.innerHTML = "<span>cooldown 10s</span>";
|
||||
setTimeout(() => {
|
||||
meowButton.innerHTML = "<span>cooldown 9s</span>";
|
||||
setTimeout(() => {
|
||||
meowButton.innerHTML = "<span>cooldown 8s</span>";
|
||||
setTimeout(() => {
|
||||
meowButton.innerHTML = "<span>cooldown 7s</span>";
|
||||
setTimeout(() => {
|
||||
meowButton.innerHTML = "<span>cooldown 6s</span>";
|
||||
setTimeout(() => {
|
||||
meowButton.innerHTML = "<span>cooldown 5s</span>";
|
||||
setTimeout(() => {
|
||||
meowButton.innerHTML = "<span>cooldown 4s</span>";
|
||||
setTimeout(() => {
|
||||
meowButton.innerHTML = "<span>cooldown 3s</span>";
|
||||
setTimeout(() => {
|
||||
meowButton.innerHTML = "<span>cooldown 2s</span>";
|
||||
setTimeout(() => {
|
||||
meowButton.innerHTML = "<span>cooldown 1s</span>";
|
||||
setTimeout(() => {
|
||||
meowButton.innerHTML = "<span>meow</span>";
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// on send button click
|
||||
async function ntfyClick() {
|
||||
if (!ntfyMessage.value.replace(/\s/g, "").length) {
|
||||
|
|
|
@ -10,9 +10,6 @@ const phonewaveSound = new Audio(
|
|||
const startLeapSound = new Audio(
|
||||
"/assets/sounds/sciadv/phonewave/begin-leap.ogg"
|
||||
);
|
||||
const stopLeapSound = new Audio(
|
||||
"/assets/sounds/sciadv/phonewave/SE11_03.ogg"
|
||||
);
|
||||
|
||||
// Sound effects
|
||||
function PlaySound(soundobj) {
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
---
|
||||
import LastFM from "./widgets/lastfm.astro";
|
||||
import NTFY from "./widgets/ntfy.astro";
|
||||
import MEOW from "./widgets/meow.astro";
|
||||
---
|
||||
|
||||
<section class="content center" id="silly-widgets" >
|
||||
<h2>silly widgets <a href="#silly-widgets"><i class="nf nf-oct-link"></i></span></a></h2>
|
||||
<LastFM />
|
||||
<NTFY />
|
||||
<MEOW />
|
||||
</section>
|
||||
|
|
11
src/components/main-page/widgets/meow.astro
Normal file
11
src/components/main-page/widgets/meow.astro
Normal file
|
@ -0,0 +1,11 @@
|
|||
<div class="funny-meow">
|
||||
<br>
|
||||
<small>press this button to make me meow on the fediverse, <br>you can POST to <span class="glitch">https://nelle.observer/meow</span>. there is a timeout of 33 minutes globally.</small>
|
||||
<button
|
||||
class="custom-btn btn-1"
|
||||
style="width: 45%; margin-top: 4%; margin-bottom: 4%;"
|
||||
onclick="meowClick()"
|
||||
id="meow-button">
|
||||
<span>meow</span>
|
||||
</button>
|
||||
</div>
|
|
@ -42,13 +42,6 @@
|
|||
<input type="checkbox" id="clickCheckbox" name="clickCheckbox" onchange="toggleClick()" style="display: none;"/>
|
||||
<label id="clickBoxLabel" style="display: none;" for="clickCheckbox">Add Click Action?</label>
|
||||
</div>
|
||||
<button
|
||||
class="custom-btn btn-1"
|
||||
style="width: 75%; margin-top: 4%"
|
||||
onclick="meowClick()"
|
||||
id="meow-button">
|
||||
<span>meow</span>
|
||||
</button>
|
||||
</fieldset>
|
||||
</div>
|
||||
<br>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
|
||||
<!-- optimized -->
|
||||
|
||||
<!-- unoptimized -->
|
||||
<script is:inline src="/scripts/sound.js"></script>
|
||||
<script is:inline src="/scripts/sga.js"></script>
|
||||
<script is:inline src="/scripts/ntfy.js"></script>
|
||||
<script is:inline src="/scripts/api.js"></script>
|
||||
|
||||
<!-- ALWAYS LAST -->
|
||||
<script is:inline src="/scripts/main.js"></script>
|
|
@ -26,7 +26,7 @@ const { title } = Astro.props;
|
|||
<NormalScripts />
|
||||
<audio
|
||||
id="clickSound"
|
||||
src="/assets/sounds/ui/zapsplat_multimedia_button_click_004_68776.mp3">
|
||||
src="/assets/sounds/ui/zapsplat_button_click_2.mp3">
|
||||
</audio>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue