change-gpt-logo.user.js
· 1.8 KiB · JavaScript
原始文件
// ==UserScript==
// @name ChatGPT Logo 换成 DeepSeek (sidebar-header, 自定义尺寸)
// @namespace https://gist.doracoin.cc/doracoin/39fd3ec77d3044fc95b408bdf6c0ac13
// @version 2025.09.09
// @description 替换 ChatGPT 左上角 sidebar-header 的 SVG logo 为 DeepSeek logo,并调整 a 标签和 logo 尺寸。
// @author Doracoin
// @match https://chatgpt.com/*
// @icon https://deepseek.com/favicon.ico
// @grant none
// ==/UserScript==
(function() {
'use strict';
const deepseekLogoUrl = 'https://commons.wikimedia.org/wiki/Special:Redirect/file/DeepSeek_logo.svg';
function replaceLogo() {
const link = document.querySelector('#sidebar-header a');
if (link && !link.classList.contains("deepseek-logo-replaced")) {
// 修改 a 标签 class
if (link.classList.contains("h-9")) {
link.classList.remove("h-9");
link.classList.add("h-10");
}
if (link.classList.contains("w-9")) {
link.classList.remove("w-9");
link.classList.add("w-68");
}
// 清空原始内容(ChatGPT 内联 SVG)
link.innerHTML = '';
// 插入 DeepSeek logo
const img = document.createElement('img');
img.src = deepseekLogoUrl;
img.alt = "DeepSeek";
img.style.width = "145px";
img.style.height = "31px";
img.style.objectFit = "contain";
link.appendChild(img);
link.classList.add("deepseek-logo-replaced");
}
}
replaceLogo();
const observer = new MutationObserver(replaceLogo);
observer.observe(document.body, { childList: true, subtree: true });
})();
| 1 | // ==UserScript== |
| 2 | // @name ChatGPT Logo 换成 DeepSeek (sidebar-header, 自定义尺寸) |
| 3 | // @namespace https://gist.doracoin.cc/doracoin/39fd3ec77d3044fc95b408bdf6c0ac13 |
| 4 | // @version 2025.09.09 |
| 5 | // @description 替换 ChatGPT 左上角 sidebar-header 的 SVG logo 为 DeepSeek logo,并调整 a 标签和 logo 尺寸。 |
| 6 | // @author Doracoin |
| 7 | // @match https://chatgpt.com/* |
| 8 | // @icon https://deepseek.com/favicon.ico |
| 9 | // @grant none |
| 10 | // ==/UserScript== |
| 11 | |
| 12 | (function() { |
| 13 | 'use strict'; |
| 14 | |
| 15 | const deepseekLogoUrl = 'https://commons.wikimedia.org/wiki/Special:Redirect/file/DeepSeek_logo.svg'; |
| 16 | |
| 17 | function replaceLogo() { |
| 18 | const link = document.querySelector('#sidebar-header a'); |
| 19 | if (link && !link.classList.contains("deepseek-logo-replaced")) { |
| 20 | // 修改 a 标签 class |
| 21 | if (link.classList.contains("h-9")) { |
| 22 | link.classList.remove("h-9"); |
| 23 | link.classList.add("h-10"); |
| 24 | } |
| 25 | if (link.classList.contains("w-9")) { |
| 26 | link.classList.remove("w-9"); |
| 27 | link.classList.add("w-68"); |
| 28 | } |
| 29 | |
| 30 | // 清空原始内容(ChatGPT 内联 SVG) |
| 31 | link.innerHTML = ''; |
| 32 | |
| 33 | // 插入 DeepSeek logo |
| 34 | const img = document.createElement('img'); |
| 35 | img.src = deepseekLogoUrl; |
| 36 | img.alt = "DeepSeek"; |
| 37 | img.style.width = "145px"; |
| 38 | img.style.height = "31px"; |
| 39 | img.style.objectFit = "contain"; |
| 40 | |
| 41 | link.appendChild(img); |
| 42 | link.classList.add("deepseek-logo-replaced"); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | replaceLogo(); |
| 47 | |
| 48 | const observer = new MutationObserver(replaceLogo); |
| 49 | observer.observe(document.body, { childList: true, subtree: true }); |
| 50 | })(); |
| 51 |