// ==UserScript== // @name Darkness // @description Deluminate Clone // @version 0.5.1 // @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; var css = 'img:-webkit-any(' + '[src$="jpg"],[src$="jpeg"],[src$="webp"]' + '),video{-webkit-filter:' + noStyle + '}'; injectCss(css); }; var injectCss = function(css) { var head = document.head; var style = document.createElement('style'); style.appendChild(document.createTextNode(css)); head.appendChild(style); } doit(); })();