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