Remove try/catch blocks to debug, clean up debug counter

This commit is contained in:
Richard Zink committed 2026-10-07 11:18:42 +02:00
1 parent 355201b174
commit 5b32f35a07
1 file changed
+15 -32
+15 -32
View File
@@ -771,8 +771,6 @@ var effect = (VANTA.CLOUDS2 || VANTA.CLOUDS)({
} }
function updateClockAndEvents() { function updateClockAndEvents() {
try {
window._updateCounter = (window._updateCounter || 0) + 1;
var now = new Date(); var now = new Date();
// Real-time clock hands and digital // Real-time clock hands and digital
@@ -899,7 +897,7 @@ if (moonTimes.set) {
// Moon phase // Moon phase
var moonIllum = SunCalc.getMoonIllumination(now); var moonIllum = SunCalc.getMoonIllumination(now);
document.getElementById('moon-phase-text').textContent = document.getElementById('moon-phase-text').textContent =
getMoonPhaseText(moonIllum.phase) + ' ' + Math.round(moonIllum.fraction * 100) + '%' + ' #' + window._updateCounter; getMoonPhaseText(moonIllum.phase) + ' ' + Math.round(moonIllum.fraction * 100) + '%';
renderMoonPhaseIcon(moonIllum.phase, moonIllum.fraction); renderMoonPhaseIcon(moonIllum.phase, moonIllum.fraction);
renderRpgMoon(moonIllum.phase, moonIllum.fraction); renderRpgMoon(moonIllum.phase, moonIllum.fraction);
@@ -914,9 +912,6 @@ if (moonTimes.set) {
var moonZenithWhen = moonZenith && moonZenith > now ? formatDateLong(moonZenith) : ''; var moonZenithWhen = moonZenith && moonZenith > now ? formatDateLong(moonZenith) : '';
document.getElementById('moon-zenith-value').textContent = moonZenith ? formatTimeHM(moonZenith) : '--:--'; document.getElementById('moon-zenith-value').textContent = moonZenith ? formatTimeHM(moonZenith) : '--:--';
document.getElementById('moon-zenith-when').textContent = moonZenithWhen ? '· ' + moonZenithWhen : ''; document.getElementById('moon-zenith-when').textContent = moonZenithWhen ? '· ' + moonZenithWhen : '';
} catch (e) {
console.log('updateClock error:', e);
}
} }
var startTime = Date.now(); var startTime = Date.now();
@@ -1059,7 +1054,6 @@ var weatherThemes = {
} }
function updateDebug(t, palette, vantaColors, themeName) { function updateDebug(t, palette, vantaColors, themeName) {
try {
var now = new Date(); var now = new Date();
var hh = now.getHours(), mm = now.getMinutes(), ss = now.getSeconds(); var hh = now.getHours(), mm = now.getMinutes(), ss = now.getSeconds();
document.getElementById('dbg-time').textContent = document.getElementById('dbg-time').textContent =
@@ -1098,38 +1092,27 @@ var weatherThemes = {
document.getElementById('dbg-vh-' + kk).textContent = '#' + ('00000' + vc.toString(16)).slice(-6); document.getElementById('dbg-vh-' + kk).textContent = '#' + ('00000' + vc.toString(16)).slice(-6);
} }
} }
} catch (e) {
console.log('updateDebug error:', e);
}
} }
function animate() { function animate() {
try { var t = (Date.now() - startTime) / CYCLE % 1;
var t = (Date.now() - startTime) / CYCLE % 1; var c = getColor(t);
var c = getColor(t); c = applyWeatherTheme(c);
c = applyWeatherTheme(c); effect.setOptions({
effect.setOptions({ skyColor: c.sky,
skyColor: c.sky, cloudColor: c.cloud,
cloudColor: c.cloud, lightColor: c.light,
lightColor: c.light, backgroundColor: c.bg,
backgroundColor: c.bg, backgroundAlpha: 0,
backgroundAlpha: 0, speed: currentThemeSpeed
speed: currentThemeSpeed });
}); document.body.style.backgroundColor = '#' + ('00000' + c.sky.toString(16)).slice(-6);
document.body.style.backgroundColor = '#' + ('00000' + c.sky.toString(16)).slice(-6); updateDebug(t, null, c, currentWeatherThemeName);
updateDebug(t, null, c, currentWeatherThemeName);
} catch (e) {
console.log('animate error:', e);
}
requestAnimationFrame(animate); requestAnimationFrame(animate);
} }
function tick() { function tick() {
try { updateClockAndEvents();
updateClockAndEvents();
} catch (e) {
console.log('tick error:', e);
}
setTimeout(tick, 1000); setTimeout(tick, 1000);
} }