Guest User

CDR.cz / DIIT.cz tampermonkey troll filter

a guest
Jun 22nd, 2021
229
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name Troll remover
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://diit.cz/clanek/*/diskuse
  8. // @match https://cdr.cz/clanek/*/diskuse
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. var trolls = [
  16. 'JirkaK',
  17. 'ASClIIIl',
  18. 'RedMaX',
  19. 'ATITom'
  20. ];
  21.  
  22. var trollsQuoted = trolls.map(name => '"'+name+'"');
  23. var trollsCondition = trollsQuoted.join(' or .=');
  24.  
  25. function _x(STR_XPATH) {
  26. var xresult = document.evaluate(STR_XPATH, document, null, XPathResult.ANY_TYPE, null);
  27. var xnodes = [];
  28. var xres;
  29. while (xres = xresult.iterateNext()) {
  30. xnodes.push(xres);
  31. }
  32.  
  33. return xnodes;
  34. }
  35. window.jQuery(_x('//*[contains(@class,"comment ") and contains(@class,"clearfix") and .//*[contains(@class,"username") and (.=' + trollsCondition + ')]]')).text('[Trollovina odfiltrov√°na]');
  36. })();
RAW Paste Data