better inversion test
This commit is contained in:
parent
54abe01d97
commit
718fd3e67a
|
@ -96,11 +96,19 @@
|
||||||
|
|
||||||
/* Switch and persist theme */
|
/* Switch and persist theme */
|
||||||
(function () {
|
(function () {
|
||||||
|
function CSSSupported (property, value) {
|
||||||
|
var prop = property + ':',
|
||||||
|
el = document.createElement('test'),
|
||||||
|
mStyle = el.style;
|
||||||
|
el.style.cssText = prop + value;
|
||||||
|
return mStyle[property];
|
||||||
|
}
|
||||||
|
|
||||||
var checkbox = document.getElementById('themer');
|
var checkbox = document.getElementById('themer');
|
||||||
var inverter = document.getElementById('inverter');
|
var inverter = document.getElementById('inverter');
|
||||||
|
|
||||||
function darkTheme(media) {
|
function darkTheme(media) {
|
||||||
if (!('filter' in document.body.style)) {
|
if (!CSSSupported('filter', 'invert(100%)')) {
|
||||||
checkbox.parentNode.hidden = true;
|
checkbox.parentNode.hidden = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -96,11 +96,19 @@
|
||||||
|
|
||||||
/* Switch and persist theme */
|
/* Switch and persist theme */
|
||||||
(function () {
|
(function () {
|
||||||
|
function CSSSupported (property, value) {
|
||||||
|
var prop = property + ':',
|
||||||
|
el = document.createElement('test'),
|
||||||
|
mStyle = el.style;
|
||||||
|
el.style.cssText = prop + value;
|
||||||
|
return mStyle[property];
|
||||||
|
}
|
||||||
|
|
||||||
var checkbox = document.getElementById('themer');
|
var checkbox = document.getElementById('themer');
|
||||||
var inverter = document.getElementById('inverter');
|
var inverter = document.getElementById('inverter');
|
||||||
|
|
||||||
function darkTheme(media) {
|
function darkTheme(media) {
|
||||||
if (!('filter' in document.body.style)) {
|
if (!CSSSupported('filter', 'invert(100%)')) {
|
||||||
checkbox.parentNode.hidden = true;
|
checkbox.parentNode.hidden = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user