// ==UserScript== // @name changeChatGPTImage // @namespace changeChatGPTImage // @version 1.0 // @description 替换ChatGPT里的ai头像 在页面加载完成后 代码都是基于ChatGPT提供的内容修改的 // @author mei // @match https://chat.openai.com/chat // @icon https://chat.openai.com/apple-touch-icon.png // @grant none // @license MIT // @downloadURL none // ==/UserScript== var link = "https://s3.bmp.ovh/imgs/2022/12/18/f2294e4eb27e9161.jpg";//ChatGPT的头像地址(你可以自己提供一个图片的链接来替换它。如果你希望使用某张本地图片可以选择上传到图床并用图床的链接替换它。) var circle = false;//是否启用圆角 (你可以通过更改borderRadius的属性来调整圆角大小。过大的borderRadius可以使头像显示为圆形,目前即为圆形。) var shadow = false;//是否启用阴影(不推荐) var change = true;//改为false会启用自动填入,但是它的运作不是很理想,会被自动清除,除非给该文本进行编辑。(这个功能本来是为了自动输入RP内容) var text = "Hello, world!";//自动填入的内容 document.addEventListener("DOMNodeInserted", function() { //自动填入 if(!change){ setTimeout(() => { let textelements = document.querySelectorAll('.flex.flex-col.w-full.py-2'); let element = textelements[0]; let textarea = element.querySelector('textarea'); textarea.value = text; }, 500); change = !change; } //更换样式 let elementsSVG = document.querySelectorAll('.flex.flex-col.relative.items-end svg'); elementsSVG.forEach(function(elementSVG) { var imgElement = document.createElement("img"); imgElement.src = link; if(circle){imgElement.style.borderRadius = "14px";} if(shadow){imgElement.style.boxShadow = "0 2px 4px rgba(0,0,0,6)";} elementSVG.parentNode.replaceChild(imgElement, elementSVG); }); let elementsRound = document.querySelectorAll('.relative.p-1.rounded-sm.text-white.flex.items-center.justify-center'); elementsRound.forEach(function(elementRound) { elementRound.style.padding = '0'; if(circle){elementRound.style.borderRadius = "14px";} }); }); /* document.addEventListener('DOMContentLoaded', function() { }); */