CroxyProxy Helper

Auto-fills 'territorial.io' and duplicates tabs with Shift+T on croxyproxy.com.

// ==UserScript==
// @name         CroxyProxy Helper
// @namespace    Violentmonkey Scripts
// @version      4.0
// @description  Auto-fills 'territorial.io' and duplicates tabs with Shift+T 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.
     */
    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 the event listener for the tab duplication shortcut.
     */
    function setupKeyListeners() {
        console.log('[CroxyProxy Helper] Keyboard shortcut active: Shift+T to duplicate tabs.');

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

    /**
     * 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 ---
    handleAutoFill();
    setupKeyListeners();

})();

QingJ © 2025

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