Remove custom css on VOAT

Removes the dark custom CSS theme from subverses on VOAT.com

As of 2015-08-16. See the latest version.

  1. // ==UserScript==
  2. // @name Remove custom css on VOAT
  3. // @include https://voat.co/*
  4. // @include https://www.voat.co/*
  5. // @description Removes the dark custom CSS theme from subverses on VOAT.com
  6. // @version 1.0
  7. // @author wOxxOm
  8. // @namespace wOxxOm.scripts
  9. // @license MIT License
  10. // @run-at document-start
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. setMutationHandler(document, '#custom_css', function(observer, nodes) {
  15. [].forEach.call(nodes, function(node) { node.remove() });
  16. if (!observer.stopQueued) {
  17. observer.stopQueued = true;
  18. (function() {
  19. document.addEventListener("DOMContentLoaded", function() {
  20. observer.disconnect();
  21. });
  22. })();
  23. }
  24. return true;
  25. });
  26.  
  27. function setMutationHandler(baseNode, selector, cb) {
  28. var ob = new MutationObserver(function(mutations){
  29. for (var i=0, ml=mutations.length, m; (i<ml) && (m=mutations[i]); i++)
  30. for (var j=0, nodes=m.addedNodes, nl=nodes.length, n; (j<nl) && (n=nodes[j]); j++)
  31. if (n.nodeType == 1)
  32. if ((n = n.matches(selector) ? [n] : n.querySelectorAll(selector)) && n.length)
  33. if (!cb(ob, n))
  34. return;
  35. });
  36. ob.observe(baseNode, {subtree:true, childList:true});
  37. }