Hide ChatGPT Header

隐藏 https://chatgpt.com/ 页面顶部的共享栏

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Hide ChatGPT Header
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  隐藏 https://chatgpt.com/ 页面顶部的共享栏
// @match        https://chatgpt.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 使用 MutationObserver 等待目标元素加载完成
    const observer = new MutationObserver(() => {
        const header = document.querySelector('.draggable.sticky.top-0.z-10.flex.min-h-[60px].items-center.justify-center.border-transparent.bg-token-main-surface-primary.pl-0.md\\:hidden');
        if (header) {
            header.style.display = 'none';
            observer.disconnect();  // 找到元素后停止观察
        }
    });

    // 开始观察整个页面的 DOM 变化
    observer.observe(document.body, { childList: true, subtree: true });
})();