assetflow/static/js/editStorages.js
Spacelord 3569c9ed4b Updated styles and Added storageManager.
- Dark/White-mode support
- Collapsible navs
- Renamed items template.
- StorageBuilding's are now StorageUnit's
- Formatting, general cleanup, some bug fixing.
2023-05-13 00:06:35 +02:00

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;
})