contentpanel - Aushangworkflow um docx Vorlage erweitern
This commit is contained in:
@@ -1,47 +1,23 @@
|
||||
(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;
|
||||
});
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const tabs = [...document.querySelectorAll('.content-tab-bar__item[data-tab]')];
|
||||
const panels = [...document.querySelectorAll('.sb-tab-content')];
|
||||
function showTab(name) {
|
||||
if (!tabs.some(tab => tab.dataset.tab === name)) return;
|
||||
tabs.forEach(tab => tab.classList.toggle('active', tab.dataset.tab === name));
|
||||
panels.forEach(panel => panel.classList.toggle('active', panel.id === 'tab-' + name));
|
||||
history.replaceState(null, '', '#' + name);
|
||||
}
|
||||
tabs.forEach(tab => tab.addEventListener('click', () => showTab(tab.dataset.tab)));
|
||||
showTab(location.hash.slice(1));
|
||||
document.querySelectorAll('[data-confirm]').forEach(button => {
|
||||
button.addEventListener('click', event => {
|
||||
if (!confirm(button.dataset.confirm)) event.preventDefault();
|
||||
});
|
||||
});
|
||||
document.querySelectorAll('[data-upload-form]').forEach(form => {
|
||||
form.addEventListener('submit', () => {
|
||||
form.classList.add('sb-uploading');
|
||||
form.querySelector('[type="submit"]').disabled = true;
|
||||
});
|
||||
});
|
||||
})();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user