Greasy Fork

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

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

目前为 2023-05-05 提交的版本。查看 最新版本

// ==UserScript==
// @name         chat gpt 聊天列表隐藏(Show/Hide List on OpenAI Chat)
// @namespace    http://tampermonkey.net/
// @version      1.0
// @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; }';

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

    // When the button is clicked
    btn.addEventListener('click', function() {
        // Get the target element
        var targetElement = document.querySelector('.w-full > .overflow-x-hidden:first-of-type');

        // If the custom CSS is already applied
        if (targetElement.style.display === 'none') {
            // Show the element
            targetElement.style.display = '';
            btn.textContent = 'Hide List';
        } else {
            // Hide the element
            targetElement.style.display = 'none';
            btn.textContent = 'Show List';
        }
    });
})();