publink-openai-beautify

openai样式美化

// ==UserScript==
// @name         publink-openai-beautify
// @namespace    http://tampermonkey.net/
// @version      0.01
// @description  openai样式美化
// @author       huangbc
// @include      *://*
// @license      MIT
// @icon         https://www.google.com/s2/favicons?sz=64&domain=shb.ltd
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let styleElement = document.createElement('style')
    styleElement.textContent = `nav > a.items-center:nth-of-type(2) { display: none; }`

    let scriptElement = document.createElement('script')
    scriptElement.textContent = `
      function setTextareaHeight() {

       let isOpenAI = window.location.host == "chat.openai.com"

      if (!isOpenAI) {
        return;
      }

      let textElement = document.querySelector('textarea');

      textElement.addEventListener('focus', function(event) {

        const element = event.target;
        element.style.minHeight = '200px';

      })

      textElement.addEventListener('blur', function() {
        const element = event.target;
        element.style.minHeight = '0px';
      })
    }

    window.onload = () => {
      setTimeout(() => {
        setTextareaHeight();
      }, 2000);
     }

    `
//    document.body.append(scriptElement)
    document.body.append(styleElement)

    // Your code here...
})();