Guest User

arsewipe.js

a guest
Mar 16th, 2020
41
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const leftyTwats = ['theoldgreenfascist',
  2.                     'DBC Reed',
  3.                         'Liberal Yank',
  4.                     'William Connolley',
  5.                     'Don\'t Hug Me',
  6.                     'Worstall\'s FAIL',
  7.                     'Mister Bean',
  8.                     'Heisenberg',
  9.                     'mr ecks is a cock',
  10.                     'Ecks is a fucking spastic',
  11.                     'meiac',
  12.                     'Jesus Christ',
  13.                     'Newmania',
  14.                     '3f1d756e98a2f6f2f036e7164635b5f8',
  15.                     'Ice',
  16.                     'Fatty',
  17.                     'NiV',
  18.                     't it',
  19.                     'Steve.'];
  20. const antiSemiticTwats = ['Dave',
  21.                           'Davedave',
  22.                           'Paul Rain'
  23.                          ];
  24. const justTwats = ['Rickie'
  25.                   ];
  26. const islamicTwats = ['Ahmed Fares'
  27.                      ];
  28.  
  29. const themes = {
  30.   'Worstall 2020': {
  31.     comments: '//div[@id=\'comments\']/ol[@class=\'nv-comments-list\']/li',
  32.     comment: 'article[@class=\'nv-comment-article\']/div[contains(@class, \'nv-comment-content\')]',
  33.     author: 'article[@class=\'nv-comment-article\']/div[@class=\'nv-comment-header\']/div[contains(@class, \'comment-author\')]/span/descendant::text()',
  34.     gravatar: 'article[@class=\'nv-comment-article\']/div[@class=\'nv-comment-header\']/div[contains(@class, \'nv-comment-avatar\')]/img/@src'
  35.   },
  36.   'Worstall 2007': {
  37.     comments: '//div[@id=\'comments\']/ol[@class=\'commentlist\']/li',
  38.     comment: 'article[@class=\'comment\']/div[@class=\'comment-content\']',
  39.     author: 'article[@class=\'comment\']/footer/div[contains(@class, \'comment-author\')]/cite[@class=\'fn\']/descendant::text()',
  40.     gravatar: 'article[@class=\'comment\']/footer/div[contains(@class, \'comment-author\')]/img/@src'
  41.   }
  42. };
  43.  
  44. const activeTheme = document.evaluate('//select[@id=\'theme-switcha\']/option[@selected]/descendant::text()', document, null, XPathResult.STRING_TYPE, null).stringValue;
  45.  
  46. function replaceDrivel (author, gravatarID, commentItem, twat, replace) {
  47.   gravatarID = gravatarID.stringValue.replace(/.*\/secure.gravatar.com\/avatar\/([a-f0-9]+)\?.*/, '$1');
  48.  
  49.   if (author.stringValue === twat || gravatarID === twat) {
  50.     const comment = document.evaluate (
  51.       themes[activeTheme].comment,
  52.       commentItem, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  53.  
  54.     /* Should just be the one, but replace all just in case */
  55.     for (let i = 0; i < comment.snapshotLength; i++) {
  56.       comment.snapshotItem (i).innerHTML = `<p>${replace}</p>`;
  57.     }
  58.   }
  59. }
  60.  
  61. if(themes[activeTheme]) {
  62.   const comments = document.evaluate(
  63.     themes[activeTheme].comments, document,
  64.     null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  65.  
  66.   for (let i = 0; i < comments.snapshotLength; i++) {
  67.     const commentItem = comments.snapshotItem (i);
  68.     const author = document.evaluate(
  69.       themes[activeTheme].author,
  70.       commentItem, null, XPathResult.STRING_TYPE, null);
  71.     const gravatarID = document.evaluate(
  72.       themes[activeTheme].gravatar,
  73.       commentItem, null, XPathResult.STRING_TYPE, null);
  74.  
  75.     [...leftyTwats, ...justTwats].forEach (twat => replaceDrivel (author, gravatarID, commentItem, twat, 'Usual twattish drivel'));
  76.     antiSemiticTwats.forEach (twat => replaceDrivel (author, gravatarID, commentItem, twat, 'Usual anti-semitic drivel'));
  77.     islamicTwats.forEach (twat => replaceDrivel (author, gravatarID, commentItem, twat, 'Usual terrorist supporting drivel'));
  78.   }
  79. }
RAW Paste Data