1
0
Fork 0
mirror of synced 2024-06-28 11:10:46 +12:00
appwrite/public/scripts/views/general/theme.js
2020-02-11 13:55:57 +02:00

24 lines
748 B
JavaScript

(function(window) {
window.ls.container.get("view").add({
selector: "data-general-theme",
controller: function(element, router, document) {
let toggle = function(c) {
if(document.body.classList.contains('theme-light')) {
document.body.classList.remove('theme-light');
document.body.classList.add('theme-dark');
window.localStorage.setItem('user-theme', 'theme-dark')
}
else {
document.body.classList.remove('theme-dark');
document.body.classList.add('theme-light');
window.localStorage.setItem('user-theme', 'theme-light')
}
};
element.addEventListener("click", function() {
toggle();
});
}
});
})(window);