This commit is contained in:
Richard Mikloš 2024-02-05 21:24:11 +01:00
commit effbc5c726

@ -144,22 +144,24 @@ function logout() {
});
}
let links = document.querySelectorAll('.navsite_link, .navpage_link');
function initAjax() {
let links = document.querySelectorAll('.navsite_link, .navpage_link');
// Add click event listener to each link
links.forEach(function(link) {
link.addEventListener('click', function(e) {
e.preventDefault();
links.forEach(function (link) {
link.addEventListener('click', function (e) {
e.preventDefault();
// Get page and site information
let page = this.closest('.navpage_item').dataset.page;
let site = this.closest('.navsite_item').dataset.site;
// Get page and site information
let page = this.closest('.navpage_item').dataset.page;
let site = this.closest('.navsite_item').dataset.site;
if(site && page){
navigateTo(site, page);
}
if (site && page) {
navigateTo(site, page);
}
// You can use this information to update the URL or perform other actions
// You can use this information to update the URL or perform other actions
});
});
});
}
document.addEventListener('DOMContentLoaded', initAjax);