feat(panel.html): use ?query instead of #hash for client selection

This commit is contained in:
2026-03-09 21:19:05 +01:00
parent 11bf344cb5
commit 78f9508753

View File

@@ -33,11 +33,12 @@
});
};
// load client_details for the client specified in the URL hash
const hash = window.location.hash;
if (hash) {
const clientId = hash.substring(1);
// load client_details for the client specified in the URL
const urlParams = new URLSearchParams(window.location.search);
const clientId = urlParams.get("client");
if (clientId) {
loadClientDetails(clientId);
$(`#client-list a[href="?client=${clientId}"]`).addClass("active");
}
$("#notify").hide();
@@ -141,7 +142,7 @@
li.append(iconElement);
const a = $("<a></a>")
.text(statusText)
.attr("href", `#${clientId}`);
.attr("href", `?client=${clientId}`);
li.attr(
"title",
@@ -164,19 +165,19 @@
$("#client-list li > a")
.off("click")
.on("click", function (e) {
const href = $(this).attr("href");
if (href.startsWith("#")) {
const clientId = href.substring(1);
loadClientDetails(clientId);
$("#client-list li > a").removeClass("active");
$(this).addClass("active");
}
});
let clientId = $(this).attr("href").substring(1);
// this is client=clientId
clientId = clientId.replace("client=", "");
if (window.location.hash) {
const clientId = window.location.hash.substring(1);
loadClientDetails(clientId);
}
$("#client-list a").removeClass("active");
$(this).addClass("active");
e.preventDefault();
let newUrl = `${window.location.pathname}?client=${clientId}`;
window.history.pushState({ path: newUrl }, "", newUrl);
});
});
});
</script>