mirror of
https://github.com/derisamedia/luci-theme-alpha.git
synced 2025-01-05 10:16:56 +08:00
luci-app-alpha-config: Migration for navbar
This commit is contained in:
parent
9d9d94e6fc
commit
40350a9c91
@ -17,49 +17,62 @@
|
||||
|
||||
Licensed to the public under the Apache License 2.0
|
||||
-%>
|
||||
<%
|
||||
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'
|
||||
}
|
||||
|
||||
<% local ver = require "luci.version" %>
|
||||
</div>
|
||||
|
||||
local function getLink(nav)
|
||||
local link = config[nav]
|
||||
return (link ~= "none") and link or nil
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
<footer class="mobile">
|
||||
<a href="https://github.com/derisamedia/luci-theme-alpha"><%= ver.luciname %> | <%= ver.luciversion %> | Alpha OS Theme v3.9</a>
|
||||
<a href="https://github.com/derisamedia/luci-theme-alpha"><%=ver.luciname%> | <%=ver.luciversion%> | Alpha OS Theme v3.9</a>
|
||||
</footer>
|
||||
</div>
|
||||
<div class="navbar active">
|
||||
<div class="dropdown">
|
||||
|
||||
<a href="/cgi-bin/luci/admin/status/overview"><img src="<%=media%>/gaya/icon/navbar/status.png" /></a>
|
||||
<a href="/cgi-bin/luci/admin/services/ttyd"><img src="<%=media%>/gaya/icon/navbar/terminal.png" /></a>
|
||||
<a href="/cgi-bin/luci/admin/services/openclash"><img src="<%=media%>/gaya/icon/navbar/oc.png" /></a>
|
||||
<a href="/cgi-bin/luci/admin/nas/tinyfm"><img src="<%=media%>/gaya/icon/navbar/nas.png" /></a>
|
||||
<a href="/cgi-bin/luci/admin/modem/main"><img src="<%=media%>/gaya/icon/navbar/modem.png" /></a>
|
||||
<a href="/cgi-bin/luci/admin/network/network"><img src="<%=media%>/gaya/icon/navbar/interface.png" /></a>
|
||||
|
||||
</div>
|
||||
<label class="toggler">
|
||||
<img src="<%=media%>/gaya/icon/arrow.svg" alt="">
|
||||
<% 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 %>
|
||||
</div>
|
||||
<label class="toggler">
|
||||
<img src="<%=media%>/gaya/icon/arrow.svg">
|
||||
</label>
|
||||
</div>
|
||||
<script>
|
||||
</div>
|
||||
<script>
|
||||
{
|
||||
const nav = document.querySelector(".navbar");
|
||||
let lastScrollY = window.scrollY;
|
||||
|
||||
window.addEventListener("scroll", () => {
|
||||
if (lastScrollY < window.scrollY) {
|
||||
nav.classList.add("navbar--hidden");
|
||||
} else {
|
||||
nav.classList.remove("navbar--hidden");
|
||||
}
|
||||
|
||||
lastScrollY = window.scrollY;
|
||||
});
|
||||
}
|
||||
const nav = document.querySelector(".navbar");
|
||||
let lastScrollY = window.scrollY;
|
||||
window.addEventListener("scroll", () => {
|
||||
if (lastScrollY < window.scrollY) {
|
||||
nav.classList.add("navbar--hidden");
|
||||
}
|
||||
else {
|
||||
nav.classList.remove("navbar--hidden");
|
||||
}
|
||||
lastScrollY = window.scrollY;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">L.require('menu-alpha')</script>
|
||||
<script src="<%=media%>/app.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user