ChatGPT WideScreen

Make the ChatGPT conversation window wider.

13.08.2024 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

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

(function() {
    'use strict';

    function updateStyle(element) {
        element.style.maxWidth = '95%';
    }
	
    var node1 = '#__next > div > div > div > main > div > div > div > div > div > div > div';
    var node2 = '#__next > div > div > main > div > div > div > div > div > div > div > div';
    var node3 = '#__next > div > div > main > div > div > div > div > div > div > div > div > div';
    var node4 = '#__next > 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 (addedNode.matches(node1) || addedNode.matches(node2)) {
                            updateStyle(addedNode);
                        } else {
                            // 如果新增节点包含目标选择器的子节点,则更新子节点的样式
                            const matchingChildren1 = addedNode.querySelectorAll(node1);
                            matchingChildren1.forEach(updateStyle);
                            const matchingChildren2 = addedNode.querySelectorAll(node2);
                            matchingChildren2.forEach(updateStyle);
                            const matchingChildren3 = addedNode.querySelectorAll(node3);
                            matchingChildren3.forEach(updateStyle);
                            const matchingChildren4 = addedNode.querySelectorAll(node4);
                            matchingChildren4.forEach(updateStyle);
                        }
                    }
                });
            }
        });
    });

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