moved js to its own static file
This commit is contained in:
@@ -24,27 +24,3 @@
|
||||
</div>
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
const setTheme = (theme) => {
|
||||
document.documentElement.className = theme;
|
||||
localStorage.setItem('theme', theme);
|
||||
}
|
||||
|
||||
const hasCodeRun = localStorage.getItem('hasCodeRun');
|
||||
|
||||
if (!hasCodeRun) {
|
||||
const defaultTheme = "{{ config.extra.default_theme }}";
|
||||
setTheme(defaultTheme);
|
||||
localStorage.setItem('hasCodeRun', 'true');
|
||||
}
|
||||
|
||||
const getTheme = () => {
|
||||
const theme = localStorage.getItem('theme');
|
||||
if (theme) {
|
||||
setTheme(theme);
|
||||
}
|
||||
}
|
||||
|
||||
getTheme();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user