mirror of
https://github.com/derisamedia/luci-theme-alpha.git
synced 2025-01-03 00:38:00 +08:00
luci-app-alpha-config: Update footer.htm for alpha config v2.1
This commit is contained in:
parent
8101f32ef8
commit
265e6d546e
@ -20,39 +20,45 @@
|
||||
<%
|
||||
local ver = require "luci.version"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local config = uci:get_all("alpha", "config")
|
||||
local icon = {
|
||||
['/cgi-bin/luci/admin/status/overview'] = '/gaya/icon/navbar/status.png',
|
||||
['/cgi-bin/luci/admin/services/ttyd'] = '/gaya/icon/navbar/terminal.png',
|
||||
['/cgi-bin/luci/admin/services/openclash'] = '/gaya/icon/navbar/oc.png',
|
||||
['/cgi-bin/luci/admin/nas/tinyfm'] = '/gaya/icon/navbar/nas.png',
|
||||
['/cgi-bin/luci/admin/modem/main'] = '/gaya/icon/navbar/modem.png',
|
||||
['/cgi-bin/luci/admin/network/network'] = '/gaya/icon/navbar/interface.png',
|
||||
['/cgi-bin/luci/admin/services/neko'] = '/gaya/icon/navbar/neko.png'
|
||||
}
|
||||
local config = uci:get_all("alpha", "theme")
|
||||
|
||||
local function getLink(nav)
|
||||
local link = config[nav]
|
||||
return (link and link ~= "none") and link or nil
|
||||
end
|
||||
-- Table to store navbar icons
|
||||
local icon = {}
|
||||
|
||||
-- Iterate through all navbar entries
|
||||
uci:foreach("alpha", "navbar", function(section)
|
||||
local address = section.address
|
||||
local icon_url = section.icon
|
||||
|
||||
if address and icon_url then
|
||||
-- Remove '/www/luci-static/alpha/' from icon_url
|
||||
icon_url = string.gsub(icon_url, "^/www/luci%-static/alpha/", "")
|
||||
icon[address] = icon_url
|
||||
end
|
||||
end)
|
||||
|
||||
-- Check navbar enable status
|
||||
local navbar_enabled = config.navbar == "1"
|
||||
|
||||
-- Calculate number of enabled navbar links
|
||||
local num_links = 0
|
||||
for i = 1, 6 do
|
||||
local nav_key = 'nav_0' .. i
|
||||
local link = getLink(nav_key)
|
||||
if link then
|
||||
uci:foreach("alpha", "navbar", function(section)
|
||||
if section.enable == "Enable" then
|
||||
num_links = num_links + 1
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Calculate link width for responsive design
|
||||
local link_width = string.format("calc(100%% / %d)", num_links)
|
||||
local blur_value = tonumber(config.blur)
|
||||
|
||||
-- Retrieve theme properties
|
||||
local background_color = config.color or '#2222359a'
|
||||
local blur_value = tonumber(config.blur) or 20
|
||||
local link_blur = string.format("blur(%dpx)", blur_value)
|
||||
local background_color = config.color
|
||||
%>
|
||||
|
||||
<style>
|
||||
.main>.main-left, .cbi-section, .cbi-section-error, #iptables, .Firewall form, #cbi-network>.cbi-section-node, #cbi-wireless>.cbi-section-node, #cbi-wireless>#wifi_assoclist_table, [data-tab-title], [data-page^="admin-system-admin"]:not(.node-main-login) .cbi-map:not(#cbi-dropbear), [data-page="admin-system-opkg"] #maincontent>.container, .tabs, .cbi-tabmenu, .cbi-tooltip {
|
||||
.main > .main-left, .cbi-section, .cbi-section-error, #iptables, .Firewall form, #cbi-network > .cbi-section-node, #cbi-wireless > .cbi-section-node, #cbi-wireless > #wifi_assoclist_table, [data-tab-title], [data-page^="admin-system-admin"]:not(.node-main-login) .cbi-map:not(#cbi-dropbear), [data-page="admin-system-opkg"] #maincontent > .container, .tabs, .cbi-tabmenu, .cbi-tooltip {
|
||||
background-color: <%=background_color%>;
|
||||
backdrop-filter: <%=link_blur%>;
|
||||
-webkit-backdrop-filter: <%=link_blur%>;
|
||||
@ -63,6 +69,12 @@ local background_color = config.color
|
||||
width: <%=link_width%>;
|
||||
}
|
||||
}
|
||||
|
||||
<% if not navbar_enabled then %>
|
||||
.navbar {
|
||||
display: none;
|
||||
}
|
||||
<% end %>
|
||||
</style>
|
||||
|
||||
</div>
|
||||
@ -71,17 +83,25 @@ local background_color = config.color
|
||||
</footer>
|
||||
</div>
|
||||
<div class="navbar active">
|
||||
<% if navbar_enabled then %>
|
||||
<div class="dropdown">
|
||||
<% for i = 1, 6 do
|
||||
local nav_key = 'nav_0' .. i
|
||||
local link = getLink(nav_key)
|
||||
if link then %>
|
||||
<a href="<%=link%>">
|
||||
<img src="<%=media%><%=icon[link]%>" />
|
||||
</a>
|
||||
<% end
|
||||
end %>
|
||||
<%
|
||||
uci:foreach("alpha", "navbar", function(section)
|
||||
local address = section.address
|
||||
local icon_url = icon[address] or 'default/icon.png'
|
||||
local target_blank = section.newtab == "Yes" and 'target="_blank"' or ''
|
||||
|
||||
if section.enable == "Enable" then
|
||||
%>
|
||||
<a href="<%=address%>" <%=target_blank%>>
|
||||
<img src="<%=media%>/<%=icon_url%>" />
|
||||
</a>
|
||||
<%
|
||||
end
|
||||
end)
|
||||
%>
|
||||
</div>
|
||||
<% end %>
|
||||
<label class="toggler">
|
||||
<img src="<%=media%>/gaya/icon/arrow.svg">
|
||||
</label>
|
||||
@ -93,8 +113,7 @@ local background_color = config.color
|
||||
window.addEventListener("scroll", () => {
|
||||
if (lastScrollY < window.scrollY) {
|
||||
nav.classList.add("navbar--hidden");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
nav.classList.remove("navbar--hidden");
|
||||
}
|
||||
lastScrollY = window.scrollY;
|
||||
|
Loading…
Reference in New Issue
Block a user