Copy All Text and Redirect to ChatGPT (iOS)

Adds a button to copy all text (with "Summarize:" prefix) and redirects to ChatGPT

当前为 2025-02-06 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Copy All Text and Redirect to ChatGPT (iOS)
// @namespace    http://tampermonkey.net/
// @version      1.6
// @description  Adds a button to copy all text (with "Summarize:" prefix) and redirects to ChatGPT
// @author       YourName
// @match        *://*/*
// @homepage     https://greasyfork.org/en/scripts/526062
// @grant        none
// ==/UserScript==
(function() {
    'use strict';
    // Create a button
    const button = document.createElement('button');
    button.textContent = '💎'; // Use an emoji or custom text
    button.style.position = 'fixed';
    button.style.bottom = '10px';
    button.style.left = '50%'; // Position in the middle horizontally
    button.style.transform = 'translateX(-50%)'; // Center the button
    button.style.zIndex = 10000;
    button.style.padding = '10px 20px';
    button.style.backgroundColor = 'rgba(255, 255, 255, 0)'; // Fully transparent background
    button.style.color = 'rgba(255, 255, 255, 0.3)'; // Semi-transparent white color
    button.style.border = 'none'; // No border
    button.style.borderRadius = '5px'; // Rounded corners
    button.style.cursor = 'pointer'; // Pointer cursor on hover
    button.style.fontSize = '18px'; // Font size
    button.style.opacity = '0.2'; // Added overall opacity
 
    // Add hover effect to make it more visible when needed
    button.addEventListener('mouseenter', () => {
        button.style.opacity = '0.8';
    });
    button.addEventListener('mouseleave', () => {
        button.style.opacity = '0.2';
    });
 
    // Add button to the page
    document.body.appendChild(button);
 
    // Button click handler
    button.addEventListener('click', () => {
        // Select all text
        const range = document.createRange();
        range.selectNodeContents(document.body);
        const selection = window.getSelection();
        selection.removeAllRanges();
        selection.addRange(range);
 
        // Add "Summarize:" prefix to the selected text
        const selectedText = selection.toString();
        const textWithPrefix = `Summarize: ${selectedText}`;
 
        // Copy text with prefix to clipboard
        navigator.clipboard.writeText(textWithPrefix)
            .then(() => {
                // Redirect to ChatGPT
                window.location.href = 'https://chat.openai.com';
            })
            .catch(err => {
                console.error('Failed to copy text:', err);
            });
    });
})();