Greasy Fork

Greasy Fork is available in English.

Hide/Show List on OpenAI Chat(隐藏/显示gpt聊天列表)

Add a button to show/hide custom CSS on OpenAI Chat page

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Hide/Show List on OpenAI Chat(隐藏/显示gpt聊天列表)
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Add a button to show/hide custom CSS on OpenAI Chat page
// @author       Your name here
// @match        https://chat.openai.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Define your custom CSS selector here
    var customCSS = '.w-full > .overflow-x-hidden:first-of-type { display: none; }';

    // Retrieve the stored state from local storage
    var isListHidden = localStorage.getItem('isListHidden') === 'true';

    // Create a button and append it to the body
    var btn = document.createElement('button');
    btn.textContent = isListHidden ?  's' : 'h';
    btn.style.position = 'fixed';
    btn.style.bottom = '10px';
    btn.style.right = '10px';
    document.body.appendChild(btn);

    // Apply the initial state based on the stored value
    var targetElement = document.querySelector('.w-full > .overflow-x-hidden:first-of-type');
    targetElement.style.display = isListHidden ? 'none' : '';

    // When the button is clicked
    btn.addEventListener('click', function() {
        // Toggle the state
        isListHidden = !isListHidden;

        // Update the stored state in local storage
        localStorage.setItem('isListHidden', isListHidden);

        // Toggle the visibility of the target element
        targetElement.style.display = isListHidden ? 'none' : '';

        // Toggle the button text
        btn.textContent = isListHidden ? 's' : 'h';
    });
})();