aboutsummaryrefslogtreecommitdiffstats
path: root/static/block_time.js
diff options
context:
space:
mode:
authorMitsuo Tokumori <[email protected]>2025-03-08 16:03:30 +0900
committerMitsuo Tokumori <[email protected]>2025-03-08 16:03:30 +0900
commit51163b167cce01af6101438e5e61145ad798f213 (patch)
tree9c8e75266cedfb205db175b0b2bc41b49df75cea /static/block_time.js
parentd9af103b9a8aed86d6ac834f1240edfb2173ffa0 (diff)
downloadmasu-51163b167cce01af6101438e5e61145ad798f213.tar.gz
masu-51163b167cce01af6101438e5e61145ad798f213.tar.bz2
masu-51163b167cce01af6101438e5e61145ad798f213.zip
Restructure python code to be modular
The python code is now a package named app. app/models: db models app/routes: flask blueprints app/static: css, js app/templates: jinja html templates
Diffstat (limited to 'static/block_time.js')
-rw-r--r--static/block_time.js49
1 files changed, 0 insertions, 49 deletions
diff --git a/static/block_time.js b/static/block_time.js
deleted file mode 100644
index d6510ae..0000000
--- a/static/block_time.js
+++ /dev/null
@@ -1,49 +0,0 @@
-function init() {
- initTimeVisualizer('timeVisualizer');
-}
-
-export function updateTime() {
- fetch("/time")
- .then(res => res.json())
- .then(data => {
- document.getElementById("weatherSummary").innerText = data.time;
- });
-}
-
-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); // 1min
-}
-
-init()