29 lines
733 B
Plaintext
29 lines
733 B
Plaintext
// SPDX-FileCopyrightText: 2022 Sarah Vaupel <vaupel.sarah@campus.lmu.de>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
|
(function() {
|
|
'use strict';
|
|
|
|
var DEFAULT_THEME = 'theme--default';
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
var themeSwitcher = document.querySelector('#theme-select');
|
|
var currentTheme = DEFAULT_THEME;
|
|
|
|
if (themeSwitcher) {
|
|
currentTheme = 'theme--' + themeSwitcher.value;
|
|
themeSwitcher.addEventListener('input', function() {
|
|
|
|
var desiredTheme = 'theme--' + themeSwitcher.value;
|
|
document.body.classList.remove(currentTheme);
|
|
document.body.classList.add(desiredTheme);
|
|
currentTheme = desiredTheme;
|
|
});
|
|
}
|
|
});
|
|
|
|
})();
|