Skip to content

Commit

Permalink
Fix script order
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainIRS committed Jul 12, 2024
1 parent b24c387 commit 0597ee8
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,6 @@

<link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin>


<script>
let isDarkMode = JSON.parse(localStorage.getItem('darkMode')) ?? window.matchMedia('(prefers-color-scheme: dark)')
.matches;
localStorage.setItem('darkMode', isDarkMode);
document.documentElement.style.setProperty('--overlay-bg', isDarkMode ? 'black' : 'white');
document.documentElement.style.setProperty('--color-scheme', isDarkMode ? 'dark' : 'light');
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
localStorage.setItem('darkMode', e.matches);
window.location.reload();
})
</script>
<style>
html {
font-size: 0.85em;
Expand Down Expand Up @@ -192,6 +177,22 @@
transition-delay: 1s;
}
</style>



<script>
let isDarkMode = JSON.parse(localStorage.getItem('darkMode')) ?? window.matchMedia('(prefers-color-scheme: dark)')
.matches;
localStorage.setItem('darkMode', isDarkMode);
document.documentElement.style.setProperty('--overlay-bg', isDarkMode ? 'black' : 'white');
document.documentElement.style.setProperty('--color-scheme', isDarkMode ? 'dark' : 'light');
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
localStorage.setItem('darkMode', e.matches);
window.location.reload();
})
</script>
</head>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ config('app.ga4_tag') }}"></script>
Expand Down

0 comments on commit 0597ee8

Please sign in to comment.