Skip to content

Commit

Permalink
properly stop white flash
Browse files Browse the repository at this point in the history
  • Loading branch information
mirrorcult committed Sep 12, 2023
1 parent deb632a commit 08e0239
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions theme/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,6 @@
} catch (e) { }
</script>

<!-- Set the theme before any content is loaded, prevents flash -->
<script type="text/javascript">
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('no-js')
html.classList.remove('{{ default_theme }}')
html.classList.add(theme);
html.classList.add('js');
</script>

<!-- Hide / unhide sidebar before it is displayed -->
<script type="text/javascript">
var html = document.querySelector('html');
Expand Down Expand Up @@ -311,5 +299,16 @@
{{/if}}
{{/if}}

<!-- Set the theme before any content is loaded, prevents flash -->
<script type="text/javascript">
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('no-js')
html.classList.remove('{{ default_theme }}')
html.classList.add(theme);
html.classList.add('js');
</script>
</body>
</html>

0 comments on commit 08e0239

Please sign in to comment.