mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-29 12:53:40 -04:00
feat(plugins): Refactor auto-hide functionality to leverage Bootstrap's tab management for improved visibility handling
This commit is contained in:
@@ -484,13 +484,10 @@ function autoHideEmptyTabs(counts, prefixes) {
|
||||
if ($activeLi.length === 0) {
|
||||
const $firstVisibleLi = $(`#tabs-location li:visible`).first();
|
||||
if ($firstVisibleLi.length) {
|
||||
$firstVisibleLi.addClass('active');
|
||||
const targetPrefix = $firstVisibleLi.find('a').attr('href')?.replace('#', '');
|
||||
if (targetPrefix) {
|
||||
$(`#tabs-content-location > #${targetPrefix}`).addClass('active');
|
||||
// Trigger shown.bs.tab so deferred DataTables initialize
|
||||
$firstVisibleLi.find('a').tab('show');
|
||||
}
|
||||
// Let Bootstrap's .tab('show') manage the active class on both
|
||||
// the <li> and the pane — adding it manually beforehand causes
|
||||
// Bootstrap to bail out early without firing shown.bs.tab.
|
||||
$firstVisibleLi.find('a').tab('show');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user