From 6a856e73670b7892c57ec6917378d6e4b4f5d7b3 Mon Sep 17 00:00:00 2001 From: nelle Date: Mon, 30 Dec 2024 14:19:31 -0700 Subject: [PATCH] bye bye posting buttons --- frontend/public/scripts/api.js | 55 ------------------- frontend/public/scripts/main.js | 37 +------------ .../components/main-page/silly-widgets.astro | 1 - .../components/main-page/widgets/meow.astro | 35 ------------ 4 files changed, 2 insertions(+), 126 deletions(-) delete mode 100644 frontend/public/scripts/api.js delete mode 100644 frontend/src/components/main-page/widgets/meow.astro diff --git a/frontend/public/scripts/api.js b/frontend/public/scripts/api.js deleted file mode 100644 index a2e33ce..0000000 --- a/frontend/public/scripts/api.js +++ /dev/null @@ -1,55 +0,0 @@ -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 === 423) { - meowButton.disabled = true; - meowButton.innerHTML = "sleeping..."; - console.warn("MEOW TIMED OUT"); - } - if (response.status === 100) { - meowButton.disabled = false; - meowButton.innerHTML = "meow"; - console.warn("MEOW NOT TIMED OUT"); - } -} - -async function getBeepTimeout(endpoint) { - const response = await fetch(endpoint); - if (response.status === 423) { - beepButton.disabled = true; - beepButton.innerHTML = "sleeping..."; - console.warn("BEEP TIMED OUT"); - } - if (response.status === 100) { - beepButton.disabled = false; - beepButton.innerHTML = "meow"; - console.warn("BEEP NOT TIMED OUT"); - } -} - -async function getKaomojiTimeout(endpoint) { - const response = await fetch(endpoint); - if (response.status === 423) { - kaomojiButton.disabled = true; - kaomojiButton.innerHTML = "sleeping..."; - console.warn("KAOMOJI TIMED OUT"); - } - if (response.status === 100) { - kaomojiButton.disabled = false; - kaomojiButton.innerHTML = "meow"; - console.warn("KAOMOJI NOT TIMED OUT"); - } -} diff --git a/frontend/public/scripts/main.js b/frontend/public/scripts/main.js index 0d50277..430e7cc 100644 --- a/frontend/public/scripts/main.js +++ b/frontend/public/scripts/main.js @@ -1,13 +1,9 @@ -const meowEndpoint = "https://nelle.observer/api/meow"; -const beepEndpoint = "https://nelle.observer/api/beep"; -const kaomojiEndpoint = "https://nelle.observer/api/kaomoji"; - const badgeGray = document.getElementById("badgeGray"); const badgeGreen = document.getElementById("badgeGreen"); const badgeOrange = document.getElementById("badgeOrange"); -var colorBool = Math.random() < 0.5; -var is_root = location.pathname === "/"; +const colorBool = Math.random() < 0.5; +const is_root = location.pathname === "/"; // loads all the functions to be loaded on load, pretty simple, it loads shit on load. function onLoad() { @@ -17,9 +13,6 @@ function onLoad() { redirect(); checkBoxes(); getPlaceholder(); - getMeowTimeout(meowEndpoint); - getBeepTimeout(beepEndpoint); - getKaomojiTimeout(beepEndpoint); } // if javascript is enabled, this script will load, enabling all site elements that use javascript, by default these are all hidden. @@ -75,32 +68,6 @@ function redirect() { } } -// meow -const meowButton = document.getElementById("meow-button"); -const beepButton = document.getElementById("beep-button"); -const kaomojiButton = document.getElementById("kaomoji-button"); - -// on send meow button click -async function meowClick() { - meowButton.disabled = true; - meowButton.innerHTML = "sleeping..."; - sendMeow(meowEndpoint); -} - -// on send beep button click -async function beepClick() { - beepButton.disabled = true; - beepButton.innerHTML = "sleeping..."; - sendMeow(beepEndpoint); -} - -// on send kaomoji button click -async function kaomojiClick() { - kaomojiButton.disabled = true; - kaomojiButton.innerHTML = "sleeping..."; - sendMeow(kaomojiEndpoint); -} - // Show/Hide Info Boxes const posterInfoButton = document.getElementById("poster-info-button"); const posterInfo = document.getElementById("poster-info"); diff --git a/frontend/src/components/main-page/silly-widgets.astro b/frontend/src/components/main-page/silly-widgets.astro index 40888d4..31d4604 100644 --- a/frontend/src/components/main-page/silly-widgets.astro +++ b/frontend/src/components/main-page/silly-widgets.astro @@ -8,5 +8,4 @@ import MEOW from "./widgets/meow.astro";

silly widgets

- diff --git a/frontend/src/components/main-page/widgets/meow.astro b/frontend/src/components/main-page/widgets/meow.astro deleted file mode 100644 index f923edf..0000000 --- a/frontend/src/components/main-page/widgets/meow.astro +++ /dev/null @@ -1,35 +0,0 @@ -
-
-
-

meow/beep/etc.

-

press the buttons bellow to make me meow/beep or post other random things on the fediverse, - there is a global timeout of anywhere between 10 and 180 minutes, and a separate timer for each button. if it says its sleeping, come back and try again later!

- - - - - - - - -
- [show more info] -
\ No newline at end of file