2015-11-18 21:53:45 +01:00
|
|
|
// ==UserScript==
|
2015-11-26 11:57:05 +01:00
|
|
|
// @name Darkness
|
2015-11-18 21:53:45 +01:00
|
|
|
// @description Deluminate Clone
|
2015-11-26 11:57:05 +01:00
|
|
|
// @version 0.5.1
|
2015-11-18 21:53:45 +01:00
|
|
|
// @namespace http://adrian.kousz.ch/
|
|
|
|
// @match *://*/*
|
|
|
|
// @grant none
|
|
|
|
// ==/UserScript==
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Inspired by: https://github.com/abstiles/deluminate
|
|
|
|
* and: https://github.com/Rojikku/Deluminate
|
|
|
|
*/
|
|
|
|
|
|
|
|
(function(){
|
|
|
|
var doStyle = 'invert() hue-rotate(180deg) contrast(80%) brightness(80%)';
|
|
|
|
var noStyle = 'hue-rotate(180deg) invert()';
|
|
|
|
|
|
|
|
if (window != window.top) return;
|
|
|
|
|
|
|
|
var doit = function() {
|
|
|
|
document.documentElement.style.backgroundColor = '#111';
|
|
|
|
document.documentElement.style.color = '#ccc';
|
|
|
|
document.body.style.webkitFilter = doStyle;
|
|
|
|
|
2015-11-26 11:57:05 +01:00
|
|
|
var css = 'img:-webkit-any('
|
|
|
|
+ '[src$="jpg"],[src$="jpeg"],[src$="webp"]'
|
|
|
|
+ '),video{-webkit-filter:' + noStyle + '}';
|
2015-11-18 21:53:45 +01:00
|
|
|
injectCss(css);
|
|
|
|
};
|
|
|
|
|
|
|
|
var injectCss = function(css) {
|
|
|
|
var head = document.head;
|
|
|
|
var style = document.createElement('style');
|
|
|
|
style.appendChild(document.createTextNode(css));
|
|
|
|
head.appendChild(style);
|
|
|
|
}
|
|
|
|
|
|
|
|
doit();
|
|
|
|
})();
|