34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
// SvxPortal — web front-end for SvxReflector
|
|
// Copyright (C) 2026 SA7AUX (Björn)
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify it under
|
|
// the terms of the GNU Affero General Public License as published by the Free
|
|
// Software Foundation, either version 3 of the License, or (at your option) any
|
|
// later version. See the LICENSE file for details.
|
|
|
|
'use strict';
|
|
|
|
// Tab switching for help.html. Deep-linkable: #build, #setup, #admin, #portal.
|
|
(function(){
|
|
const tabs = document.getElementById('helpTabs');
|
|
if (!tabs) return;
|
|
|
|
function show(name){
|
|
document.querySelectorAll('.tab-section').forEach(s =>
|
|
s.classList.toggle('d-none', s.id !== 'tab-' + name));
|
|
tabs.querySelectorAll('button').forEach(b =>
|
|
b.classList.toggle('active', b.dataset.tab === name));
|
|
}
|
|
|
|
tabs.addEventListener('click', e => {
|
|
const b = e.target.closest('button[data-tab]');
|
|
if (!b) return;
|
|
show(b.dataset.tab);
|
|
history.replaceState(null, '', '#' + b.dataset.tab);
|
|
});
|
|
|
|
const h = location.hash.replace('#', '');
|
|
if (h && document.getElementById('tab-' + h)) show(h);
|
|
})();
|