Random Target Finder

Adds a button to the top of the page that opens a new tab with an easy target.

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

You will need to install an extension such as Tampermonkey to install this script.

Necesitarás instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Necesitará instalar una extensión como Tampermonkey para instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

// ==UserScript==
// @name         Random Target Finder
// @version      1.0
// @namespace    http://tampermonkey.net/
// @description  Adds a button to the top of the page that opens a new tab with an easy target.
// @author       Omanpx [1906686]
// @license      MIT
// @match        https://www.torn.com/*
// ==/UserScript==

(function() {
    'use strict';

    // Define requirements
    // These are user ID ranges that will be targeted
    const minID = 3000000;
    const maxID = 3400000;
    function getRandomNumber(min, max) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    }
    // Create a button element
    const button = document.createElement('button');
    button.innerHTML = 'Chain';
    button.style.position = 'fixed';
    //button.style.top = '10px';
    //button.style.right = '10px';
    button.style.top = '27%'; // Adjusted to center vertically
    button.style.right = '0%'; // Center horizontally
    //button.style.transform = 'translate(-50%, -50%)'; // Center the button properly
    button.style.zIndex = '9999';

    // Add CSS styles for a green background
    button.style.backgroundColor = 'green';
    button.style.color = 'white';
    button.style.border = 'none';
    button.style.padding = '6px';
    button.style.borderRadius = '6px';
    button.style.cursor = 'pointer';

    // Add a click event listener to open Google in a new tab
    button.addEventListener('click', function() {
        let randID = getRandomNumber(minID,maxID);
        // Uncomment one of the lines below, depending on what you prefer
        //let profileLink = `https://www.torn.com/profiles.php?XID=${randID}`; // Profile link
        let profileLink = `https://www.torn.com/loader.php?sid=attack&user2ID=${randID}`; // Attack link

        // Comment this line and uncomment the one below it if you want the profile to open in a new tab
        window.location.href = profileLink;
        //window.open(profileLink, '_blank');
    });
    // Add the button to the page
    document.body.appendChild(button);
})();