comparison libervia/web/pages/calendar/_browser/__init__.py @ 1518:eb00d593801d

refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
author Goffi <goffi@goffi.org>
date Fri, 02 Jun 2023 16:49:28 +0200
parents libervia/pages/calendar/_browser/__init__.py@ec3ad9abf9f9
children
comparison
equal deleted inserted replaced
1517:b8ed9726525b 1518:eb00d593801d
1 from browser import document, window
2 from browser.timer import set_interval
3
4 calendar_start = window.calendar_start
5
6
7 def update_current_time_line():
8 now = window.Date.new()
9
10 # Calculate the position of the current-time-line
11 now_ts = now.getTime() / 1000
12 minutes_passed = (now_ts - calendar_start) / 60
13
14 new_top = minutes_passed + 15
15
16 # Update the current-time-line position and make it visible
17 current_time_line = document["current-time-line"]
18 current_time_line.style.top = f"{new_top}px"
19 current_time_line.hidden = False
20
21 # Initial update
22 update_current_time_line()
23
24 # Update the current-time-line every minute
25 set_interval(update_current_time_line, 60 * 1000)