|
36 | 36 | <script src="/site_libs/quarto-html/tippy.umd.min.js"></script>
|
37 | 37 | <script src="/site_libs/quarto-html/anchor.min.js"></script>
|
38 | 38 | <link href="/site_libs/quarto-html/tippy.css" rel="stylesheet">
|
39 |
| -<link href="/site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles"> |
| 39 | +<link href="/site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-text-highlighting-styles"> |
| 40 | +<link href="/site_libs/quarto-html/quarto-syntax-highlighting-dark.css" rel="prefetch" class="quarto-color-scheme quarto-color-alternate" id="quarto-text-highlighting-styles"> |
40 | 41 | <script src="/site_libs/bootstrap/bootstrap.min.js"></script>
|
41 | 42 | <link href="/site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
|
42 |
| -<link href="/site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light"> |
| 43 | +<link href="/site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-bootstrap" data-mode="light"> |
| 44 | +<link href="/site_libs/bootstrap/bootstrap-dark.min.css" rel="prefetch" class="quarto-color-scheme quarto-color-alternate" id="quarto-bootstrap" data-mode="dark"> |
43 | 45 | <script id="quarto-search-options" type="application/json">{
|
44 | 46 | "location": "navbar",
|
45 | 47 | "copy-button": false,
|
|
114 | 116 | </li>
|
115 | 117 | </ul>
|
116 | 118 | </div> <!-- /navcollapse -->
|
117 |
| - <div class="quarto-navbar-tools"> |
| 119 | + <div class="quarto-navbar-tools tools-wide"> |
118 | 120 | <a href="https://x.com/TuringLang" title="Turing Twitter" class="quarto-navigation-tool px-1" aria-label="Turing Twitter"><i class="bi bi-twitter"></i></a>
|
119 | 121 | <a href="https://github.com/TuringLang/Turing.jl" title="Turing GitHub" class="quarto-navigation-tool px-1" aria-label="Turing GitHub"><i class="bi bi-github"></i></a>
|
| 122 | + <a href="" class="quarto-color-scheme-toggle quarto-navigation-tool px-1" onclick="window.quartoToggleColorScheme(); return false;" title="Toggle dark mode"><i class="bi"></i></a> |
120 | 123 | </div>
|
121 | 124 | </div> <!-- /container-fluid -->
|
122 | 125 | </nav>
|
@@ -176,6 +179,150 @@ <h1 class="title">Page Not Found</h1>
|
176 | 179 | }
|
177 | 180 | }
|
178 | 181 | toggleBodyColorPrimary();
|
| 182 | + const disableStylesheet = (stylesheets) => { |
| 183 | + for (let i=0; i < stylesheets.length; i++) { |
| 184 | + const stylesheet = stylesheets[i]; |
| 185 | + stylesheet.rel = 'prefetch'; |
| 186 | + } |
| 187 | + } |
| 188 | + const enableStylesheet = (stylesheets) => { |
| 189 | + for (let i=0; i < stylesheets.length; i++) { |
| 190 | + const stylesheet = stylesheets[i]; |
| 191 | + stylesheet.rel = 'stylesheet'; |
| 192 | + } |
| 193 | + } |
| 194 | + const manageTransitions = (selector, allowTransitions) => { |
| 195 | + const els = window.document.querySelectorAll(selector); |
| 196 | + for (let i=0; i < els.length; i++) { |
| 197 | + const el = els[i]; |
| 198 | + if (allowTransitions) { |
| 199 | + el.classList.remove('notransition'); |
| 200 | + } else { |
| 201 | + el.classList.add('notransition'); |
| 202 | + } |
| 203 | + } |
| 204 | + } |
| 205 | + const toggleGiscusIfUsed = (isAlternate, darkModeDefault) => { |
| 206 | + const baseTheme = document.querySelector('#giscus-base-theme')?.value ?? 'light'; |
| 207 | + const alternateTheme = document.querySelector('#giscus-alt-theme')?.value ?? 'dark'; |
| 208 | + let newTheme = ''; |
| 209 | + if(darkModeDefault) { |
| 210 | + newTheme = isAlternate ? baseTheme : alternateTheme; |
| 211 | + } else { |
| 212 | + newTheme = isAlternate ? alternateTheme : baseTheme; |
| 213 | + } |
| 214 | + const changeGiscusTheme = () => { |
| 215 | + // From: https://github.com/giscus/giscus/issues/336 |
| 216 | + const sendMessage = (message) => { |
| 217 | + const iframe = document.querySelector('iframe.giscus-frame'); |
| 218 | + if (!iframe) return; |
| 219 | + iframe.contentWindow.postMessage({ giscus: message }, 'https://giscus.app'); |
| 220 | + } |
| 221 | + sendMessage({ |
| 222 | + setConfig: { |
| 223 | + theme: newTheme |
| 224 | + } |
| 225 | + }); |
| 226 | + } |
| 227 | + const isGiscussLoaded = window.document.querySelector('iframe.giscus-frame') !== null; |
| 228 | + if (isGiscussLoaded) { |
| 229 | + changeGiscusTheme(); |
| 230 | + } |
| 231 | + } |
| 232 | + const toggleColorMode = (alternate) => { |
| 233 | + // Switch the stylesheets |
| 234 | + const alternateStylesheets = window.document.querySelectorAll('link.quarto-color-scheme.quarto-color-alternate'); |
| 235 | + manageTransitions('#quarto-margin-sidebar .nav-link', false); |
| 236 | + if (alternate) { |
| 237 | + enableStylesheet(alternateStylesheets); |
| 238 | + for (const sheetNode of alternateStylesheets) { |
| 239 | + if (sheetNode.id === "quarto-bootstrap") { |
| 240 | + toggleBodyColorMode(sheetNode); |
| 241 | + } |
| 242 | + } |
| 243 | + } else { |
| 244 | + disableStylesheet(alternateStylesheets); |
| 245 | + toggleBodyColorPrimary(); |
| 246 | + } |
| 247 | + manageTransitions('#quarto-margin-sidebar .nav-link', true); |
| 248 | + // Switch the toggles |
| 249 | + const toggles = window.document.querySelectorAll('.quarto-color-scheme-toggle'); |
| 250 | + for (let i=0; i < toggles.length; i++) { |
| 251 | + const toggle = toggles[i]; |
| 252 | + if (toggle) { |
| 253 | + if (alternate) { |
| 254 | + toggle.classList.add("alternate"); |
| 255 | + } else { |
| 256 | + toggle.classList.remove("alternate"); |
| 257 | + } |
| 258 | + } |
| 259 | + } |
| 260 | + // Hack to workaround the fact that safari doesn't |
| 261 | + // properly recolor the scrollbar when toggling (#1455) |
| 262 | + if (navigator.userAgent.indexOf('Safari') > 0 && navigator.userAgent.indexOf('Chrome') == -1) { |
| 263 | + manageTransitions("body", false); |
| 264 | + window.scrollTo(0, 1); |
| 265 | + setTimeout(() => { |
| 266 | + window.scrollTo(0, 0); |
| 267 | + manageTransitions("body", true); |
| 268 | + }, 40); |
| 269 | + } |
| 270 | + } |
| 271 | + const isFileUrl = () => { |
| 272 | + return window.location.protocol === 'file:'; |
| 273 | + } |
| 274 | + const hasAlternateSentinel = () => { |
| 275 | + let styleSentinel = getColorSchemeSentinel(); |
| 276 | + if (styleSentinel !== null) { |
| 277 | + return styleSentinel === "alternate"; |
| 278 | + } else { |
| 279 | + return false; |
| 280 | + } |
| 281 | + } |
| 282 | + const setStyleSentinel = (alternate) => { |
| 283 | + const value = alternate ? "alternate" : "default"; |
| 284 | + if (!isFileUrl()) { |
| 285 | + window.localStorage.setItem("quarto-color-scheme", value); |
| 286 | + } else { |
| 287 | + localAlternateSentinel = value; |
| 288 | + } |
| 289 | + } |
| 290 | + const getColorSchemeSentinel = () => { |
| 291 | + if (!isFileUrl()) { |
| 292 | + const storageValue = window.localStorage.getItem("quarto-color-scheme"); |
| 293 | + return storageValue != null ? storageValue : localAlternateSentinel; |
| 294 | + } else { |
| 295 | + return localAlternateSentinel; |
| 296 | + } |
| 297 | + } |
| 298 | + const darkModeDefault = false; |
| 299 | + let localAlternateSentinel = darkModeDefault ? 'alternate' : 'default'; |
| 300 | + // Dark / light mode switch |
| 301 | + window.quartoToggleColorScheme = () => { |
| 302 | + // Read the current dark / light value |
| 303 | + let toAlternate = !hasAlternateSentinel(); |
| 304 | + toggleColorMode(toAlternate); |
| 305 | + setStyleSentinel(toAlternate); |
| 306 | + toggleGiscusIfUsed(toAlternate, darkModeDefault); |
| 307 | + }; |
| 308 | + // Ensure there is a toggle, if there isn't float one in the top right |
| 309 | + if (window.document.querySelector('.quarto-color-scheme-toggle') === null) { |
| 310 | + const a = window.document.createElement('a'); |
| 311 | + a.classList.add('top-right'); |
| 312 | + a.classList.add('quarto-color-scheme-toggle'); |
| 313 | + a.href = ""; |
| 314 | + a.onclick = function() { try { window.quartoToggleColorScheme(); } catch {} return false; }; |
| 315 | + const i = window.document.createElement("i"); |
| 316 | + i.classList.add('bi'); |
| 317 | + a.appendChild(i); |
| 318 | + window.document.body.appendChild(a); |
| 319 | + } |
| 320 | + // Switch to dark mode if need be |
| 321 | + if (hasAlternateSentinel()) { |
| 322 | + toggleColorMode(true); |
| 323 | + } else { |
| 324 | + toggleColorMode(false); |
| 325 | + } |
179 | 326 | const icon = "";
|
180 | 327 | const anchorJS = new window.AnchorJS();
|
181 | 328 | anchorJS.options = {
|
|
0 commit comments