Skip to content

Commit ac462e1

Browse files
update 20220809
1 parent 4c27257 commit ac462e1

File tree

4 files changed

+26
-33
lines changed

4 files changed

+26
-33
lines changed

luci-theme-opentopd/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ THEME_NAME:=opentopd
99
THEME_TITLE:=opentopd Theme
1010

1111
PKG_NAME:=luci-theme-$(THEME_NAME)
12-
PKG_VERSION:=1.4.9
13-
PKG_RELEASE:=20220220
12+
PKG_VERSION:=1.5.0
13+
PKG_RELEASE:=20220809
1414

1515
include $(INCLUDE_DIR)/package.mk
1616

Loading

luci-theme-opentopd/htdocs/luci-static/opentopd/js/script.js

+8-22
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@
3434
var mainNodeName = undefined;
3535

3636
var nodeUrl = "";
37-
(function(node){
38-
if (node[0] == "admin"){
37+
(function (node) {
38+
if (node[0] == "admin") {
3939
luciLocation = [node[1], node[2]];
40-
}else{
40+
} else {
4141
luciLocation = node;
4242
}
4343

44-
for(var i in luciLocation){
44+
for (var i in luciLocation) {
4545
nodeUrl += luciLocation[i];
46-
if (i != luciLocation.length - 1){
46+
if (i != luciLocation.length - 1) {
4747
nodeUrl += "/";
4848
}
4949
}
@@ -59,24 +59,7 @@
5959
luciLocation = ["Main", "Login"];
6060
return true;
6161
}
62-
$(".main > .main-left > .nav > .slide > .active").next(".slide-menu").stop(true).slideUp("fast");
63-
$(".main > .main-left > .nav > .slide > .menu").removeClass("active");
64-
$(".main > .main-left > .nav > .slide > .menu").each(function () {
65-
var ulNode = $(this);
66-
ulNode.next().find("a").each(function () {
67-
var that = $(this);
68-
var href = that.attr("href");
6962

70-
if (href.indexOf(nodeUrl) != -1) {
71-
ulNode.click();
72-
ulNode.next(".slide-menu").stop(true, true);
73-
lastNode = that.parent();
74-
lastNode.addClass("active");
75-
ret = true;
76-
return true;
77-
}
78-
});
79-
});
8063
return ret;
8164
}
8265

@@ -102,6 +85,7 @@
10285

10386
return false;
10487
}
88+
10589
});
10690

10791
/**
@@ -143,6 +127,7 @@
143127
mainNodeName = "node-" + luciLocation[0] + "-" + luciLocation[1];
144128
mainNodeName = mainNodeName.replace(/[ \t\n\r\/]+/g, "_").toLowerCase();
145129
$("body").addClass(mainNodeName);
130+
146131
}
147132
$(".cbi-button-up").val("");
148133
$(".cbi-button-down").val("");
@@ -250,4 +235,5 @@
250235
break;
251236
}
252237
}
238+
253239
})(jQuery);

luci-theme-opentopd/luasrc/view/themes/opentopd/header.htm

+16-9
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
local node = disp.context.dispatched
3232

3333
local categories = disp.node_childs(tree)
34-
35-
34+
local currentNode = luci.dispatcher.context.path
3635
local c = tree
3736
local i, r
3837

@@ -107,16 +106,22 @@
107106
end
108107
end
109108

110-
local function render_submenu(prefix, node)
109+
local function render_submenu(prefix,parent, node)
111110
local childs = disp.node_childs(node)
112111
if #childs > 0 then
113-
write('<ul class="slide-menu">')
114-
112+
local active = (currentNode[2] == parent) and "active" or ""
113+
local display = (currentNode[2] == parent) and 'style="display: block;"' or ""
114+
115+
write('<ul class="slide-menu %s" %s>' %{
116+
active,
117+
display
118+
})
115119
for i, r in ipairs(childs) do
116120
local nnode = node.nodes[r]
117121
local title = pcdata(striptags(translate(nnode.title)))
118-
119-
write('<li><a data-title="%s" href="%s">%s</a></li>' %{
122+
local subactive = (currentNode[3] == r) and 'class="active"' or ""
123+
write('<li %s><a data-title="%s" href="%s">%s</a></li>' %{
124+
subactive,
120125
title,
121126
nodeurl(prefix, r, nnode.query),
122127
title
@@ -137,14 +142,16 @@
137142
local grandchildren = disp.node_childs(nnode)
138143

139144
if #grandchildren > 0 then
145+
local active = (currentNode[2] == r) and "active" or ""
140146
local title = pcdata(striptags(translate(nnode.title)))
141147
local en_title = pcdata(striptags(string.gsub(nnode.title," ","_")))
142-
write('<li class="slide"><a class="menu" data-title="%s" href="#">%s</a>' %{
148+
write('<li class="slide"><a class="menu %s" data-title="%s" href="#">%s</a>' %{
149+
active,
143150
en_title,
144151
title
145152
})
146153

147-
render_submenu(category .. "/" .. r, nnode)
154+
render_submenu(category .. "/" .. r,r, nnode)
148155
write('</li>')
149156
else
150157
local title = pcdata(striptags(translate(nnode.title)))

0 commit comments

Comments
 (0)