ChatGPT UP DOWN buttons

up/down buttons for chatgpt

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         ChatGPT UP DOWN buttons
// @namespace    http://tampermonkey.net/
// @version      2026-07-25
// @description  up/down buttons for chatgpt
// @author       Johann Nather
// @match        https://chatgpt.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=chatgpt.com
// @grant        none
// @license      GNU GPLv3
// ==/UserScript==
(function () {
    "use strict";

    // Mehrfaches Einfügen verhindern
    if (document.getElementById("chat-scroll-buttons")) return;

    // Chat-Container suchen
    function getScrollContainer() {
        let best = document.scrollingElement;
        let maxScroll = 0;

        document.querySelectorAll("*").forEach((el) => {
            const style = getComputedStyle(el);

            if (
                (style.overflowY === "auto" || style.overflowY === "scroll") &&
                el.scrollHeight > el.clientHeight + 50
            ) {
                const scroll = el.scrollHeight - el.clientHeight;
                if (scroll > maxScroll) {
                    maxScroll = scroll;
                    best = el;
                }
            }
        });

        return best;
    }

    function scrollTop() {
        getScrollContainer().scrollTo({
            top: 0,
            behavior: "smooth",
        });
    }

    function scrollBottom() {
        const c = getScrollContainer();
        c.scrollTo({
            top: c.scrollHeight,
            behavior: "smooth",
        });
    }
    // Container für Buttons
    const wrapper = document.createElement("div");
    wrapper.id = "chat-scroll-buttons";
wrapper.style.cssText = `
    position: fixed;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 999999;
`;
    function createButton(symbol, onClick) {
        const btn = document.createElement("button");

        // btn.textContent = symbol;
        btn.innerHTML = symbol;
        btn.style.cssText = `
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 100, 0, 0.5);
    color: black;
    font-size: 19px;
    font-weight: bold;
    line-height: 32px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 3px 8px rgba(0,0,0,.35);
    transition: transform .15s, background-color .2s;
`;
        //-----------------------------------------------------------------------------------
        //-----------------------------------------------------------------------------------
        //-----------------------------------------------------------------------------------
        btn.onmouseenter = () => {
            btn.style.transform = "scale(1.08)";
            btn.style.backgroundColor = "rgba(139, 0, 0, 0.5)"; // dunkelrot, 50% transparent
        };

        btn.onmouseleave = () => {
            btn.style.transform = "scale(1)";
            btn.style.backgroundColor = "rgba(0, 100, 0, 0.5)"; // dunkelgrün, 50% transparent
        };
        btn.onclick = onClick;
        return btn;
    }
    //wrapper.appendChild(createButton("⬆", scrollTop));
    //wrapper.appendChild(createButton("⬇", scrollBottom));

    wrapper.appendChild(createButton("▲", scrollTop));
    wrapper.appendChild(createButton("▼", scrollBottom));

    document.body.appendChild(wrapper);
})();