luci-theme-material: fix wrong active state on common prefix node 5000/head
authorLiangbin Lian <jjm2473@gmail.com>
Wed, 21 Apr 2021 10:00:48 +0000 (18:00 +0800)
committerLiangbin Lian <jjm2473@gmail.com>
Wed, 21 Apr 2021 10:00:48 +0000 (18:00 +0800)
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>
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();