CustomVehicles

Fahrzeugtyp umbennen + eigene AAO

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 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         CustomVehicles
// @namespace    http://tampermonkey.net/
// @version      1.0.5
// @description  Fahrzeugtyp umbennen + eigene AAO
// @author       JuMaHo
// @match        https://www.leitstellenspiel.de/*
// @grant        none
// ==/UserScript==

(function() {


    function fz_edit(fz_id,fz_type,fz_color){
$( "a[href$='/vehicles/" + fz_id + "']" ).next().text('(' + fz_type +')');
    if($( "a[href$='/vehicles/" + fz_id + "/edit']" ).length > 0){
        $( "a[href$='/fahrzeugfarbe/" + fz_color + "']" ).text('' + fz_type + '');
    }
}

    function aao(aao_id,custom_id){
$("#aao_" + aao_id + "").click(function(){
    $(".vehicle_checkbox").each(function(){
        var vehicle_checkid = $(this).attr("custom_id");
        var vehicle_id = $(this).attr("value");

        if($("#vehicle_checkbox_" + vehicle_id + "").prop('checked') === false) {
        if(vehicle_checkid === '' + custom_id + ''){
            $("#vehicle_checkbox_" + vehicle_id + "").click();
        return false;
        }
      }

    });
 });
}

    function add_custom_id(vehicle_id,custom_id){
         $('#vehicle_checkbox_' + vehicle_id + '').attr('custom_id', '' + custom_id + '');
    }

    /***************************************************************************************/
    add_custom_id(12645389,54321); //Fahrzeug eine neuen Unterkategorie zuweisen
    fz_edit(12645389,'GW-Tier',30); //Typenbezeichnung in Einsatzliste und Wache anpassen
    aao(2593847,54321); //Fahrzeugkategorie einem AAO Button zuweisen
   /***************************************************************************************/
   
})();