(function () { function switchTab(tabName, updateHash) { const tab = document.querySelector('.content-tab-bar__item[data-tab="' + tabName + '"]'); const content = document.getElementById('tab-' + tabName); if (!tab || !content) return; document.querySelectorAll('.content-tab-bar__item').forEach(function (item) { item.classList.toggle('active', item === tab); }); document.querySelectorAll('.sb-tab-content').forEach(function (item) { item.classList.toggle('active', item === content); }); if (updateHash) { history.replaceState(null, '', '#' + tabName); } } document.addEventListener('DOMContentLoaded', function () { document.querySelectorAll('.content-tab-bar__item[data-tab]').forEach(function (tab) { tab.addEventListener('click', function () { switchTab(tab.dataset.tab, true); }); }); const hash = window.location.hash.slice(1); if (hash) { switchTab(hash, false); } document.querySelectorAll('[data-confirm]').forEach(function (button) { button.addEventListener('click', function (event) { if (!window.confirm(button.dataset.confirm || 'Wirklich fortfahren?')) { event.preventDefault(); } }); }); document.querySelectorAll('[data-upload-form]').forEach(function (form) { form.addEventListener('submit', function () { form.classList.add('sb-uploading'); const button = form.querySelector('.sb-upload-button'); if (button) button.disabled = true; }); }); }); })();