Skip to content

Commit

Permalink
chore: refine
Browse files Browse the repository at this point in the history
  • Loading branch information
vernesong committed Jan 12, 2025
1 parent 81edfa0 commit 3c80969
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 10 deletions.
16 changes: 12 additions & 4 deletions luci-app-openclash/luasrc/view/openclash/dlercloud.htm
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,32 @@
}

.card .general .dler-title{
color: #ffffff;
color: #bbbbbb;
}

.card .general .dler-result{
color: #ffffff;
color: #bbbbbb;
}

.card .general .dler-result2{
color: #ffffff;
color: #bbbbbb;
}

.card .general h1 {
color: #ffffff;
color: #bbbbbb;
}

.card .additional .user-card::after {
border-left: 2px solid #bbbbbb;
}

.card .additional .more-info h1 {
color: #bbbbbb;
}

.card .additional .coords {
color: #bbbbbb;
}
}

.center {
Expand Down
51 changes: 48 additions & 3 deletions luci-app-openclash/luasrc/view/openclash/select_git_cdn.htm
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@

<style type="text/css">
<style type="text/css">

:root[data-darkmode="true"] {
.select-popup {
background-color: #000000;
}

.select-option:hover {
background-color: #444444;
}
}

.select-popup {
position: fixed;
top: 50%;
Expand All @@ -16,6 +27,10 @@
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.select-class {
width: auto;
}

.select-popup.hidden {
display: none;
}
Expand Down Expand Up @@ -52,7 +67,7 @@
<div id="selectPopup" class="select-popup hidden">
<table width="100%"><tr>
<td width="25%" align="center"><%:Compiled Version Selected (Auto-save when you click to update or download)%></td>
<td width="25%" align="center"><select id="CORE_VERSION_CDN">
<td width="25%" align="center"><select class="select-class" id="CORE_VERSION_CDN">
<option value="linux-386"><%:linux-386%></option>
<option value="linux-amd64"><%:linux-amd64(x86-64)%></option>
<option value="linux-amd64-v3"><%:linux-amd64-v3(x86-64)%></option>
Expand All @@ -73,7 +88,7 @@
<option value="0"><%:Not Set%></option>
</select></td>
<td width="25%" align="center"><%:Release Branch Selected (Auto-save when you click to update or download)%></td>
<td width="25%" align="center"><select id="RELEASE_BRANCH_CDN">
<td width="25%" align="center"><select class="select-class" id="RELEASE_BRANCH_CDN">
<option value="master">Master</option>
<option value="dev">Developer</option>
</select></td>
Expand All @@ -97,6 +112,36 @@
var core_version_cdn = document.getElementById('CORE_VERSION_CDN');
var release_branch_cdn = document.getElementById('RELEASE_BRANCH_CDN');

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 get_update_info() {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update_info")%>', null, function(x, status) {
if ( x && x.status == 200 ) {
Expand Down
4 changes: 2 additions & 2 deletions luci-app-openclash/luasrc/view/openclash/update_config.htm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
function act_update_config_<%=idname%>(btn)
{
btn.disabled = true;
btn.value = '<%:Update%>';
btn.value = '<%:UpDate%>';
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash","update_config")%>',{filename: "<%=filename%>"}, function(x,status){});
btn.disabled = false;
return false;
Expand All @@ -20,7 +20,7 @@
<%
if display == "" then
%>
<input type="button" class="btn cbi-button cbi-input-reload" value="<%:Update%>" onclick="return act_update_config_<%=idname%>(this)" />
<input type="button" class="btn cbi-button cbi-input-reload" value="<%:UpDate%>" onclick="return act_update_config_<%=idname%>(this)" />
<%
end
%>
Expand Down
5 changes: 4 additions & 1 deletion luci-app-openclash/po/zh-cn/openclash.zh-cn.po
Original file line number Diff line number Diff line change
Expand Up @@ -3454,4 +3454,7 @@ msgid "Error: Network Anomaly, Suspend Unlock Detection..."
msgstr "错误:网络异常,暂停解锁检测..."

msgid "(Not Support mrs Format)"
msgstr "(不支持 mrs 格式)"
msgstr "(不支持 mrs 格式)"

msgid "UpDate"
msgstr "更新"

0 comments on commit 3c80969

Please sign in to comment.