PEed the themer
This commit is contained in:
parent
91db19dfae
commit
5c07e6d1a4
|
@ -71,6 +71,10 @@ figure p img {
|
|||
div:not([tabindex]):focus {
|
||||
outline: none;
|
||||
}
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* skip link */
|
||||
|
||||
[href="#main"] {
|
||||
|
|
|
@ -128,11 +128,16 @@
|
|||
/* Switch and persist theme */
|
||||
(function () {
|
||||
var checkbox = document.getElementById('themer');
|
||||
var invertor = document.getElementById('inverter');
|
||||
var inverter = document.getElementById('inverter');
|
||||
|
||||
function darkTheme(media) {
|
||||
invertor.setAttribute('media', media);
|
||||
invertor.textContent = invertor.textContent.trim();
|
||||
if (!('filter' in document.body.style)) {
|
||||
checkbox.parentNode.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
inverter.setAttribute('media', media);
|
||||
inverter.textContent = inverter.textContent.trim();
|
||||
localStorage.setItem('darkTheme', media);
|
||||
}
|
||||
|
||||
|
@ -141,8 +146,10 @@
|
|||
});
|
||||
|
||||
window.addEventListener('DOMContentLoaded', function () {
|
||||
if ('filter' in document.body.style) {
|
||||
if (localStorage.getItem('darkTheme') === 'screen') {
|
||||
checkbox.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -71,6 +71,10 @@ figure p img {
|
|||
div:not([tabindex]):focus {
|
||||
outline: none;
|
||||
}
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* skip link */
|
||||
|
||||
[href="#main"] {
|
||||
|
|
|
@ -128,11 +128,16 @@
|
|||
/* Switch and persist theme */
|
||||
(function () {
|
||||
var checkbox = document.getElementById('themer');
|
||||
var invertor = document.getElementById('inverter');
|
||||
var inverter = document.getElementById('inverter');
|
||||
|
||||
function darkTheme(media) {
|
||||
invertor.setAttribute('media', media);
|
||||
invertor.textContent = invertor.textContent.trim();
|
||||
if (!('filter' in document.body.style)) {
|
||||
checkbox.parentNode.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
inverter.setAttribute('media', media);
|
||||
inverter.textContent = inverter.textContent.trim();
|
||||
localStorage.setItem('darkTheme', media);
|
||||
}
|
||||
|
||||
|
@ -141,8 +146,10 @@
|
|||
});
|
||||
|
||||
window.addEventListener('DOMContentLoaded', function () {
|
||||
if ('filter' in document.body.style) {
|
||||
if (localStorage.getItem('darkTheme') === 'screen') {
|
||||
checkbox.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
|
Loading…
Reference in New Issue
Block a user