feat(theme-switcher): hide button if JS is disabled

This commit is contained in:
welpo 2023-08-03 00:12:00 +02:00
parent a4e48b48fd
commit 113a7f4e5d
No known key found for this signature in database
GPG Key ID: A2F978CF4EC1F5A6
3 changed files with 4 additions and 1 deletions

1
static/no_js.css Normal file
View File

@ -0,0 +1 @@
.js{display:none}

View File

@ -110,6 +110,8 @@
{%- endif -%}">
{%- if config.extra.theme_switcher and config.extra.theme_switcher == true -%}
{# If JavaScript is disabled, hide the button. #}
<noscript><link rel="stylesheet" href="{{ get_url(path='no_js.css') | safe }}"/></noscript>
<script type="text/javascript" src="{{ get_url(path='js/initializeTheme.min.js') | safe }}"></script>
<script defer src="{{ get_url(path='js/themeSwitcher.min.js', trailing_slash=false) | safe }}"/></script>
{%- endif -%}

View File

@ -64,7 +64,7 @@
{# Theme switcher #}
{%- if config.extra.theme_switcher and config.extra.theme_switcher == true -%}
<li class="theme-switcher-wrapper">
<li class="theme-switcher-wrapper js">
<div class="theme-switcher"></div>
</li>
{%- endif -%}