🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2026/01/11 18:20:36
🔄 下次更新时间:2026/01/11 19:20:36
手动刷新缓存

Remove ChatGPT GPT-5 Background

Remove the background image from ChatGPT webpage

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         Remove ChatGPT GPT-5 Background
// @name:zh-CN   移除 ChatGPT GPT-5 渐变背景图片
// @namespace    kai.tools
// @version      0.1.1
// @description  Remove the background image from ChatGPT webpage
// @description:zh-CN  移除 ChatGPT 页面上的装饰性背景图
// @match        https://chatgpt.com/*
// @match        https://chat.openai.com/*
// @run-at       document-start
// @grant        GM_registerMenuCommand
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';
    const LOG = false;
    const log = (...a) => LOG && console.log('[BG-Remover]', ...a);

    // 提前用 CSS 隐藏,减少闪烁
    const css = `
img[src*="persistent.oaistatic.com/burrito-nux"],
img[srcset*="persistent.oaistatic.com/burrito-nux"],
source[srcset*="persistent.oaistatic.com/burrito-nux"],
picture:has(source[srcset*="persistent.oaistatic.com/burrito-nux"]),
img.absolute.inset-0.h-full.w-full[alt=""][aria-hidden="true"][src*="persistent.oaistatic.com"],
img[class*="blur-2xl"][src*="persistent.oaistatic.com"],
img[class*="opacity-50"][src*="persistent.oaistatic.com"],
img[class*="opacity-30"][src*="persistent.oaistatic.com"] { display: none !important; }
`;
    function injectCSS() {
        if (document.getElementById('bg-remover-style')) return;
        const style = document.createElement('style');
        style.id = 'bg-remover-style';
        style.textContent = css;
        document.documentElement.appendChild(style);
    }

    function removeBackgroundElements(root = document) {
        try {
            root.querySelectorAll('img[src*="persistent.oaistatic.com/burrito-nux"], img[srcset*="persistent.oaistatic.com/burrito-nux"]').forEach(img => {
                log('remove img', img.src || img.srcset);
                img.remove();
            });

            root.querySelectorAll('source[srcset*="persistent.oaistatic.com/burrito-nux"]').forEach(s => {
                log('remove source', s.srcset);
                s.remove();
            });

            root.querySelectorAll('picture').forEach(p => {
                if (p.querySelector('source[srcset*="persistent.oaistatic.com/burrito-nux"]')) {
                    log('remove picture');
                    p.remove();
                }
            });

            root.querySelectorAll('img.absolute.inset-0.h-full.w-full[alt=""][aria-hidden="true"]').forEach(img => {
                if (img.src && img.src.includes('persistent.oaistatic.com')) {
                    log('remove hero bg', img.src);
                    img.remove();
                }
            });

            root.querySelectorAll('img[class*="blur-2xl"], img[class*="opacity-50"], img[class*="opacity-30"]').forEach(img => {
                if (img.src && img.src.includes('persistent.oaistatic.com')) {
                    log('remove blur bg', img.src);
                    img.remove();
                }
            });

            // 清除通过 CSS background-image 引入的背景
            root.querySelectorAll('[style*="background"]').forEach(el => {
                const bg = getComputedStyle(el).backgroundImage;
                if (bg && bg.includes('persistent.oaistatic.com')) {
                    el.style.setProperty('background', 'none', 'important');
                    el.style.setProperty('background-image', 'none', 'important');
                    log('clear css background', bg);
                }
            });
        } catch (e) {
            console.error('BG-Remover error:', e);
        }
    }

    const observer = new MutationObserver(muts => {
        for (const m of muts) {
            if (m.addedNodes && m.addedNodes.length) {
                removeBackgroundElements(document);
                break;
            }
        }
    });

    function start() {
        injectCSS();
        removeBackgroundElements(document);
        observer.observe(document.documentElement, { childList: true, subtree: true });
        setTimeout(removeBackgroundElements, 1000);
        setTimeout(removeBackgroundElements, 3000);

        if (typeof GM_registerMenuCommand === 'function') {
            GM_registerMenuCommand('手动移除背景(ChatGPT)', () => removeBackgroundElements(document));
        }
        log('started');
    }

    if (document.readyState === 'loading') {
        start();
        document.addEventListener('DOMContentLoaded', () => {
            injectCSS();
            removeBackgroundElements(document);
        });
    } else {
        start();
    }
})();