油猴:使用 tampermonkey 将 ChatGPT 对话界面加宽

此文章发布于 7 个月前,部分信息可能已经过时,请自行斟酌确认。

ChatGPT 对话网页有点窄,在看代码的时候有时候需要左右拖动不太方便,可通过油猴脚本修改 css 样式来增加宽度。

// ==UserScript==
// @name         ChatGPT 加宽
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       xinggang
// @match        https://chat.openai.com/c/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=openai.com
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // 创建 <style> 元素
    var style = document.createElement('style');
    style.type = 'text/css';

    // 添加你想要修改的 CSS 规则
    var css = `
        @media (min-width: 1280px) {
            .xl\\:max-w-3xl {
                max-width: 68rem !important;  // 修改为你希望的新样式
            }
        }
    `;

    // 添加 CSS 规则到 <style> 元素
    if (style.styleSheet) {
        style.styleSheet.cssText = css;
    } else {
        style.appendChild(document.createTextNode(css));
    }

    // 将 <style> 元素添加到 <head>
    document.head.appendChild(style);
})();

2023-12 更新规则:

    // 添加你想要修改的 CSS 规则
    var css = `
        @media (min-width: 1280px) {
            .xl\\:max-w-\\[48rem\\] {
                max-width: 68rem !important;  // 修改为你希望的新样式
            }
        }
    `;

效果如图:
20231216_105808.png

最后修改:2023 年 12 月 22 日 01 : 49 PM
如果觉得我的文章对你有用,请随意赞赏

发表评论