ChatGPT adjust height of source bar

Sets height to revert on the first span ancestor of path elements with specific d attribute

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        ChatGPT adjust height of source bar
// @match       https://chatgpt.com/*
// @description Sets height to revert on the first span ancestor of path elements with specific d attribute
// @version 0.0.1.20250718195752
// @namespace https://greasyfork.org/users/1435046
// ==/UserScript==

function setSpanHeight() {
    const pathElements = document.querySelectorAll('path[d^="M14.0857 8.74999C14.0857 5.80355"]');
    pathElements.forEach(pathElement => {
        let currentElement = pathElement;
        while (currentElement && currentElement.tagName.toLowerCase() !== 'span') {
            currentElement = currentElement.parentElement;
        }
        if (currentElement) {
            currentElement.style.setProperty('height', 'revert', 'important');
        }
    });
}

const observer = new MutationObserver(setSpanHeight);
observer.observe(document.body, { childList: true, subtree: true });
setSpanHeight();