Condole

condole!

  1. // ==UserScript==
  2. // @name Condole
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description condole!
  6. // @author AnCoSONG
  7. // @include *
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. let html = document.querySelector('html')
  15. function transitionToGray(dom){
  16.  
  17. const transitionConfig = "filter 0.5s linear"
  18. dom.style.transition = transitionConfig
  19. dom.style.webkitTransition = transitionConfig
  20. dom.style['-moz-transition'] = transitionConfig
  21. dom.style['-o-transition'] = transitionConfig
  22. dom.style['-ms-transition'] = transitionConfig
  23. }
  24.  
  25. function grayScalify(dom, level=1){
  26. const grayscale = `grayscale(${level})`
  27. dom.style.filter = grayscale
  28. dom.style.webkitFilter = grayscale
  29. dom.style['-moz-filter'] = grayscale
  30. dom.style['-o-filter'] = grayscale
  31. dom.style['-ms-filter'] = grayscale
  32. }
  33. transitionToGray(html);
  34. grayScalify(html);
  35. })();