Skip to content

Commit

Permalink
fix: sidebar active menu
Browse files Browse the repository at this point in the history
  • Loading branch information
sunuazizrahayu committed Nov 26, 2024
1 parent 15cc10e commit bd60cc9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions files/www/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,12 @@ class="navbar-brand"
<a href="#clash" onclick="loadIframe('http://<?php echo $host; ?>:9090/ui/?hostname=<?php echo $host; ?>#/proxies')">
<i class="fas fa-home"></i>
<p>Clash Dashboard</p>
<span class="badge badge-secondary">1</span>
</a>
</li>
<li class="nav-item">
<a href="#sysinfo" onclick="loadIframe('/tools/sysinfo.php')">
<i class="fas fa-cogs"></i>
<p>System Info</p>
<span class="badge badge-secondary"></span>
</a>
</li>

Expand Down Expand Up @@ -381,10 +379,15 @@ function loadIframe(url) {
var hash = document.URL.substr(document.URL.indexOf('#')+1);
let url = '/tools/sysinfo.php';

//remove last submenu
$('.sidebar-content a').click(function() {
$('.sidebar-content li.nav-item').removeClass('submenu');
})

$('#iframe').removeClass('d-none');
if (hash != '') {
console.log('open menu '+hash)
$('.sidebar-content a[href*="#'+hash+'"]').click();
$('.sidebar-content a[href*="#'+hash+'"]').click().parent().addClass('submenu');
}
})
</script>
Expand Down

0 comments on commit bd60cc9

Please sign in to comment.