Spaces:
Running
Running
File size: 2,171 Bytes
0d2d822 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | (function () {
"use strict";
var TABS = ["overview", "results", "explorer"];
function activate(tab, sub) {
if (TABS.indexOf(tab) === -1) tab = "overview";
document.querySelectorAll(".tab-btn").forEach(function (b) { b.classList.toggle("active", b.dataset.tab === tab); });
document.querySelectorAll(".tab-panel").forEach(function (p) { p.classList.toggle("active", p.id === "tab-" + tab); });
if (tab === "results") window.renderResults();
if (tab === "explorer") window.openExplorer(sub);
}
function fromHash() {
var h = (location.hash || "#overview").slice(1).split("/");
activate(h[0], h[1]);
}
document.querySelectorAll(".tab-btn").forEach(function (b) {
b.addEventListener("click", function () {
history.pushState(null, "", "#" + b.dataset.tab);
activate(b.dataset.tab);
window.scrollTo({ top: 0 });
});
});
window.addEventListener("hashchange", function () { fromHash(); window.scrollTo({ top: 0 }); });
// BibTeX modal + copy buttons
var modal = document.getElementById("bibtexModal");
document.getElementById("bibtexModalCode").textContent = document.getElementById("bibtex").textContent;
document.querySelectorAll("[data-open-bibtex]").forEach(function (b) { b.addEventListener("click", function () { modal.classList.add("open"); }); });
document.querySelectorAll("[data-close-bibtex]").forEach(function (b) { b.addEventListener("click", function () { modal.classList.remove("open"); }); });
modal.addEventListener("click", function (e) { if (e.target === modal) modal.classList.remove("open"); });
document.addEventListener("keydown", function (e) { if (e.key === "Escape") modal.classList.remove("open"); });
document.querySelectorAll("[data-copy]").forEach(function (b) {
b.addEventListener("click", function () {
var text = document.getElementById(b.dataset.copy).textContent;
var done = function () { b.textContent = "Copied!"; setTimeout(function () { b.textContent = "Copy"; }, 1600); };
if (navigator.clipboard) navigator.clipboard.writeText(text).then(done, function () {});
});
});
window.renderSetupTable();
fromHash();
})();
|