// The front page: theme toggle and the download section's // "your system" highlight. The download buttons themselves are repointed at the newest release by // _static/jfjoch_downloads.js, shared with the Sphinx download pages. (function () { // ---- theme: follows the system until the toggle is used, then remembered ----------------- var root = document.documentElement; var toggle = document.querySelector(".theme-toggle"); function isDark() { var set = root.getAttribute("data-theme"); if (set) return set === "dark"; return window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches; } if (toggle) toggle.addEventListener("click", function () { var next = isDark() ? "light" : "dark"; root.setAttribute("data-theme", next); try { localStorage.setItem("jfj-theme", next); } catch (e) {} }); // ---- "your system": highlight the platform the browser runs on ---------------------------- var ua = navigator.userAgent || "", platform = navigator.platform || ""; var os = /Windows/.test(ua) ? "windows" : /Mac/.test(platform) || /Macintosh/.test(ua) ? "macos" : /Linux|X11/.test(platform + ua) && !/Android/.test(ua) ? "linux" : null; if (os) { document.querySelectorAll('.jfj-dl__card[data-platform="' + os + '"]').forEach(function (c) { c.classList.add("is-yours"); }); var note = document.querySelector("[data-os-note]"); var names = { windows: "Windows", macos: "macOS", linux: "Linux" }; if (note) note.textContent = "The " + names[os] + " builds are marked for you."; } })();