diff --git a/resources/base.scss b/resources/base.scss index 752c749..fc07ed2 100644 --- a/resources/base.scss +++ b/resources/base.scss @@ -721,6 +721,14 @@ math { #nav-lang-icon:hover { color: darkblue; } + +#nav-darkmode-icon { + cursor: pointer; + &:hover { + color: gray; + } +} + .dropdown { border-radius: 4px; border: 0.5px solid lightgray; diff --git a/resources/common.js b/resources/common.js index 6e6e1bf..0b0fb74 100644 --- a/resources/common.js +++ b/resources/common.js @@ -410,4 +410,19 @@ $(function() { $('#form-lang').submit(); }) $('#logout').on('click', () => $('#logout-form').submit()); + + $('#nav-darkmode-icon').on('click', function() { + if (localStorage.getItem("darkmode") === "true") { + localStorage.setItem("darkmode", "false"); + DarkReader.disable(); + } + else { + localStorage.setItem("darkmode", "true"); + DarkReader.enable(); + } + }) }); + +if (localStorage.getItem("darkmode") === "true") { + DarkReader.enable(); +} diff --git a/templates/base.html b/templates/base.html index 033340c..991b3f9 100644 --- a/templates/base.html +++ b/templates/base.html @@ -72,6 +72,8 @@ {% endif %} + + {% compress js %} {% if INLINE_JQUERY %} @@ -91,7 +93,6 @@ }); {% endcompress %} - {% block js_media %}{% endblock %} {% if request.in_contest %} @@ -247,6 +248,9 @@ {% endfor %} + + + {% if request.user.is_authenticated %}