CroxyProxy Super Helper

Auto-fills 'territorial.io', duplicates tabs with Shift+T, and clicks "Go!" with Shift+G on croxyproxy.com.

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

// ==UserScript==
// @name         CroxyProxy Super Helper
// @namespace    Violentmonkey Scripts
// @version      3.0
// @description  Auto-fills 'territorial.io', duplicates tabs with Shift+T, and clicks "Go!" with Shift+G on croxyproxy.com.
// @author       Assistant
// @match        https://*.croxyproxy.com/*
// @grant        window.open
// @run-at       document-end
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    /**
     * Finds the URL input field and fills it with "territorial.io" if it's empty.
     * This runs once when the page loads.
     */
    function handleAutoFill() {
        const urlInput = document.getElementById('url');
        if (urlInput && urlInput.value === '') {
            console.log('[CroxyProxy Helper] Found URL input. Filling with territorial.io...');
            urlInput.value = 'territorial.io';
        }
    }

    /**
     * Sets up a single event listener for all keyboard shortcuts.
     */
    function setupKeyListeners() {
        console.log('[CroxyProxy Helper] Keyboard shortcuts active: Shift+T (Duplicate), Shift+G (Go).');

        document.addEventListener('keydown', function(event) {
            // Check for Shift + T to duplicate tabs
            if (event.shiftKey && event.key === 'T') {
                event.preventDefault();
                duplicateTabs();
            }

            // NEW: Check for Shift + G to click the "Go!" button
            if (event.shiftKey && event.key === 'G') {
                event.preventDefault();
                const goButton = document.getElementById('requestSubmit');
                if (goButton) {
                    console.log('[CroxyProxy Helper] Shift+G pressed. Clicking the "Go!" button.');
                    goButton.click();
                } else {
                    console.warn('[CroxyProxy Helper] "Go!" button (id="requestSubmit") not found on the page.');
                }
            }
        });
    }

    /**
     * Contains the logic for prompting and duplicating tabs.
     */
    function duplicateTabs() {
        const countInput = prompt("How many times do you want to duplicate this page?", "2");
        if (countInput === null) {
            console.log('[CroxyProxy Helper] Tab duplication cancelled.');
            return;
        }
        const count = parseInt(countInput, 10);
        if (isNaN(count) || count <= 0) {
            alert("Invalid input. Please enter a positive number.");
            return;
        }
        const currentUrl = window.location.href;
        console.log(`[CroxyProxy Helper] Duplicating page ${count} time(s). Note: Browser may block pop-ups.`);
        for (let i = 0; i < count; i++) {
            window.open(currentUrl, '_blank');
        }
    }


    // --- Main Execution ---
    // Run the auto-fill function as soon as the script executes.
    handleAutoFill();

    // Set up the listener for all keyboard shortcuts.
    setupKeyListeners();

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址