-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathoptions.js
executable file
·33 lines (30 loc) · 1.33 KB
/
options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { initializeEntriesTab } from './entries-tab.js';
import { initializeImport } from './import-tab.js';
import { initializePersonasTab } from './personas-tab.js';
import { initializeCookiesTab } from './cookies-tab.js';
import { initializeConfigTab } from './config-tab.js';
// Initialize all tabs when options page loads
document.addEventListener('DOMContentLoaded', () => {
initializeEntriesTab();
initializeImport();
initializePersonasTab();
initializeCookiesTab();
initializeConfigTab();
function changeTab() {
if (window.location.hash && window.location.hash !== document.querySelector('a.nav-link.active').id) {
console.log('Changing tab based on URL hash:', window.location.hash, `a.nav-link${window.location.hash}`, document.querySelector(`a.nav-link${window.location.hash}`));
// document.querySelector(`a.nav-link${window.location.hash}`).click();
}
}
// changeTab();
window.addEventListener('hashchange', changeTab);
var tabEls = document.querySelectorAll('a.nav-link[data-bs-toggle="tab"]')
for (const tabEl of tabEls) {
tabEl.addEventListener('shown.bs.tab', function (event) {
console.log('ArchiveBox tab switched to:', event.target);
event.target // newly activated tab
event.relatedTarget // previous active tab
// window.location.hash = event.target.id;
})
}
});