Remove custom css on VOAT

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

目前為 2015-08-16 提交的版本,檢視 最新版本

// ==UserScript==
// @name          Remove custom css on VOAT
// @include       https://voat.co/*
// @include       https://www.voat.co/*
// @description   Removes the dark custom CSS theme from subverses on VOAT.co
// @version       1.0.1
// @author        wOxxOm
// @namespace     wOxxOm.scripts
// @license       MIT License
// @run-at        document-start
// @grant         none
// ==/UserScript==

[].forEach.call(document.querySelectorAll('#custom_css'), function(node) { node.remove() });

setMutationHandler(document, '#custom_css', function(observer, nodes) {
	[].forEach.call(nodes, function(node) { node.remove() });
	if (!observer.stopQueued) {
		observer.stopQueued = true;
		(function() {
			document.addEventListener("DOMContentLoaded", function() {
					observer.disconnect();
			});
		})();
	}
	return true;
});

function setMutationHandler(baseNode, selector, cb) {
	var ob = new MutationObserver(function(mutations){
		for (var i=0, ml=mutations.length, m; (i<ml) && (m=mutations[i]); i++)
			for (var j=0, nodes=m.addedNodes, nl=nodes.length, n; (j<nl) && (n=nodes[j]); j++)
				if (n.nodeType == 1) 
					if ((n = n.matches(selector) ? [n] : n.querySelectorAll(selector)) && n.length)
						if (!cb(ob, n))
							return;
	});
	ob.observe(baseNode, {subtree:true, childList:true}); 
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址