Advertisement
MeKLiN2

Untitled

Dec 4th, 2024
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. // Observe mutations in the chat content
  2. const observer = new MutationObserver(mutationsList => {
  3. mutationsList.forEach(mutation => {
  4. mutation.addedNodes.forEach(node => {
  5. if (node instanceof HTMLElement && node.classList.contains('message') && node.classList.contains('common')) {
  6. // Check if the added node is a common message and from the user "u_u"
  7. const nicknameElement = node.querySelector('.nickname');
  8. if (nicknameElement && nicknameElement.innerText.trim() === 'u_u') {
  9. const messageText = node.innerText.trim();
  10. const messageElement = document.createElement('div');
  11. messageElement.textContent = messageText;
  12. userMessageWindow.appendChild(messageElement);
  13. // Hide the user's message in the main chat box
  14. node.style.display = 'none';
  15. }
  16. }
  17. });
  18. });
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement