Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const leftyTwats = ['theoldgreenfascist',
- 'DBC Reed',
- 'Liberal Yank',
- 'William Connolley',
- 'Don\'t Hug Me',
- 'Worstall\'s FAIL',
- 'Mister Bean',
- 'Heisenberg',
- 'mr ecks is a cock',
- 'Ecks is a fucking spastic',
- 'meiac',
- 'Jesus Christ',
- 'Newmania',
- '3f1d756e98a2f6f2f036e7164635b5f8',
- 'Ice',
- 'Fatty',
- 'NiV',
- 't it',
- 'Steve.'];
- const antiSemiticTwats = ['Dave',
- 'Davedave',
- 'Paul Rain'
- ];
- const justTwats = ['Rickie'
- ];
- const islamicTwats = ['Ahmed Fares'
- ];
- const themes = {
- 'Worstall 2020': {
- comments: '//div[@id=\'comments\']/ol[@class=\'nv-comments-list\']/li',
- comment: 'article[@class=\'nv-comment-article\']/div[contains(@class, \'nv-comment-content\')]',
- author: 'article[@class=\'nv-comment-article\']/div[@class=\'nv-comment-header\']/div[contains(@class, \'comment-author\')]/span/descendant::text()',
- gravatar: 'article[@class=\'nv-comment-article\']/div[@class=\'nv-comment-header\']/div[contains(@class, \'nv-comment-avatar\')]/img/@src'
- },
- 'Worstall 2007': {
- comments: '//div[@id=\'comments\']/ol[@class=\'commentlist\']/li',
- comment: 'article[@class=\'comment\']/div[@class=\'comment-content\']',
- author: 'article[@class=\'comment\']/footer/div[contains(@class, \'comment-author\')]/cite[@class=\'fn\']/descendant::text()',
- gravatar: 'article[@class=\'comment\']/footer/div[contains(@class, \'comment-author\')]/img/@src'
- }
- };
- const activeTheme = document.evaluate('//select[@id=\'theme-switcha\']/option[@selected]/descendant::text()', document, null, XPathResult.STRING_TYPE, null).stringValue;
- function replaceDrivel (author, gravatarID, commentItem, twat, replace) {
- gravatarID = gravatarID.stringValue.replace(/.*\/secure.gravatar.com\/avatar\/([a-f0-9]+)\?.*/, '$1');
- if (author.stringValue === twat || gravatarID === twat) {
- const comment = document.evaluate (
- themes[activeTheme].comment,
- commentItem, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
- /* Should just be the one, but replace all just in case */
- for (let i = 0; i < comment.snapshotLength; i++) {
- comment.snapshotItem (i).innerHTML = `<p>${replace}</p>`;
- }
- }
- }
- if(themes[activeTheme]) {
- const comments = document.evaluate(
- themes[activeTheme].comments, document,
- null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
- for (let i = 0; i < comments.snapshotLength; i++) {
- const commentItem = comments.snapshotItem (i);
- const author = document.evaluate(
- themes[activeTheme].author,
- commentItem, null, XPathResult.STRING_TYPE, null);
- const gravatarID = document.evaluate(
- themes[activeTheme].gravatar,
- commentItem, null, XPathResult.STRING_TYPE, null);
- [...leftyTwats, ...justTwats].forEach (twat => replaceDrivel (author, gravatarID, commentItem, twat, 'Usual twattish drivel'));
- antiSemiticTwats.forEach (twat => replaceDrivel (author, gravatarID, commentItem, twat, 'Usual anti-semitic drivel'));
- islamicTwats.forEach (twat => replaceDrivel (author, gravatarID, commentItem, twat, 'Usual terrorist supporting drivel'));
- }
- }
Add Comment
Please, Sign In to add comment