switching themes via loading only specific CSS

This commit is contained in:
zadam
2021-09-26 15:24:37 +02:00
parent 2fcb0c05c0
commit 113bebed3b
15 changed files with 219 additions and 232 deletions

View File

@@ -23,19 +23,7 @@ function SetupModel() {
this.password1 = ko.observable();
this.password2 = ko.observable();
this.theme = ko.observable("white");
this.theme.subscribe(function(newTheme) {
const $body = $("body");
for (const clazz of Array.from($body[0].classList)) { // create copy to safely iterate over while removing classes
if (clazz.startsWith("theme-")) {
$body.removeClass(clazz);
}
}
$body.addClass("theme-" + newTheme);
});
this.theme = ko.observable("light");
this.syncServerHost = ko.observable();
this.syncProxy = ko.observable();