NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name ASI and Routine in representation // @version 1.3 // @description Adds age, routine and Asi to the players of the National teams // @author Andrizz aka Banana aka Jimmy il Fenomeno (team ID = 3257254) in collaboration with wojtekkl (team ID = 1355208) // @downloadURL https://openuserjs.org/install/andrizz/ASI_and_Routine_in_representation.user.js // @updateURL https://openuserjs.org/meta/andrizz/ASI_and_Routine_in_representation.meta.js // @namespace http://trophymanager.com // @include https://trophymanager.com/national-teams/* // @grant none // @license MIT // ==/UserScript== addASItoTable(); function addASItoTable() { $(".column2_a").width("460px"); // shorten central box $(".column3_a").width("326px"); // enlarge right box const tableHeaders = '<tr><td class="align_center player_no"><b>Nr</b></td><td><b>Name</b></td><td class="align_center"><b>Pos</b></td><td class="align_center"><b>Age</b></td><td class="align_center"><b>Routine</b></td><td class="align_center"><b>ASI</b></td></tr>'; $(".column3_a .zebra tbody:first-of-type").prepend(tableHeaders); let tableRow = $('.column3_a .zebra tr:not(:first-of-type)'); // get each row $(tableRow).each(function(index) { let playerID = $(this).find('a').attr('player_link'); $(this).append('<td align="center"; class="AGE"></td>'); // create the new columns $(this).append('<td align="center"; class="ROU"></td>'); $(this).append('<td align="right"; class="ASI"></td>'); var name = $(this).find("td:eq(1)").find("a"); // get each player's name var NewName = $(name).text($(name).text().replace($(name).text().match(/[^ ]+/), $(name).text().match(/^./)+".")); // abbreviate the name $.post("/ajax/tooltip.ajax.php",{async:false,"player_id":playerID},function(data){ // get each player's info var data = JSON.parse(data); let Age = data.player.age; let Months = data.player.months; let ROUvalue = data.player.routine; let ASIvalue = data.player.skill_index; $('.column3_a .zebra tr:nth-of-type('+ (index+2) + ') .AGE').html(Age+"."+Months); // add new infos to the corresponding columns $('.column3_a .zebra tr:nth-of-type('+ (index+2) + ') .ROU').html(ROUvalue); $('.column3_a .zebra tr:nth-of-type('+ (index+2) + ') .ASI').html(ASIvalue);}); }); }