fradrive/templates/profile.julius
2018-08-06 22:16:33 +02:00

18 lines
586 B
Plaintext

document.addEventListener('DOMContentLoaded', function () {
var themeSelector = document.querySelector('#theme-select');
themeSelector.addEventListener('change', function() {
// get rid of old themes on body
var options = Array.from(themeSelector.options)
.forEach(function (option) {
document.body.classList.remove(optionToTheme(option));
});
// add newly selected theme
document.body.classList.add(optionToTheme(themeSelector.selectedOptions[0]));
});
function optionToTheme(option) {
return optionValue = 'theme--' + option.value;
}
});