Added JS for dealing with setting the custom theme

This commit is contained in:
Pieter-Jan Cassiman 2019-12-17 22:21:17 +01:00
parent b8c15e5cf3
commit 1657cec1d1
2 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,11 @@
function changeTheme() {
// Get the selected theme for the dropdown
var themes_select = document.getElementById("themes_select");
var selected_theme = themes_select.options[themes_select.selectedIndex].text;
// Update the theme cookie
document.cookie = "theme=" + escape(selected_theme) + "; Path=/;"
// Finally reload the page to let the new theme take effect
location.reload();
}

View file

@ -32,6 +32,7 @@ Haldis - {{ active_page|capitalize }}
{{ super() }}
<script type="text/javascript" src="{{ url_for('static', filename='js/theme.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/timer.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/customThemes.js') }}"></script>
{% endblock %}
{% block navbar %}