"use strict"; // Top-level tabs. Each benchmark is a self-contained static app in its own folder, // loaded in a same-origin iframe so its own CSS, JS and #hash tabs keep working unchanged. // Deep links: #tooldoc, #tooldoc:explorer, #tool-output, #ctt, #ctt:article, #about const APPS = { "tooldoc": "tooldoc/index.html", "tool-output": "tool-output/index.html", "ctt": "ctt/index.html" }; const frame = document.getElementById("app"); const about = document.getElementById("about"); function route() { const [app, sub] = (location.hash.slice(1) || "tooldoc").split(":"); const key = app in APPS || app === "about" ? app : "tooldoc"; document.querySelectorAll(".shell-tabs a").forEach((a) => a.setAttribute("aria-selected", a.dataset.app === key)); if (key === "about") { frame.hidden = true; about.hidden = false; return; } about.hidden = true; frame.hidden = false; let src = APPS[key]; if (key === "ctt" && sub === "article") src = "ctt/article.html"; else if (sub) src += "#" + sub; if (frame.getAttribute("src") !== src) frame.setAttribute("src", src); } window.addEventListener("hashchange", route); route();