ChatGPT WideScreen

Make the ChatGPT conversation window wider.

ของเมื่อวันที่ 05-02-2025 ดู เวอร์ชันล่าสุด

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         ChatGPT WideScreen
// @namespace    http://tampermonkey.net/
// @version      1.6
// @description  Make the ChatGPT conversation window wider.
// @author       Xiong Yu
// @match        https://chat.openai.com/*
// @match        https://chatgpt.com/*
// @grant        none
// @homepageURL  https://greatest.deepsurf.us/zh-CN/scripts/473238
// ==/UserScript==

(function() {
    'use strict';

    function updateStyle(element) {
        element.style.maxWidth = '95%';
    }
	
    const nodes = [
        'body > div > div > main > div > div > div > div > div > div > article > div > div',
        'body > div > div > div > div > main > div > div > div > div > div > div > article > div > div'
    ];

    const observer = new MutationObserver(mutationsList => {
        mutationsList.forEach(mutation => {
            if (mutation.addedNodes.length > 0) {
                mutation.addedNodes.forEach(addedNode => {
                    if (addedNode.nodeType === Node.ELEMENT_NODE) {
                        if (nodes.some(selector => addedNode.matches(selector))) {
                            updateStyle(addedNode);
                        } else {
                            nodes.forEach(selector => {
                                addedNode.querySelectorAll(selector).forEach(updateStyle);
                            });
                        }
                    }
                });
            }
        });
    });

    observer.observe(document, { childList: true, subtree: true });
})();