摸鱼室终端风格-黑白版

将摸鱼室聊天界面改造成终端风格(黑白版),方便摸鱼

目前為 2025-05-30 提交的版本,檢視 最新版本

// ==UserScript==
// @name         摸鱼室终端风格-黑白版
// @namespace    http://tampermonkey.net/
// @version      1.1.4
// @description  将摸鱼室聊天界面改造成终端风格(黑白版),方便摸鱼
// @author       Claude
// @match        https://fish.codebug.icu/chat
// @match        https://yucoder.cn/chat
// @icon         https://www.google.com/s2/favicons?sz=64&domain=codebug.icu
// @grant        none
// ==/UserScript==

(function () {
  "use strict";

  // 创建并添加终端风格的CSS
  const terminalStyle = document.createElement("style");
  terminalStyle.textContent = `
      /* 整体背景和字体 */
      body {
        background-color: #0c0c0c !important;
        color: #d0d0d0 !important;
        font-family: 'Courier New', monospace !important;
      }

      /* 聊天容器样式 */
      .messageContainer___zUc1q {
        background-color: #0c0c0c !important;
        border: 1px solid #555 !important;
        border-radius: 0 !important;
        padding: 10px !important;
        max-height: 85vh !important;
      }

      /* 消息项样式 - 改为单行终端风格 */
      .messageItem___UXffF {
        background-color: transparent !important;
        border-bottom: 1px dashed #444 !important;
        padding: 5px 0 !important;
        margin-bottom: 5px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
      }

      /* 隐藏头像 */
      .avatar___zrh3f {
        display: none !important;
      }

      /* 消息头部样式 */
      .messageHeader___ABpsT {
        display: inline-flex !important;
        align-items: center !important;
        margin-right: 5px !important;
        order: 2 !important;
        width: 150px !important; /* 固定宽度 */
        min-width: 150px !important; /* 防止缩小 */
        flex-shrink: 0 !important; /* 防止缩小 */
      }

      /* 用户名样式 */
      .senderName___s5UP3 {
        color: #4CAF50 !important;
        font-weight: bold !important;
        margin-right: 5px !important;
        width: 120px !important; /* 固定宽度,最多显示10个汉字 */
        min-width: 120px !important; /* 防止缩小 */
        display: inline-block !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important; /* 防止缩小 */
      }

      /* 完全删除等级标签和管理员标签 */
      .levelBadge___XJap_, .adminTag___lL0Ow, .titleTagInvestor___DUbJ4 {
        display: none !important;
      }

      /* 隐藏等级文字 */
      .adminText___jDfqg {
        display: none !important;
      }

      /* 消息内容样式 - 终端风格单行显示 */
      .messageContent___BeZJv {
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        margin-left: 0 !important;
        display: inline-block !important;
        order: 3 !important;
        flex: 1 !important; /* 让消息内容占据剩余空间 */
      }

      .messageContent___QDsxD {
        color: #d0d0d0 !important;
        display: inline !important;
        background: transparent !important;
        padding: 0 !important;
        box-shadow: none !important;
      }

      /* 移除消息内容的气泡样式 */
      .chatRoom___z4hOy .messageContainer___zUc1q .messageItem___UXffF .messageContent___BeZJv {
        margin-top: 0 !important;
        background: transparent !important;
        padding: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin-left: 0 !important;
      }

      /* 时间戳样式 - 移到最前面并调整宽度 */
      .timestamp___pqcve {
        color: #777 !important;
        font-style: italic !important;
        margin-right: 0px !important;
        order: 1 !important;
        width: 60px !important;
        min-width: 60px !important; /* 防止缩小 */
        padding-left: 0px !important;
        font-size: 12px !important;
        flex-shrink: 0 !important; /* 防止缩小 */
      }

      /* 消息底部样式 */
      .messageFooter___eWkrw {
        display: inline-flex !important;
        align-items: center !important;
        margin-left: 0px !important;
        margin-right: 5px !important;
        order: 1 !important; /* 将整个footer移到前面 */
        padding-left: 0px !important;
        flex-shrink: 0 !important; /* 防止缩小 */
      }

      /* 引用按钮样式 - 默认隐藏,悬浮时显示 */
      .quoteText___reQEz {
        display: none !important;
        color: #888 !important;
        font-size: 12px !important;
        cursor: pointer !important;
        margin-left: 5px !important;
      }

      /* 悬浮在消息上时显示引用按钮 */
      .messageItem___UXffF:hover .quoteText___reQEz {
        display: inline-block !important;
      }

      /* 输入区域样式 */
      .inputArea___KNPKm {
        background-color: #0c0c0c !important;
        border-top: 1px solid #444 !important;
        padding: 10px !important;
      }

      /* 输入框样式 */
      .chatTextArea___P0JAV {
        background-color: #0c0c0c !important;
        color: #d0d0d0 !important;
        border: 1px solid #444 !important;
        border-radius: 0 !important;
      }

      /* 隐藏输入框的占位符文本 */
      .chatTextArea___P0JAV::placeholder {
        color: transparent !important;
      }

      /* 按钮样式 */
      .ant-btn {
        background-color: #0c0c0c !important;
        color: #d0d0d0 !important;
        border: 1px solid #444 !important;
        border-radius: 0 !important;
      }

      /* 发送按钮样式 */
      .sendButton___gOHpp {
        background-color: #0c0c0c !important;
        color: #d0d0d0 !important;
        border: 1px solid #444 !important;
      }

      /* 隐藏发送按钮中的所有文本 */
      .sendButton___gOHpp span {
        font-size: 0 !important;
      }

      /* 隐藏发送按钮中的图标 */
      .sendButton___gOHpp .ant-btn-icon {
        display: none !important;
      }

      /* 只在按钮上添加一个执行文本 */
      .sendButton___gOHpp::after {
        content: "执行" !important;
        font-size: 14px !important;
        color: #d0d0d0 !important;
      }

      /* 修改滚动条样式 */
      ::-webkit-scrollbar {
        width: 8px !important;
        background-color: #0c0c0c !important;
      }

      ::-webkit-scrollbar-thumb {
        background-color: #444 !important;
      }

      /* 添加终端前缀 - 放在时间戳后面 */
      .messageHeader___ABpsT::before {
        content: "$ " !important;
        color: #ffffff !important;
        font-weight: bold !important;
        margin-right: 5px !important;
        display: inline-block !important;
        width: 15px !important;
        text-align: center !important;
      }



      /* 添加终端窗口标题 */
      body::before {
        content: "Terminal - 系统监控";
        display: block;
        background-color: #222;
        color: #fff;
        padding: 5px 10px;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        font-size: 14px;
        border-bottom: 1px solid #444;
      }

      /* 添加终端命令提示符 */
      .inputRow___kMy91::before {
        content: "$ ";
        color: #ffffff;
        font-weight: bold;
        margin-right: 5px;
      }

      /* 隐藏在线成员列表 */
      .userList___AyZ7o {
        display: none !important;
      }

      /* 让聊天区域占满整个宽度 */
      .chatPanel___QEdZP {
        width: 100% !important;
        max-width: 100% !important;
      }

      /* 强制消息内容为单行,超出部分用省略号 */
      .messageContent___QDsxD p {
        display: inline !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 70% !important;
      }

      /* 修复可能的布局问题 */
      .senderInfo___F2m3s {
        display: inline-flex !important;
        align-items: center !important;
      }
    `;

  document.head.appendChild(terminalStyle);

  // 修改页面标题
  document.title = "系统监控终端";

  // 页面加载完成后设置界面
  window.addEventListener("load", function () {
    // 修改输入框占位符文本为空
    const textarea = document.querySelector(".chatTextArea___P0JAV");
    if (textarea) {
      textarea.setAttribute("placeholder", "");
    }

    // 隐藏在线成员列表
    const userList = document.querySelector(".userList___AyZ7o");
    if (userList) {
      userList.style.display = "none";
    }

    // 监听DOM变化,对新添加的消息应用终端风格
    const observer = new MutationObserver(function (mutations) {
      mutations.forEach(function (mutation) {
        if (mutation.addedNodes.length) {
          mutation.addedNodes.forEach(function (node) {
            if (
              node.nodeType === 1 &&
              node.classList.contains("messageItem___UXffF")
            ) {
              // 确保消息内容在一行显示
              const contentDiv = node.querySelector(".messageContent___QDsxD");
              if (contentDiv && contentDiv.querySelector("p")) {
                const text = contentDiv.querySelector("p").innerText;
                contentDiv.querySelector("p").innerText = text.replace(
                  /\n/g,
                  " "
                );
              }

              // 将时间戳移到最前面
              const footer = node.querySelector(".messageFooter___eWkrw");
              if (footer) {
                node.insertBefore(footer, node.firstChild);

                // 确保引用按钮可见性正确
                const quoteButton = footer.querySelector(".quoteText___reQEz");
                if (quoteButton) {
                  quoteButton.style.display = "none";
                }
              }

              // 删除等级标签和天使投资人标签
              const levelBadge = node.querySelector(".levelBadge___XJap_");
              if (levelBadge) {
                levelBadge.remove();
              }

              const adminTag = node.querySelector(".adminTag___lL0Ow");
              if (adminTag) {
                adminTag.remove();
              }

              // 确保用户名占用固定宽度
              const senderName = node.querySelector(".senderName___s5UP3");
              if (senderName) {
                // 已经在CSS中设置了固定宽度
                // 这里可以添加额外的处理,比如去除特殊字符等
              }
            }
          });
        }
      });
    });

    const messageContainer = document.querySelector(
      ".messageContainer___zUc1q"
    );
    if (messageContainer) {
      observer.observe(messageContainer, { childList: true });

      // 处理已有的消息
      const existingMessages = messageContainer.querySelectorAll(
        ".messageItem___UXffF"
      );
      existingMessages.forEach(function (message) {
        // 将时间戳移到最前面
        const footer = message.querySelector(".messageFooter___eWkrw");
        if (footer) {
          message.insertBefore(footer, message.firstChild);

          // 确保引用按钮可见性正确
          const quoteButton = footer.querySelector(".quoteText___reQEz");
          if (quoteButton) {
            quoteButton.style.display = "none";
          }
        }

        // 确保消息内容在一行显示
        const contentDiv = message.querySelector(".messageContent___QDsxD");
        if (contentDiv && contentDiv.querySelector("p")) {
          const text = contentDiv.querySelector("p").innerText;
          contentDiv.querySelector("p").innerText = text.replace(/\n/g, " ");
        }

        // 删除等级标签和天使投资人标签
        const levelBadge = message.querySelector(".levelBadge___XJap_");
        if (levelBadge) {
          levelBadge.remove();
        }

        const adminTag = message.querySelector(".adminTag___lL0Ow");
        if (adminTag) {
          adminTag.remove();
        }

        // 确保用户名占用固定宽度
        const senderName = message.querySelector(".senderName___s5UP3");
        if (senderName) {
          // 已经在CSS中设置了固定宽度
          // 这里可以添加额外的处理,比如去除特殊字符等
        }
      });
    }
  });

  // 添加键盘快捷键 - 按下Esc键快速切换回正常模式
  let terminalModeEnabled = true;
  document.addEventListener("keydown", function (e) {
    // Esc键切换终端模式
    if (e.key === "Escape") {
      terminalModeEnabled = !terminalModeEnabled;
      terminalStyle.disabled = !terminalModeEnabled;

      // 切换页面标题
      document.title = terminalModeEnabled ? "系统监控终端" : "摸鱼室";

      // 切换在线成员列表显示
      const userList = document.querySelector(".userList___AyZ7o");
      if (userList) {
        userList.style.display = terminalModeEnabled ? "none" : "";
      }
    }
  });
})();

QingJ © 2025

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