Skip to content

Commit

Permalink
Set ?device={device} when changing tab in installation guides (vllm…
Browse files Browse the repository at this point in the history
…-project#12560)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
  • Loading branch information
hmellor authored and NickLucche committed Feb 7, 2025
1 parent e590f9c commit a6d053c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion docs/source/_static/custom.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Add RunLLM widget
document.addEventListener("DOMContentLoaded", function () {
var script = document.createElement("script");
script.type = "module";
Expand All @@ -15,4 +16,23 @@ document.addEventListener("DOMContentLoaded", function () {

script.async = true;
document.head.appendChild(script);
});
});

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

0 comments on commit a6d053c

Please sign in to comment.