Spacelord
3b1b4f3092
- Dark/White-mode support - Collapsible navs - Renamed items template. - StorageBuilding's are now StorageUnit's - Formatting, general cleanup, some bug fixing.
23 lines
791 B
JavaScript
23 lines
791 B
JavaScript
// Javascript to enable link to tab
|
|
// This magic js codes enables anchor links to work with bootstrap tabs
|
|
// Taken from https://stackoverflow.com/a/9393768/11317151 (and edited, like a lot)
|
|
|
|
// Also update on location change
|
|
window.addEventListener("hashchange", function() {
|
|
|
|
|
|
var hash = location.hash.replace(/^#/, ''); // ^ means starting, meaning only match the first hash
|
|
if (hash) {
|
|
bootstrap.Tab.getOrCreateInstance(document.querySelector('#' + hash)).show()
|
|
}
|
|
|
|
}, false);
|
|
var hash = location.hash.replace(/^#/, ''); // ^ means starting, meaning only match the first hash
|
|
if (hash) {
|
|
bootstrap.Tab.getOrCreateInstance(document.querySelector('#' + hash)).show()
|
|
}
|
|
|
|
// Change hash for page-reload
|
|
$('.nav-link').on('click', function (e) {
|
|
window.location.hash = e.target.id;
|
|
}) |