From: Liangbin Lian Date: Wed, 21 Apr 2021 10:00:48 +0000 (+0800) Subject: luci-theme-material: fix wrong active state on common prefix node X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=97d50d2c6b80805cd7e513eeafc8b62fef4ab1b6;p=openwrt-luci.git luci-theme-material: fix wrong active state on common prefix node 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 --- diff --git a/themes/luci-theme-material/htdocs/luci-static/material/js/script.js b/themes/luci-theme-material/htdocs/luci-static/material/js/script.js index 1a5fce4e2d..8ffb6b923f 100755 --- a/themes/luci-theme-material/htdocs/luci-static/material/js/script.js +++ b/themes/luci-theme-material/htdocs/luci-static/material/js/script.js @@ -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();