aboutsummaryrefslogtreecommitdiffstats
path: root/static/timeVisualizer.js
diff options
context:
space:
mode:
authorMitsuo Tokumori <[email protected]>2025-03-08 02:17:52 +0900
committerMitsuo Tokumori <[email protected]>2025-03-08 02:17:52 +0900
commitd9af103b9a8aed86d6ac834f1240edfb2173ffa0 (patch)
tree6b11b47db6201a357277b587561fb429c2451b99 /static/timeVisualizer.js
parentec80766af5e2f59f3842b613f271c1100705af5e (diff)
downloadmasu-d9af103b9a8aed86d6ac834f1240edfb2173ffa0.tar.gz
masu-d9af103b9a8aed86d6ac834f1240edfb2173ffa0.tar.bz2
masu-d9af103b9a8aed86d6ac834f1240edfb2173ffa0.zip
Restructure js and css into single block modules
Each block is defined by: * html: front-end elements (modify: templates/index.html) (for now) * css: front-end design (modify: static/style.css) * js: front-end code (new file: static/block_name.js) * python: back-end code (new file: ./block_name.py) (will move later from the root to an "app" directory (python package)
Diffstat (limited to 'static/timeVisualizer.js')
-rw-r--r--static/timeVisualizer.js35
1 files changed, 0 insertions, 35 deletions
diff --git a/static/timeVisualizer.js b/static/timeVisualizer.js
deleted file mode 100644
index 2dfb59e..0000000
--- a/static/timeVisualizer.js
+++ /dev/null
@@ -1,35 +0,0 @@
-export function initTimeVisualizer(containerId) {
- const grid = document.createElement('div');
- grid.className = 'grid';
- document.getElementById(containerId).appendChild(grid);
-
- function updateTime() {
- grid.innerHTML = '';
- const now = new Date();
- const hours = now.getHours();
- const minutes = now.getMinutes();
-
- for (let i = 0; i < 24; i++) {
- const cell = document.createElement('div');
- cell.className = 'cell';
-
- if (i >= 20 || i < 4) cell.classList.add('sleep');
- if (i < hours) cell.classList.add('past');
-
- if (i === hours) {
- cell.classList.add('current');
- const fillPercentage = (minutes / 60) * 100;
- cell.style.setProperty('--fill', `${fillPercentage}%`);
- const line = document.createElement('div');
- line.className = 'timeline';
- line.style.left = `calc(${fillPercentage}% - 1px)`;
- cell.appendChild(line);
- }
-
- grid.appendChild(cell);
- }
- }
-
- updateTime();
- setInterval(updateTime, 60000);
-}