maak security.nl minder irritant

This commit is contained in:
Ward Wouts 2009-11-30 16:00:04 +00:00
parent 7d36791118
commit d80a24aeaa

View file

@ -0,0 +1,40 @@
// ==UserScript==
// @name Security.nl comments remover
// @namespace http://www.security.nl
// @description laat de idioten weg
// @include http://www.security.nl/*
// ==/UserScript==
function $$(xpath,root) {
xpath = xpath
.replace(/((^|\|)\s*)([^/|\s]+)/g,'$2.//$3')
.replace(/\.([\w-]+)(?!([^\]]*]))/g, '[@class="$1" or @class$=" $1" or @class^="$1 " or @class~=" $1 "]')
.replace(/#([\w-]+)/g, '[@id="$1"]')
.replace(/\/\[/g,'/*[');
str = '(@\\w+|"[^"]*"|\'[^\']*\')';
xpath = xpath
.replace(new RegExp(str+'\\s*~=\\s*'+str,'g'), 'contains($1,$2)')
.replace(new RegExp(str+'\\s*\\^=\\s*'+str,'g'), 'starts-with($1,$2)')
.replace(new RegExp(str+'\\s*\\$=\\s*'+str,'g'), 'substring($1,string-length($1)-string-length($2)+1)=$2');
var got = document.evaluate(xpath, root||document, null, 5, null), result=[];
while (next = got.iterateNext())
result.push(next);
return result;
}
//GM_log("script aangeroepen");
$$('div[@class ^= "comments discussie"]').forEach(function (a) {
a.parentNode.removeChild(a);
// GM_log("remove one");
});
$$('div[@class ^= "comment discussie"]').forEach(function (a) {
a.parentNode.removeChild(a);
// GM_log("remove one");
});
$$('div[@class ^= "respond discussie"]').forEach(function (a) {
a.parentNode.removeChild(a);
// GM_log("remove one");
});