Skip to content

Instantly share code, notes, and snippets.

@defaultcf
Last active February 26, 2021 17:09
Show Gist options
  • Save defaultcf/1ae779e494cdc0cf5d2f95a1b01be278 to your computer and use it in GitHub Desktop.
Save defaultcf/1ae779e494cdc0cf5d2f95a1b01be278 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Fuck corps
// @namespace https://i544c.github.io
// @match *://*/*
// @grant GM_getValue
// @version 1.1.2
// @author i544c
// @description クソ企業ばかり
// ==/UserScript==
(() => {
'use strict';
const shitty_corps = GM_getValue('shitty_corps', []);
const shitty_word = GM_getValue('shitty_word', 'クソ企業');
const shit_regex = new RegExp(`(${shitty_corps.join('|')})`, 'ig');
const replacer = el => {
el.childNodes.forEach(child_el => {
if (child_el.childNodes.length > 0) {
replacer(child_el);
return;
}
if (child_el.nodeType !== Node.TEXT_NODE) return;
child_el.nodeValue = child_el.nodeValue.replace(shit_regex, shitty_word);
});
};
replacer(document.body);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment