40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
// ==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");
|
|
});
|
|
|