Delete System Chat Messages

Deletes any new system chat message, leaves dungeon messages alone

  1. // ==UserScript==
  2. // @name Delete System Chat Messages
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description Deletes any new system chat message, leaves dungeon messages alone
  6. // @author GoldenHound
  7. // @match https://www.milkywayidle.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function removeInvalidMessages() {
  16. document.querySelectorAll('.TabPanel_tabPanel__tXMJF .ChatMessage_chatMessage__2wev4.ChatMessage_systemMessage__3Jz9e').forEach(msg => {
  17. const messageText = msg.textContent.trim();
  18.  
  19. // List of strings that should not be deleted
  20. const allowedStrings = [
  21. "Key count:", "Party failed", "is not ready",
  22. "joined the party", "is ready", "Battle started:"
  23. ];
  24.  
  25. // Check if the message contains any of the allowed strings
  26. const isValid = allowedStrings.some(allowedString => messageText.includes(allowedString));
  27.  
  28. // Delete the message if it doesn't contain a ":" or any of the allowed strings
  29. if (!isValid) {
  30. msg.remove();
  31. }
  32. });
  33. }
  34.  
  35. const observer = new MutationObserver(removeInvalidMessages);
  36. observer.observe(document.body, { childList: true, subtree: true });
  37.  
  38. removeInvalidMessages();
  39. })();

QingJ © 2025

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