PageSourceSearch

https://franklincountyva.gov/static/Directory/js/directory-tabs.js

js franklincountyva.gov collected 2026-10-03 17:35:04 UTC 1,395 bytes, 44 lines download raw bytes

1(function () {
2    const storageKey = 'directory.activeTab';
3
4    function showTab(tabName) {
5        const btn = document.querySelector(tabName === 'people' ? '#nav-people-tab' : '#nav-categories-tab');
6        if (!btn || !window.bootstrap?.Tab) return;
7
8        const tab = window.bootstrap.Tab.getOrCreateInstance(btn);
9        tab.show();
10    }
11
12    function getSavedTab() {
13        try { return localStorage.getItem(storageKey); } catch { return null; }
14    }
15
16    function applySavedTab() {
17        setTimeout(function () {
18            const tab = getSavedTab();
19            if (tab === 'people' || tab === 'categories') {
20                showTab(tab);
21            }
22        }, 50);
23    }
24
25    // Persist whenever user changes tabs
26    document.addEventListener('shown.bs.tab', function (e) {
27        const tab = e.target?.getAttribute('data-tab');
28        if (!tab) return;
29        try { localStorage.setItem(storageKey, tab); } catch { }
30    });
31
32    // Re-apply after any HTMX swap that updates the directory content
33    document.addEventListener('htmx:afterSwap', function (e) {
34        const target = e.detail?.target;
35        if (!target || target.id !== 'main-wrapper') return;
36        applySavedTab();
37    });
38    
39    if (document.readyState === 'loading') {
40        document.addEventListener('DOMContentLoaded', applySavedTab);
41    } else {
42        applySavedTab();
43    }
44})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.