Cuberealm chat cleanup

Cleans up your chatbox by removing [tip]s and other messages

// ==UserScript==
// @name        Cuberealm chat cleanup
// @namespace   Violentmonkey Scripts
// @match       *://cuberealm.io/*
// @grant       none
// @version     1.0
// @author      pi64
// @description Cleans up your chatbox by removing [tip]s and other messages
// ==/UserScript==

let chatMsgContainer = null;
const chatContainer = "#app > div > div > div.sc-eAuMPQ.fYWjnW > div > div:nth-child(1)";

const findChat = setInterval(() => {
  chatMsgContainer = document.querySelector(chatContainer);
  if (chatMsgContainer != null) {
    startObserving();
    clearInterval(findChat);
  }
}, 1000);


function startObserving() {
  chatMsgContainer.children[0].children[0].textContent += " (Loaded chat cleanup script)";

  const chatObserver = new MutationObserver(entries => {
    entries.forEach(entry => {
      const chatMessage = entry.addedNodes[0];
      if (!chatMessage) return;

      if (chatMessage.children.length != 1 ||
          chatMessage.children[0].textContent == "You can't build too close to world spawn (100 blocks)") {
          // console.log("Hiding a chat msg");
          chatMessage.style.display = "none";
      }

    });

  });

  chatObserver.observe(chatMsgContainer, {childList: true});
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址