ChatGPT Image Upload Enabler

Attempt to enable image uploads on ChatGPT without Plus.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         ChatGPT Image Upload Enabler
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Attempt to enable image uploads on ChatGPT without Plus.
// @author       YourName
// @match        https://chatgpt.com/*
// @icon         https://chatgpt.com/favicon.ico
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function enableImageUpload() {
        const chatInputArea = document.querySelector('textarea');
        if (!chatInputArea) return;

        // Create an image upload button
        const uploadButton = document.createElement('input');
        uploadButton.type = 'file';
        uploadButton.accept = 'image/*';
        uploadButton.style.margin = '10px';

        uploadButton.addEventListener('change', (event) => {
            const file = event.target.files[0];
            if (file) {
                alert(`Selected image: ${file.name}`);

                // Placeholder action - real uploads require API access
                console.log('Image selected:', file);
            }
        });

        // Insert the upload button before the input area
        chatInputArea.parentNode.insertBefore(uploadButton, chatInputArea);
    }

    // Observe page for dynamic changes
    const observer = new MutationObserver(() => {
        if (!document.querySelector('input[type="file"]')) {
            enableImageUpload();
        }
    });

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

    enableImageUpload();
})();