Beauty fix for URLs

This commit is contained in:
Kumi 2019-02-02 12:14:12 +00:00
parent ff17fb284f
commit a3679d4f99

View file

@ -74,6 +74,9 @@ function showdevices() {
$("#linkdevices").css("font-weight", "bold"); $("#linkdevices").css("font-weight", "bold");
$("#linkwifi").css("font-weight", "normal"); $("#linkwifi").css("font-weight", "normal");
$("#linkusers").css("font-weight", "normal"); $("#linkusers").css("font-weight", "normal");
window.history.pushState("", "", "/devices/");
return false;
}; };
function showwifi() { function showwifi() {
@ -84,6 +87,9 @@ function showwifi() {
$("#linkdevices").css("font-weight", "normal"); $("#linkdevices").css("font-weight", "normal");
$("#linkwifi").css("font-weight", "bold"); $("#linkwifi").css("font-weight", "bold");
$("#linkusers").css("font-weight", "normal"); $("#linkusers").css("font-weight", "normal");
window.history.pushState("", "", "/wifi/");
return false;
}; };
function showusers() { function showusers() {
@ -94,10 +100,12 @@ function showusers() {
$("#linkdevices").css("font-weight", "normal"); $("#linkdevices").css("font-weight", "normal");
$("#linkwifi").css("font-weight", "normal"); $("#linkwifi").css("font-weight", "normal");
$("#linkusers").css("font-weight", "bold"); $("#linkusers").css("font-weight", "bold");
window.history.pushState("", "", "/users/");
return false;
}; };
var page = document.location.pathname.substring(1, document.location.pathname.lastIndexOf('/')); var page = document.location.pathname.substring(1, document.location.pathname.lastIndexOf('/'));
console.log(page)
if (page == "users") showusers(); if (page == "users") showusers();
else if (page == "wifi") showwifi(); else if (page == "wifi") showwifi();
else showdevices(); else showdevices();