From d8d3221fd39729aa13c82399ade92ecf4571c1d6 Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Mon, 7 Mar 2022 03:43:38 +0200 Subject: [PATCH] Weather: Icon pack applies to widget icons as well (#1015) --- ExplorerPatcher/settings.reg | 2 +- ExplorerPatcher/settings10.reg | 4 + ep_weather_host/ep_weather_host.c | 2 +- .../ep_weather_provider_google_script.h | 256 ++++++++++++------ 4 files changed, 185 insertions(+), 79 deletions(-) diff --git a/ExplorerPatcher/settings.reg b/ExplorerPatcher/settings.reg index b0d36d7..f2aaae4 100644 --- a/ExplorerPatcher/settings.reg +++ b/ExplorerPatcher/settings.reg @@ -465,7 +465,7 @@ ;x 3 Small rounded ;x 1 Not rounded "WeatherWindowCornerPreference"=dword:00000002 -;c 2 Taskbar icon pack +;c 2 Icon pack ;x 0 Microsoft (default) ;x 1 Google "WeatherIconPack"=dword:00000000 diff --git a/ExplorerPatcher/settings10.reg b/ExplorerPatcher/settings10.reg index 8d1ff69..075ca53 100644 --- a/ExplorerPatcher/settings10.reg +++ b/ExplorerPatcher/settings10.reg @@ -404,6 +404,10 @@ ;x 1 Light ;x 2 Dark "WeatherTheme"=dword:00000000 +;c 2 Icon pack +;x 0 Microsoft (default) +;x 1 Google +"WeatherIconPack"=dword:00000000 ;q ;t Weather data courtesy of Google, and weather.com. ;y Learn more about the Weather taskbar widget 🡕 diff --git a/ep_weather_host/ep_weather_host.c b/ep_weather_host/ep_weather_host.c index fe853fa..a66c5fc 100644 --- a/ep_weather_host/ep_weather_host.c +++ b/ep_weather_host/ep_weather_host.c @@ -230,7 +230,7 @@ HRESULT STDMETHODCALLTYPE _epw_Weather_ExecuteDataScript(EPWeather* _this) LONG64 dwIconPack = InterlockedAdd(&_this->dwIconPack, 0); if (dwIconPack == EP_WEATHER_ICONPACK_MICROSOFT) { - swprintf_s(wszScriptData, EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN, L"%s%s", ep_weather_provider_google_script00, ep_weather_provider_google_script01); + swprintf_s(wszScriptData, EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN, L"%s%s%s%s", ep_weather_provider_google_script00, ep_weather_provider_google_script01, ep_weather_provider_google_script02, ep_weather_provider_google_script03); } else if (dwIconPack == EP_WEATHER_ICONPACK_GOOGLE) { diff --git a/ep_weather_host/ep_weather_provider_google_script.h b/ep_weather_host/ep_weather_provider_google_script.h index 845d311..21ca5a8 100644 --- a/ep_weather_host/ep_weather_provider_google_script.h +++ b/ep_weather_host/ep_weather_provider_google_script.h @@ -2,7 +2,7 @@ #define _H_EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_H_ #include // many thanks to https://stackoverflow.com/questions/23202966/google-weather-widget-on-my-website -#define EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN 20000 +#define EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN 30000 LPCWSTR ep_weather_provider_google_script10 = L"var final_im = 0; function ep_weather_part0() { return \"run_part_0\"; }; ep_weather_part0();"; @@ -102,11 +102,11 @@ Math.mod = function(a, b) {\n\ \n\ \n\ var final_im = 0;\n\ -var final_img = 0;\n\ +var final_img2 = 0;\n\ var final_int;\n\ var final_cnt = 0;\n\ function ep_set_final_img(){\n\ -document.getElementById('wob_tci').src = final_img;\n\ +document.getElementById('wob_tci').src = final_img2;\n\ final_cnt++;\n\ if (final_cnt == 20) clearInterval(final_int);\n\ }\n\ @@ -119,6 +119,7 @@ function ep_download_image_blob(url) {\n\ for(var i=0;i {\n\ + changes.forEach(change => {\n\ + if(change.attributeName.includes('src') && document.getElementById('wob_tci').src.includes('gstatic.com')){\n\ + let includes_time = document.getElementById(\"wob_dts\").innerText.includes(\":\");\n\ + if (includes_time) {\n\ + let sp = document.getElementById(\"wob_dts\").innerText.split(':');\n\ + let hrs = parseInt(sp[0].split(' ')[1]);\n\ + let mins = parseInt(sp[1]);\n\ + replaceImage(document.getElementById('wob_tci'), IsDay(1, hrs, mins));\n\ + } else { replaceImage(document.getElementById('wob_tci'), 1); }\n\ + }\n\ + });\n\ +});\n\ +observer.observe(document.getElementById('wob_tci'), {attributes : true});\n\ function ep_weather_part0() {\n\ return \"run_part_0\";\n\ }\n\