Greasy Fork 支持简体中文。

Arch-A

A simplistic tampermonkey script that sends a highlighted piece of text to a helper site

目前為 2023-03-22 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Arch-A
// @namespace    https://github.com/DevilGlitch/ArchA
// @version      A.2.5.3
// @description  A simplistic tampermonkey script that sends a highlighted piece of text to a helper site
// @license      MIT
// @match        https://course.apexlearning.com/*
// @grant        GM_xmlhttpRequest
// ==/UserScript==

(function() {
    'use strict';

    let highlightedText = '';
    let container = null;

    window.addEventListener('mouseup', event => {
        console.log('Mouse up event detected');
        runArchA();
    });

    // function to send the request to ChatGPT and display the response
    function runArchA() {
        const highlightedText = window.getSelection().toString();
        if (!highlightedText) return;

        // Replace <TRANSLATOR_URL> with the URL of the translator API that you want to use
        const translatorUrl = 'https://www.answers.com/search?q=';

        // Replace spaces with plus signs and encode question marks
        const translatedText = encodeURIComponent(highlightedText);

        const url = `${translatorUrl}?text=${translatedText}`;

        // Open the translated text in a new window
        window.open(url);
    }
})();