From 035d43fb1843720909ef77b40e4e5474cd21543b Mon Sep 17 00:00:00 2001 From: Envision <9063072+elapsingdreams@user.noreply.gitee.com> Date: Mon, 12 Aug 2024 16:04:27 +0800 Subject: [PATCH 1/6] =?UTF-8?q?:art::bug:=20=E4=BF=AE=E5=A4=8D=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=BD=9C=E5=9C=A8=E7=9A=84=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E6=98=BE=E7=A4=BAbug=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/css/weather_now.css | 54 +++++++-------- .../templates/js/weather_now.js | 43 ++++++++---- .../templates/weather_now.html | 68 ++----------------- 3 files changed, 61 insertions(+), 104 deletions(-) diff --git a/src/resources/liteyuki_weather/templates/css/weather_now.css b/src/resources/liteyuki_weather/templates/css/weather_now.css index 608c93bb..c8d83d2a 100644 --- a/src/resources/liteyuki_weather/templates/css/weather_now.css +++ b/src/resources/liteyuki_weather/templates/css/weather_now.css @@ -187,37 +187,37 @@ .ad-box { margin-bottom: 20px; - - img { - border-radius: 60px; - } } -.sub-info { +#ad { + border-radius: 60px; +} + +#sub-info { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; color: var(--main-text-color); - font-size: 40px; + font-size: 36px; align-items: center; } -.sub-info>div { +.sub-item { display: flex; align-items: center; gap: 5px; overflow: hidden; padding-left: 20px; +} - /*要问就问html调svg为什么那么不友好*/ - img { - transform: translateY(-80px); - /*自定义颜色*/ - filter: drop-shadow(var(--main-text-color) 0 80px); - /*自定义透明度*/ - opacity: 1; - padding-right: 10px; - } +/*要问就问为什么html调svg那么不友好*/ +.sub-svg { + transform: translateY(-80px); + /*此处用作自定义颜色*/ + filter: drop-shadow(var(--main-text-color) 0 80px); + /*此处用作自定义透明度*/ + opacity: 1; + padding-right: 10px; } .attribution-box { @@ -225,16 +225,16 @@ position: relative; display: flex; justify-content: center; +} - #attribution-info { - backdrop-filter: blur(10px); - padding: 0 5px 0; - background-color: rgba(0, 0, 0, 0.5); - font-size: 25px; - justify-content: space-between; - display: inline-flex; - word-wrap: break-word; - color: var(--sub-text-color); - text-align: center; - } +.attribution-info { + backdrop-filter: blur(10px); + padding: 0 5px 0; + background-color: rgba(0, 0, 0, 0.5); + font-size: 25px; + justify-content: space-between; + display: inline-flex; + word-wrap: break-word; + color: var(--sub-text-color); + text-align: center; } \ No newline at end of file diff --git a/src/resources/liteyuki_weather/templates/js/weather_now.js b/src/resources/liteyuki_weather/templates/js/weather_now.js index b8af944f..d822caec 100644 --- a/src/resources/liteyuki_weather/templates/js/weather_now.js +++ b/src/resources/liteyuki_weather/templates/js/weather_now.js @@ -54,7 +54,7 @@ if ("aqi" in aqi) { } -templates = { +let templates = { "time": weatherNow["now"]["obsTime"], "city": locationData["name"], "adm": locationData["country"] + " " + locationData["adm1"] + " " + locationData["adm2"], @@ -69,31 +69,48 @@ for (let id in templates) { } -subtemplates = { +let subtemplates = { "now-windDirect": weatherNow["now"]["windDir"] + " " + weatherNow["now"]["wind360"] + "°", "now-windVelocity": "风矢 " + weatherNow["now"]["windScale"] + "级 " + weatherNow["now"]["windSpeed"] + "km/h", "now-humidity": "湿度 " + weatherNow["now"]["humidity"] + "%", "now-feelsLike": "体感 " + weatherNow["now"]["feelsLike"] + "°C", "now-precip": "降水 " + weatherNow["now"]["precip"] + "mm", "now-pressure": "气压 " + weatherNow["now"]["pressure"] + "hPa", - "vis": "能见 " + weatherNow["now"]["vis"] + "km", - "cloud ": "云量 " + (weatherNow["now"]["cloud"] == "" ? "无数据" : (weatherNow["now"]["cloud"] + "%")), + "now-vis": "能见 " + weatherNow["now"]["vis"] + "km", + "now-cloud": "云量 " + (weatherNow["now"]["cloud"] == "" ? "无数据" : (weatherNow["now"]["cloud"] + "%")), "astronomy-sunrise": "日出 " + get_time_hour(weatherAstronomy["sunrise"]), "astronomy-sunset": "日落 " + get_time_hour(weatherAstronomy["sunset"]) } -let subItemDivTemplate = document.importNode(document.getElementById("sub-info-template").content, true); +let subiconMap = { + "now-windDirect": "windDirect", + "now-windVelocity": "windVelocity", + "now-humidity": "humidity", + "now-feelsLike": "feelsLike", + "now-precip": "precip", + "now-pressure": "pressure", + "now-vis": "vis", + "now-cloud": "cloud", + "astronomy-sunrise": "sunrise", + "astronomy-sunset": "sunset" +}; -let subItemDiv = subItemDivTemplate.querySelector(".sub-info"); +let subtemplate = document.getElementById('sub-info-template').content; +let subcontainer = document.getElementById('sub-info'); -for (let id in subtemplates) { - let element = subItemDiv.querySelector(`#${id}`); - if (element) { - element.innerText = subtemplates[id]; - } -} +Object.keys(subtemplates).forEach(id => { + let subItemDiv = document.importNode(subtemplate, true).querySelector('.sub-item'); + + subItemDiv.querySelector(`div`).innerText = subtemplates[id]; + + let iconName = subiconMap[id]; + + subItemDiv.querySelector(`img`).src = `./img/svg/${iconName}.svg`; + subItemDiv.querySelector(`img`).alt = `SVG ${id}`; + + subcontainer.appendChild(subItemDiv); +}); -document.getElementById('sub-info').appendChild(subItemDiv); let maxHourlyItem = 8 let percentWidth = 1 / (maxHourlyItem * 1.5) * 100 diff --git a/src/resources/liteyuki_weather/templates/weather_now.html b/src/resources/liteyuki_weather/templates/weather_now.html index 8a65bffc..6d0f9154 100644 --- a/src/resources/liteyuki_weather/templates/weather_now.html +++ b/src/resources/liteyuki_weather/templates/weather_now.html @@ -7,7 +7,6 @@ - @@ -38,68 +37,9 @@ @@ -143,7 +83,7 @@
-
+
From 32e1963d5a72beb87b752986d5f1409e14eee72d Mon Sep 17 00:00:00 2001 From: Envision <9063072+elapsingdreams@user.noreply.gitee.com> Date: Mon, 12 Aug 2024 16:47:16 +0800 Subject: [PATCH 2/6] =?UTF-8?q?:art:=E7=83=AD=E4=BF=AE=E5=A4=8D=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E6=98=BE=E7=A4=BA=20:see=5Fno=5Fevil:=E6=9B=B4?= =?UTF-8?q?=E6=96=B0.gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ src/resources/liteyuki_weather/templates/css/weather_now.css | 2 +- src/resources/liteyuki_weather/templates/js/weather_now.js | 4 ++-- src/resources/liteyuki_weather/templates/weather_now.html | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index a80db66f..67716fee 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ .vscode/ .cache/ +venv/ + node_modules/ data/ db/ diff --git a/src/resources/liteyuki_weather/templates/css/weather_now.css b/src/resources/liteyuki_weather/templates/css/weather_now.css index c8d83d2a..dd1f4298 100644 --- a/src/resources/liteyuki_weather/templates/css/weather_now.css +++ b/src/resources/liteyuki_weather/templates/css/weather_now.css @@ -227,7 +227,7 @@ justify-content: center; } -.attribution-info { +#attribution-info { backdrop-filter: blur(10px); padding: 0 5px 0; background-color: rgba(0, 0, 0, 0.5); diff --git a/src/resources/liteyuki_weather/templates/js/weather_now.js b/src/resources/liteyuki_weather/templates/js/weather_now.js index d822caec..8e9b9e7a 100644 --- a/src/resources/liteyuki_weather/templates/js/weather_now.js +++ b/src/resources/liteyuki_weather/templates/js/weather_now.js @@ -179,6 +179,6 @@ function get_time_hour(fxTime) { } let attrinfo = document.getElementById('attribution-info'); -if (!is_dev & !attr) attrinfo.parentElement.style.display = "none" +if (!is_dev & !attr) attrinfo.parentElement.style.display = "none"; -attrinfo.innerText = is_dev ? "Weather Service Drived by QWeather" : (attr ? attr : "Weather Service Drived by QWeather") +attrinfo.innerText = is_dev ? "Weather Service Drived by QWeather" : (attr ? attr : "Weather Service Drived by QWeather"); \ No newline at end of file diff --git a/src/resources/liteyuki_weather/templates/weather_now.html b/src/resources/liteyuki_weather/templates/weather_now.html index 6d0f9154..3cb2de7c 100644 --- a/src/resources/liteyuki_weather/templates/weather_now.html +++ b/src/resources/liteyuki_weather/templates/weather_now.html @@ -83,7 +83,7 @@
-
+
From e801a99f67d8912c7c3aa66bf6647ef36741f9a1 Mon Sep 17 00:00:00 2001 From: Envision <9063072+elapsingdreams@user.noreply.gitee.com> Date: Mon, 12 Aug 2024 19:13:03 +0800 Subject: [PATCH 3/6] =?UTF-8?q?:adhesive=5Fbandage:=E9=9D=9E=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E9=97=AE=E9=A2=98=E7=9A=84=E7=AE=80=E5=8D=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D:=E6=8F=92=E4=BB=B6=E6=9C=8D=E5=8A=A1=E5=A3=B0?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/liteyuki_weather/templates/js/weather_now.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/resources/liteyuki_weather/templates/js/weather_now.js b/src/resources/liteyuki_weather/templates/js/weather_now.js index 8e9b9e7a..4e02fdd3 100644 --- a/src/resources/liteyuki_weather/templates/js/weather_now.js +++ b/src/resources/liteyuki_weather/templates/js/weather_now.js @@ -178,7 +178,6 @@ function get_time_hour(fxTime) { return fxTime.split("T")[1].split("+")[0] } -let attrinfo = document.getElementById('attribution-info'); -if (!is_dev & !attr) attrinfo.parentElement.style.display = "none"; + attrinfo.innerText = is_dev ? "Weather Service Drived by QWeather" : (attr ? attr : "Weather Service Drived by QWeather"); \ No newline at end of file From 61c0cf2c2d0fd623f7f04a73910dd9470432cc34 Mon Sep 17 00:00:00 2001 From: ElapsingDreams <159739277+ElapsingDreams@users.noreply.github.com> Date: Mon, 12 Aug 2024 20:01:29 +0800 Subject: [PATCH 4/6] Update weather_now.js --- src/resources/liteyuki_weather/templates/js/weather_now.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/resources/liteyuki_weather/templates/js/weather_now.js b/src/resources/liteyuki_weather/templates/js/weather_now.js index 4e02fdd3..3dc87a23 100644 --- a/src/resources/liteyuki_weather/templates/js/weather_now.js +++ b/src/resources/liteyuki_weather/templates/js/weather_now.js @@ -179,5 +179,5 @@ function get_time_hour(fxTime) { } - -attrinfo.innerText = is_dev ? "Weather Service Drived by QWeather" : (attr ? attr : "Weather Service Drived by QWeather"); \ No newline at end of file +let attrinfo = document.getElementById('attribution-info'); +attrinfo.innerText = is_dev ? "Weather Service Drived by QWeather" : (attr ? attr : "Weather Service Drived by QWeather"); From 90b9d1af1e41c10ad12e9f7a9752d2a027458a2e Mon Sep 17 00:00:00 2001 From: Envision <9063072+elapsingdreams@user.noreply.gitee.com> Date: Mon, 12 Aug 2024 22:13:59 +0800 Subject: [PATCH 5/6] =?UTF-8?q?:globe=5Fwith=5Fmeridians:=20liteyuki=5Fwea?= =?UTF-8?q?ther=20i18n=20(=E8=99=BD=E7=84=B6=E4=BB=85=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=B8=89=E7=A7=8D=E8=AF=AD=E8=A8=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../liteyuki_weather/qw_api.py | 31 ++++++++++++------- src/resources/liteyuki_weather/lang/en.lang | 11 ++++++- src/resources/liteyuki_weather/lang/ja.lang | 11 ++++++- .../liteyuki_weather/lang/zh-CN.lang | 11 ++++++- .../templates/js/weather_now.js | 18 +++++------ 5 files changed, 59 insertions(+), 23 deletions(-) diff --git a/src/nonebot_plugins/liteyuki_weather/qw_api.py b/src/nonebot_plugins/liteyuki_weather/qw_api.py index ab47fad6..22300edd 100644 --- a/src/nonebot_plugins/liteyuki_weather/qw_api.py +++ b/src/nonebot_plugins/liteyuki_weather/qw_api.py @@ -43,18 +43,27 @@ def get_local_data(ulang_code: str) -> dict: """ ulang = Language(ulang_code) return { - "monday" : ulang.get("weather.monday"), + "monday" : ulang.get("weather.monday"), "tuesday" : ulang.get("weather.tuesday"), - "wednesday": ulang.get("weather.wednesday"), - "thursday" : ulang.get("weather.thursday"), - "friday" : ulang.get("weather.friday"), - "saturday" : ulang.get("weather.saturday"), - "sunday" : ulang.get("weather.sunday"), - "today" : ulang.get("weather.today"), - "tomorrow" : ulang.get("weather.tomorrow"), - "day" : ulang.get("weather.day"), - "night" : ulang.get("weather.night"), - "no_aqi" : ulang.get("weather.no_aqi"), + "wednesday" : ulang.get("weather.wednesday"), + "thursday" : ulang.get("weather.thursday"), + "friday" : ulang.get("weather.friday"), + "saturday" : ulang.get("weather.saturday"), + "sunday" : ulang.get("weather.sunday"), + "today" : ulang.get("weather.today"), + "tomorrow" : ulang.get("weather.tomorrow"), + "day" : ulang.get("weather.day"), + "night" : ulang.get("weather.night"), + "no_aqi" : ulang.get("weather.no_aqi"), + "now-windVelocity" : ulang.get("weather.now-windVelocity"), + "now-humidity" : ulang.get("weather.now-humidity"), + "now-feelsLike" : ulang.get("weather.now-feelsLike"), + "now-precip" : ulang.get("weather.now-precip"), + "now-pressure" : ulang.get("weather.now-pressure"), + "now-vis" : ulang.get("weather.now-vis"), + "now-cloud" : ulang.get("weather.now-cloud"), + "astronomy-sunrise" : ulang.get("weather.astronomy-sunrise"), + "astronomy-sunset" : ulang.get("weather.astronomy-sunset"), } diff --git a/src/resources/liteyuki_weather/lang/en.lang b/src/resources/liteyuki_weather/lang/en.lang index d8642dfe..7d3d68a5 100644 --- a/src/resources/liteyuki_weather/lang/en.lang +++ b/src/resources/liteyuki_weather/lang/en.lang @@ -9,4 +9,13 @@ weather.day=Day weather.night=Night weather.today=Today weather.tomorrow=Tomorrow -weather.no_aqi=No AQI data \ No newline at end of file +weather.no_aqi=No AQI data +weather.now-windVelocity=WS +weather.now-humidity=RH +weather.now-feelsLike=FL +weather.now-precip=PPT +weather.now-pressure=MSLP +weather.now-vis=VIS +weather.now-cloud=CC +weather.astronomy-sunrise=SR +weather.astronomy-sunset=SS \ No newline at end of file diff --git a/src/resources/liteyuki_weather/lang/ja.lang b/src/resources/liteyuki_weather/lang/ja.lang index 5c39ab6a..2b221bec 100644 --- a/src/resources/liteyuki_weather/lang/ja.lang +++ b/src/resources/liteyuki_weather/lang/ja.lang @@ -9,4 +9,13 @@ weather.day=昼 weather.night=夜 weather.today=今日 weather.tomorrow=明日 -weather.no_aqi=空気質データなし \ No newline at end of file +weather.no_aqi=空気質データなし +weather.now-windVelocity=風速 +weather.now-humidity=湿度 +weather.now-feelsLike=体感温度 +weather.now-precip=降水量 +weather.now-pressure=気圧 +weather.now-vis=能視距離 +weather.now-cloud=雲量 +weather.astronomy-sunrise=日出 +weather.astronomy-sunset=日没 \ No newline at end of file diff --git a/src/resources/liteyuki_weather/lang/zh-CN.lang b/src/resources/liteyuki_weather/lang/zh-CN.lang index e4fb52e1..26931d65 100644 --- a/src/resources/liteyuki_weather/lang/zh-CN.lang +++ b/src/resources/liteyuki_weather/lang/zh-CN.lang @@ -9,4 +9,13 @@ weather.day=白天 weather.night=夜晚 weather.today=今天 weather.tomorrow=明天 -weather.no_aqi=暂无AQI数据 \ No newline at end of file +weather.no_aqi=暂无AQI数据 +weather.now-windVelocity=风矢 +weather.now-humidity=湿度 +weather.now-feelsLike=体感 +weather.now-precip=降水 +weather.now-pressure=气压 +weather.now-vis=能见 +weather.now-cloud=云量 +weather.astronomy-sunrise=日出 +weather.astronomy-sunset=日落 \ No newline at end of file diff --git a/src/resources/liteyuki_weather/templates/js/weather_now.js b/src/resources/liteyuki_weather/templates/js/weather_now.js index 3dc87a23..c2cb7973 100644 --- a/src/resources/liteyuki_weather/templates/js/weather_now.js +++ b/src/resources/liteyuki_weather/templates/js/weather_now.js @@ -71,15 +71,15 @@ for (let id in templates) { let subtemplates = { "now-windDirect": weatherNow["now"]["windDir"] + " " + weatherNow["now"]["wind360"] + "°", - "now-windVelocity": "风矢 " + weatherNow["now"]["windScale"] + "级 " + weatherNow["now"]["windSpeed"] + "km/h", - "now-humidity": "湿度 " + weatherNow["now"]["humidity"] + "%", - "now-feelsLike": "体感 " + weatherNow["now"]["feelsLike"] + "°C", - "now-precip": "降水 " + weatherNow["now"]["precip"] + "mm", - "now-pressure": "气压 " + weatherNow["now"]["pressure"] + "hPa", - "now-vis": "能见 " + weatherNow["now"]["vis"] + "km", - "now-cloud": "云量 " + (weatherNow["now"]["cloud"] == "" ? "无数据" : (weatherNow["now"]["cloud"] + "%")), - "astronomy-sunrise": "日出 " + get_time_hour(weatherAstronomy["sunrise"]), - "astronomy-sunset": "日落 " + get_time_hour(weatherAstronomy["sunset"]) + "now-windVelocity": localData["now-windVelocity"] + " " + weatherNow["now"]["windScale"] + "级 " + weatherNow["now"]["windSpeed"] + "km/h", + "now-humidity": localData["now-humidity"] + " " + weatherNow["now"]["humidity"] + "%", + "now-feelsLike": localData["now-feelsLike"] + " " + weatherNow["now"]["feelsLike"] + "°C", + "now-precip": localData["now-precip"] + " " + weatherNow["now"]["precip"] + "mm", + "now-pressure": localData["now-pressure"] + " " + weatherNow["now"]["pressure"] + "hPa", + "now-vis": localData["now-vis"] + " " + weatherNow["now"]["vis"] + "km", + "now-cloud": localData["now-cloud"] + " " + (weatherNow["now"]["cloud"] == "" ? "无数据" : (weatherNow["now"]["cloud"] + "%")), + "astronomy-sunrise": localData["astronomy-sunrise"] + " " + get_time_hour(weatherAstronomy["sunrise"]), + "astronomy-sunset": localData["astronomy-sunset"] + " " + get_time_hour(weatherAstronomy["sunset"]) } let subiconMap = { From 624afa57ba55ca96ca5252d36b77000cbbf373a7 Mon Sep 17 00:00:00 2001 From: Envision <9063072+elapsingdreams@user.noreply.gitee.com> Date: Thu, 15 Aug 2024 02:59:03 +0800 Subject: [PATCH 6/6] =?UTF-8?q?:bug:=20=E5=B0=9D=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dliteyuki=5Fstatus=E6=8F=92=E4=BB=B6=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E8=BF=87=E9=95=BF=E7=9A=84=E5=B8=83=E5=B1=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/vanilla_resource/templates/css/status.css | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/resources/vanilla_resource/templates/css/status.css b/src/resources/vanilla_resource/templates/css/status.css index c7ed2cb0..0e8b6ad3 100644 --- a/src/resources/vanilla_resource/templates/css/status.css +++ b/src/resources/vanilla_resource/templates/css/status.css @@ -107,6 +107,10 @@ margin-bottom: 10px; margin-left: 20px; text-align: left; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: calc(100% - 40px); z-index: 2; } @@ -123,5 +127,4 @@ font-style: italic; color: var(--sub-text-color); text-align: right; -} - +} \ No newline at end of file