Files
dgtlmoon afc64ea96a
Some checks failed
Build and push containers / metadata (push) Has been cancelled
Build and push containers / build-push-containers (push) Has been cancelled
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Build distribution 📦 (push) Has been cancelled
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Test the built package works basically. (push) Has been cancelled
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Publish Python 🐍 distribution 📦 to PyPI (push) Has been cancelled
ChangeDetection.io App Test / lint-code (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-10 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-11 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-12 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-13 (push) Has been cancelled
Layout css (#3702)
* Adding test sidebar

* Fixing mobile mobile menu and adding action menu

* Adding toast

* Adding toast libraries

* Fix styling

* More styling improvements

* Improving translations

* More translation improvements

* More translation updates
2026-01-03 14:47:26 +01:00

49 lines
1.4 KiB
JavaScript

// Rewrite this is a plugin.. is all this JS really 'worth it?'
window.addEventListener('hashchange', function () {
// Only remove active from tab elements, not menu items
var tabs = document.querySelectorAll('.tabs li.active');
tabs.forEach(function(tab) {
tab.classList.remove('active');
});
document.body.classList.remove('full-width');
set_active_tab();
}, false);
var has_errors = document.querySelectorAll(".messages .error");
if (!has_errors.length) {
if (document.location.hash == "") {
location.replace(document.querySelector(".tabs ul li:first-child a").hash);
} else {
set_active_tab();
}
} else {
focus_error_tab();
}
function set_active_tab() {
document.body.classList.remove('full-width');
var tab = document.querySelectorAll(".tabs a[href='" + location.hash + "']");
if (tab.length) {
tab[0].parentElement.classList.add("active");
}
}
function focus_error_tab() {
// time to use jquery or vuejs really,
// activate the tab with the error
var tabs = document.querySelectorAll('.tabs li a'), i;
for (i = 0; i < tabs.length; ++i) {
var tab_name = tabs[i].hash.replace('#', '');
var pane_errors = document.querySelectorAll('#' + tab_name + ' .error')
if (pane_errors.length) {
document.location.hash = '#' + tab_name;
return true;
}
}
return false;
}