Skip to content

Instantly share code, notes, and snippets.

@i544c

i544c/fuck_corps.user.js

Last active Oct 12, 2020
Embed
What would you like to do?
// ==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