Add testing mode and data

This commit is contained in:
2026-06-05 17:43:16 +03:00
parent e47dfce717
commit 4221b836d0
+38 -1
View File
@@ -2,13 +2,21 @@ let scrolling = false;
let primaryAnimation, secondaryAnimation;
let focusing = {};
let showseconds = true;
let testing = false;
window.addEventListener("DOMContentLoaded", () => {
importStyles();
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();