From 4221b836d04eb6ea9e7f1d147579a2f65f69d337 Mon Sep 17 00:00:00 2001 From: Interitio Date: Fri, 5 Jun 2026 17:43:16 +0300 Subject: [PATCH] Add testing mode and data --- main.js | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index 9f11e5f..4d540f0 100644 --- a/main.js +++ b/main.js @@ -2,13 +2,21 @@ let scrolling = false; let primaryAnimation, secondaryAnimation; let focusing = {}; let showseconds = true; +let testing = false; window.addEventListener("DOMContentLoaded", () => { importStyles(); - - const websocket = new ReconnectingWebSocket("wss://croccyfocus.thewisewolf.dev/ws"); - setInterval(updateTimers, 1000); - communicate(websocket); + const params = new URLSearchParams(window.location.search); + testing = (params.get('community') === 'testing'); + if (testing) { + setTestFocus(); + renderList(); + setInterval(updateTimers, 1000); + } else { + const websocket = new ReconnectingWebSocket("wss://croccyfocus.thewisewolf.dev/ws"); + setInterval(updateTimers, 1000); + communicate(websocket); + } }); @@ -174,6 +182,35 @@ function clearFocus(tasks) { } } +Date.prototype.addTime = function (h) { + this.setTime(this.getTime() + (h)); + return this; +} + +function setTestFocus() { + focusing[0] = { + name: "silentstudy101", hyper: true, end_at: new Date().addTime((26 * 60 + 44) * 1000) + } + focusing[1] = { + name: "Holonomy", hyper: true, end_at: new Date().addTime((2 * 60 + 36) * 1000) + } + focusing[2] = { + name: "siona_aoe", hyper: true, end_at: new Date().addTime((2 * 60 + 36) * 1000) + } + focusing[3] = { + name: "arandomdude_72269", hyper: true, end_at: new Date().addTime((2 * 60 + 36) * 1000) + } + focusing[4] = { + name: "xxkxpxx", hyper: true, end_at: new Date().addTime((2 * 60 + 36) * 1000) + } + focusing[5] = { + name: "Natsame", hyper: true, end_at: new Date().addTime((2 * 60 + 36) * 1000) + } + focusing[6] = { + name: "readersfan", hyper: true, end_at: new Date().addTime((2 * 60 + 36) * 1000) + } +} + function renderList() { let containers = document.querySelectorAll(".task-container") let now = Date.now();