From 06e5834e51e55876ea2c08d2dec867abd7f45751 Mon Sep 17 00:00:00 2001 From: kek7198 Date: Sun, 19 Dec 2021 12:21:33 -0600 Subject: [PATCH] fix --- files/assets/CHRISTMAS/js/default.js | 17 ++++++++++++++++- files/templates/CHRISTMAS/default.html | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/files/assets/CHRISTMAS/js/default.js b/files/assets/CHRISTMAS/js/default.js index 0580b2217..aa7316b72 100644 --- a/files/assets/CHRISTMAS/js/default.js +++ b/files/assets/CHRISTMAS/js/default.js @@ -145,4 +145,19 @@ function expandDesktopImage(image) { document.getElementById("desktop-expanded-image").src = image.replace("200w_d.webp", "giphy.webp"); document.getElementById("desktop-expanded-image-link").href = image; document.getElementById("desktop-expanded-image-wrap-link").href=image; -}; \ No newline at end of file +}; + + +var previousTheme = []; + +function changeTheme(theme) { + const body = document.body; + // if previous selection has a value, remove them from body tag + if (previousTheme.length) { + previousTheme.map(v => body.classList.toggle(v)); + } + // toggle classes in body tag + theme.map(v => body.classList.toggle(v)); + // Set global previous selection to current selection + previousTheme = theme; +} \ No newline at end of file diff --git a/files/templates/CHRISTMAS/default.html b/files/templates/CHRISTMAS/default.html index eb732c04c..78e6385ca 100644 --- a/files/templates/CHRISTMAS/default.html +++ b/files/templates/CHRISTMAS/default.html @@ -347,7 +347,7 @@ {% if v %} {% endif %} - +