Random Target Finder

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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);
})();