Unverified Commit a2769032 authored by Harry Mellor's avatar Harry Mellor Committed by GitHub
Browse files

Set `?device={device}` when changing tab in installation guides (#12560)


Signed-off-by: default avatarHarry Mellor <19981378+hmellor@users.noreply.github.com>
parent f17f1d46
// Add RunLLM widget
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
var script = document.createElement("script"); var script = document.createElement("script");
script.type = "module"; script.type = "module";
...@@ -15,4 +16,23 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -15,4 +16,23 @@ document.addEventListener("DOMContentLoaded", function () {
script.async = true; script.async = true;
document.head.appendChild(script); document.head.appendChild(script);
}); });
\ No newline at end of file
// Update URL search params when tab is clicked
document.addEventListener("DOMContentLoaded", function () {
const tabs = document.querySelectorAll(".sd-tab-label");
function updateURL(tab) {
const syncGroup = tab.getAttribute("data-sync-group");
const syncId = tab.getAttribute("data-sync-id");
if (syncGroup && syncId) {
const url = new URL(window.location);
url.searchParams.set(syncGroup, syncId);
window.history.replaceState(null, "", url);
}
}
tabs.forEach(tab => {
tab.addEventListener("click", () => updateURL(tab));
});
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment