Arch-A

A simplistic tampermonkey script that sends a highlighted piece of text to Google search or performs additional actions on Brainly.com question pages

安装此脚本
作者推荐脚本

您可能也喜欢Enable Right Click(APEX)

安装此脚本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Arch-A
// @namespace    https://github.com/DevilGlitch/ArchA
// @version      A.3.5.6
// @description  A simplistic tampermonkey script that sends a highlighted piece of text to Google search or performs additional actions on Brainly.com question pages
// @author       TheLostMoon. (Brainly script from ExtraTankz & Gradyn Wursten)
// @license      MIT
// @match        https://course.apexlearning.com/*
// @match        https://brainly.com/question/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Google Search
    if (window.location.host === 'course.apexlearning.com') {
        let highlightedText = '';
        let container = null;

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

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

            // Replace spaces with plus signs
            const query = highlightedText.replace(/\s+/g, '+');

            const searchUrl = `https://www.google.com/search?q=${query}`;

            // Open the Google search in a new tab
            window.open(searchUrl);

            // Deselect the selected text
            window.getSelection().removeAllRanges();
        }
    }

    // Brainly.com Question Page
    if (window.location.host === 'brainly.com') {
        // Remove unwanted elements after DOMContentLoaded
        document.addEventListener('DOMContentLoaded', function() {
            const unwantedElements = [
                '.brn-expanded-bottom-banner',
                '.brn-brainly-plus-box',
                '.brn-fullscreen-toplayer',
                '.sg-overlay.sg-overlay--dark',
            ];

            unwantedElements.forEach(selector => {
                const element = document.querySelector(selector);
                if (element) {
                    element.remove();
                }
            });
        });
    }
})();