Remove extra timer modes.

This commit is contained in:
2025-09-22 23:05:25 +10:00
parent 84eeb1bb81
commit b21a5969e3

View File

@@ -1,5 +1,5 @@
window.addEventListener("DOMContentLoaded", () => {
const websocket = new WebSocket("ws://adamwalsh.name:9533");
const websocket = new WebSocket("wss://izashi.thewisewolf.dev/tracker/timer/ws");
websocket.addEventListener("open", () => {
communicate(websocket);
@@ -20,12 +20,12 @@ class Timer {
render_time() {
// Render timer status to the document
var timestr;
if (this.counter < 0) {
timestr = "--:--";
} else {
// How many seconds have passed in this block
// How many seconds to the end of time
var dur_seconds = Math.floor( (this.end_time - new Date()) / 1000);
if (dur_seconds < 0) {
timestr = "00:00";
} else {
var seconds = dur_seconds % 60;
dur_seconds = dur_seconds - seconds;
var minutes = Math.floor(dur_seconds / 60);
@@ -86,68 +86,6 @@ class TimerRenderer {
}
function rectBounds(prop, rectHeight, rectWidth) {
var totalCircum = 2 * rectHeight + 2 * rectWidth;
var propCircum = prop * totalCircum;
let bounds;
if (propCircum < rectWidth / 2) {
var xprop = Math.floor((
(rectWidth/2 + propCircum) / rectWidth
) * 1000)/10;
bounds = [
"50% -5%",
`${xprop}% -5%`,
`${xprop}% 4%`,
"50% 4%"
];
} else if (propCircum < rectWidth / 2 + rectHeight) {
var yprop = (
(propCircum - rectWidth / 2) / rectHeight
) * 100;
bounds = [
"50% -5%", "110% -5%",
`110% ${yprop}%`, `96% ${yprop}%`,
"95% 4%", "50% 4%"
];
} else if (propCircum < 3 * rectWidth / 2 + rectHeight) {
var xprop = (
((3 * rectWidth/2 + rectHeight) - propCircum) / rectWidth
) * 100;
bounds = [
"50% -5%", "110% -5%",
"110% 110%",
`${xprop}% 110%`, `${xprop}% 96%`,
"95% 96%",
"95% 4%", "50% 4%"
];
} else if (propCircum < 3 * rectWidth / 2 + 2 * rectHeight) {
var yprop = (
((3 * rectWidth/2 + 2 * rectHeight) - propCircum) / rectHeight
) * 100;
bounds = [
"50% -5%", "110% -5%",
"110% 110%", "-5% 110%",
`-5% ${yprop}%`, `4% ${yprop}%`,
"5% 96%", "95% 96%",
"95% 4%", "50% 4%"
];
} else {
var xprop = (
(propCircum - (3 * rectWidth/2 + 2 * rectHeight)) / rectWidth
) * 100;
bounds = [
"50% -5%", "110% -5%",
"110% 110%", "-5% 110%",
"-5% -5%",
`${xprop}% -5%`, `${xprop}% 4%`,
"4% 4%",
"5% 96%", "95% 96%",
"95% 4%", "50% 4%"
];
}
return bounds;
}
function communicate(websocket) {
console.log("Communicating");