14 lines
449 B
JavaScript
14 lines
449 B
JavaScript
(function () {
|
|
var root = document.documentElement;
|
|
var button = document.getElementById('theme-toggle');
|
|
if (!button) {
|
|
return;
|
|
}
|
|
button.addEventListener('click', function () {
|
|
var next = root.getAttribute('data-theme') === 'light' ? 'dark' : 'light';
|
|
root.setAttribute('data-theme', next);
|
|
try {
|
|
localStorage.setItem('tinyauth-web-theme', next);
|
|
} catch (e) {}
|
|
});
|
|
})();
|