From 5922db99c66066921e5920d51485376614a1d251 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 4 Jan 2025 01:45:31 +0000 Subject: [PATCH] Sync Openclash dev with upstream dev --- .../luasrc/view/openclash/dlercloud.htm | 11 ++++--- .../luasrc/view/openclash/sub_info_show.htm | 30 +++++++++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Openclash dev/luci-app-openclash/luasrc/view/openclash/dlercloud.htm b/Openclash dev/luci-app-openclash/luasrc/view/openclash/dlercloud.htm index b78bdf7..83d77d0 100644 --- a/Openclash dev/luci-app-openclash/luasrc/view/openclash/dlercloud.htm +++ b/Openclash dev/luci-app-openclash/luasrc/view/openclash/dlercloud.htm @@ -30,6 +30,10 @@ .card .general h1 { color: #ffffff; } + + .card .additional .user-card::after { + border-left: 2px solid #bbbbbb; + } } .center { @@ -76,7 +80,7 @@ top: 10%; right: -2px; height: 80%; - border-left: 2px solid rgba(0,0,0,0.025);*/ + border-left: 2px solid rgba(0,0,0,0.025); } .card .additional .user-card img { @@ -315,11 +319,6 @@

var more_info = document.getElementById("more_info"); var dler_logo = document.getElementById("dler_logo"); var showmore=1; - var rootStyles = getComputedStyle(document.documentElement); - - if (rootStyles.getPropertyValue('--bar-bg') == rootStyles.getPropertyValue('--dark-primary') && rootStyles.getPropertyValue('--bar-bg') != "") { - document.documentElement.setAttribute('data-darkmode', 'true'); - } XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "dler_info")%>', null, function(x, status) { if (x && x.status == 200 && status.dler_info != "error") { diff --git a/Openclash dev/luci-app-openclash/luasrc/view/openclash/sub_info_show.htm b/Openclash dev/luci-app-openclash/luasrc/view/openclash/sub_info_show.htm index b50f361..3f372dc 100644 --- a/Openclash dev/luci-app-openclash/luasrc/view/openclash/sub_info_show.htm +++ b/Openclash dev/luci-app-openclash/luasrc/view/openclash/sub_info_show.htm @@ -73,6 +73,36 @@ var s_<%=idname%>; sub_info_get_<%=idname%>(); +function isDarkBackground(element) { + var style = window.getComputedStyle(element); + var bgColor = style.backgroundColor; + let r, g, b; + if (/rgb\(/.test(bgColor)) { + var rgb = bgColor.match(/\d+/g); + r = parseInt(rgb); + g = parseInt(rgb); + b = parseInt(rgb); + } else if (/#/.test(bgColor)) { + if (bgColor.length === 4) { + r = parseInt(bgColor + bgColor, 16); + g = parseInt(bgColor + bgColor, 16); + b = parseInt(bgColor + bgColor, 16); + } else { + r = parseInt(bgColor.slice(1, 3), 16); + g = parseInt(bgColor.slice(3, 5), 16); + b = parseInt(bgColor.slice(5, 7), 16); + } + } else { + return false; + } + var luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b; + return luminance < 128; + } + +if (isDarkBackground(document.body)) { + document.documentElement.setAttribute('data-darkmode', 'true'); +} + function progressbar_<%=idname%>(v, m, pc, np, f, t, tr) { return String.format( '
' +