Skip to content

Commit e38b1e2

Browse files
Deploying to gh-pages from @ 911471d 🚀
1 parent cf2d4d8 commit e38b1e2

File tree

18 files changed

+2931
-1182
lines changed

18 files changed

+2931
-1182
lines changed

404.html

Lines changed: 150 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@
3636
<script src="/site_libs/quarto-html/tippy.umd.min.js"></script>
3737
<script src="/site_libs/quarto-html/anchor.min.js"></script>
3838
<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">
4041
<script src="/site_libs/bootstrap/bootstrap.min.js"></script>
4142
<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">
4345
<script id="quarto-search-options" type="application/json">{
4446
"location": "navbar",
4547
"copy-button": false,
@@ -114,9 +116,10 @@
114116
</li>
115117
</ul>
116118
</div> <!-- /navcollapse -->
117-
<div class="quarto-navbar-tools">
119+
<div class="quarto-navbar-tools tools-wide">
118120
<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>
119121
<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>
120123
</div>
121124
</div> <!-- /container-fluid -->
122125
</nav>
@@ -176,6 +179,150 @@ <h1 class="title">Page Not Found</h1>
176179
}
177180
}
178181
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+
}
179326
const icon = "";
180327
const anchorJS = new window.AnchorJS();
181328
anchorJS.options = {

index.html

Lines changed: 150 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@
3737
<script src="site_libs/quarto-html/tippy.umd.min.js"></script>
3838
<script src="site_libs/quarto-html/anchor.min.js"></script>
3939
<link href="site_libs/quarto-html/tippy.css" rel="stylesheet">
40-
<link href="site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
40+
<link href="site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-text-highlighting-styles">
41+
<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">
4142
<script src="site_libs/bootstrap/bootstrap.min.js"></script>
4243
<link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
43-
<link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
44+
<link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-bootstrap" data-mode="light">
45+
<link href="site_libs/bootstrap/bootstrap-dark.min.css" rel="prefetch" class="quarto-color-scheme quarto-color-alternate" id="quarto-bootstrap" data-mode="dark">
4446
<script id="quarto-search-options" type="application/json">{
4547
"location": "navbar",
4648
"copy-button": false,
@@ -115,9 +117,10 @@
115117
</li>
116118
</ul>
117119
</div> <!-- /navcollapse -->
118-
<div class="quarto-navbar-tools">
120+
<div class="quarto-navbar-tools tools-wide">
119121
<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>
120122
<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>
123+
<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>
121124
</div>
122125
</div> <!-- /container-fluid -->
123126
</nav>
@@ -191,6 +194,150 @@ <h2>Community Resources</h2>
191194
}
192195
}
193196
toggleBodyColorPrimary();
197+
const disableStylesheet = (stylesheets) => {
198+
for (let i=0; i < stylesheets.length; i++) {
199+
const stylesheet = stylesheets[i];
200+
stylesheet.rel = 'prefetch';
201+
}
202+
}
203+
const enableStylesheet = (stylesheets) => {
204+
for (let i=0; i < stylesheets.length; i++) {
205+
const stylesheet = stylesheets[i];
206+
stylesheet.rel = 'stylesheet';
207+
}
208+
}
209+
const manageTransitions = (selector, allowTransitions) => {
210+
const els = window.document.querySelectorAll(selector);
211+
for (let i=0; i < els.length; i++) {
212+
const el = els[i];
213+
if (allowTransitions) {
214+
el.classList.remove('notransition');
215+
} else {
216+
el.classList.add('notransition');
217+
}
218+
}
219+
}
220+
const toggleGiscusIfUsed = (isAlternate, darkModeDefault) => {
221+
const baseTheme = document.querySelector('#giscus-base-theme')?.value ?? 'light';
222+
const alternateTheme = document.querySelector('#giscus-alt-theme')?.value ?? 'dark';
223+
let newTheme = '';
224+
if(darkModeDefault) {
225+
newTheme = isAlternate ? baseTheme : alternateTheme;
226+
} else {
227+
newTheme = isAlternate ? alternateTheme : baseTheme;
228+
}
229+
const changeGiscusTheme = () => {
230+
// From: https://github.com/giscus/giscus/issues/336
231+
const sendMessage = (message) => {
232+
const iframe = document.querySelector('iframe.giscus-frame');
233+
if (!iframe) return;
234+
iframe.contentWindow.postMessage({ giscus: message }, 'https://giscus.app');
235+
}
236+
sendMessage({
237+
setConfig: {
238+
theme: newTheme
239+
}
240+
});
241+
}
242+
const isGiscussLoaded = window.document.querySelector('iframe.giscus-frame') !== null;
243+
if (isGiscussLoaded) {
244+
changeGiscusTheme();
245+
}
246+
}
247+
const toggleColorMode = (alternate) => {
248+
// Switch the stylesheets
249+
const alternateStylesheets = window.document.querySelectorAll('link.quarto-color-scheme.quarto-color-alternate');
250+
manageTransitions('#quarto-margin-sidebar .nav-link', false);
251+
if (alternate) {
252+
enableStylesheet(alternateStylesheets);
253+
for (const sheetNode of alternateStylesheets) {
254+
if (sheetNode.id === "quarto-bootstrap") {
255+
toggleBodyColorMode(sheetNode);
256+
}
257+
}
258+
} else {
259+
disableStylesheet(alternateStylesheets);
260+
toggleBodyColorPrimary();
261+
}
262+
manageTransitions('#quarto-margin-sidebar .nav-link', true);
263+
// Switch the toggles
264+
const toggles = window.document.querySelectorAll('.quarto-color-scheme-toggle');
265+
for (let i=0; i < toggles.length; i++) {
266+
const toggle = toggles[i];
267+
if (toggle) {
268+
if (alternate) {
269+
toggle.classList.add("alternate");
270+
} else {
271+
toggle.classList.remove("alternate");
272+
}
273+
}
274+
}
275+
// Hack to workaround the fact that safari doesn't
276+
// properly recolor the scrollbar when toggling (#1455)
277+
if (navigator.userAgent.indexOf('Safari') > 0 && navigator.userAgent.indexOf('Chrome') == -1) {
278+
manageTransitions("body", false);
279+
window.scrollTo(0, 1);
280+
setTimeout(() => {
281+
window.scrollTo(0, 0);
282+
manageTransitions("body", true);
283+
}, 40);
284+
}
285+
}
286+
const isFileUrl = () => {
287+
return window.location.protocol === 'file:';
288+
}
289+
const hasAlternateSentinel = () => {
290+
let styleSentinel = getColorSchemeSentinel();
291+
if (styleSentinel !== null) {
292+
return styleSentinel === "alternate";
293+
} else {
294+
return false;
295+
}
296+
}
297+
const setStyleSentinel = (alternate) => {
298+
const value = alternate ? "alternate" : "default";
299+
if (!isFileUrl()) {
300+
window.localStorage.setItem("quarto-color-scheme", value);
301+
} else {
302+
localAlternateSentinel = value;
303+
}
304+
}
305+
const getColorSchemeSentinel = () => {
306+
if (!isFileUrl()) {
307+
const storageValue = window.localStorage.getItem("quarto-color-scheme");
308+
return storageValue != null ? storageValue : localAlternateSentinel;
309+
} else {
310+
return localAlternateSentinel;
311+
}
312+
}
313+
const darkModeDefault = false;
314+
let localAlternateSentinel = darkModeDefault ? 'alternate' : 'default';
315+
// Dark / light mode switch
316+
window.quartoToggleColorScheme = () => {
317+
// Read the current dark / light value
318+
let toAlternate = !hasAlternateSentinel();
319+
toggleColorMode(toAlternate);
320+
setStyleSentinel(toAlternate);
321+
toggleGiscusIfUsed(toAlternate, darkModeDefault);
322+
};
323+
// Ensure there is a toggle, if there isn't float one in the top right
324+
if (window.document.querySelector('.quarto-color-scheme-toggle') === null) {
325+
const a = window.document.createElement('a');
326+
a.classList.add('top-right');
327+
a.classList.add('quarto-color-scheme-toggle');
328+
a.href = "";
329+
a.onclick = function() { try { window.quartoToggleColorScheme(); } catch {} return false; };
330+
const i = window.document.createElement("i");
331+
i.classList.add('bi');
332+
a.appendChild(i);
333+
window.document.body.appendChild(a);
334+
}
335+
// Switch to dark mode if need be
336+
if (hasAlternateSentinel()) {
337+
toggleColorMode(true);
338+
} else {
339+
toggleColorMode(false);
340+
}
194341
const icon = "";
195342
const anchorJS = new window.AnchorJS();
196343
anchorJS.options = {

0 commit comments

Comments
 (0)