Advertisement
Guest User

Untitled

a guest
Mar 29th, 2023
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        4chan vtuber fan mark adder
  3. // @match       https://boards.4channel.org/*
  4. // ==/UserScript==
  5. (function() {
  6.  
  7.     function addEmoji() {
  8.         for (const e of document.querySelectorAll(".postMessage")) {
  9.             if (e.modded != true) {
  10.                 e.modded = true;
  11.                 for (const n of e.childNodes) {
  12.                     if (n.nodeType === 3) {
  13.                         n.nodeValue = n.nodeValue.replace(/\bpomu\b/ig, '🧚🍂Pomu');
  14.                         n.nodeValue = n.nodeValue.replace(/\belira\b/ig, '🌤️Elira');
  15.                         n.nodeValue = n.nodeValue.replace(/\bewiwa\b/ig, '🌤️Ewiwa');
  16.                     }
  17.                 }
  18.             }
  19.         }
  20.     }
  21.  
  22.     // identify an element to observe
  23.     const target = document.querySelector(".thread");
  24.  
  25.     // create a new instance of `MutationObserver` named `observer`,
  26.     // passing it a callback function
  27.     const observer = new MutationObserver(() => {
  28.         addEmoji();
  29.     });
  30.  
  31.     observer.observe(target, {
  32.         subtree: true,
  33.         childList: true
  34.     });
  35.  
  36.     addEmoji();
  37.  
  38. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement