mirror of
https://github.com/smittix/intercept.git
synced 2026-06-08 14:11:54 -07:00
Fix clock flickering on main page — inline updateHeaderClock was using UTC
The updateHeaderClock function in index.html was inlined and still using raw UTC (toISOString), while nav.html's version used InterceptTime. Both ran on 1-second intervals updating the same element, causing the clock to rapidly alternate between ET and UTC. Fix: Updated the inline version in index.html to use InterceptTime, matching nav.html. Added _navClockStarted guard and onChange listener so only one interval runs and timezone changes apply instantly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+14
-4
@@ -3816,11 +3816,17 @@
|
||||
keywords: []
|
||||
};
|
||||
|
||||
// UTC Clock Update
|
||||
// Clock Update (uses global InterceptTime for timezone/format)
|
||||
function updateHeaderClock() {
|
||||
const now = new Date();
|
||||
const utc = now.toISOString().substring(11, 19);
|
||||
document.getElementById('headerUtcTime').textContent = utc;
|
||||
const el = document.getElementById('headerUtcTime');
|
||||
const label = document.querySelector('.utc-label');
|
||||
if (typeof InterceptTime !== 'undefined') {
|
||||
if (el) el.textContent = InterceptTime.fullTime(now);
|
||||
if (label) label.textContent = InterceptTime.getLabel() || 'LOCAL';
|
||||
} else {
|
||||
if (el) el.textContent = now.toISOString().substring(11, 19);
|
||||
}
|
||||
}
|
||||
|
||||
function setActiveModeIndicator(label) {
|
||||
@@ -3855,8 +3861,12 @@
|
||||
}
|
||||
|
||||
// Update clock every second
|
||||
window._navClockStarted = true;
|
||||
setInterval(updateHeaderClock, 1000);
|
||||
updateHeaderClock(); // Initial call
|
||||
updateHeaderClock();
|
||||
if (typeof InterceptTime !== 'undefined' && InterceptTime.onChange) {
|
||||
InterceptTime.onChange(updateHeaderClock);
|
||||
}
|
||||
applyKeyboardAccessibility();
|
||||
|
||||
// Pager message filter functions
|
||||
|
||||
Reference in New Issue
Block a user