diff --git a/js/main.js b/js/main.js
index fb526ba..ee45c85 100644
--- a/js/main.js
+++ b/js/main.js
@@ -1,7 +1,5 @@
/*jshint esversion: 6 */
-var light = false;
-
window.onload = function() {
reorganize_html();
create_theme_switcher();
@@ -65,34 +63,46 @@ function reorganize_html() {
}
function create_theme_switcher() {
- // If no theme cookie is found, set dark by default
- if (Cookies.get('theme') == null) {
- Cookies.set('theme', 'dark');
- }
+ // set the correct CSS depending on the cookie, dark is default
+ var light = isThemeLight();
+ $('body').append('
'));
+ $('head').append(''));
- // set the css and button depending on the cookie found, dark is default
- if (Cookies.get('theme') == 'light') {
- $('body').append('