Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Observe mutations in the chat content
- const observer = new MutationObserver(mutationsList => {
- mutationsList.forEach(mutation => {
- mutation.addedNodes.forEach(node => {
- if (node instanceof HTMLElement && node.classList.contains('message') && node.classList.contains('common')) {
- // Check if the added node is a common message and from the user "u_u"
- const nicknameElement = node.querySelector('.nickname');
- if (nicknameElement && nicknameElement.innerText.trim() === 'u_u') {
- const messageText = node.innerText.trim();
- const messageElement = document.createElement('div');
- messageElement.textContent = messageText;
- userMessageWindow.appendChild(messageElement);
- // Hide the user's message in the main chat box
- node.style.display = 'none';
- }
- }
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement