Settings: Possibility to navigate tabs through link

This commit is contained in:
slawkens
2026-01-31 19:26:35 +01:00
parent 8d78e7090d
commit 7a113ee72a
2 changed files with 33 additions and 2 deletions

View File

@@ -165,3 +165,31 @@
{% endif %}
{% endfor %}
</script>
<script>
$(function () {
if ($('.tab-content').length) {
let url = window.location.href;
let activeTab = url.substring(url.indexOf("#") + 1);
let $selector = $('[href="#' + activeTab + '"]')
if ($selector.length) {
$selector.tab('show');
}
}
let url = location.href.replace(/\/$/, "");
$('a[data-toggle="tab"]').on("click", function() {
let newUrl;
const hash = $(this).attr("href");
if(hash === "#home") {
newUrl = url.split("#")[0];
} else {
newUrl = url.split("#")[0] + hash;
}
history.replaceState(null, null, newUrl);
});
});
</script>