PageSourceSearch

https://veza.com/wp-content/themes/veza/assets/js/tab-switcher-pagination.js?ver=1.5.0

js veza.com collected 2026-09-25 14:12:28 UTC 2,215 bytes, 87 lines download raw bytes

1function initializeTabPersistence() {
2	const pathname = window.location.pathname;
3	const storageKey = `activeTab_${pathname}`;
4
5	const validPathnames = ['/blog/', '/resources/', '/company/events/'];
6
7	function cleanupStorage() {
8		if (!validPathnames.includes(pathname)) {
9			for (let i = 0; i < localStorage.length; i++) {
10				const key = localStorage.key(i);
11				if (key && key.startsWith('activeTab_')) {
12					localStorage.removeItem(key);
13				}
14			}
15		}
16	}
17
18	cleanupStorage();
19
20	if (!validPathnames.includes(pathname)) {
21		return;
22	}
23
24	const tabButtons = document.querySelectorAll('.tab');
25	const tabPanel = document.querySelector('.tab-panel');
26
27	function saveActiveTab(tabId) {
28		localStorage.setItem(storageKey, tabId);
29	}
30
31	function restoreActiveTab() {
32		const savedTabId = localStorage.getItem(storageKey);
33		if (!savedTabId) return;
34
35		tabButtons.forEach((tab) => {
36			tab.classList.remove('active');
37			if (tab.getAttribute('data-tab-id') === savedTabId) {
38				tab.classList.add('active');
39			}
40		});
41
42		const selectElement = tabPanel.querySelector('.choices__input');
43		if (selectElement) {
44			selectElement.value = savedTabId;
45
46			const choicesText = tabPanel.querySelector(
47				'.choices__item--selectable'
48			);
49			if (choicesText) {
50				const selectedTab = Array.from(tabButtons).find(
51					(tab) => tab.getAttribute('data-tab-id') === savedTabId
52				);
53				if (selectedTab) {
54					choicesText.textContent = selectedTab.textContent.trim();
55				}
56			}
57		}
58
59		const tabContents = document.querySelectorAll(
60			'.wp-block-veza-blocks-vz-tab'
61		);
62		tabContents.forEach((content) => {
63			content.removeAttribute('data-status');
64			if (content.getAttribute('data-tab-id') === savedTabId) {
65				content.setAttribute('data-status', 'active');
66			}
67		});
68	}
69
70	tabButtons.forEach((tab) => {
71		tab.addEventListener('click', () => {
72			const tabId = tab.getAttribute('data-tab-id');
73			saveActiveTab(tabId);
74		});
75	});
76
77	const selectElement = tabPanel.querySelector('.choices__input');
78	if (selectElement) {
79		selectElement.addEventListener('change', (event) => {
80			saveActiveTab(event.target.value);
81		});
82	}
83
84	document.addEventListener('DOMContentLoaded', restoreActiveTab);
85}
86
87initializeTabPersistence();

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.