Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name 4chan vtuber fan mark adder
- // @match https://boards.4channel.org/*
- // ==/UserScript==
- (function() {
- const replacements = [
- { regex: /\bpomu\b/ig, value: '🧚🍂$&' },
- { regex: /\b(ewiwa|elira)\b/ig, value: '🌤️$&' },
- { regex: /\b(finana|feesh)\b/ig, value: '🐠$&' },
- ];
- function handleChildNodes(e) {
- for (const n of e.childNodes) {
- if (n.nodeType === 3) {
- for (const r of replacements) {
- n.nodeValue = n.nodeValue.replace(r.regex, r.value);
- }
- } else if (n.nodeType === 1) {
- handleChildNodes(n)
- }
- }
- }
- function addEmoji() {
- for (const e of document.querySelectorAll(".postMessage")) {
- if (e.modded != true) {
- e.modded = true;
- handleChildNodes(e);
- }
- }
- }
- // identify an element to observe
- const target = document.querySelector(".thread");
- // create a new instance of `MutationObserver` named `observer`,
- // passing it a callback function
- const observer = new MutationObserver(() => {
- addEmoji();
- });
- observer.observe(target, {
- subtree: true,
- childList: true
- });
- addEmoji();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement