luci-theme-material: fix wrong active state on common prefix node
authorLiangbin Lian <jjm2473@gmail.com>
Wed, 21 Apr 2021 10:00:48 +0000 (18:00 +0800)
committerHannu Nyman <hannu.nyman@iki.fi>
Wed, 26 May 2021 07:09:05 +0000 (10:09 +0300)
Before fixed, if we have two nodes: 'services/ddns' and 'services/ddnsto',
click any one of they, will show they all actived.

Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
(cherry picked from commit 97d50d2c6b80805cd7e513eeafc8b62fef4ab1b6)

themes/luci-theme-material/htdocs/luci-static/material/js/script.js

index 1a5fce4e2db8ce43925128fd0acc006551b66c77..8ffb6b923fbe3a2494571cb8f851cf716867e49e 100755 (executable)
@@ -68,7 +68,7 @@ document.addEventListener('luci-loaded', function(ev) {
                                var that = $(this);
                                var href = that.attr("href");
 
-                               if (href.indexOf(nodeUrl) != -1) {
+                               if (href.endsWith(nodeUrl) || href.indexOf('/' + nodeUrl + '/') != -1) {
                                        ulNode.click();
                                        ulNode.next(".slide-menu").stop(true, true);
                                        lastNode = that.parent();