您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
直观展示颜色代码
// ==UserScript== // @name 颜色替换 // @namespace http://tampermonkey.net/ // @version 0.4 // @description 直观展示颜色代码 // @author yihouzenmeban // @match *://chat.openai.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; function changeNode() { document.querySelectorAll('.markdown.prose.w-full p').forEach(nodeContent => { if (!nodeContent.classList.contains('haveReplace')) { nodeContent.classList.add('haveReplace'); const str = nodeContent.innerHTML; const newStr = str.replace(/(#([a-f0-9]{3}){1,2}\b)/gi, '<span style="background-color: $1;display:inline-block;width:12px;height:12px;margin-right: 2px;border-radius:2px;"></span>$1'); nodeContent.innerHTML = newStr; } }); } function debounce(fn, delay) { let timeout; return function() { clearTimeout(timeout); timeout = setTimeout(() => { fn.apply(this, arguments); }, delay); }; } // 创建一个观察器实例并传入回调函数 const observer = new MutationObserver(debounce(() => { changeNode(); }, 500)); observer.observe(document.querySelector('body'), { childList: true, subtree: true }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址