|
21 | 21 | }
|
22 | 22 | }
|
23 | 23 |
|
24 |
| - window.setColorSchemeToggle = (alternate) => { |
| 24 | + const setColorSchemeToggle = (alternate) => { |
25 | 25 | const toggles = window.document.querySelectorAll('.quarto-color-scheme-toggle');
|
26 | 26 | for (let i=0; i < toggles.length; i++) {
|
27 | 27 | const toggle = toggles[i];
|
|
56 | 56 | manageTransitions('#quarto-margin-sidebar .nav-link', true);
|
57 | 57 |
|
58 | 58 | // Switch the toggles
|
59 |
| - window.setColorSchemeToggle(alternate) |
| 59 | + setColorSchemeToggle(alternate) |
60 | 60 |
|
61 | 61 | // Hack to workaround the fact that safari doesn't
|
62 | 62 | // properly recolor the scrollbar when toggling (#1455)
|
|
103 | 103 | return window.location.protocol === 'file:';
|
104 | 104 | }
|
105 | 105 |
|
106 |
| - window.hasAlternateSentinel = () => { |
| 106 | + const hasAlternateSentinel = () => { |
107 | 107 | let styleSentinel = getColorSchemeSentinel();
|
108 | 108 | if (styleSentinel !== null) {
|
109 | 109 | return styleSentinel === "alternate";
|
|
182 | 182 | // Dark / light mode switch
|
183 | 183 | window.quartoToggleColorScheme = () => {
|
184 | 184 | // Read the current dark / light value
|
185 |
| - let toAlternate = !window.hasAlternateSentinel(); |
| 185 | + let toAlternate = !hasAlternateSentinel(); |
186 | 186 | toggleColorMode(toAlternate);
|
187 | 187 | setStyleSentinel(toAlternate);
|
188 | 188 | toggleGiscusIfUsed(toAlternate, darkModeDefault);
|
189 | 189 | };
|
190 | 190 |
|
191 |
| - window.toggleGiscusIfUsed = toggleGiscusIfUsed; |
192 |
| -
|
193 | 191 | <% if (respectUserColorScheme) { %>
|
194 | 192 | queryPrefersDark.addEventListener("change", e => {
|
195 | 193 | if(window.localStorage.getItem("quarto-color-scheme") !== null)
|
|
202 | 200 | <% } %>
|
203 | 201 |
|
204 | 202 | // Switch to dark mode if need be
|
205 |
| - if (window.hasAlternateSentinel()) { |
| 203 | + if (hasAlternateSentinel()) { |
206 | 204 | toggleColorMode(true);
|
207 | 205 | } else {
|
208 | 206 | toggleColorMode(false);
|
|
0 commit comments