ChatGPT Message Queue

Queue messages when ChatGPT is still composing responses

18.03.2025 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 Message Queue
// @match       https://chat.openai.com/*
// @match       https://chatgpt.com/*
// @description Queue messages when ChatGPT is still composing responses
// @version 0.0.1.20250318110102
// @namespace https://greasyfork.org/users/1435046
// ==/UserScript==

(function() {
    'use strict';
    
    let queueCount = 0;
    let queueObserver;
    let queueDisplay;

    function createQueueDisplay() {
        // Create queue display with clear button
        queueDisplay = document.createElement('div');
        queueDisplay.style.position = 'fixed';
        queueDisplay.style.bottom = '100px';
        queueDisplay.style.right = '20px';
        queueDisplay.style.background = 'rgba(0,0,0,0.7)';
        queueDisplay.style.color = 'white';
        queueDisplay.style.padding = '5px 10px';
        queueDisplay.style.borderRadius = '4px';
        queueDisplay.style.display = 'flex';
        queueDisplay.style.gap = '8px';
        queueDisplay.style.alignItems = 'center';

        const text = document.createElement('span');
        text.textContent = `Queue: ${queueCount}`;
        
        const clearBtn = document.createElement('button');
        clearBtn.textContent = '×';
        clearBtn.style.cursor = 'pointer';
        clearBtn.style.background = 'transparent';
        clearBtn.style.border = 'none';
        clearBtn.style.color = 'inherit';
        clearBtn.style.fontSize = '18px';
        clearBtn.style.padding = '0 4px';
        clearBtn.onclick = () => {
            queueCount = 0;
            text.textContent = `Queue: ${queueCount}`;
        };

        queueDisplay.appendChild(text);
        queueDisplay.appendChild(clearBtn);
        document.body.appendChild(queueDisplay);
    }

    // Rest of the original script remains unchanged
    function handleSendButton() {
        const sendButton = document.querySelector('[data-testid="send-button"]');
        if (sendButton && queueCount > 0) {
            sendButton.click();
            queueCount--;
            queueDisplay.querySelector('span').textContent = `Queue: ${queueCount}`;
        }
    }

    const textareaObserver = new MutationObserver(() => {
        const textarea = document.getElementById('prompt-textarea');
        if (textarea && !textarea.dataset.queueEnabled) {
            textarea.dataset.queueEnabled = 'true';
            
            textarea.addEventListener('keydown', (e) => {
                if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
                    if (document.querySelector('[data-testid="stop-button"]')) {
                        e.preventDefault();
                        queueCount++;
                        queueDisplay.querySelector('span').textContent = `Queue: ${queueCount}`;
                        
                        if (!queueObserver) {
                            queueObserver = new MutationObserver(handleSendButton);
                            queueObserver.observe(document.body, {
                                childList: true,
                                subtree: true
                            });
                        }
                    }
                }
            });
        }
    });

    // Initialize
    createQueueDisplay();
    textareaObserver.observe(document.body, {
        childList: true,
        subtree: true
    });
})();