Fix weather icons, forecast temps, and update docs
- Replace emoji weather icons with OWM icon images to fix rendering issues on Linux displays (e.g. ⛅ showing as a rectangle) - Fix forecast daily max/min to use true high/low across all 3-hour slots instead of just the first entry of the day - Update README: correct BACKGROUND interval (60 min), update kiosk setup for labwc/Wayland, add restart-calendar.sh instructions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,18 +7,11 @@ const INTERVALS = {
|
||||
JOKE: 3600000 // 1 hour
|
||||
};
|
||||
|
||||
// Weather icon mapping (OpenWeatherMap icons to emoji or text)
|
||||
const WEATHER_ICONS = {
|
||||
'01d': '☀️', '01n': '🌙',
|
||||
'02d': '⛅', '02n': '☁️',
|
||||
'03d': '☁️', '03n': '☁️',
|
||||
'04d': '☁️', '04n': '☁️',
|
||||
'09d': '🌧️', '09n': '🌧️',
|
||||
'10d': '🌦️', '10n': '🌧️',
|
||||
'11d': '⛈️', '11n': '⛈️',
|
||||
'13d': '❄️', '13n': '❄️',
|
||||
'50d': '🌫️', '50n': '🌫️'
|
||||
};
|
||||
// Return an OWM icon image tag for a given icon code
|
||||
function weatherIcon(code) {
|
||||
const src = `https://openweathermap.org/img/wn/${code}@2x.png`;
|
||||
return `<img src="${src}" alt="${code}" class="owm-icon">`;
|
||||
}
|
||||
|
||||
// Initialize the application
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
@@ -69,7 +62,7 @@ async function updateWeather() {
|
||||
const { current, forecast } = data;
|
||||
|
||||
document.getElementById('current-temp').textContent = `${current.temp}°`;
|
||||
document.getElementById('weather-icon').textContent = WEATHER_ICONS[current.icon] || '🌤️';
|
||||
document.getElementById('weather-icon').innerHTML = weatherIcon(current.icon);
|
||||
|
||||
// Update 3-day forecast in header
|
||||
const headerForecast = document.getElementById('header-forecast');
|
||||
@@ -80,7 +73,7 @@ async function updateWeather() {
|
||||
dayElement.className = 'forecast-item';
|
||||
dayElement.innerHTML = `
|
||||
<div class="weather-label">${day.date}</div>
|
||||
<div class="forecast-icon">${WEATHER_ICONS[day.icon] || '🌤️'}</div>
|
||||
<div class="forecast-icon">${weatherIcon(day.icon)}</div>
|
||||
<div class="forecast-temps">
|
||||
<span class="high">${day.temp_max}°</span>
|
||||
<span class="low">${day.temp_min}°</span>
|
||||
|
||||
Reference in New Issue
Block a user