Torn Custom Race Simplifier

Make it easier and faster to make custom races.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Torn Custom Race Simplifier
// @version      0.5
// @description  Make it easier and faster to make custom races.
// @author       Xiphias[187717]
// @match        *www.torn.com/loader.php?sid=racing*
// @grant        none
// @namespace https://greatest.deepsurf.us/users/3898
// ==/UserScript==
var numberOfLaps = "1"; // Change this value to set number of laps.
var maxDrivers = "2"; // Change this value to set the number of maximum drivers.
var trackName = "Uptown"; // Change to desired track name

(function() {
    'use strict';
	$('body').ajaxComplete(function (e, xhr, settings) {
        var createCustomRaceSection = "section=createCustomRace";
		var url = settings.url;
		if (url.indexOf(createCustomRaceSection) >= 0) {
            var lapsInput = $('.laps-wrap > .input-wrap > input');
            lapsInput.attr('value', numberOfLaps);

            var maxDriversInput = $('.drivers-max-wrap div.input-wrap input');
            maxDriversInput.attr('value', maxDrivers);

            $('#select-racing-track').selectmenu();
            $('#select-racing-track-menu > li:contains(' + trackName+ ')').mouseup();
        }
    });
})();