From 4535037c15b4ecb804766411f3b679f5463011d7 Mon Sep 17 00:00:00 2001 From: Rakibei Date: Tue, 25 Aug 2026 12:31:16 +0200 Subject: [PATCH] eureka: added config to hide weather --- ui/eureka/eureka.css | 9 +++ ui/eureka/eureka.ts | 127 ++++++++++++++++++++----------------- ui/eureka/eureka_config.ts | 14 ++++ 3 files changed, 91 insertions(+), 59 deletions(-) diff --git a/ui/eureka/eureka.css b/ui/eureka/eureka.css index 1e68c9e606b..4e2917abdc0 100644 --- a/ui/eureka/eureka.css +++ b/ui/eureka/eureka.css @@ -284,11 +284,20 @@ padding-top: 5px; } +#label-weather-container.hidden { + display: none; +} + #label-time { padding-bottom: 5px; border-bottom: 2px dashed rgb(255 255 255 / 30%); } +#label-time.weather-hidden { + padding-bottom: 0; + border-bottom: none; +} + .aspect-ratio-anemos #label-container { top: 0%; } diff --git a/ui/eureka/eureka.ts b/ui/eureka/eureka.ts index f4862017ec8..b40bb4d8a74 100644 --- a/ui/eureka/eureka.ts +++ b/ui/eureka/eureka.ts @@ -117,6 +117,7 @@ const defaultEurekaConfigOptions = { FlagTimeoutMs: 90, CompleteNamesSTQ: false, EnrichedSTQ: false, + HideWeather: false, PopNoiseForNM: true, PopNoiseForBunny: true, PopNoiseForSkirmish: false, @@ -586,71 +587,79 @@ class EurekaTracker { return; const nowMs = +new Date(); - const primaryWeatherList = this.zoneInfo?.primaryWeather; - const currentWeather = getWeather(nowMs, zoneId); - if (primaryWeatherList) { - for (let i = 0; i < numWeatherElem; ++i) { - const iconElem = document.getElementById(`label-weather-icon${i}`); - const textElem = document.getElementById(`label-weather-text${i}`); - if (!iconElem || !textElem) - throw new UnreachableCode(); - iconElem.innerHTML = ''; - textElem.innerHTML = ''; - } + const weatherContainer = document.getElementById('label-weather-container'); + const labelTime = document.getElementById('label-time'); - primaryWeatherList.forEach((primaryWeather, i) => { - const weatherIcon = gWeatherIcons[primaryWeather]; - let weatherStr = ''; - if (currentWeather === primaryWeather) { - const stopTime = findNextWeatherNot(nowMs, zoneId, primaryWeather); - weatherStr = this.TransByDispLang(this.options.timeStrings.weatherFor)(nowMs, stopTime); - } else { - const startTime = findNextWeather(nowMs, zoneId, primaryWeather); - if (startTime !== undefined) - weatherStr = this.TransByDispLang(this.options.timeStrings.weatherIn)(nowMs, startTime); - } - const iconElem = document.getElementById(`label-weather-icon${i}`); - const textElem = document.getElementById(`label-weather-text${i}`); - if (!iconElem || !textElem) - throw new UnreachableCode(); + if (!weatherContainer || !labelTime) + throw new UnreachableCode(); + + weatherContainer.classList.toggle('hidden', this.options.HideWeather); + labelTime.classList.toggle('weather-hidden', this.options.HideWeather); + + if (!this.options.HideWeather) { + const primaryWeatherList = this.zoneInfo?.primaryWeather; + const currentWeather = getWeather(nowMs, zoneId); + + if (primaryWeatherList) { + primaryWeatherList.forEach((primaryWeather, i) => { + const weatherIcon = gWeatherIcons[primaryWeather]; + let weatherStr = ''; + if (currentWeather === primaryWeather) { + const stopTime = findNextWeatherNot(nowMs, zoneId, primaryWeather); + weatherStr = this.TransByDispLang(this.options.timeStrings.weatherFor)(nowMs, stopTime); + } else { + const startTime = findNextWeather(nowMs, zoneId, primaryWeather); + if (startTime !== undefined) { + weatherStr = this.TransByDispLang(this.options.timeStrings.weatherIn)( + nowMs, + startTime, + ); + } + } + const iconElem = document.getElementById(`label-weather-icon${i}`); + const textElem = document.getElementById(`label-weather-text${i}`); + if (!iconElem || !textElem) + throw new UnreachableCode(); + + iconElem.innerHTML = weatherIcon ?? ''; + textElem.innerHTML = weatherStr; + }); + } else if (currentWeather !== undefined) { + const stopTime = findNextWeatherNot(nowMs, zoneId, currentWeather); + const weatherIcon = gWeatherIcons[currentWeather]; + let weatherStr = this.TransByDispLang(this.options.timeStrings.weatherFor)(nowMs, stopTime); + + const iconElem = document.getElementById('label-weather-icon0'); + const textElem = document.getElementById('label-weather-text0'); - iconElem.innerHTML = weatherIcon ?? ''; - textElem.innerHTML = weatherStr; - }); - } else if (currentWeather !== undefined) { - const stopTime = findNextWeatherNot(nowMs, zoneId, currentWeather); - const weatherIcon = gWeatherIcons[currentWeather]; - let weatherStr = this.TransByDispLang(this.options.timeStrings.weatherFor)(nowMs, stopTime); - - const iconElem = document.getElementById(`label-weather-icon0`); - const textElem = document.getElementById(`label-weather-text0`); - if (!iconElem || !textElem) - throw new UnreachableCode(); - iconElem.innerHTML = weatherIcon ?? ''; - textElem.innerHTML = weatherStr; - - // round up current time - let lastTime = nowMs; - let lastWeather = currentWeather; - for (let i = 1; i < 5; ++i) { - const startTime = findNextWeatherNot(lastTime, zoneId, lastWeather); - if (startTime === undefined) - continue; - const weather = getWeather(startTime + 1, zoneId); - if (weather === undefined) - continue; - const weatherIcon = gWeatherIcons[weather]; - weatherStr = this.TransByDispLang(this.options.timeStrings.weatherIn)(nowMs, startTime); - - const iconElem = document.getElementById(`label-weather-icon${i}`); - const textElem = document.getElementById(`label-weather-text${i}`); if (!iconElem || !textElem) throw new UnreachableCode(); - iconElem.innerHTML = weatherIcon ?? ''; textElem.innerHTML = weatherStr; - lastTime = startTime; - lastWeather = weather; + + let lastTime = nowMs; + let lastWeather = currentWeather; + + for (let i = 1; i < numWeatherElem; ++i) { + const startTime = findNextWeatherNot(lastTime, zoneId, lastWeather); + if (startTime === undefined) + continue; + const weather = getWeather(startTime + 1, zoneId); + if (weather === undefined) + continue; + const weatherIcon = gWeatherIcons[weather]; + weatherStr = this.TransByDispLang(this.options.timeStrings.weatherIn)(nowMs, startTime); + + const iconElem = document.getElementById(`label-weather-icon${i}`); + const textElem = document.getElementById(`label-weather-text${i}`); + if (!iconElem || !textElem) + throw new UnreachableCode(); + + iconElem.innerHTML = weatherIcon ?? ''; + textElem.innerHTML = weatherStr; + lastTime = startTime; + lastWeather = weather; + } } } diff --git a/ui/eureka/eureka_config.ts b/ui/eureka/eureka_config.ts index 022e372f33c..15ae7a67a9c 100644 --- a/ui/eureka/eureka_config.ts +++ b/ui/eureka/eureka_config.ts @@ -70,6 +70,20 @@ UserConfig.registerOptions('eureka', { type: 'checkbox', default: false, }, + { + id: 'HideWeather', + name: { + en: 'Hide weather information', + de: 'Wetterinformationen ausblenden', + fr: 'Masquer les informations météo', + ja: '天気情報を非表示にする', + cn: '隐藏天气信息', + ko: '날씨 정보 숨기기', + tc: '隱藏天氣資訊', + }, + type: 'checkbox', + default: false, + }, { id: 'PopNoiseForNM', name: {