From be069419ceca7d1bc5a2d602d99ee5d5f1f41714 Mon Sep 17 00:00:00 2001 From: elijah <146715005+schizoposter@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:58:35 +0100 Subject: [PATCH] Fixed the edge case typing animation fail. --- assets/index.js | 136 +++++++++++++++++++++--------------------------- 1 file changed, 60 insertions(+), 76 deletions(-) diff --git a/assets/index.js b/assets/index.js index 288ba58..4b8be67 100644 --- a/assets/index.js +++ b/assets/index.js @@ -1,21 +1,21 @@ -// animation speeds (ms) -const TYPING_SPEED = 180; -const ERASE_SPEED = 100; -const STATUS_UPDATE_INTERVAL = 60000; // 1min -const TIME_UPDATE_INTERVAL = 1; // 1ms (still terrible) +// animation speeds cause why not +const TYPING_SPEED = 60; +const ERASE_SPEED = 80; +const STATUS_UPDATE_INTERVAL = 60000; // 1min updates +const TIME_UPDATE_INTERVAL = 1; // 1ms updates (yeah its bad) -// status thresholds +// status warning stuff const LATENCY_WARNING_THRESHOLD = 500000; -// mapping for group names because i'm lazy +// lazy group name mapping const GROUP_NAMES = { 4: "INFRASTRUCTURE", 5: "SERVICES", 6: "API", }; -// fancy text typing animation for nav labels -// overcomplicated as fuck but whatever +// does the fancy typing animation for nav labels +// its way overcomplicated but whatever function writeoutnavlabel(label) { if (label.getAttribute("data-animating") === "true") return; @@ -44,8 +44,8 @@ function writeoutnavlabel(label) { label.setAttribute("data-animation-interval", animationInterval); } -// erase animation for nav labels -// also terrible but consistent with the above +// erases the nav labels +// just as terrible as the typing but matches function eraselabel(label) { if (label.getAttribute("data-animating") === "true") { const existingInterval = label.getAttribute("data-animation-interval"); @@ -68,8 +68,8 @@ function eraselabel(label) { label.setAttribute("data-animation-interval", eraseInterval); } -// time display updater -// still updates way too frequently but whatever +// updates the time display +// probably updates too much but eh function updateTime() { const now = new Date(); const timeString = now @@ -87,7 +87,7 @@ function updateTime() { document.getElementById("current-time").textContent = timeString; } -// status helper functions +// bunch of status helper functions for formatting and stuff function calculateAverageUptime(services) { if (!services || services.length === 0) return 0; const totalUptime = services.reduce( @@ -115,8 +115,8 @@ function getGroupName(groupId) { return GROUP_NAMES[groupId] || `GROUP ${groupId}`; } -// creates the HTML for the status page -// groups services by their group_id +// builds all the html for status page +// groups everything by group_id cause organization function createStatusHTML(services) { const groups = services.reduce((acc, service) => { const groupId = service.group_id; @@ -128,33 +128,34 @@ function createStatusHTML(services) { return Object.entries(groups) .map( ([groupId, groupServices]) => ` -