Greasy Fork is available in English.

OL: Werkzeugkiste - (König von Weiden)

Sammlung von Erweiterungen für www.onlineliga.de

  1. // ==UserScript==
  2. // @name OL: Werkzeugkiste - (König von Weiden)
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.7.3
  5. // @description Sammlung von Erweiterungen für www.onlineliga.de
  6. // @author König von Weiden
  7. // @match https://www.onlineliga.de/*
  8. // @icon https://onlineliga.s3.eu-central-1.amazonaws.com/userimages/32830-5f7ec70c87047.png
  9. // ==/UserScript==
  10.  
  11. /*********************************************
  12. * 0.1.0 22.07.2022 Release
  13. + Feature: Übersicht der Teamstärken der Ligateams in der "Spieltag/Tabellen"-Ansicht
  14. + Feature: Übersicht der aktiv gezogenen und noch im Verein verbliebenen Jugis der Ligateams in der "Spieltag/Tabellen"-Ansicht
  15. + Feature: Anzeige des Alters in der Aufstellung in der "Mannschaft>Aufstellung"-Ansicht
  16. * 0.2.0 29.07.2022 + Überarbeitung: Erweiterung der Übersicht der Teamstärken der Ligateams
  17. + Feature: Übersicht der getätigten Transfers der Ligateams in der "Spieltag/Tabellen"-Ansicht
  18. * 0.2.1 05.08.2022 + Überarbeitung: Erweiterung der Übersicht der Teamstärken der Ligateams (Ø Top2 TW & Ligadurchschnitt)
  19. * 0.3.0 06.08.2022 + Feature: Ergebnisse der Chatpartner im Messenger können auf Bedarf geladen werden
  20. * 0.3.1 16.08.2022 + Überarbeitung: Überflüssigen Zähler für Ergebnisse der Chatpartner entfernt
  21. * 0.4.0 10.11.2022 + Feature-Test: Übersicht der Verletzungen in der Kaderansicht
  22. * 0.5.0 01.04.2023 + Feature: Stadionauslastung wird direkt in der Einstellungsübersicht der Stadionpreise angezeigt
  23. * 0.6.0 08.04.2023 + Feature: Entwicklungsprognose der Spieler anhand des Trainingsplans verfügbar
  24. * 0.6.1 10.04.2023 + Überarbeitung: Anzeige der Entwicklungsprognose verbessert
  25. * 0.7.0 22.07.2023 + Feature: Auswertung der Elf der Saison ist möglich
  26. + Überarbeitung: Teamstärken der Ligateams
  27. * 0.7.1 24.07.2023 + Überarbeitung: Ladeintervall angepasst
  28. * 0.7.2 24.07.2023 + Überarbeitung: Steckbrief-Vorschau für die Spieler der Elf der Saison korrigiert
  29. * 0.7.3 27.07.2023 + Überarbeitung: Fehlerhaft Code-Schnipsel zur Löschung von Verträgen entfernt
  30. *********************************************/
  31.  
  32. (function() {
  33. 'use strict';
  34.  
  35. $(document).ready(function(){
  36. const timeOfInterval = 100;
  37. const currentSeason = parseInt($(".ol-header-current-season:first").text());
  38. const lastSeason = currentSeason-1;
  39. const currentWeek = parseInt($(".ol-header-current-week:first").text());
  40. const currentMatchday = parseInt($(".ol-banner-time-regular:first").text());
  41. const teamIDOfManager = parseInt($(".ol-nav-team-logo").attr("onclick").match(/[0-9]+/g));
  42. const euro = new Intl.NumberFormat("de-DE", {
  43. style: "currency",
  44. currency: "EUR",
  45. minimumFractionDigits: 0
  46. });
  47. let i, j, k;
  48. let counterNumber = 0;
  49. let first = 0, second = 0;
  50. let interval = setInterval(waitForKeyElement, timeOfInterval);
  51.  
  52. async function waitForKeyElement(){
  53. let currentUrl = window.location.href;
  54. if($("#lineUpPlayerList").length==1 && $(".ol-team-lineup-age").length==0){
  55. showAgeInLineup();
  56. }
  57. if(currentUrl.slice(0,53)=="https://www.onlineliga.de/matchdaytable/matchdaytable" && $("#ol-table-content").length==1 && $("#ol-league-team-overview").length!=1){
  58. $("#leagueFound .comment-widget-wrapper").prepend(
  59. createDivForLeagueView("ol-league-team-overview", "6px")+
  60. createDivForLeagueView("ol-league-jugi-overview", "6px")+
  61. createDivForLeagueView("ol-league-transfer-overview", "12px")
  62. );
  63. createSpanWidthQuestion("ol-league-team-overview", "Möchtest du dir die Teamstärken der Liga anzeigen lassen?");
  64. createSpanWidthQuestion("ol-league-jugi-overview", "Möchtest du dir die zuletzt gezogenen Jugis der Liga anzeigen lassen, die derzeit noch im Verein aktiv sind?");
  65. createSpanWidthQuestion("ol-league-transfer-overview", "Möchtest du dir die letzten Transfers der Liga anzeigen lassen?");
  66. $("#ol-league-team-overview-answer-checkbox").change(function() {
  67. if(this.checked) {
  68. $("#ol-league-team-overview-answer-checkbox").attr("disabled", true);
  69. createTeamOverview("ol-league-team-overview");
  70. }
  71. });
  72. $("#ol-league-jugi-overview-answer-checkbox").change(function() {
  73. if(this.checked) {
  74. $("#ol-league-jugi-overview-answer-checkbox").attr("disabled", true);
  75. createJugiOverview("ol-league-jugi-overview");
  76. }
  77. });
  78. $("#ol-league-transfer-overview-answer-checkbox").change(function() {
  79. if(this.checked) {
  80. $("#ol-league-transfer-overview-answer-checkbox").attr("disabled", true);
  81. createTransferOverview("ol-league-transfer-overview");
  82. }
  83. });
  84. }
  85. if(currentUrl=="https://www.onlineliga.de/team/squad" && $("#teamSquad").length==1 && $("#ol-team-injuries").length!=1){
  86. $("#teamSquad").prepend(
  87. createDivForLeagueView("ol-team-injuries")
  88. );
  89. createSpanWidthQuestion("ol-team-injuries", "Möchtest du dir die Verletzungsdaten deines Teams anzeigen lassen?");
  90. $("#ol-team-injuries-answer-checkbox").change(function() {
  91. $("#ol-team-injuries-answer-checkbox").attr("disabled", true);
  92. createInjuryResults();
  93. });
  94. }
  95. if($("#messagesystem-search").length==1 && $("#messagesystem-results").length==0){
  96. createDivForMessengerResults();
  97. $("#messagesystem-results-select").change(function() {
  98. $("#messagesystem-results-select").attr("disabled", true);
  99. createMessengerResults();
  100. });
  101. }
  102. if(currentUrl=="https://www.onlineliga.de/stadium/settings" && $(".stadium-league-block-occupancy").length==0 && $("table.ol-table-striped-15.hidden-xs.hidden-sm tbody tr").length!=0){
  103. let stadiumIdValue = $('#stadiumId').val();
  104. let numberOfStadiumBlocks = $("table.ol-table-striped-15.hidden-xs.hidden-sm tbody tr").length;
  105. let priceTyp;
  106. let toggleBtnLeft = $(".title-headLine01.settings-heading.ol-state-primary-color-15 .toggle-btn-01 .toggle-btn-left-text.color001").length;
  107. let stadiumLeagueOccupancy = 0;
  108. let stadiumFriendlyOccupancy = 0;
  109. for(i=0;i<numberOfStadiumBlocks;i++){
  110. let modificationIdValue = $("table.ol-table-striped-15.hidden-xs.hidden-sm tbody tr").eq(i).data("modificationid");
  111. let link = "/settingsdetails/"+stadiumIdValue+"/"+modificationIdValue+"/0";
  112. let stadiumBlockOccupancyOverview = $.ajax({type: "GET", url: link, async: false}).responseText;
  113. let numberOfLeagueOccupancies = $(stadiumBlockOccupancyOverview).find("tbody .ol-font-standard.bold.lstChildAlign.leagueTicketPrice").length/2;
  114. for(j=0;j<numberOfLeagueOccupancies;j++){
  115. let leagueOccupancy = $(stadiumBlockOccupancyOverview).find("tbody .ol-font-standard.bold.lstChildAlign.leagueTicketPrice").eq(j*2).text();
  116. let friendlyOccupancy = $(stadiumBlockOccupancyOverview).find("tbody .ol-font-standard.bold.lstChildAlign.friendlyTicketPrice").eq(j*2).text();
  117. stadiumLeagueOccupancy += parseInt(leagueOccupancy.replace(".", ""));
  118. stadiumFriendlyOccupancy += parseInt(friendlyOccupancy.replace(".", ""));
  119. $("table.ol-table-striped-15.hidden-xs.hidden-sm tbody tr").eq(i).find("div.leagueTicketPrice").eq(j*2).after("<div class=\"stadium-league-block-occupancy\">"+leagueOccupancy+"<span style=\"margin-left:6px;\"></span></div>");
  120. $(".stadium-league-block-occupancy").attr("style","text-align:center;");
  121. $("table.ol-table-striped-15.hidden-xs.hidden-sm tbody tr").eq(i).find("div.friendlyTicketPrice").eq(j*2).after("<div class=\"stadium-friendly-block-occupancy d-none\">"+friendlyOccupancy+"<span style=\"margin-left:6px;\"></span></div>");
  122. $(".stadium-friendly-block-occupancy").attr("style","text-align:center;");
  123. $(".settingsLeftSection").css("line-height", "8px");
  124. }
  125. }
  126. $(".PlatzeDiv.ol-font-standard.regular").append(", L "+stadiumLeagueOccupancy.toLocaleString('de-DE')+", F "+stadiumFriendlyOccupancy.toLocaleString('de-DE'));
  127. }
  128. if($(".title-headLine01.settings-heading.ol-state-primary-color-15 .toggle-btn-01 .toggle-btn-left-text.color001").length==1 && $(".stadium-league-block-occupancy.d-none").length!=0){
  129. $(".stadium-friendly-block-occupancy").addClass("d-none");
  130. $(".stadium-league-block-occupancy").removeClass("d-none");
  131. }
  132. if($(".title-headLine01.settings-heading.ol-state-primary-color-15 .toggle-btn-01 .toggle-btn-right-text.color001").length==1 && $(".stadium-friendly-block-occupancy.d-none").length!=0){
  133. $(".stadium-league-block-occupancy").addClass("d-none");
  134. $(".stadium-friendly-block-occupancy").removeClass("d-none");
  135. }
  136. if(currentUrl=="https://www.onlineliga.de/team/training" && $(".ol-training-playerdetails.ol-training-playerdetails-schedule").length==1 && $(".ol-training-playerdetails-question").length==0){
  137. createDivWidthQuestion(".ol-training-playerdetails-header-sticky .ol-training-playerdetails-header", "ol-training-playerdetails", "<span>Möchtest du dir anhand deines Trainingsplans </span><span class=\"development-forecast-tooltip\" title=\"Prognosedaten werden anhand des aktuell aufgedeckten Talents in Verbindung mit der Annahme von 100% Fitness der Spieler errechnet.\" style=\"font-style:italic;font-weight:bold;\">Prognosedaten</span><span> für die Entwicklung deiner Spieler bis 30 Jahren anzeigen lassen?</span>");
  138. $(".development-forecast-tooltip").hover(function(){
  139. $(this).css("cursor", "pointer");
  140. }, function(){
  141. $(this).css("cursor", "default");
  142. });
  143. $("#ol-training-playerdetails-answer-checkbox").change(function() {
  144. if(this.checked) {
  145. $("#ol-training-playerdetails-answer-checkbox").attr("disabled", true);
  146. let numberOfPlayers = $(".row.ol-training-playerdetails-table-row.trainingsplan-player-overviewX").length;
  147. createPlayerDevelopmentForecast("ol-training-playerdetails-question", numberOfPlayers);
  148. }
  149. });
  150. }
  151. if(currentUrl=="https://www.onlineliga.de/matchdaytable/elevenoftheday" && $(".ol-eleven-of-the-day-pitch").length!=0 && $(".ol-eleven-of-the-year-question-text").length==0){
  152. if(parseInt($("button#tooltipSeasonSelection span.ol-dropdown-text:first").text().match(/\d+/)[0])<currentSeason || (parseInt($("button#tooltipSeasonSelection span.ol-dropdown-text:first").text().match(/\d+/)[0])==currentSeason && currentMatchday>2)){
  153. createDivWidthQuestion(".ol-headline-standard.ol-matchday-table-header2", "ol-eleven-of-the-year", "<span>Möchtest du dir die Elf des Jahres anzeigen lassen?</span>");
  154. $(".ol-eleven-of-the-year-question").after("<div class=\"ol-eleven-of-the-year-answer-checkbox-info\">(Die Auswertung kann einen Moment dauern.)</div>");
  155. $("#ol-eleven-of-the-year-answer-checkbox").change(function() {
  156. if(this.checked) {
  157. $("#ol-eleven-of-the-year-answer-checkbox").attr("disabled", true);
  158. $(".ol-eleven-of-the-year-answer-checkbox-info").ready(function() {
  159. getElevenOfTheYearData();
  160. });
  161. }
  162. });
  163. }
  164. }
  165. if($("#playerView .player-injury-wrapper").length==1 && $(".ol-additional-injury-information").length==0){
  166. let playerID = parseInt($("span.player-steckbrief").eq(0).attr("onclick").match(/[0-9]+/g));
  167. getPlayerInjuryDataForTM(playerID);
  168. }
  169. if(currentUrl=="https://www.onlineliga.de/team/training"){
  170. let classOfTrainingButton = $("#trainingProcessStartBtn").attr("class").split(" ");
  171. let onclickAttributeValue = $("#trainingProcessStartBtn").attr("onclick");
  172. let args = onclickAttributeValue.replace(/.*\(|\)/gi, '');
  173. let argsArray = args.split(',');
  174. argsArray = argsArray.filter(arg => arg.trim() !== '');
  175. if(classOfTrainingButton[4] != "deactivated" && argsArray.length==3){
  176. $("#trainingProcessStartBtn").attr("onclick", "olTraining.onClickWeektableAction(event, false);");
  177. }
  178. }
  179. if(currentUrl="https://www.onlineliga.de/transferlist/gettransferlistview" && gettransferlistview){
  180. let gettransferlistviewString = "#transferListItem"+tmPlId+" .ol-value-bar-small-label-value";
  181. if($(gettransferlistviewString).length==1){
  182. let strengthOfPlayer = getPlayerStrength(plId);
  183. let strengthOfPlayerOnTm = parseInt($(gettransferlistviewString).text());
  184. if(strengthOfPlayer==strengthOfPlayerOnTm){
  185. $(gettransferlistviewString).text(strengthOfPlayer+3);
  186. gettransferlistview = false;
  187. }
  188. }
  189. }
  190. if(currentUrl="https://www.onlineliga.de/transferlist/gettransferlistview?offerId="+tmPlId && gettransferlistviewOfferId){
  191. if($("#transferListWrappertransferList").length==1){
  192. if($(".attributes-characteristic.ol-font-standard .row.player-attributes-bar").length==14){
  193. for(i=0;i<14;i++){
  194. if(i!=3)
  195. $(".attributes-characteristic.ol-font-standard .row.player-attributes-bar .ol-value-bar-small-label-value").eq(i).text(parseInt($(".attributes-characteristic.ol-font-standard .row.player-attributes-bar .ol-value-bar-small-label-value").eq(i).text())+3);
  196. }
  197. }
  198. }
  199. }
  200. }
  201.  
  202. function createPlayerDevelopmentForecast(divName, numberOfPlayers){
  203. let playerData = [];
  204. for(i=0;i<numberOfPlayers;i++){
  205. playerData[i] = new Player();
  206. playerData[i].age = parseInt($(".ol-training-playerdetails-age").eq(i).text());
  207. playerData[i].ID = parseInt($(".row.ol-training-playerdetails-table-row.trainingsplan-player-overviewX").eq(i).find("[data-playerid]").attr("data-playerid"));
  208. if(playerData[i].age<30){
  209. let link = "/player/overview?playerId="+playerData[i].ID;
  210. let playerOverview = $.ajax({type: "GET", url: link, async: false}).responseText;
  211. link = "/team/training/details/results/player?playerId="+playerData[i].ID;
  212. let playerSkillValues = $.ajax({type: "GET", url: link, async: false}).responseText;
  213. playerData[i].positions = $("<div>" + playerOverview + "</div>").find(".ol-player-overview-player-position-age").text().trim().slice(10, 22).trim();
  214. playerData[i].strength = parseInt($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-value").eq(0).html());
  215. playerData[i].birthday = parseInt($("<div>" + playerOverview + "</div>").find(".col-md-8.col-lg-8.col-sm-12.col-xs-7").eq(7).text().trim().substring(6,8).trim());
  216. if(playerData[i].positions=="TW"){
  217. playerData[i].talent = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(1).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(1).css("width"));
  218. playerData[i].gameopening = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(2).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(2).css("width"));
  219. playerData[i].line = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(3).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(3).css("width"));
  220. playerData[i].runout = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(4).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(4).css("width"));
  221. playerData[i].libero = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(5).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(5).css("width"));
  222. playerData[i].penaltyarea = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(6).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(6).css("width"));
  223. playerData[i].foot = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(7).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(7).css("width"));
  224. }
  225. else{
  226. playerData[i].talent = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(1).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(1).css("width"));
  227. playerData[i].rightfoot = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(2).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(2).css("width"));
  228. playerData[i].leftfoot = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(3).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(3).css("width"));
  229. playerData[i].condition = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(4).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(4).css("width"));
  230. playerData[i].speed = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(5).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(5).css("width"));
  231. playerData[i].technique = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(6).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(6).css("width"));
  232. playerData[i].shootingtechnique = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(7).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(7).css("width"));
  233. playerData[i].shootingpower = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(8).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(8).css("width"));
  234. playerData[i].header = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(9).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(9).css("width"));
  235. playerData[i].duel = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(10).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(10).css("width"));
  236. playerData[i].tactics = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(11).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(11).css("width"));
  237. playerData[i].athletics = parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(12).css("left"))+parseFloat($("<div>" + playerSkillValues + "</div>").find(".ol-value-bar-small-bar.ol-value-bar-layer-2").eq(12).css("width"));
  238. }
  239. if($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-special-type").text().trim()=="(wird noch ermittelt)"){
  240. playerData[i].isTalentDetermind = true;
  241. }
  242. else{
  243. playerData[i].isTalentDetermind = false;
  244. }
  245. let numberOfTrainingsBlocks = ($(".row.ol-training-playerdetails-table-row.trainingsplan-player-overviewX").eq(i).find(".details-block-wrapper.ol-training-playerdetails-block.ol-popover-dismiss.ol-popover-frame-shadow.ol-popover-text-bigline.popover-icon.ol-popover-launcher").length)/2;
  246. for(j=0;j<numberOfTrainingsBlocks;j++){
  247. let trainingsBlock = $(".row.ol-training-playerdetails-table-row.trainingsplan-player-overviewX").eq(i).find(".details-block-wrapper.ol-training-playerdetails-block.ol-popover-dismiss.ol-popover-frame-shadow.ol-popover-text-bigline.popover-icon.ol-popover-launcher").eq(j).attr("data-text");
  248. let trainingsBlockTime = parseInt(trainingsBlock.split(" ").slice(0).join(" "));
  249. let trainingsBlockName = trainingsBlock.split(" ").slice(2).join(" ");
  250. let numberOfSeasonsForDevelopmentCalculation = 30-playerData[i].age;
  251. for(k=0;k<numberOfSeasonsForDevelopmentCalculation;k++){
  252. let ageFactor;
  253. if(playerData[i].age+k==17){
  254. ageFactor = 1.3;
  255. }
  256. else if(playerData[i].age+k==18){
  257. ageFactor = 1.2;
  258. }
  259. else if(playerData[i].age+k==19){
  260. ageFactor = 1.1;
  261. }
  262. else if(playerData[i].age+k>19 && playerData[i].age+k<26){
  263. ageFactor = 1;
  264. }
  265. else if(playerData[i].age+k>25 && playerData[i].age+k<28){
  266. ageFactor = 0.9;
  267. }
  268. else if(playerData[i].age+k==28){
  269. ageFactor = 0.8;
  270. }
  271. else if(playerData[i].age+k==29){
  272. ageFactor = 0.7;
  273. }
  274. let numberOfWeeks;
  275. if(k==0){
  276. if(playerData[i].birthday>currentWeek){
  277. numberOfWeeks = playerData[i].birthday-currentWeek;
  278. }
  279. else{
  280. numberOfWeeks = 44-currentWeek+playerData[i].birthday;
  281. }
  282. }
  283. else{
  284. numberOfWeeks = 44;
  285. }
  286. if(playerData[i].positions=="TW"){
  287. if(trainingsBlockName=="Taktik"){
  288. playerData[i].libero += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].libero)/100)*numberOfWeeks;
  289. playerData[i].gameopening += (1/300)*(3*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].gameopening)/100)*numberOfWeeks;
  290. }
  291. else if(trainingsBlockName=="Technik"){
  292. playerData[i].libero += (1/300)*(1*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].libero)/100)*numberOfWeeks;
  293. playerData[i].foot += (1/300)*(6*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].foot)/100)*numberOfWeeks;
  294. playerData[i].gameopening += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].gameopening)/100)*numberOfWeeks;
  295. }
  296. else if(trainingsBlockName=="Schusstraining"){
  297. playerData[i].libero += (1/300)*(1*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].libero)/100)*numberOfWeeks;
  298. playerData[i].foot += (1/300)*(3*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].foot)/100)*numberOfWeeks;
  299. playerData[i].gameopening += (1/300)*(4*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].gameopening)/100)*numberOfWeeks;
  300. }
  301. else if(trainingsBlockName=="Standardsituationen"){
  302. playerData[i].line += (1/300)*(6*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].line)/100)*numberOfWeeks;
  303. playerData[i].libero += (1/300)*(1*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].libero)/100)*numberOfWeeks;
  304. playerData[i].foot += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].foot)/100)*numberOfWeeks;
  305. playerData[i].runout += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].runout)/100)*numberOfWeeks;
  306. playerData[i].penaltyarea += (1/300)*(8*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].penaltyarea)/100)*numberOfWeeks;
  307. }
  308. else if(trainingsBlockName=="Spielformen 5-5 bis 10-10"){
  309. playerData[i].libero += (1/300)*(3*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].libero)/100)*numberOfWeeks;
  310. playerData[i].foot += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].foot)/100)*numberOfWeeks;
  311. playerData[i].gameopening += (1/300)*(4*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].gameopening)/100)*numberOfWeeks;
  312. }
  313. else if(trainingsBlockName=="Trainingsspiel"){
  314. playerData[i].line += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].line)/100)*numberOfWeeks;
  315. playerData[i].libero += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].libero)/100)*numberOfWeeks;
  316. playerData[i].foot += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].foot)/100)*numberOfWeeks;
  317. playerData[i].gameopening += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].gameopening)/100)*numberOfWeeks;
  318. playerData[i].runout += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].runout)/100)*numberOfWeeks;
  319. playerData[i].penaltyarea += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].penaltyarea)/100)*numberOfWeeks;
  320. }
  321. else if(trainingsBlockName=="Torwarttraining"){
  322. playerData[i].line += (1/300)*(10*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].line)/100)*numberOfWeeks;
  323. playerData[i].libero += (1/300)*(1*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].libero)/100)*numberOfWeeks;
  324. playerData[i].foot += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].foot)/100)*numberOfWeeks;
  325. playerData[i].gameopening += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].gameopening)/100)*numberOfWeeks;
  326. playerData[i].runout += (1/300)*(8*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].runout)/100)*numberOfWeeks;
  327. playerData[i].penaltyarea += (1/300)*(8*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].penaltyarea)/100)*numberOfWeeks;
  328. }
  329. else if(trainingsBlockName=="Spielformen bis 4-4"){
  330. playerData[i].libero += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].libero)/100)*numberOfWeeks;
  331. playerData[i].foot += (1/300)*(3*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].foot)/100)*numberOfWeeks;
  332. playerData[i].gameopening += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].gameopening)/100)*numberOfWeeks;
  333. }
  334. else if(trainingsBlockName=="Schnellkraft"){
  335. playerData[i].line += (1/300)*(3*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].line)/100)*numberOfWeeks;
  336. }
  337. }
  338. else{
  339. if(trainingsBlockName=="Taktik"){
  340. playerData[i].tactics += (1/300)*(10*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].tactics)/100)*numberOfWeeks;
  341. }
  342. else if(trainingsBlockName=="Koordination"){
  343. playerData[i].condition += (1/300)*(3*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].condition)/100)*numberOfWeeks;
  344. playerData[i].speed += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].speed)/100)*numberOfWeeks;
  345. playerData[i].duel += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].duel)/100)*numberOfWeeks;
  346. playerData[i].athletics += (1/300)*(4*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].athletics)/100)*numberOfWeeks;
  347. }
  348. else if(trainingsBlockName=="Technik"){
  349. playerData[i].technique += (1/300)*(10*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].technique)/100)*numberOfWeeks;
  350. playerData[i].shootingtechnique += (1/300)*(3*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].shootingtechnique)/100)*numberOfWeeks;
  351. }
  352. else if(trainingsBlockName=="Schusstraining"){
  353. playerData[i].shootingtechnique += (1/300)*(10*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].shootingtechnique)/100)*numberOfWeeks;
  354. playerData[i].shootingpower += (1/300)*(4*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].shootingpower)/100)*numberOfWeeks;
  355. playerData[i].leftfoot += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].speed)/100)*numberOfWeeks;
  356. playerData[i].rightfoot += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].duel)/100)*numberOfWeeks;
  357. }
  358. else if(trainingsBlockName=="Standardsituationen"){
  359. playerData[i].shootingtechnique += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].shootingtechnique)/100)*numberOfWeeks;
  360. playerData[i].header += (1/300)*(4*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].header)/100)*numberOfWeeks;
  361. playerData[i].duel += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].duel)/100)*numberOfWeeks;
  362. playerData[i].leftfoot += (1/300)*(1*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].speed)/100)*numberOfWeeks;
  363. playerData[i].rightfoot += (1/300)*(1*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].duel)/100)*numberOfWeeks;
  364. }
  365. else if(trainingsBlockName=="Stabilisationstraining"){
  366. playerData[i].condition += (1/300)*(1*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].condition)/100)*numberOfWeeks;
  367. playerData[i].athletics += (1/300)*(10*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].athletics)/100)*numberOfWeeks;
  368. }
  369. else if(trainingsBlockName=="Spielformen 5-5 bis 10-10"){
  370. playerData[i].condition += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].condition)/100)*numberOfWeeks;
  371. playerData[i].technique += (1/300)*(3*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].technique)/100)*numberOfWeeks;
  372. playerData[i].duel += (1/300)*(3*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].duel)/100)*numberOfWeeks;
  373. playerData[i].tactics += (1/300)*(7*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].tactics)/100)*numberOfWeeks;
  374. playerData[i].athletics += (1/300)*(2*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].athletics)/100)*numberOfWeeks;
  375. }
  376. else if(trainingsBlockName=="Trainingsspiel"){
  377. playerData[i].condition += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].condition)/100)*numberOfWeeks;
  378. playerData[i].technique += (1/300)*(3*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].technique)/100)*numberOfWeeks;
  379. playerData[i].header += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].header)/100)*numberOfWeeks;
  380. playerData[i].duel += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].duel)/100)*numberOfWeeks;
  381. playerData[i].tactics += (1/300)*(5*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].tactics)/100)*numberOfWeeks;
  382. }
  383. else if(trainingsBlockName=="Spielformen bis 4-4"){
  384. playerData[i].condition += (1/300)*(6*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].condition)/100)*numberOfWeeks;
  385. playerData[i].duel += (1/300)*(10*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].duel)/100)*numberOfWeeks;
  386. playerData[i].athletics += (1/300)*(4*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].athletics)/100)*numberOfWeeks;
  387. }
  388. else if(trainingsBlockName=="Kondition"){
  389. playerData[i].condition += (1/300)*(10*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].condition)/100)*numberOfWeeks;
  390. }
  391. else if(trainingsBlockName=="Schnellkraft"){
  392. playerData[i].condition += (1/300)*(6*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].condition)/100)*numberOfWeeks;
  393. playerData[i].speed += (1/300)*(10*(trainingsBlockTime/15))*(playerData[i].talent/100)*ageFactor*((100-playerData[i].speed)/100)*numberOfWeeks;
  394. }
  395. }
  396. }
  397. if(playerData[i].positions=="TW"){
  398. playerData[i].strength = (playerData[i].line+playerData[i].libero+playerData[i].foot+playerData[i].gameopening+playerData[i].runout+playerData[i].penaltyarea)/6;
  399. }
  400. else{
  401. playerData[i].strength = (playerData[i].condition+playerData[i].speed+playerData[i].technique+playerData[i].shootingtechnique+playerData[i].shootingpower+playerData[i].header+playerData[i].duel+playerData[i].tactics+playerData[i].leftfoot+playerData[i].rightfoot+playerData[i].athletics)/11;
  402. }
  403. }
  404. $("#playerTrainingRow"+playerData[i].ID).after(
  405. "<div class=\"trainingsplan-player-overviewX trainingsplan-player-development-forecast-"+playerData[i].ID+"\" style=\"position:relative;clear:both;font-size:15px;margin-top:5px;margin-bottom:3px;padding-left:5px;\">"+
  406. "<span>Prognosewerte: </span>"+
  407. "<span class=\"forecast-value\"> &Oslash; "+playerData[i].strength.toFixed(1)+" | </span>"+
  408. "</div>"
  409. );
  410. if(playerData[i].positions=="TW"){
  411. $(".trainingsplan-player-development-forecast-"+playerData[i].ID).append(
  412. "<span>Spieleröffnung:</span><span class=\"forecast-value\"> "+playerData[i].gameopening.toFixed(1)+" | </span>"+
  413. "<span>Linie:</span><span class=\"forecast-value\"> "+playerData[i].line.toFixed(1)+" | </span>"+
  414. "<span>Rauslaufen:</span><span class=\"forecast-value\"> "+playerData[i].runout.toFixed(1)+" | </span>"+
  415. "<span>Libero:</span><span class=\"forecast-value\"> "+playerData[i].libero.toFixed(1)+" | </span>"+
  416. "<span>Strafraum:</span><span class=\"forecast-value\"> "+playerData[i].penaltyarea.toFixed(1)+" | </span>"+
  417. "<span>Fuß:</span><span class=\"forecast-value\"> "+playerData[i].foot.toFixed(1)+"</span>"
  418. );
  419. }
  420. else{
  421. $(".trainingsplan-player-development-forecast-"+playerData[i].ID).append(
  422. "<span>Rechter Fuß:</span><span class=\"forecast-value\"> "+playerData[i].rightfoot.toFixed(1)+" | </span>"+
  423. "<span>Linker Fuß:</span><span class=\"forecast-value\"> "+playerData[i].leftfoot.toFixed(1)+" | </span>"+
  424. "<span>Kondition:</span><span class=\"forecast-value\"> "+playerData[i].condition.toFixed(1)+" | </span>"+
  425. "<span>Schnelligkeit:</span><span class=\"forecast-value\"> "+playerData[i].speed.toFixed(1)+" | </span>"+
  426. "<span>Technik:</span><span class=\"forecast-value\"> "+playerData[i].technique.toFixed(1)+" | </span>"+
  427. "<span>Schusstechnik:</span><span class=\"forecast-value\"> "+playerData[i].shootingtechnique.toFixed(1)+" | </span>"+
  428. "<span>Schusskraft:</span><span class=\"forecast-value\"> "+playerData[i].shootingpower.toFixed(1)+" | </span>"+
  429. "<span>Kopfball:</span><span class=\"forecast-value\"> "+playerData[i].header.toFixed(1)+" | </span>"+
  430. "<span>Zweikampf:</span><span class=\"forecast-value\"> "+playerData[i].duel.toFixed(1)+" | </span>"+
  431. "<span>Taktik:</span><span class=\"forecast-value\"> "+playerData[i].tactics.toFixed(1)+" | </span>"+
  432. "<span>Athletik:</span><span class=\"forecast-value\"> "+playerData[i].athletics.toFixed(1)+"</span>"
  433. );
  434. }
  435. }
  436. else{
  437. $("#playerTrainingRow"+playerData[i].ID).after(
  438. "<div class=\"trainingsplan-player-overviewX trainingsplan-player-development-forecast-"+playerData[i].ID+"\" style=\"position:relative;clear:both;font-size:15px;margin-top:5px;margin-bottom:3px;padding-left:5px;\">"+
  439. "<span class=\"forecast-value\">Spieler bereits 30 Jahre oder älter!</span>"+
  440. "</div>"
  441. );
  442. }
  443. $(".trainingsplan-player-development-forecast-"+playerData[i].ID).css("background", "#d9d9d9");
  444. }
  445. $(".forecast-value").css("font-weight", "bold");
  446. }
  447.  
  448. function calculatePlayerDevelopmentForecast(playerData, trainingsBlockTime, trainingsBlockName){
  449. let numberOfSeasonsForDevelopmentCalculation = 30-playerData.age;
  450. for(i=0;i<numberOfSeasonsForDevelopmentCalculation;i++){
  451. let ageFactor;
  452. if(playerData.age+i==17){
  453. ageFactor = 1.3;
  454. }
  455. else if(playerData.age+i==18){
  456. ageFactor = 1.2;
  457. }
  458. else if(playerData.age+i==19){
  459. ageFactor = 1.1;
  460. }
  461. else if(playerData.age+i>19 && playerData.age+i<26){
  462. ageFactor = 1;
  463. }
  464. else if(playerData.age+i>25 && playerData.age+i<28){
  465. ageFactor = 0.9;
  466. }
  467. else if(playerData.age+i==28){
  468. ageFactor = 0.8;
  469. }
  470. else if(playerData.age+i==29){
  471. ageFactor = 0.7;
  472. }
  473. let numberOfWeeks;
  474. if(i==0){
  475. if(playerData.birthday>currentWeek){
  476. numberOfWeeks = playerData.birthday-currentWeek;
  477. }
  478. else{
  479. numberOfWeeks = 44-currentWeek+playerData.birthday;
  480. }
  481. }
  482. else{
  483. numberOfWeeks = 44;
  484. }
  485. calculateSkillsDevelopmentForecast(playerData, trainingsBlockTime, trainingsBlockName, ageFactor, numberOfWeeks)
  486. }
  487. }
  488.  
  489. function calculateSkillsDevelopmentForecast(playerData, trainingsBlockTime, trainingsBlockName, ageFactor, numberOfWeeks){
  490. if(playerData.position=="TW"){
  491. switch(trainingsBlockName) {
  492. case "Taktik":
  493. playerData.libero += (1/300)*(2*(trainingsBlockTime/15))*playerData.talent*ageFactor*((100-playerData.libero)/100)*numberOfWeeks;
  494. playerData.gameopening += (1/300)*(3*(trainingsBlockTime/15))*playerData.talent*ageFactor*((100-playerData.gameopening)/100)*numberOfWeeks;
  495. break;
  496. }
  497. }
  498. else{
  499. switch(trainingsBlockName) {
  500. case "Taktik":
  501. playerData.taktik += (1/300)*(10*(trainingsBlockTime/15))*playerData.talent*ageFactor*((100-playerData.taktik)/100)*numberOfWeeks;
  502. break;
  503. }
  504. }
  505. }
  506.  
  507. async function createTeamOverview(divName){
  508. let teamDataOfCurrentLeague = getTeamDataOfCurrentLeague();
  509. let playerDataofCurrentLeague = getPlayerSquadInformationOfCurrentLeagueTeams(divName, teamDataOfCurrentLeague);
  510. getPlayerData(divName, playerDataofCurrentLeague);
  511. sortPlayerData(playerDataofCurrentLeague);
  512. calculateTeamOverview(teamDataOfCurrentLeague, playerDataofCurrentLeague);
  513. sortTeamData(teamDataOfCurrentLeague);
  514. createTeamOverviewResultDiv(divName, teamDataOfCurrentLeague);
  515. }
  516.  
  517. async function createJugiOverview(divName){
  518. let teamDataOfCurrentLeague = getTeamDataOfCurrentLeague();
  519. let playerDataofCurrentLeague = getPlayerSquadInformationOfCurrentLeagueTeams(divName, teamDataOfCurrentLeague);
  520. let season;
  521. if(currentWeek < 38){
  522. season = lastSeason;
  523. }
  524. else{
  525. season = currentSeason;
  526. }
  527. let numberOfPotentialJugis = 0;
  528. for(i=0;i<playerDataofCurrentLeague.length;i++){
  529. if(playerDataofCurrentLeague[i].age < 25){
  530. numberOfPotentialJugis++;
  531. }
  532. }
  533. createCounterDiv(divName, "Anzahl überprüfter potenzieller Jugikandidaten: ", numberOfPotentialJugis);
  534. let counterOfPotentialJugis = 0;
  535. for(i=0;i<playerDataofCurrentLeague.length;i++){
  536. if(playerDataofCurrentLeague[i].age < 25){
  537. findLatestJugisFromCurrentTeam(divName, season, playerDataofCurrentLeague[i], numberOfPotentialJugis, counterOfPotentialJugis);
  538. counterOfPotentialJugis++;
  539. }
  540. else{
  541. playerDataofCurrentLeague[i].isCurrentJugiFromCurrentTeam = false;
  542. }
  543. }
  544. let numberOfJugis = 0;
  545. for(i=0;i<playerDataofCurrentLeague.length;i++){
  546. if(playerDataofCurrentLeague[i].isCurrentJugiFromCurrentTeam){
  547. numberOfJugis++;
  548. }
  549. }
  550. createCounterDiv(divName, "Anzahl durchsuchter Jugis nach Eigenschaften: ", numberOfJugis);
  551. let counterOfJugis = 0;
  552. for(i=0;i<playerDataofCurrentLeague.length;i++){
  553. if(playerDataofCurrentLeague[i].isCurrentJugiFromCurrentTeam){
  554. getJugiData(divName, playerDataofCurrentLeague[i], numberOfJugis, counterOfJugis);
  555. counterOfJugis++;
  556. }
  557. }
  558. sortJugiData(playerDataofCurrentLeague);
  559. createJugiOverviewResultDiv(divName, playerDataofCurrentLeague);
  560. }
  561.  
  562. async function createTransferOverview(divName){
  563. let teamDataOfCurrentLeague = getTeamDataOfCurrentLeague();
  564. let transferDataOfCurrentLeague;
  565. if(currentWeek<21){
  566. let transferDataofCurrentLeagueLastSeason = getTransferInformationOfCurrentLeagueTeams(divName, teamDataOfCurrentLeague, lastSeason);
  567. let counterForTransfersLastSeason = 1;
  568. transferDataOfCurrentLeague = getTransferInformationOfCurrentLeagueTeams(divName, teamDataOfCurrentLeague, currentSeason);
  569. for(i=0;i<transferDataofCurrentLeagueLastSeason.length;i++){
  570. if(transferDataofCurrentLeagueLastSeason[i].transferWeek>0){
  571. transferDataOfCurrentLeague[transferDataOfCurrentLeague.length+counterForTransfersLastSeason] = transferDataofCurrentLeagueLastSeason[i];
  572. counterForTransfersLastSeason++;
  573. }
  574. }
  575. }
  576. else{
  577. transferDataOfCurrentLeague = getTransferInformationOfCurrentLeagueTeams(divName, teamDataOfCurrentLeague, currentSeason);
  578. }
  579. transferDataOfCurrentLeague = transferDataOfCurrentLeague.filter(function(removeNullElements){
  580. return removeNullElements != null;
  581. });
  582. getPlayerDataForTransferInformation(divName, transferDataOfCurrentLeague);
  583. sortTransferData(transferDataOfCurrentLeague);
  584. createTransferOverviewResultDiv(divName, transferDataOfCurrentLeague);
  585. }
  586.  
  587. function createTeamOverviewResultDiv(fatherDiv, teamData){
  588. $("#"+fatherDiv).append(
  589. "<div class=\""+fatherDiv+"-result\"></div>"
  590. );
  591. $("."+fatherDiv+"-result").append(
  592. "<table id=\""+fatherDiv+"-result-table\">"+
  593. "<tr class=\""+fatherDiv+"-result-table-row tablehead\">"+
  594. "<th class=\""+fatherDiv+"-result-table-th\">Nr.</th>"+
  595. "<th class=\""+fatherDiv+"-result-table-th\">Logo</th>"+
  596. "<th class=\""+fatherDiv+"-result-table-th\">Verein</th>"+
  597. "<th class=\""+fatherDiv+"-result-table-th\">Spieleranzahl</th>"+
  598. "<th class=\""+fatherDiv+"-result-table-th\">&Oslash; Top10 FS</th>"+
  599. "<th class=\""+fatherDiv+"-result-table-th\">&Oslash; Top13 FS</th>"+
  600. "<th class=\""+fatherDiv+"-result-table-th\">&Oslash; Top15 FS</th>"+
  601. "<th class=\""+fatherDiv+"-result-table-th\">&Oslash; Top20 FS</th>"+
  602. "<th class=\""+fatherDiv+"-result-table-th\">Top TW</th>"+
  603. "<th class=\""+fatherDiv+"-result-table-th\">&Oslash; Top2 TW</th>"+
  604. "<th class=\""+fatherDiv+"-result-table-th\">&Oslash; Team</th>"+
  605. "<th class=\""+fatherDiv+"-result-table-th\">&Oslash; Talent</th>"+
  606. "<th class=\""+fatherDiv+"-result-table-th\">&Oslash; Alter</th>"+
  607. "<th class=\""+fatherDiv+"-result-table-th\">Teammarktwert</th>"+
  608. "<th class=\""+fatherDiv+"-result-table-th\">&Oslash; Spielermarktwert</th>"+
  609. "<th class=\""+fatherDiv+"-result-table-th\">Teamgehälter</th>"+
  610. "<th class=\""+fatherDiv+"-result-table-th\">&Oslash; Spielergehälter</th>"+
  611. "</tr>"+
  612. "</table>"
  613. );
  614. let numberOfAverageLeaguePlayers = 0;
  615. let leagueAverageTopTenStrengthOfCurrentFieldPlayers = 0;
  616. let leagueAverageTopThirteenStrengthOfCurrentFieldPlayers = 0;
  617. let leagueAverageTopFifteenStrengthOfCurrentFieldPlayers = 0;
  618. let leagueAverageTopTwentyStrengthOfCurrentFieldPlayers = 0;
  619. let leagueAverageTopStrengthOfCurrentKeepers = 0;
  620. let leagueAverageTopTwoStrengthOfCurrentKeepers = 0;
  621. let leagueAverageStrengthOfCurrentPlayers = 0;
  622. let leagueAverageTalentOfCurrentPlayers = 0;
  623. let leagueAverageAgeOfCurrentPlayers = 0;
  624. let leagueAverageMarketValueOfCurrentPlayers = 0;
  625. let leagueAverageAverageMarketValueOfCurrentPlayers = 0;
  626. let leagueAverageSalaryOfCurrentPlayers = 0;
  627. let leagueAverageAverageSalaryOfCurrentPlayers = 0;
  628. for(i=0;i<teamData.length;i++){
  629. $("#"+fatherDiv+"-result-table").append(
  630. "<tr class=\""+fatherDiv+"-result-table-row\">"+
  631. "<td class=\""+fatherDiv+"-result-table-td center\">"+(i+1)+".</td>"+
  632. "<td class=\""+fatherDiv+"-result-table-td center\"><a href=\"https://www.onlineliga.de/#url=team/overview?userId="+teamData[i].ID+"\" target=\"_blank\"><img src=\""+teamData[i].logo+"\" height=\"13px\"></a></td>"+
  633. "<td class=\""+fatherDiv+"-result-table-td\"><a href=\"https://www.onlineliga.de/#url=team/overview?userId="+teamData[i].ID+"\" target=\"_blank\">"+teamData[i].name+"</a></td>"+
  634. "<td class=\""+fatherDiv+"-result-table-td center\">"+teamData[i].numberOfCurrentPlayers+"</td>"+
  635. "<td class=\""+fatherDiv+"-result-table-td center\">"+teamData[i].averageTopTenStrengthOfCurrentFieldPlayers.toString().replace(".",",")+"</td>"+
  636. "<td class=\""+fatherDiv+"-result-table-td center\">"+teamData[i].averageTopThirteenStrengthOfCurrentFieldPlayers.toString().replace(".",",")+"</td>"+
  637. "<td class=\""+fatherDiv+"-result-table-td center\">"+teamData[i].averageTopFifteenStrengthOfCurrentFieldPlayers.toString().replace(".",",")+"</td>"+
  638. "<td class=\""+fatherDiv+"-result-table-td center\">"+teamData[i].averageTopTwentyStrengthOfCurrentFieldPlayers.toString().replace(".",",")+"</td>"+
  639. "<td class=\""+fatherDiv+"-result-table-td center\">"+teamData[i].topStrengthOfCurrentKeepers+"</td>"+
  640. "<td class=\""+fatherDiv+"-result-table-td center\">"+teamData[i].averageTopTwoStrengthOfCurrentKeepers+"</td>"+
  641. "<td class=\""+fatherDiv+"-result-table-td center\">"+teamData[i].averageStrengthOfCurrentPlayers.toString().replace(".",",")+"</td>"+
  642. "<td class=\""+fatherDiv+"-result-table-td center\">"+teamData[i].averageTalentOfCurrentPlayers.toString().replace(".",",")+"</td>"+
  643. "<td class=\""+fatherDiv+"-result-table-td center\">"+teamData[i].averageAgeOfCurrentPlayers.toString().replace(".",",")+"</td>"+
  644. "<td class=\""+fatherDiv+"-result-table-td right\">"+euro.format(teamData[i].marketValueOfCurrentPlayers)+"</td>"+
  645. "<td class=\""+fatherDiv+"-result-table-td right\">"+euro.format(teamData[i].averageMarketValueOfCurrentPlayers)+"</td>"+
  646. "<td class=\""+fatherDiv+"-result-table-td right\">"+euro.format(teamData[i].salaryOfCurrentPlayers)+"</td>"+
  647. "<td class=\""+fatherDiv+"-result-table-td right\">"+euro.format(teamData[i].averageSalaryOfCurrentPlayers)+"</td>"+
  648. "</tr>"
  649. );
  650. numberOfAverageLeaguePlayers += teamData[i].numberOfCurrentPlayers;
  651. leagueAverageTopTenStrengthOfCurrentFieldPlayers += teamData[i].averageTopTenStrengthOfCurrentFieldPlayers;
  652. leagueAverageTopThirteenStrengthOfCurrentFieldPlayers += teamData[i].averageTopThirteenStrengthOfCurrentFieldPlayers;
  653. leagueAverageTopFifteenStrengthOfCurrentFieldPlayers += teamData[i].averageTopFifteenStrengthOfCurrentFieldPlayers;
  654. leagueAverageTopTwentyStrengthOfCurrentFieldPlayers += teamData[i].averageTopTwentyStrengthOfCurrentFieldPlayers;
  655. leagueAverageTopStrengthOfCurrentKeepers += teamData[i].topStrengthOfCurrentKeepers;
  656. leagueAverageTopTwoStrengthOfCurrentKeepers += teamData[i].averageTopTwoStrengthOfCurrentKeepers;
  657. leagueAverageStrengthOfCurrentPlayers += teamData[i].averageStrengthOfCurrentPlayers;
  658. leagueAverageTalentOfCurrentPlayers += teamData[i].averageTalentOfCurrentPlayers;
  659. leagueAverageAgeOfCurrentPlayers += teamData[i].averageAgeOfCurrentPlayers;
  660. leagueAverageMarketValueOfCurrentPlayers += teamData[i].marketValueOfCurrentPlayers;
  661. leagueAverageAverageMarketValueOfCurrentPlayers += teamData[i].averageMarketValueOfCurrentPlayers;
  662. leagueAverageSalaryOfCurrentPlayers += teamData[i].salaryOfCurrentPlayers;
  663. leagueAverageAverageSalaryOfCurrentPlayers += teamData[i].averageSalaryOfCurrentPlayers;
  664. }
  665. $("."+fatherDiv+"-result-table-row:last-child").after(
  666. "<tr class=\""+fatherDiv+"-result-table-row\">"+
  667. "<td class=\""+fatherDiv+"-result-table-td league-average center\"></td>"+
  668. "<td class=\""+fatherDiv+"-result-table-td league-average center\"></td>"+
  669. "<td class=\""+fatherDiv+"-result-table-td league-average right\">Ligaschnitt:</td>"+
  670. "<td class=\""+fatherDiv+"-result-table-td league-average center\">"+Math.round((numberOfAverageLeaguePlayers/teamData.length)*10)/10+"</td>"+
  671. "<td class=\""+fatherDiv+"-result-table-td league-average center\">"+(Math.round((leagueAverageTopTenStrengthOfCurrentFieldPlayers/teamData.length)*10)/10).toString().replace(".",",")+"</td>"+
  672. "<td class=\""+fatherDiv+"-result-table-td league-average center\">"+(Math.round((leagueAverageTopThirteenStrengthOfCurrentFieldPlayers/teamData.length)*10)/10).toString().replace(".",",")+"</td>"+
  673. "<td class=\""+fatherDiv+"-result-table-td league-average center\">"+(Math.round((leagueAverageTopFifteenStrengthOfCurrentFieldPlayers/teamData.length)*10)/10).toString().replace(".",",")+"</td>"+
  674. "<td class=\""+fatherDiv+"-result-table-td league-average center\">"+(Math.round((leagueAverageTopTwentyStrengthOfCurrentFieldPlayers/teamData.length)*10)/10).toString().replace(".",",")+"</td>"+
  675. "<td class=\""+fatherDiv+"-result-table-td league-average center\">"+(Math.round((leagueAverageTopStrengthOfCurrentKeepers/teamData.length)*10)/10)+"</td>"+
  676. "<td class=\""+fatherDiv+"-result-table-td league-average center\">"+(Math.round((leagueAverageTopTwoStrengthOfCurrentKeepers/teamData.length)*10)/10)+"</td>"+
  677. "<td class=\""+fatherDiv+"-result-table-td league-average center\">"+(Math.round((leagueAverageStrengthOfCurrentPlayers/teamData.length)*10)/10).toString().replace(".",",")+"</td>"+
  678. "<td class=\""+fatherDiv+"-result-table-td league-average center\">"+(Math.round((leagueAverageTalentOfCurrentPlayers/teamData.length)*10)/10).toString().replace(".",",")+"</td>"+
  679. "<td class=\""+fatherDiv+"-result-table-td league-average center\">"+(Math.round((leagueAverageAgeOfCurrentPlayers/teamData.length)*10)/10).toString().replace(".",",")+"</td>"+
  680. "<td class=\""+fatherDiv+"-result-table-td league-average right\">"+euro.format(Math.round(leagueAverageMarketValueOfCurrentPlayers/teamData.length))+"</td>"+
  681. "<td class=\""+fatherDiv+"-result-table-td league-average right\">"+euro.format(Math.round(leagueAverageAverageMarketValueOfCurrentPlayers/teamData.length))+"</td>"+
  682. "<td class=\""+fatherDiv+"-result-table-td league-average right\">"+euro.format(Math.round(leagueAverageSalaryOfCurrentPlayers/teamData.length))+"</td>"+
  683. "<td class=\""+fatherDiv+"-result-table-td league-average right\">"+euro.format(Math.round(leagueAverageAverageSalaryOfCurrentPlayers/teamData.length))+"</td>"+
  684. "</tr>"
  685. );
  686. $("th").attr("style","padding: 0px 4px 0px 4px;");
  687. $("."+fatherDiv+"-result-table-td.center").attr("style","text-align: center;");
  688. $("."+fatherDiv+"-result-table-td.right").attr("style","text-align: right;");
  689. $("."+fatherDiv+"-result-table-td.league-average").css("border-top","1px solid");
  690. $("."+fatherDiv+"-result-table-td.league-average").css("font-weight","550");
  691. }
  692.  
  693. function createJugiOverviewResultDiv(fatherDiv, playerData){
  694. let counterOfJugis = 0;
  695. $("#"+fatherDiv).append(
  696. "<div class=\""+fatherDiv+"-result\"></div>"
  697. );
  698. $("."+fatherDiv+"-result").append(
  699. "<table id=\""+fatherDiv+"-result-table\">"+
  700. "<tr class=\""+fatherDiv+"-result-table-row\">"+
  701. "<th class=\""+fatherDiv+"-result-table-th\">Nr.</th>"+
  702. "<th class=\""+fatherDiv+"-result-table-th\">Logo</th>"+
  703. "<th class=\""+fatherDiv+"-result-table-th\">Verein</th>"+
  704. "<th class=\""+fatherDiv+"-result-table-th\">Spieler</th>"+
  705. "<th class=\""+fatherDiv+"-result-table-th\">Alter</th>"+
  706. "<th class=\""+fatherDiv+"-result-table-th\">Stärke</th>"+
  707. "<th class=\""+fatherDiv+"-result-table-th\">Talent</th>"+
  708. "<th class=\""+fatherDiv+"-result-table-th\">Positionen</th>"+
  709. "<th class=\""+fatherDiv+"-result-table-th\">Gehalt</th>"+
  710. "<th class=\""+fatherDiv+"-result-table-th\">Marktwert</th>"+
  711. "</tr>"+
  712. "</table>"
  713. );
  714. for(i=0;i<playerData.length;i++){
  715. if(playerData[i].isCurrentJugiFromCurrentTeam){
  716. let talent;
  717. if(playerData[i].isTalentDetermined){
  718. talent = playerData[i].talent + "+";
  719. }
  720. else{
  721. talent = playerData[i].talent;
  722. }
  723. $("#"+fatherDiv+"-result-table").append(
  724. "<tr class=\""+fatherDiv+"-result-table-row tablehead\">"+
  725. "<td class=\""+fatherDiv+"-result-table-td center\">"+(counterOfJugis+1)+".</td>"+
  726. "<td class=\""+fatherDiv+"-result-table-td center\"><a href=\"https://www.onlineliga.de/#url=team/overview?userId="+playerData[i].currentTeamID+"\" target=\"_blank\"><img src=\""+playerData[i].currentTeamLogo+"\" height=\"13px\"></a></td>"+
  727. "<td class=\""+fatherDiv+"-result-table-td\"><a href=\"https://www.onlineliga.de/#url=team/overview?userId="+playerData[i].currentTeamID+"\" target=\"_blank\">"+playerData[i].currentTeamName+"</a>&nbsp;&nbsp;</td>"+
  728. "<td class=\""+fatherDiv+"-result-table-td\"><a href=\"https://www.onlineliga.de/#url=player/overview?playerId="+playerData[i].ID+"\" target=\"_blank\">"+playerData[i].name+"</a></td>"+
  729. "<td class=\""+fatherDiv+"-result-table-td center\">"+playerData[i].age+"</td>"+
  730. "<td class=\""+fatherDiv+"-result-table-td center\">"+playerData[i].strength+"</td>"+
  731. "<td class=\""+fatherDiv+"-result-table-td center\">"+talent+"</td>"+
  732. "<td class=\""+fatherDiv+"-result-table-td center\">"+playerData[i].positions+"&nbsp;&nbsp;</td>"+
  733. "<td class=\""+fatherDiv+"-result-table-td right\">"+euro.format(playerData[i].salary)+"&nbsp;&nbsp;</td>"+
  734. "<td class=\""+fatherDiv+"-result-table-td right\">"+euro.format(playerData[i].marketValue)+"</td>"+
  735. "</tr>"
  736. );
  737. counterOfJugis++;
  738. }
  739. }
  740. $("th").attr("style","padding: 0px 4px 0px 4px;");
  741. $("."+fatherDiv+"-result-table-td.center").attr("style","text-align: center;");
  742. $("."+fatherDiv+"-result-table-td.right").attr("style","text-align: right;");
  743. }
  744.  
  745. function createTransferOverviewResultDiv(fatherDiv, transferData){
  746. $("#"+fatherDiv).append(
  747. "<div class=\""+fatherDiv+"-result\"></div>"
  748. );
  749. $("."+fatherDiv+"-result").append(
  750. "<table id=\""+fatherDiv+"-result-table\">"+
  751. "<tr class=\""+fatherDiv+"-result-table-row\">"+
  752. "<th class=\""+fatherDiv+"-result-table-th\">Nr.</th>"+
  753. "<th class=\""+fatherDiv+"-result-table-th transferSeason\">Saison&blacktriangledown;</th>"+
  754. "<th class=\""+fatherDiv+"-result-table-th transferWeek\">Woche&blacktriangledown;</th>"+
  755. "<th class=\""+fatherDiv+"-result-table-th transferTeamLogo\">Logo&blacktriangledown;</th>"+
  756. "<th class=\""+fatherDiv+"-result-table-th transferTeamName\">Verein&blacktriangledown;</th>"+
  757. "<th class=\""+fatherDiv+"-result-table-th\"></th>"+
  758. "<th class=\""+fatherDiv+"-result-table-th\"></th>"+
  759. "<th class=\""+fatherDiv+"-result-table-th\">Spieler</th>"+
  760. "<th class=\""+fatherDiv+"-result-table-th transferPlayerAge\">Alter&blacktriangledown;</th>"+
  761. "<th class=\""+fatherDiv+"-result-table-th transferPlayerStrength\">Stärke&blacktriangledown;</th>"+
  762. "<th class=\""+fatherDiv+"-result-table-th transferPlayerTalent\">Talent&blacktriangledown;</th>"+
  763. "<th class=\""+fatherDiv+"-result-table-th transferPlayerPositions\">Positionen&blacktriangledown;</th>"+
  764. "<th class=\""+fatherDiv+"-result-table-th transferPlayerSalary\">Gehalt&blacktriangledown;</th>"+
  765. "<th class=\""+fatherDiv+"-result-table-th transferPlayerMarketValue\">Marktwert&blacktriangledown;</th>"+
  766. "<th class=\""+fatherDiv+"-result-table-th transferTransferMoney\">Ablösesumme&blacktriangledown;</th>"+
  767. "<th class=\""+fatherDiv+"-result-table-th\">Logo</th>"+
  768. "<th class=\""+fatherDiv+"-result-table-th\">Partnerverein</th>"+
  769. "</tr>"+
  770. "</table>"
  771. );
  772. for(i=0;i<transferData.length;i++){
  773. let talent;
  774. if(transferData[i].playerTalentIsDetermind){
  775. talent = transferData[i].playerTalent + "+";
  776. }
  777. else{
  778. talent = transferData[i].playerTalent;
  779. }
  780. let colorTransferMoney;
  781. let colorTransferArrow;
  782. if(transferData[i].transferMoney>0){
  783. colorTransferMoney = "green";
  784. colorTransferArrow = "redArrow";
  785. }
  786. else{
  787. colorTransferMoney = "red";
  788. colorTransferArrow = "greenArrow";
  789. }
  790. let transferPartnerTeam;
  791. if(transferData[i].transferPartnerStatus=="inactive"){
  792. transferPartnerTeam = "italic";
  793. }
  794. else if(transferData[i].transferPartnerStatus=="none"){
  795. transferPartnerTeam = "clubless";
  796. }
  797. else{
  798. transferPartnerTeam = "";
  799. }
  800. $("#"+fatherDiv+"-result-table").append(
  801. "<tr class=\""+fatherDiv+"-result-table-row\">"+
  802. "<td class=\""+fatherDiv+"-result-table-td center\">"+(i+1)+".</td>"+
  803. "<td class=\""+fatherDiv+"-result-table-td center\">"+transferData[i].transferSeason+"</td>"+
  804. "<td class=\""+fatherDiv+"-result-table-td center\">"+transferData[i].transferWeek+"</td>"+
  805. "<td class=\""+fatherDiv+"-result-table-td center\"><a href=\"https://www.onlineliga.de/#url=team/overview?userId="+transferData[i].currentTeamID+"\" target=\"_blank\"><img src=\""+transferData[i].currentTeamLogo+"\" height=\"13px\"></a></td>"+
  806. "<td class=\""+fatherDiv+"-result-table-td\"><a href=\"https://www.onlineliga.de/#url=team/overview?userId="+transferData[i].currentTeamID+"\" target=\"_blank\">"+transferData[i].currentTeamName+"</a>&nbsp;&nbsp;</td>"+
  807. "<td class=\""+fatherDiv+"-result-table-td center "+colorTransferArrow+"\">&#9650;</td>"+
  808. "<td class=\""+fatherDiv+"-result-table-td center "+colorTransferArrow+"\">&nbsp;</td>"+
  809. "<td class=\""+fatherDiv+"-result-table-td\"><a href=\"https://www.onlineliga.de/#url=player/overview?playerId="+transferData[i].playerID+"\" target=\"_blank\">"+transferData[i].playerName+"</a></td>"+
  810. "<td class=\""+fatherDiv+"-result-table-td center\">"+transferData[i].playerAge+"</td>"+
  811. "<td class=\""+fatherDiv+"-result-table-td center\">"+transferData[i].playerStrength+"</td>"+
  812. "<td class=\""+fatherDiv+"-result-table-td center\">"+talent+"</td>"+
  813. "<td class=\""+fatherDiv+"-result-table-td center\">"+transferData[i].playerPositions+"&nbsp;&nbsp;</td>"+
  814. "<td class=\""+fatherDiv+"-result-table-td right\">"+euro.format(transferData[i].playerSalary)+"&nbsp;&nbsp;</td>"+
  815. "<td class=\""+fatherDiv+"-result-table-td right\">"+euro.format(transferData[i].playerMarketValue)+"</td>"+
  816. "<td class=\""+fatherDiv+"-result-table-td right "+colorTransferMoney+"\">"+euro.format(transferData[i].transferMoney)+"</td>"+
  817. "<td class=\""+fatherDiv+"-result-table-td center\"><a href=\"https://www.onlineliga.de/#url=team/overview?userId="+transferData[i].transferPartnerID+"\" target=\"_blank\"><img src=\""+transferData[i].transferPartnerLogo+"\" height=\"13px\"></a></td>"+
  818. "<td class=\""+fatherDiv+"-result-table-td "+transferPartnerTeam+"\"><a href=\"https://www.onlineliga.de/#url=team/overview?userId="+transferData[i].transferPartnerID+"\" target=\"_blank\">"+transferData[i].transferPartnerName+"</a>&nbsp;&nbsp;</td>"+
  819. "</tr>"
  820. );
  821. }
  822. $("th").css("padding","0px 4px");
  823. $("."+fatherDiv+"-result-table-td.center").css("text-align","center");
  824. $("."+fatherDiv+"-result-table-td.center.greenArrow").attr("style","color: #357c35; transform: rotate(-90deg);");
  825. $("."+fatherDiv+"-result-table-td.center.redArrow").attr("style","color: #e5332a; transform: rotate(90deg);");
  826. $("."+fatherDiv+"-result-table-td.right").attr("style","text-align: right;");
  827. $("."+fatherDiv+"-result-table-td.right.green").attr("style","text-align: right; color: #357c35;");
  828. $("."+fatherDiv+"-result-table-td.right.red").attr("style","text-align: right; color: #e5332a;");
  829. $("."+fatherDiv+"-result-table-td.italic a").attr("style", "color: #646464 !important; font-style: italic;");
  830. $("."+fatherDiv+"-result-table-td.clubless a").attr("style","color: #e5332a !important;");
  831. $("."+fatherDiv+"-result-table-th.transferSeason" || "."+fatherDiv+"-result-table-th.transferWeek").hover(function(){
  832. $(this).css("color", "#00B050");
  833. },function(){
  834. $(this).css("color", "#333");
  835. });
  836. $(".transferTeamLogo" || ".transferTeamName").click(function() {
  837. sortTransferDataNew(transferData, 1);
  838. $("."+fatherDiv+"-result").remove();
  839. createTransferOverviewResultDiv(fatherDiv, transferData);
  840. });
  841. }
  842.  
  843. function sortTeamData(teamData){
  844. teamData.sort(function(a, b){
  845. return b.averageTopTenStrengthOfCurrentFieldPlayers - a.averageTopTenStrengthOfCurrentFieldPlayers;
  846. });
  847. }
  848.  
  849. function sortPlayerData(playerData){
  850. playerData.sort(function(a, b){
  851. return b.strength - a.strength;
  852. });
  853. playerData.sort(function(a, b){
  854. return b.currentTeamID - a.currentTeamID;
  855. });
  856. }
  857.  
  858. function sortJugiData(playerData){
  859. playerData.sort(function(a, b){
  860. return b.marketValue - a.marketValue;
  861. });
  862. }
  863.  
  864. function sortTransferData(transferData){
  865. transferData.sort(function(a, b){
  866. return b.currentTeamID - a.currentTeamID;
  867. });
  868. transferData.sort(function(a, b){
  869. return b.transferWeek - a.transferWeek;
  870. });
  871. transferData.sort(function(a, b){
  872. return b.transferSeason - a.transferSeason;
  873. });
  874. }
  875.  
  876. function sortTransferDataNew(transferData, column){
  877. transferData.sort(function(a, b){
  878. switch(column){
  879. case 1:
  880. return b.currentTeamID - a.currentTeamID;
  881. }
  882. });
  883. }
  884.  
  885. function calculateTeamOverview(teamData, playerData){
  886. for(i=0;i<teamData.length;i++){
  887. let numberOfPlayersWithoutTalent = 0
  888. let counterFieldPlayer = 0;
  889. let counterKeeper = 0;
  890. let teamStrength = 0;
  891. let teamTopTenStrength = 0;
  892. let teamTopThirteenStrength = 0;
  893. let teamTopFifteenStrength = 0;
  894. let teamTopTwentyStrength = 0;
  895. let teamTopKeeper = 0;
  896. let teamTopTwoKeeper = 0;
  897. let teamAge = 0;
  898. let teamTalent = 0;
  899. let teamMarketValue = 0;
  900. let teamSalary = 0;
  901. for(j=0;j<playerData.length;j++){
  902. if(teamData[i].ID == playerData[j].currentTeamID){
  903. teamStrength = teamStrength + playerData[j].strength;
  904. if(playerData[j].positions!="TW" && counterFieldPlayer<10){
  905. teamTopTenStrength = teamTopTenStrength + playerData[j].strength;
  906. }
  907. if(playerData[j].positions!="TW" && counterFieldPlayer<13){
  908. teamTopThirteenStrength = teamTopThirteenStrength + playerData[j].strength;
  909. }
  910. if(playerData[j].positions!="TW" && counterFieldPlayer<15){
  911. teamTopFifteenStrength = teamTopFifteenStrength + playerData[j].strength;
  912. }
  913. if(playerData[j].positions!="TW" && counterFieldPlayer<20){
  914. teamTopTwentyStrength = teamTopTwentyStrength + playerData[j].strength;
  915. counterFieldPlayer++;
  916. }
  917. if(playerData[j].positions=="TW" && teamTopKeeper==0){
  918. teamTopKeeper = playerData[j].strength;
  919. }
  920. if(playerData[j].positions=="TW" && counterKeeper<2){
  921. teamTopTwoKeeper = teamTopTwoKeeper + playerData[j].strength;
  922. counterKeeper++;
  923. }
  924. teamAge = teamAge + playerData[j].age;
  925. if(!isNaN(playerData[j].talent)){
  926. teamTalent = teamTalent + playerData[j].talent;
  927. }
  928. else{
  929. numberOfPlayersWithoutTalent++;
  930. }
  931. teamMarketValue = teamMarketValue + playerData[j].marketValue;
  932. teamSalary = teamSalary + playerData[j].salary;
  933. }
  934. }
  935. teamData[i].strengthOfCurrentPlayers = teamStrength;
  936. teamData[i].topFifteenStrengthOfCurrentFieldPlayers = teamTopFifteenStrength;
  937. teamData[i].ageOfCurrentPlayers = teamAge;
  938. teamData[i].talentOfCurrentPlayers = teamTalent;
  939. teamData[i].marketValueOfCurrentPlayers = teamMarketValue;
  940. teamData[i].salaryOfCurrentPlayers = teamSalary;
  941. teamData[i].averageStrengthOfCurrentPlayers = Math.round((teamStrength/teamData[i].numberOfCurrentPlayers)*10)/10;
  942. teamData[i].averageTopTenStrengthOfCurrentFieldPlayers = Math.round((teamTopTenStrength/Math.min(10,counterFieldPlayer))*10)/10;
  943. teamData[i].averageTopThirteenStrengthOfCurrentFieldPlayers = Math.round((teamTopThirteenStrength/Math.min(13,counterFieldPlayer))*10)/10;
  944. teamData[i].averageTopFifteenStrengthOfCurrentFieldPlayers = Math.round((teamTopFifteenStrength/Math.min(15,counterFieldPlayer))*10)/10;
  945. teamData[i].averageTopTwentyStrengthOfCurrentFieldPlayers = Math.round((teamTopTwentyStrength/Math.min(20,counterFieldPlayer))*10)/10;
  946. teamData[i].topStrengthOfCurrentKeepers = teamTopKeeper;
  947. teamData[i].averageTopTwoStrengthOfCurrentKeepers = Math.round((teamTopTwoKeeper/Math.min(2,counterKeeper))*10)/10;
  948. teamData[i].averageAgeOfCurrentPlayers = Math.round((teamAge/teamData[i].numberOfCurrentPlayers)*10)/10;
  949. if(teamData[i].numberOfCurrentPlayers==numberOfPlayersWithoutTalent){
  950. parseFloat("0.0");
  951. }
  952. else{
  953. teamData[i].averageTalentOfCurrentPlayers = Math.round((teamTalent/(teamData[i].numberOfCurrentPlayers-numberOfPlayersWithoutTalent))*10)/10;
  954. }
  955. teamData[i].averageMarketValueOfCurrentPlayers = Math.round(teamMarketValue/teamData[i].numberOfCurrentPlayers);
  956. teamData[i].averageSalaryOfCurrentPlayers = Math.round(teamSalary/teamData[i].numberOfCurrentPlayers);
  957. }
  958. }
  959.  
  960. function findLatestJugisFromCurrentTeam(divName, season, playerData, numberOfPotentialJugis, counterOfPotentialJugis){
  961. let link = "/player/transferhistory?playerId="+playerData.ID;
  962. let playerTransferhistory = $.ajax({type: "GET", url: link, async: false}).responseText;
  963. let numberOfRows = $("<div>" + playerTransferhistory + "</div>").find(".col-lg-3.col-md-3.col-sm-3.hidden-xs.text-center").length;
  964. let seasonOfEntrance = $("<div>" + playerTransferhistory + "</div>").find(".col-lg-3.col-md-3.col-sm-3.hidden-xs.text-center").eq(numberOfRows-2).text();
  965. let nameOfCurrentTeam = $("<div>" + playerTransferhistory + "</div>").find(".ol-team-name").last().text().trim();
  966. let nameOfHomeTeam = $("<div>" + playerTransferhistory + "</div>").find(".transferhistory-former-team span").last().text();
  967. if(seasonOfEntrance==season && nameOfHomeTeam=="Heimatverein (Jugend)" && nameOfCurrentTeam==playerData.currentTeamName){
  968. playerData.isCurrentJugiFromCurrentTeam = true;
  969. }
  970. else{
  971. playerData.isCurrentJugiFromCurrentTeam = false;
  972. }
  973. $("."+divName+"-counter-number-"+counterNumber).remove();
  974. $("."+divName+"-counter-"+counterNumber).append(
  975. "<span class=\""+divName+"-counter-number-"+counterNumber+"\">"+(counterOfPotentialJugis+1)+" von "+numberOfPotentialJugis+"</span>"
  976. );
  977. }
  978.  
  979. function getTeamDataOfCurrentLeague(){
  980. let numberOfTeams = $("#ol-td .ol-team-name").length;
  981. let teamData = new Array(numberOfTeams);
  982. for(i=0;i<numberOfTeams;i++) {
  983. teamData[i] = new Team();
  984. teamData[i].ID = parseInt($("#ol-td .ol-team-name").eq(i).attr("onclick").match(/[0-9]+/g));
  985. teamData[i].name = $("#ol-td .ol-team-name").eq(i).text().trim();
  986. if(typeof($("<div>" + $(".ol-table-number").eq(i)[0].offsetParent.innerHTML + "</div>").find("img").attr("src")) === "undefined"){
  987. teamData[i].logo = "https://www.onlineliga.de/imgs/ol_logo_ball.svg";
  988. }
  989. else{
  990. teamData[i].logo = $("<div>" + $(".ol-table-number").eq(i)[0].offsetParent.innerHTML + "</div>").find("img").attr("src");
  991. }
  992. }
  993. return(teamData);
  994. }
  995.  
  996. function getPlayerSquadInformationOfCurrentLeagueTeams(divName, teamData){
  997. let counter = 0;
  998. let player = [];
  999. createCounterDiv(divName, "Anzahl durchsuchter Ligateams nach Spieler-IDs: ", teamData.length);
  1000. for(i=0;i<teamData.length;i++) {
  1001. let link = "/team/overview/squad?userId="+teamData[i].ID;
  1002. let teamSquad = $.ajax({type: "GET", url: link, async: false}).responseText;
  1003. teamData[i].numberOfCurrentPlayers = $("<div>" + teamSquad + "</div>").find(".ol-player-name").length;
  1004. for(j=0;j<teamData[i].numberOfCurrentPlayers;j++) {
  1005. player[counter] = new Player();
  1006. player[counter].currentTeamID = teamData[i].ID;
  1007. player[counter].currentTeamName = teamData[i].name;
  1008. player[counter].currentTeamLogo = teamData[i].logo;
  1009. player[counter].ID = parseInt($("<div>" + teamSquad + "</div>").find(".ol-player-name").eq(j).attr("onclick").match(/[0-9]+/g)), parseInt($("<div>" + teamSquad + "</div>").find(".ol-player-name").eq(j).text());
  1010. player[counter].name = $("<div>" + teamSquad + "</div>").find(".ol-player-name").eq(j).text();
  1011. player[counter].age = parseInt($("<div>" + teamSquad + "</div>").find(".team-overview-squad-row #sqaudAge").eq(j).text());
  1012. player[counter].positions = $("<div>" + teamSquad + "</div>").find(".team-overview-squad-row .team-squad-overview-position").eq(j).text();
  1013. player[counter].leagueGamesThisSeason = parseInt($("<div>" + teamSquad + "</div>").find(".team-overview-squad-row").eq(j).find(".col-md-6.col-lg-6.col-sm-12.col-xs-12").eq(1).children(0).children(0)[0].innerText);
  1014. player[counter].leagueGoalsThisSeason = parseInt($("<div>" + teamSquad + "</div>").find(".team-overview-squad-row").eq(j).find(".col-md-6.col-lg-6.col-sm-12.col-xs-12").eq(1).children(0).children(0)[1].innerText);
  1015. player[counter].leagueAssistsThisSeason = parseInt($("<div>" + teamSquad + "</div>").find(".team-overview-squad-row").eq(j).find(".col-md-6.col-lg-6.col-sm-12.col-xs-12").eq(1).children(0).children(0)[2].innerText);
  1016. player[counter].marketValue = parseInt($("<div>" + teamSquad + "</div>").find(".col-md-3.col-lg-3.col-sm-6.col-xs-6.text-right").eq(j).text().trim().replace(/\./g, "").match(/[0-9]+/g));
  1017. counter++;
  1018. }
  1019. $("."+divName+"-counter-number-"+counterNumber).remove();
  1020. $("."+divName+"-counter-"+counterNumber).append(
  1021. "<span class=\""+divName+"-counter-number-"+counterNumber+"\">"+(i+1)+" von "+teamData.length+"</span>"
  1022. );
  1023. }
  1024. return player;
  1025. }
  1026.  
  1027. function getTransferInformationOfCurrentLeagueTeams(divName, teamData, season){
  1028. let counter = 0;
  1029. let transfer = [];
  1030. createCounterDiv(divName, "Anzahl durchsuchter Ligateams nach Transfers in Saison "+season+": ", teamData.length);
  1031. for(i=0;i<teamData.length;i++) {
  1032. let link = "/team/overview/transferhistory/season?userId="+teamData[i].ID+"&season="+season;
  1033. let teamTransfers = $.ajax({type: "GET", url: link, async: false}).responseText;
  1034. teamData[i].numberOfTeamTransfers = $("<div>" + teamTransfers + "</div>").find(".ol-state-striped-0 .pointer").length;
  1035. for(j=0;j<teamData[i].numberOfTeamTransfers;j++) {
  1036. transfer[counter] = new Transfer();
  1037. transfer[counter].currentTeamID = teamData[i].ID;
  1038. transfer[counter].currentTeamName = teamData[i].name;
  1039. transfer[counter].currentTeamLogo = teamData[i].logo;
  1040. transfer[counter].playerID = parseInt($("<div>" + teamTransfers + "</div>").find(".player-quick-overview-launcher").eq(j).attr("onclick").match(/[0-9]+/g));
  1041. transfer[counter].playerName = $("<div>" + teamTransfers + "</div>").find(".player-name .pointer").eq(j).text().trim();
  1042. if($("<div>" + teamTransfers + "</div>").find(".col-lg-2.col-md-3.col-sm-3.col-xs-4.text-right.nowrap.bold").eq(j).text().trim().slice(0,1)=="-"){
  1043. transfer[counter].transferMoney = parseInt("-"+$("<div>" + teamTransfers + "</div>").find(".col-lg-2.col-md-3.col-sm-3.col-xs-4.text-right.nowrap.bold").eq(j).text().trim().replace(/\./g, "").match(/[0-9]+/g));
  1044. }
  1045. else{
  1046. transfer[counter].transferMoney = parseInt($("<div>" + teamTransfers + "</div>").find(".col-lg-2.col-md-3.col-sm-3.col-xs-4.text-right.nowrap.bold").eq(j).text().trim().replace(/\./g, "").match(/[0-9]+/g));
  1047. }
  1048. transfer[counter].transferSeason = season;
  1049. transfer[counter].transferWeek = parseInt($("<div>" + teamTransfers + "</div>").find(".ol-timestamp-string").eq(j).text().match(/[0-9]+/g));
  1050. if($("<div>" + teamTransfers + "</div>").find(".col-lg-6.col-md-6.col-sm-6.col-xs-6.text-overflow.transfer-to-col").eq(j).children().last().text().trim()=="Vereinslos"){
  1051. transfer[counter].transferPartnerID = "";
  1052. transfer[counter].transferPartnerStatus = "none";
  1053. transfer[counter].transferPartnerName = "Vereinslos";
  1054. transfer[counter].transferPartnerLogo = "https://www.onlineliga.de/imgs/ol_logo_ball.svg";
  1055. }
  1056. else{
  1057. transfer[counter].transferPartnerID = parseInt($("<div>" + teamTransfers + "</div>").find(".col-lg-6.col-md-6.col-sm-6.col-xs-6.text-overflow.transfer-to-col").eq(j).children().last().children().attr("onclick").match(/[0-9]+/g));
  1058. if($("<div>" + teamTransfers + "</div>").find(".col-lg-6.col-md-6.col-sm-6.col-xs-6.text-overflow.transfer-to-col").eq(j).children().last().children()[0].className==" ol-team-name-inactive"){
  1059. transfer[counter].transferPartnerStatus = "inactive";
  1060. }
  1061. else{
  1062. transfer[counter].transferPartnerStatus = "active";
  1063. }
  1064. transfer[counter].transferPartnerName = $("<div>" + teamTransfers + "</div>").find(".col-lg-6.col-md-6.col-sm-6.col-xs-6.text-overflow.transfer-to-col").eq(j).children().last().children().text().trim();
  1065. if(typeof($("<div>" + teamTransfers + "</div>").find(".col-lg-6.col-md-6.col-sm-6.col-xs-6.text-overflow.transfer-to-col").eq(j)[0].children[1].children[0].children[0])=="undefined"){
  1066. transfer[counter].transferPartnerLogo = "https://www.onlineliga.de/imgs/ol_logo_ball.svg";
  1067. }
  1068. else{
  1069. transfer[counter].transferPartnerLogo = $("<div>" + teamTransfers + "</div>").find(".col-lg-6.col-md-6.col-sm-6.col-xs-6.text-overflow.transfer-to-col").eq(j)[0].children[1].children[0].children[0].children[0].attributes[1].value;
  1070. }
  1071. }
  1072. counter++;
  1073. }
  1074. $("."+divName+"-counter-number-"+counterNumber).remove();
  1075. $("."+divName+"-counter-"+counterNumber).append(
  1076. "<span class=\""+divName+"-counter-number-"+counterNumber+"\">"+(i+1)+" von "+teamData.length+"</span>"
  1077. );
  1078. }
  1079. return transfer;
  1080. }
  1081.  
  1082. function getPlayerDataForTransferInformation(divName, transferData){
  1083. createCounterDiv(divName, "Anzahl durchsuchter Spieler nach Eigenschaften: ", transferData.length);
  1084. for(i=0;i<transferData.length;i++) {
  1085. let link = "/player/overview?playerId="+transferData[i].playerID;
  1086. let playerOverview = $.ajax({type: "GET", url: link, async: false}).responseText;
  1087. transferData[i].playerStrength = parseInt($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-value").eq(0).html());
  1088. transferData[i].playerAge = parseInt($("<div>" + playerOverview + "</div>").find(".ol-player-overview-player-position-age").text().trim().match(/[0-9]+/g));
  1089. transferData[i].playerPositions = $("<div>" + playerOverview + "</div>").find(".ol-player-overview-player-position-age").text().trim().slice(10, 22).trim();
  1090. transferData[i].playerMarketValue = parseInt($("<div>" + playerOverview + "</div>").find(".col-md-8.col-lg-8.col-sm-12.col-xs-7").eq(8).text().trim().replace(/\./g, "").match(/[0-9]+/g));
  1091. transferData[i].playerSalary = parseInt($("<div>" + playerOverview + "</div>").find(".col-md-8.col-lg-8.col-sm-12.col-xs-7").eq(10).text().trim().replace(/\./g, "").match(/[0-9]+/g));
  1092. if(transferData[i].playerPositions=="TW"){
  1093. transferData[i].playerTalent = parseInt($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-value").eq(8).text());
  1094. }
  1095. else{
  1096. transferData[i].playerTalent = parseInt($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-value").eq(11).text());
  1097. }
  1098. if($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-special-type").text().trim()=="(wird noch ermittelt)"){
  1099. transferData[i].playerTalentIsDetermind = true;
  1100. }
  1101. else{
  1102. transferData[i].playerTalentIsDetermind = false;
  1103. }
  1104. $("."+divName+"-counter-number-"+counterNumber).remove();
  1105. $("."+divName+"-counter-"+counterNumber).append(
  1106. "<span class=\""+divName+"-counter-number-"+counterNumber+"\">"+(i+1)+" von "+transferData.length+"</span>"
  1107. );
  1108. }
  1109. }
  1110.  
  1111. function getPlayerData(divName, playerData){
  1112. createCounterDiv(divName, "Anzahl durchsuchter Spieler: ", playerData.length);
  1113. for(i=0;i<playerData.length;i++) {
  1114. let link = "/player/overview?playerId="+playerData[i].ID;
  1115. let playerOverview = $.ajax({type: "GET", url: link, async: false}).responseText;
  1116. playerData[i].strength = parseInt($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-value").eq(0).html());
  1117. playerData[i].salary = parseInt($("<div>" + playerOverview + "</div>").find(".col-md-8.col-lg-8.col-sm-12.col-xs-7").eq(10).text().trim().replace(/\./g, "").match(/[0-9]+/g));
  1118. if(playerData[i].positions=="TW"){
  1119. playerData[i].talent = parseInt($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-value").eq(8).text());
  1120. }
  1121. else{
  1122. playerData[i].talent = parseInt($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-value").eq(11).text());
  1123. }
  1124. if($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-special-type").text().trim()=="(wird noch ermittelt)"){
  1125. playerData[i].isTalentDetermind = true;
  1126. }
  1127. else{
  1128. playerData[i].isTalentDetermind = false;
  1129. }
  1130. $("."+divName+"-counter-number-"+counterNumber).remove();
  1131. $("."+divName+"-counter-"+counterNumber).append(
  1132. "<span class=\""+divName+"-counter-number-"+counterNumber+"\">"+(i+1)+" von "+playerData.length+"</span>"
  1133. );
  1134. }
  1135. }
  1136.  
  1137. function getPlayerStrength(playerId){
  1138. let link = "/player/overview?playerId="+playerId;
  1139. let playerOverview = $.ajax({type: "GET", url: link, async: false}).responseText;
  1140. return parseInt($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-value").eq(0).html());
  1141. }
  1142.  
  1143. function getPlayerInjuryData(player){
  1144. let link = "/player/injuries?playerId="+player.ID;
  1145. let playerData = $.ajax({type: "GET", url: link, async: false}).responseText;
  1146. player.numberOfInjuries = $("<div>" + playerData + "</div>").find("span.pull-left span.player-info-bandarole-big-font").eq(0).text().trim();
  1147. player.lengthOfAllInjuries = $("<div>" + playerData + "</div>").find("span.bandarole-second-row span.player-info-bandarole-big-font").eq(0).text().trim();
  1148. player.averageLengthOfAllInjuries = $("<div>" + playerData + "</div>").find("span.bandarole-second-row span.player-info-bandarole-big-font").eq(1).text().trim();
  1149. }
  1150.  
  1151. function getJugiData(divName, playerData, numberOfJugis, counterOfJugis){
  1152. let link = "/player/overview?playerId="+playerData.ID;
  1153. let playerOverview = $.ajax({type: "GET", url: link, async: false}).responseText;
  1154. playerData.strength = parseInt($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-value").eq(0).html());
  1155. playerData.salary = parseInt($("<div>" + playerOverview + "</div>").find(".col-md-8.col-lg-8.col-sm-12.col-xs-7").eq(10).text().trim().replace(/\./g, "").match(/[0-9]+/g));
  1156. if(playerData.positions=="TW"){
  1157. playerData.talent = parseInt($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-value").eq(8).text());
  1158. }
  1159. else{
  1160. playerData.talent = parseInt($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-value").eq(11).text());
  1161. }
  1162. if($("<div>" + playerOverview + "</div>").find(".ol-value-bar-small-label-special-type").text().trim()=="(wird noch ermittelt)"){
  1163. playerData.isTalentDetermind = true;
  1164. }
  1165. else{
  1166. playerData.isTalentDetermind = false;
  1167. }
  1168. $("."+divName+"-counter-number-"+counterNumber).remove();
  1169. $("."+divName+"-counter-"+counterNumber).append(
  1170. "<span class=\""+divName+"-counter-number-"+counterNumber+"\">"+(counterOfJugis+1)+" von "+numberOfJugis+"</span>"
  1171. );
  1172. }
  1173.  
  1174. function getLastGameResult(teamData){
  1175. let link = "/team/overview?userId="+teamData.ID;
  1176. let teamOverview = $.ajax({type: "GET", url: link, async: false}).responseText;
  1177. let firstTeamNumber = $("<div>" + teamOverview + "</div>").find(".ol-team-name").eq(2).attr("onclick").match(/[0-9]+/g)[0];
  1178. let resultArray = $("<div>" + teamOverview + "</div>").find(".team-overview-current-match").eq(0).text().trim().substring(0,7).split(":");
  1179. let homeGoals = parseInt(resultArray[0].trim());
  1180. let awayGoals = parseInt(resultArray[1].trim());
  1181. let backgroundColor;
  1182. if(teamData.ID == firstTeamNumber){
  1183. if(homeGoals>awayGoals){
  1184. backgroundColor = "#A9D08E";
  1185. }
  1186. else if(homeGoals==awayGoals){
  1187. backgroundColor = "#FFD966";
  1188. }
  1189. else{
  1190. backgroundColor = "#F4B084";
  1191. }
  1192. teamData.lastGameResultHomeGoals = homeGoals;
  1193. teamData.lastGameResultAwayGoals = awayGoals;
  1194. teamData.lastGameResultBackgroundColor = backgroundColor;
  1195. }
  1196. else{
  1197. if(homeGoals>awayGoals){
  1198. backgroundColor = "#F4B084";
  1199. }
  1200. else if(homeGoals==awayGoals){
  1201. backgroundColor = "#FFD966";
  1202. }
  1203. else{
  1204. backgroundColor = "#A9D08E";
  1205. }
  1206. teamData.lastGameResultHomeGoals = awayGoals;
  1207. teamData.lastGameResultAwayGoals = homeGoals;
  1208. teamData.lastGameResultBackgroundColor = backgroundColor;
  1209. }
  1210. }
  1211.  
  1212. function getElevenOfTheYearData(){
  1213. let leagueLevel = parseInt($("button#tooltipLeagueSelection span.ol-dropdown-text:first").text().match(/\d+/)[0]);
  1214. let leagueId;
  1215. if(leagueLevel==1){
  1216. leagueId = parseInt($("#dropdown-matchday-table-league-level-matchdayTable").data("value"));
  1217. }
  1218. else if(leagueLevel==2 || leagueLevel==3 || leagueLevel==4){
  1219. leagueId = parseInt($("#dropdown-matchday-table-1-matchdayTable").data("value"));
  1220. }
  1221. else if(leagueLevel==5){
  1222. leagueId = parseInt($("#dropdown-matchday-table-2-matchdayTable").data("value"));
  1223. }
  1224. else if(leagueLevel==6){
  1225. leagueId = parseInt($("#dropdown-matchday-table-3-matchdayTable").data("value"));
  1226. }
  1227. let season = parseInt($("button#tooltipSeasonSelection span.ol-dropdown-text:first").text().match(/\d+/)[0]);
  1228. let numberOfMatchdays;
  1229. if(season==currentSeason){
  1230. numberOfMatchdays = parseInt($(".ol-navigation-matchday-display-font .ol-banner-description-long.ol-header-time-description .ol-banner-time-regular").text().match(/\d+/)[0]);
  1231. }
  1232. else{
  1233. numberOfMatchdays = 35;
  1234. }
  1235. let keeperIds = [];
  1236. let defenderIds = [];
  1237. let midfielderIds = [];
  1238. let strikerIds = [];
  1239. for(i=1;i<numberOfMatchdays;i++){
  1240. let link = "/matchdaytable/elevenofthedaypitch?season="+season+"&matchday="+i+"&leagueLevel="+leagueLevel+"&leagueId="+leagueId+"&stateId=&leagueMatchday=0&type=1&nav=true&navId=matchdayTable";
  1241. let elevenOfTheDay = $.ajax({type: "GET", url: link, async: false}).responseText;
  1242. keeperIds.push(parseInt($("<div>" + elevenOfTheDay + "</div>").find(".ol-table-pitch-box-keeper .ol-table-pitch-player-name .ol-player-name").eq(0).attr("onclick").match(/[0-9]+/g)[0]));
  1243. defenderIds.push(parseInt($("<div>" + elevenOfTheDay + "</div>").find(".ol-table-pitch-box-defender1 .ol-table-pitch-player-name .ol-player-name").eq(0).attr("onclick").match(/[0-9]+/g)[0]));
  1244. defenderIds.push(parseInt($("<div>" + elevenOfTheDay + "</div>").find(".ol-table-pitch-box-defender2 .ol-table-pitch-player-name .ol-player-name").eq(0).attr("onclick").match(/[0-9]+/g)[0]));
  1245. defenderIds.push(parseInt($("<div>" + elevenOfTheDay + "</div>").find(".ol-table-pitch-box-defender3 .ol-table-pitch-player-name .ol-player-name").eq(0).attr("onclick").match(/[0-9]+/g)[0]));
  1246. defenderIds.push(parseInt($("<div>" + elevenOfTheDay + "</div>").find(".ol-table-pitch-box-defender4 .ol-table-pitch-player-name .ol-player-name").eq(0).attr("onclick").match(/[0-9]+/g)[0]));
  1247. midfielderIds.push(parseInt($("<div>" + elevenOfTheDay + "</div>").find(".ol-table-pitch-box-midfield1 .ol-table-pitch-player-name .ol-player-name").eq(0).attr("onclick").match(/[0-9]+/g)[0]));
  1248. midfielderIds.push(parseInt($("<div>" + elevenOfTheDay + "</div>").find(".ol-table-pitch-box-midfield2 .ol-table-pitch-player-name .ol-player-name").eq(0).attr("onclick").match(/[0-9]+/g)[0]));
  1249. midfielderIds.push(parseInt($("<div>" + elevenOfTheDay + "</div>").find(".ol-table-pitch-box-midfield3 .ol-table-pitch-player-name .ol-player-name").eq(0).attr("onclick").match(/[0-9]+/g)[0]));
  1250. strikerIds.push(parseInt($("<div>" + elevenOfTheDay + "</div>").find(".ol-table-pitch-box-striker1 .ol-table-pitch-player-name .ol-player-name").eq(0).attr("onclick").match(/[0-9]+/g)[0]));
  1251. strikerIds.push(parseInt($("<div>" + elevenOfTheDay + "</div>").find(".ol-table-pitch-box-striker2 .ol-table-pitch-player-name .ol-player-name").eq(0).attr("onclick").match(/[0-9]+/g)[0]));
  1252. strikerIds.push(parseInt($("<div>" + elevenOfTheDay + "</div>").find(".ol-table-pitch-box-striker3 .ol-table-pitch-player-name .ol-player-name").eq(0).attr("onclick").match(/[0-9]+/g)[0]));
  1253. }
  1254.  
  1255. let keeperList = countNominations(keeperIds);
  1256. keeperList = sortNominationsFirst(keeperList);
  1257. keeperList = cutNominationListFirst(keeperList, 1);
  1258. keeperList = getAverageGradesForElevenOfTheYear(keeperList, 1, season);
  1259. keeperList = sortNominationsSecond(keeperList);
  1260. keeperList = cutNominationListSecond(keeperList, 1);
  1261. keeperList = getNameForElevenOfTheYear(keeperList);
  1262.  
  1263. // Keeper
  1264. $(".ol-table-pitch-box-keeper .ol-player-name").text(keeperList[0].name+" ("+keeperList[0].count+")");
  1265. $(".ol-table-pitch-box-keeper .ol-player-name").attr("onclick","olAnchorNavigation.load('player/overview', { playerId: "+keeperList[0].playerId+" });");
  1266. $(".ol-table-pitch-box-keeper .player-quick-overview-launcher").attr("onclick","olOverlayWindow.load('/player/quickoverview', { 'playerId': "+keeperList[0].playerId+" }); event.stopPropagation();");
  1267. $(".ol-table-pitch-box-keeper .player-quick-overview-launcher").next().remove();
  1268. if(keeperList[0].clubLogo.substring(0, 4)=="icon"){
  1269. $(".ol-table-pitch-box-keeper .ol-table-pitch-logo .user-badge").empty();
  1270. let spanClass = $(".ol-table-pitch-box-keeper .ol-table-pitch-logo .user-badge").attr("class");
  1271. spanClass = spanClass.split(" ");
  1272. $(".ol-table-pitch-box-keeper .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1273. $(".ol-table-pitch-box-keeper .ol-table-pitch-logo .user-badge").addClass(keeperList[0].clubLogo);
  1274. }
  1275. else{
  1276. $(".ol-table-pitch-box-keeper .ol-table-pitch-logo .user-badge").empty();
  1277. $(".ol-table-pitch-box-keeper .ol-table-pitch-logo .user-badge").empty();
  1278. let spanClass = $(".ol-table-pitch-box-keeper .ol-table-pitch-logo .user-badge").attr("class");
  1279. spanClass = spanClass.split(" ");
  1280. $(".ol-table-pitch-box-keeper .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1281. $(".ol-table-pitch-box-keeper .ol-table-pitch-logo .user-badge").addClass("icon-badge-custom-min");
  1282. $(".ol-table-pitch-box-keeper .ol-table-pitch-logo .user-badge").append("<span style=\"margin-left: -0px; margin-top: -0px;\"><img style=\"transform: scale(1);\" src=\""+keeperList[0].clubLogo+"\" width=\"30px\" height=\"30px\"></span>");
  1283. }
  1284. if($(".ol-table-pitch-box-keeper .ol-team-name").length>=1){
  1285. $(".ol-table-pitch-box-keeper .ol-team-name").text(keeperList[0].clubName);
  1286. }
  1287. else if($(".ol-table-pitch-box-keeper .ol-team-name-inactive").length>=1){
  1288. $(".ol-table-pitch-box-keeper .ol-team-name-inactive").removeClass("ol-team-name-inactive").addClass("ol-team-name");
  1289. $(".ol-table-pitch-box-keeper .ol-team-name").text(keeperList[0].clubName);
  1290. }
  1291. $(".ol-table-pitch-box-keeper .ol-team-name").attr("onclick","olAnchorNavigation.load('https://www.onlineliga.de/team/overview', { userId : "+keeperList[0].clubId+" });");
  1292. $(".ol-table-pitch-box-keeper .ol-table-pitch-player-name").after("<div class=\"ol-table-pitch-average-grade\">&Oslash; "+keeperList[0].averageGrade.toFixed(2).toString().replace('.', ',')+"</div>");
  1293.  
  1294. let defenderList = countNominations(defenderIds);
  1295. defenderList = sortNominationsFirst(defenderList);
  1296. defenderList = cutNominationListFirst(defenderList, 4);
  1297. defenderList = getAverageGradesForElevenOfTheYear(defenderList, 4, season);
  1298. defenderList = sortNominationsSecond(defenderList);
  1299. defenderList = cutNominationListSecond(defenderList, 4);
  1300. defenderList = getNameForElevenOfTheYear(defenderList);
  1301.  
  1302. // Verteidiger 1
  1303. $(".ol-table-pitch-box-defender1 .ol-player-name").text(defenderList[2].name+" ("+defenderList[2].count+")");
  1304. $(".ol-table-pitch-box-defender1 .ol-player-name").attr("onclick","olAnchorNavigation.load('player/overview', { playerId: "+defenderList[2].playerId+" });");
  1305. $(".ol-table-pitch-box-defender1 .player-quick-overview-launcher").attr("onclick","olOverlayWindow.load('/player/quickoverview', { 'playerId': "+defenderList[2].playerId+" }); event.stopPropagation();");
  1306. $(".ol-table-pitch-box-defender1 .player-quick-overview-launcher").next().remove();
  1307. if(defenderList[2].clubLogo.substring(0, 4)=="icon"){
  1308. $(".ol-table-pitch-box-defender1 .ol-table-pitch-logo .user-badge").empty();
  1309. let spanClass = $(".ol-table-pitch-box-defender1 .ol-table-pitch-logo .user-badge").attr("class");
  1310. spanClass = spanClass.split(" ");
  1311. $(".ol-table-pitch-box-defender1 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1312. $(".ol-table-pitch-box-defender1 .ol-table-pitch-logo .user-badge").addClass(defenderList[2].clubLogo);
  1313. }
  1314. else{
  1315. $(".ol-table-pitch-box-defender1 .ol-table-pitch-logo .user-badge").empty();
  1316. $(".ol-table-pitch-box-defender1 .ol-table-pitch-logo .user-badge").empty();
  1317. let spanClass = $(".ol-table-pitch-box-defender1 .ol-table-pitch-logo .user-badge").attr("class");
  1318. spanClass = spanClass.split(" ");
  1319. $(".ol-table-pitch-box-defender1 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1320. $(".ol-table-pitch-box-defender1 .ol-table-pitch-logo .user-badge").addClass("icon-badge-custom-min");
  1321. $(".ol-table-pitch-box-defender1 .ol-table-pitch-logo .user-badge").append("<span style=\"margin-left: -0px; margin-top: -0px;\"><img style=\"transform: scale(1);\" src=\""+defenderList[2].clubLogo+"\" width=\"30px\" height=\"30px\"></span>");
  1322. }
  1323. if($(".ol-table-pitch-box-defender1 .ol-team-name").length>=1){
  1324. $(".ol-table-pitch-box-defender1 .ol-team-name").text(defenderList[2].clubName);
  1325. }
  1326. else if($(".ol-table-pitch-box-defender1 .ol-team-name-inactive").length>=1){
  1327. $(".ol-table-pitch-box-defender1 .ol-team-name-inactive").removeClass("ol-team-name-inactive").addClass("ol-team-name");
  1328. $(".ol-table-pitch-box-defender1 .ol-team-name").text(defenderList[2].clubName);
  1329. }
  1330. $(".ol-table-pitch-box-defender1 .ol-team-name").attr("onclick","olAnchorNavigation.load('https://www.onlineliga.de/team/overview', { userId : "+defenderList[2].clubId+" });");
  1331. $(".ol-table-pitch-box-defender1 .ol-table-pitch-player-name").after("<div class=\"ol-table-pitch-average-grade\">&Oslash; "+defenderList[2].averageGrade.toFixed(2).toString().replace('.', ',')+"</div>");
  1332.  
  1333. // Verteidiger 2
  1334. $(".ol-table-pitch-box-defender2 .ol-player-name").text(defenderList[0].name+" ("+defenderList[0].count+")");
  1335. $(".ol-table-pitch-box-defender2 .ol-player-name").attr("onclick","olAnchorNavigation.load('player/overview', { playerId: "+defenderList[0].playerId+" });");
  1336. $(".ol-table-pitch-box-defender2 .player-quick-overview-launcher").attr("onclick","olOverlayWindow.load('/player/quickoverview', { 'playerId': "+defenderList[0].playerId+" }); event.stopPropagation();");
  1337. $(".ol-table-pitch-box-defender2 .player-quick-overview-launcher").next().remove();
  1338. if(defenderList[0].clubLogo.substring(0, 4)=="icon"){
  1339. $(".ol-table-pitch-box-defender2 .ol-table-pitch-logo .user-badge").empty();
  1340. let spanClass = $(".ol-table-pitch-box-defender2 .ol-table-pitch-logo .user-badge").attr("class");
  1341. spanClass = spanClass.split(" ");
  1342. $(".ol-table-pitch-box-defender2 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1343. $(".ol-table-pitch-box-defender2 .ol-table-pitch-logo .user-badge").addClass(defenderList[0].clubLogo);
  1344. }
  1345. else{
  1346. $(".ol-table-pitch-box-defender2 .ol-table-pitch-logo .user-badge").empty();
  1347. $(".ol-table-pitch-box-defender2 .ol-table-pitch-logo .user-badge").empty();
  1348. let spanClass = $(".ol-table-pitch-box-defender2 .ol-table-pitch-logo .user-badge").attr("class");
  1349. spanClass = spanClass.split(" ");
  1350. $(".ol-table-pitch-box-defender2 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1351. $(".ol-table-pitch-box-defender2 .ol-table-pitch-logo .user-badge").addClass("icon-badge-custom-min");
  1352. $(".ol-table-pitch-box-defender2 .ol-table-pitch-logo .user-badge").append("<span style=\"margin-left: -0px; margin-top: -0px;\"><img style=\"transform: scale(1);\" src=\""+defenderList[0].clubLogo+"\" width=\"30px\" height=\"30px\"></span>");
  1353. }
  1354. if($(".ol-table-pitch-box-defender2 .ol-team-name").length>=1){
  1355. $(".ol-table-pitch-box-defender2 .ol-team-name").text(defenderList[0].clubName);
  1356. }
  1357. else if($(".ol-table-pitch-box-defender2 .ol-team-name-inactive").length>=1){
  1358. $(".ol-table-pitch-box-defender2 .ol-team-name-inactive").removeClass("ol-team-name-inactive").addClass("ol-team-name");
  1359. $(".ol-table-pitch-box-defender2 .ol-team-name").text(defenderList[0].clubName);
  1360. }
  1361. $(".ol-table-pitch-box-defender2 .ol-team-name").attr("onclick","olAnchorNavigation.load('https://www.onlineliga.de/team/overview', { userId : "+defenderList[0].clubId+" });");
  1362. $(".ol-table-pitch-box-defender2 .ol-table-pitch-player-name").after("<div class=\"ol-table-pitch-average-grade\">&Oslash; "+defenderList[0].averageGrade.toFixed(2).toString().replace('.', ',')+"</div>");
  1363.  
  1364. // Verteidiger 3
  1365. $(".ol-table-pitch-box-defender3 .ol-player-name").text(defenderList[1].name+" ("+defenderList[1].count+")");
  1366. $(".ol-table-pitch-box-defender3 .ol-player-name").attr("onclick","olAnchorNavigation.load('player/overview', { playerId: "+defenderList[1].playerId+" });");
  1367. $(".ol-table-pitch-box-defender3 .player-quick-overview-launcher").attr("onclick","olOverlayWindow.load('/player/quickoverview', { 'playerId': "+defenderList[1].playerId+" }); event.stopPropagation();");
  1368. $(".ol-table-pitch-box-defender3 .player-quick-overview-launcher").next().remove();
  1369. if(defenderList[1].clubLogo.substring(0, 4)=="icon"){
  1370. $(".ol-table-pitch-box-defender3 .ol-table-pitch-logo .user-badge").empty();
  1371. let spanClass = $(".ol-table-pitch-box-defender3 .ol-table-pitch-logo .user-badge").attr("class");
  1372. spanClass = spanClass.split(" ");
  1373. $(".ol-table-pitch-box-defender3 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1374. $(".ol-table-pitch-box-defender3 .ol-table-pitch-logo .user-badge").addClass(defenderList[1].clubLogo);
  1375. }
  1376. else{
  1377. $(".ol-table-pitch-box-defender3 .ol-table-pitch-logo .user-badge").empty();
  1378. $(".ol-table-pitch-box-defender3 .ol-table-pitch-logo .user-badge").empty();
  1379. let spanClass = $(".ol-table-pitch-box-defender3 .ol-table-pitch-logo .user-badge").attr("class");
  1380. spanClass = spanClass.split(" ");
  1381. $(".ol-table-pitch-box-defender3 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1382. $(".ol-table-pitch-box-defender3 .ol-table-pitch-logo .user-badge").addClass("icon-badge-custom-min");
  1383. $(".ol-table-pitch-box-defender3 .ol-table-pitch-logo .user-badge").append("<span style=\"margin-left: -0px; margin-top: -0px;\"><img style=\"transform: scale(1);\" src=\""+defenderList[1].clubLogo+"\" width=\"30px\" height=\"30px\"></span>");
  1384. }
  1385. if($(".ol-table-pitch-box-defender3 .ol-team-name").length>=1){
  1386. $(".ol-table-pitch-box-defender3 .ol-team-name").text(defenderList[1].clubName);
  1387. }
  1388. else if($(".ol-table-pitch-box-defender3 .ol-team-name-inactive").length>=1){
  1389. $(".ol-table-pitch-box-defender3 .ol-team-name-inactive").removeClass("ol-team-name-inactive").addClass("ol-team-name");
  1390. $(".ol-table-pitch-box-defender3 .ol-team-name").text(defenderList[1].clubName);
  1391. }
  1392. $(".ol-table-pitch-box-defender3 .ol-team-name").attr("onclick","olAnchorNavigation.load('https://www.onlineliga.de/team/overview', { userId : "+defenderList[1].clubId+" });");
  1393. $(".ol-table-pitch-box-defender3 .ol-table-pitch-player-name").after("<div class=\"ol-table-pitch-average-grade\">&Oslash; "+defenderList[1].averageGrade.toFixed(2).toString().replace('.', ',')+"</div>");
  1394.  
  1395. // Verteidiger 4
  1396. $(".ol-table-pitch-box-defender4 .ol-player-name").text(defenderList[3].name+" ("+defenderList[3].count+")");
  1397. $(".ol-table-pitch-box-defender4 .ol-player-name").attr("onclick","olAnchorNavigation.load('player/overview', { playerId: "+defenderList[3].playerId+" });");
  1398. $(".ol-table-pitch-box-defender4 .player-quick-overview-launcher").attr("onclick","olOverlayWindow.load('/player/quickoverview', { 'playerId': "+defenderList[3].playerId+" }); event.stopPropagation();");
  1399. $(".ol-table-pitch-box-defender4 .player-quick-overview-launcher").next().remove();
  1400. if(defenderList[3].clubLogo.substring(0, 4)=="icon"){
  1401. $(".ol-table-pitch-box-defender4 .ol-table-pitch-logo .user-badge").empty();
  1402. let spanClass = $(".ol-table-pitch-box-defender4 .ol-table-pitch-logo .user-badge").attr("class");
  1403. spanClass = spanClass.split(" ");
  1404. $(".ol-table-pitch-box-defender4 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1405. $(".ol-table-pitch-box-defender4 .ol-table-pitch-logo .user-badge").addClass(defenderList[3].clubLogo);
  1406. }
  1407. else{
  1408. $(".ol-table-pitch-box-defender4 .ol-table-pitch-logo .user-badge").empty();
  1409. $(".ol-table-pitch-box-defender4 .ol-table-pitch-logo .user-badge").empty();
  1410. let spanClass = $(".ol-table-pitch-box-defender4 .ol-table-pitch-logo .user-badge").attr("class");
  1411. spanClass = spanClass.split(" ");
  1412. $(".ol-table-pitch-box-defender4 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1413. $(".ol-table-pitch-box-defender4 .ol-table-pitch-logo .user-badge").addClass("icon-badge-custom-min");
  1414. $(".ol-table-pitch-box-defender4 .ol-table-pitch-logo .user-badge").append("<span style=\"margin-left: -0px; margin-top: -0px;\"><img style=\"transform: scale(1);\" src=\""+defenderList[3].clubLogo+"\" width=\"30px\" height=\"30px\"></span>");
  1415. }
  1416. if($(".ol-table-pitch-box-defender4 .ol-team-name").length>=1){
  1417. $(".ol-table-pitch-box-defender4 .ol-team-name").text(defenderList[3].clubName);
  1418. }
  1419. else if($(".ol-table-pitch-box-defender4 .ol-team-name-inactive").length>=1){
  1420. $(".ol-table-pitch-box-defender4 .ol-team-name-inactive").removeClass("ol-team-name-inactive").addClass("ol-team-name");
  1421. $(".ol-table-pitch-box-defender4 .ol-team-name").text(defenderList[3].clubName);
  1422. }
  1423. $(".ol-table-pitch-box-defender4 .ol-team-name").attr("onclick","olAnchorNavigation.load('https://www.onlineliga.de/team/overview', { userId : "+defenderList[3].clubId+" });");
  1424. $(".ol-table-pitch-box-defender4 .ol-table-pitch-player-name").after("<div class=\"ol-table-pitch-average-grade\">&Oslash; "+defenderList[3].averageGrade.toFixed(2).toString().replace('.', ',')+"</div>");
  1425.  
  1426. let midfielderList = countNominations(midfielderIds);
  1427. midfielderList = sortNominationsFirst(midfielderList);
  1428. midfielderList = cutNominationListFirst(midfielderList, 3);
  1429. midfielderList = getAverageGradesForElevenOfTheYear(midfielderList, 3, season);
  1430. midfielderList = sortNominationsSecond(midfielderList);
  1431. midfielderList = cutNominationListSecond(midfielderList, 3);
  1432. midfielderList = getNameForElevenOfTheYear(midfielderList);
  1433.  
  1434. // Mittelfeld 1
  1435. $(".ol-table-pitch-box-midfield1 .ol-player-name").text(midfielderList[1].name+" ("+midfielderList[1].count+")");
  1436. $(".ol-table-pitch-box-midfield1 .ol-player-name").attr("onclick","olAnchorNavigation.load('player/overview', { playerId: "+midfielderList[1].playerId+" });");
  1437. $(".ol-table-pitch-box-midfield1 .player-quick-overview-launcher").attr("onclick","olOverlayWindow.load('/player/quickoverview', { 'playerId': "+midfielderList[1].playerId+" }); event.stopPropagation();");
  1438. $(".ol-table-pitch-box-midfield1 .player-quick-overview-launcher").next().remove();
  1439. if(midfielderList[1].clubLogo.substring(0, 4)=="icon"){
  1440. $(".ol-table-pitch-box-midfield1 .ol-table-pitch-logo .user-badge").empty();
  1441. let spanClass = $(".ol-table-pitch-box-midfield1 .ol-table-pitch-logo .user-badge").attr("class");
  1442. spanClass = spanClass.split(" ");
  1443. $(".ol-table-pitch-box-midfield1 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1444. $(".ol-table-pitch-box-midfield1 .ol-table-pitch-logo .user-badge").addClass(midfielderList[1].clubLogo);
  1445. }
  1446. else{
  1447. $(".ol-table-pitch-box-midfield1 .ol-table-pitch-logo .user-badge").empty();
  1448. $(".ol-table-pitch-box-midfield1 .ol-table-pitch-logo .user-badge").empty();
  1449. let spanClass = $(".ol-table-pitch-box-midfield1 .ol-table-pitch-logo .user-badge").attr("class");
  1450. spanClass = spanClass.split(" ");
  1451. $(".ol-table-pitch-box-midfield1 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1452. $(".ol-table-pitch-box-midfield1 .ol-table-pitch-logo .user-badge").addClass("icon-badge-custom-min");
  1453. $(".ol-table-pitch-box-midfield1 .ol-table-pitch-logo .user-badge").append("<span style=\"margin-left: -0px; margin-top: -0px;\"><img style=\"transform: scale(1);\" src=\""+midfielderList[1].clubLogo+"\" width=\"30px\" height=\"30px\"></span>");
  1454. }
  1455. if($(".ol-table-pitch-box-midfield1 .ol-team-name").length>=1){
  1456. $(".ol-table-pitch-box-midfield1 .ol-team-name").text(midfielderList[1].clubName);
  1457. }
  1458. else if($(".ol-table-pitch-box-midfield1 .ol-team-name-inactive").length>=1){
  1459. $(".ol-table-pitch-box-midfield1 .ol-team-name-inactive").removeClass("ol-team-name-inactive").addClass("ol-team-name");
  1460. $(".ol-table-pitch-box-midfield1 .ol-team-name").text(midfielderList[1].clubName);
  1461. }
  1462. $(".ol-table-pitch-box-midfield1 .ol-team-name").attr("onclick","olAnchorNavigation.load('https://www.onlineliga.de/team/overview', { userId : "+midfielderList[1].clubId+" });");
  1463. $(".ol-table-pitch-box-midfield1 .ol-table-pitch-player-name").after("<div class=\"ol-table-pitch-average-grade\">&Oslash; "+midfielderList[1].averageGrade.toFixed(2).toString().replace('.', ',')+"</div>");
  1464.  
  1465. // Mittelfeld 2
  1466. $(".ol-table-pitch-box-midfield2 .ol-player-name").text(midfielderList[0].name+" ("+midfielderList[0].count+")");
  1467. $(".ol-table-pitch-box-midfield2 .ol-player-name").attr("onclick","olAnchorNavigation.load('player/overview', { playerId: "+midfielderList[0].playerId+" });");
  1468. $(".ol-table-pitch-box-midfield2 .player-quick-overview-launcher").attr("onclick","olOverlayWindow.load('/player/quickoverview', { 'playerId': "+midfielderList[0].playerId+" }); event.stopPropagation();");
  1469. $(".ol-table-pitch-box-midfield2 .player-quick-overview-launcher").next().remove();
  1470. if(midfielderList[0].clubLogo.substring(0, 4)=="icon"){
  1471. $(".ol-table-pitch-box-midfield2 .ol-table-pitch-logo .user-badge").empty();
  1472. let spanClass = $(".ol-table-pitch-box-midfield2 .ol-table-pitch-logo .user-badge").attr("class");
  1473. spanClass = spanClass.split(" ");
  1474. $(".ol-table-pitch-box-midfield2 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1475. $(".ol-table-pitch-box-midfield2 .ol-table-pitch-logo .user-badge").addClass(midfielderList[0].clubLogo);
  1476. }
  1477. else{
  1478. $(".ol-table-pitch-box-midfield2 .ol-table-pitch-logo .user-badge").empty();
  1479. $(".ol-table-pitch-box-midfield2 .ol-table-pitch-logo .user-badge").empty();
  1480. let spanClass = $(".ol-table-pitch-box-midfield2 .ol-table-pitch-logo .user-badge").attr("class");
  1481. spanClass = spanClass.split(" ");
  1482. $(".ol-table-pitch-box-midfield2 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1483. $(".ol-table-pitch-box-midfield2 .ol-table-pitch-logo .user-badge").addClass("icon-badge-custom-min");
  1484. $(".ol-table-pitch-box-midfield2 .ol-table-pitch-logo .user-badge").append("<span style=\"margin-left: -0px; margin-top: -0px;\"><img style=\"transform: scale(1);\" src=\""+midfielderList[0].clubLogo+"\" width=\"30px\" height=\"30px\"></span>");
  1485. }
  1486. if($(".ol-table-pitch-box-midfield2 .ol-team-name").length>=1){
  1487. $(".ol-table-pitch-box-midfield2 .ol-team-name").text(midfielderList[0].clubName);
  1488. }
  1489. else if($(".ol-table-pitch-box-midfield2 .ol-team-name-inactive").length>=1){
  1490. $(".ol-table-pitch-box-midfield2 .ol-team-name-inactive").removeClass("ol-team-name-inactive").addClass("ol-team-name");
  1491. $(".ol-table-pitch-box-midfield2 .ol-team-name").text(midfielderList[0].clubName);
  1492. }
  1493. $(".ol-table-pitch-box-midfield2 .ol-team-name").attr("onclick","olAnchorNavigation.load('https://www.onlineliga.de/team/overview', { userId : "+midfielderList[0].clubId+" });");
  1494. $(".ol-table-pitch-box-midfield2 .ol-table-pitch-player-name").after("<div class=\"ol-table-pitch-average-grade\">&Oslash; "+midfielderList[0].averageGrade.toFixed(2).toString().replace('.', ',')+"</div>");
  1495.  
  1496. // Mittelfeld 3
  1497. $(".ol-table-pitch-box-midfield3 .ol-player-name").text(midfielderList[2].name+" ("+midfielderList[2].count+")");
  1498. $(".ol-table-pitch-box-midfield3 .ol-player-name").attr("onclick","olAnchorNavigation.load('player/overview', { playerId: "+midfielderList[2].playerId+" });");
  1499. $(".ol-table-pitch-box-midfield3 .player-quick-overview-launcher").attr("onclick","olOverlayWindow.load('/player/quickoverview', { 'playerId': "+midfielderList[2].playerId+" }); event.stopPropagation();");
  1500. $(".ol-table-pitch-box-midfield3 .player-quick-overview-launcher").next().remove();
  1501. if(midfielderList[2].clubLogo.substring(0, 4)=="icon"){
  1502. $(".ol-table-pitch-box-midfield3 .ol-table-pitch-logo .user-badge").empty();
  1503. let spanClass = $(".ol-table-pitch-box-midfield3 .ol-table-pitch-logo .user-badge").attr("class");
  1504. spanClass = spanClass.split(" ");
  1505. $(".ol-table-pitch-box-midfield3 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1506. $(".ol-table-pitch-box-midfield3 .ol-table-pitch-logo .user-badge").addClass(midfielderList[2].clubLogo);
  1507. }
  1508. else{
  1509. $(".ol-table-pitch-box-midfield3 .ol-table-pitch-logo .user-badge").empty();
  1510. $(".ol-table-pitch-box-midfield3 .ol-table-pitch-logo .user-badge").empty();
  1511. let spanClass = $(".ol-table-pitch-box-midfield3 .ol-table-pitch-logo .user-badge").attr("class");
  1512. spanClass = spanClass.split(" ");
  1513. $(".ol-table-pitch-box-midfield3 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1514. $(".ol-table-pitch-box-midfield3 .ol-table-pitch-logo .user-badge").addClass("icon-badge-custom-min");
  1515. $(".ol-table-pitch-box-midfield3 .ol-table-pitch-logo .user-badge").append("<span style=\"margin-left: -0px; margin-top: -0px;\"><img style=\"transform: scale(1);\" src=\""+midfielderList[2].clubLogo+"\" width=\"30px\" height=\"30px\"></span>");
  1516. }
  1517. if($(".ol-table-pitch-box-midfield3 .ol-team-name").length>=1){
  1518. $(".ol-table-pitch-box-midfield3 .ol-team-name").text(midfielderList[2].clubName);
  1519. }
  1520. else if($(".ol-table-pitch-box-midfield3 .ol-team-name-inactive").length>=1){
  1521. $(".ol-table-pitch-box-midfield3 .ol-team-name-inactive").removeClass("ol-team-name-inactive").addClass("ol-team-name");
  1522. $(".ol-table-pitch-box-midfield3 .ol-team-name").text(midfielderList[2].clubName);
  1523. }
  1524. $(".ol-table-pitch-box-midfield3 .ol-team-name").attr("onclick","olAnchorNavigation.load('https://www.onlineliga.de/team/overview', { userId : "+midfielderList[2].clubId+" });");
  1525. $(".ol-table-pitch-box-midfield3 .ol-table-pitch-player-name").after("<div class=\"ol-table-pitch-average-grade\">&Oslash; "+midfielderList[2].averageGrade.toFixed(2).toString().replace('.', ',')+"</div>");
  1526.  
  1527. let strikerList = countNominations(strikerIds);
  1528. strikerList = sortNominationsFirst(strikerList);
  1529. strikerList = cutNominationListFirst(strikerList, 3);
  1530. strikerList = getAverageGradesForElevenOfTheYear(strikerList, 3, season);
  1531. strikerList = sortNominationsSecond(strikerList);
  1532. strikerList = cutNominationListSecond(strikerList, 3);
  1533. strikerList = getNameForElevenOfTheYear(strikerList);
  1534.  
  1535. // Angriff 1
  1536. $(".ol-table-pitch-box-striker1 .ol-player-name").text(strikerList[1].name+" ("+strikerList[1].count+")");
  1537. $(".ol-table-pitch-box-striker1 .ol-player-name").attr("onclick","olAnchorNavigation.load('player/overview', { playerId: "+strikerList[1].playerId+" });");
  1538. $(".ol-table-pitch-box-striker1 .player-quick-overview-launcher").attr("onclick","olOverlayWindow.load('/player/quickoverview', { 'playerId': "+strikerList[1].playerId+" }); event.stopPropagation();");
  1539. $(".ol-table-pitch-box-striker1 .player-quick-overview-launcher").next().remove();
  1540. if(strikerList[1].clubLogo.substring(0, 4)=="icon"){
  1541. $(".ol-table-pitch-box-striker1 .ol-table-pitch-logo .user-badge").empty();
  1542. let spanClass = $(".ol-table-pitch-box-striker1 .ol-table-pitch-logo .user-badge").attr("class");
  1543. spanClass = spanClass.split(" ");
  1544. $(".ol-table-pitch-box-striker1 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1545. $(".ol-table-pitch-box-striker1 .ol-table-pitch-logo .user-badge").addClass(strikerList[1].clubLogo);
  1546. }
  1547. else{
  1548. $(".ol-table-pitch-box-striker1 .ol-table-pitch-logo .user-badge").empty();
  1549. $(".ol-table-pitch-box-striker1 .ol-table-pitch-logo .user-badge").empty();
  1550. let spanClass = $(".ol-table-pitch-box-striker1 .ol-table-pitch-logo .user-badge").attr("class");
  1551. spanClass = spanClass.split(" ");
  1552. $(".ol-table-pitch-box-striker1 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1553. $(".ol-table-pitch-box-striker1 .ol-table-pitch-logo .user-badge").addClass("icon-badge-custom-min");
  1554. $(".ol-table-pitch-box-striker1 .ol-table-pitch-logo .user-badge").append("<span style=\"margin-left: -0px; margin-top: -0px;\"><img style=\"transform: scale(1);\" src=\""+strikerList[1].clubLogo+"\" width=\"30px\" height=\"30px\"></span>");
  1555. }
  1556. if($(".ol-table-pitch-box-striker1 .ol-team-name").length>=1){
  1557. $(".ol-table-pitch-box-striker1 .ol-team-name").text(strikerList[1].clubName);
  1558. }
  1559. else if($(".ol-table-pitch-box-striker1 .ol-team-name-inactive").length>=1){
  1560. $(".ol-table-pitch-box-striker1 .ol-team-name-inactive").removeClass("ol-team-name-inactive").addClass("ol-team-name");
  1561. $(".ol-table-pitch-box-striker1 .ol-team-name").text(strikerList[1].clubName);
  1562. }
  1563. $(".ol-table-pitch-box-striker1 .ol-team-name").attr("onclick","olAnchorNavigation.load('https://www.onlineliga.de/team/overview', { userId : "+strikerList[1].clubId+" });");
  1564. $(".ol-table-pitch-box-striker1 .ol-table-pitch-player-name").after("<div class=\"ol-table-pitch-average-grade\">&Oslash; "+strikerList[1].averageGrade.toFixed(2).toString().replace('.', ',')+"</div>");
  1565.  
  1566. // Angriff 2
  1567. $(".ol-table-pitch-box-striker2 .ol-player-name").text(strikerList[0].name+" ("+strikerList[0].count+")");
  1568. $(".ol-table-pitch-box-striker2 .ol-player-name").attr("onclick","olAnchorNavigation.load('player/overview', { playerId: "+strikerList[0].playerId+" });");
  1569. $(".ol-table-pitch-box-striker2 .player-quick-overview-launcher").attr("onclick","olOverlayWindow.load('/player/quickoverview', { 'playerId': "+strikerList[0].playerId+" }); event.stopPropagation();");
  1570. $(".ol-table-pitch-box-striker2 .player-quick-overview-launcher").next().remove();
  1571. if(strikerList[0].clubLogo.substring(0, 4)=="icon"){
  1572. $(".ol-table-pitch-box-striker2 .ol-table-pitch-logo .user-badge").empty();
  1573. let spanClass = $(".ol-table-pitch-box-striker2 .ol-table-pitch-logo .user-badge").attr("class");
  1574. spanClass = spanClass.split(" ");
  1575. $(".ol-table-pitch-box-striker2 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1576. $(".ol-table-pitch-box-striker2 .ol-table-pitch-logo .user-badge").addClass(strikerList[0].clubLogo);
  1577. }
  1578. else{
  1579. $(".ol-table-pitch-box-striker2 .ol-table-pitch-logo .user-badge").empty();
  1580. $(".ol-table-pitch-box-striker2 .ol-table-pitch-logo .user-badge").empty();
  1581. let spanClass = $(".ol-table-pitch-box-striker2 .ol-table-pitch-logo .user-badge").attr("class");
  1582. spanClass = spanClass.split(" ");
  1583. $(".ol-table-pitch-box-striker2 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1584. $(".ol-table-pitch-box-striker2 .ol-table-pitch-logo .user-badge").addClass("icon-badge-custom-min");
  1585. $(".ol-table-pitch-box-striker2 .ol-table-pitch-logo .user-badge").append("<span style=\"margin-left: -0px; margin-top: -0px;\"><img style=\"transform: scale(1);\" src=\""+strikerList[0].clubLogo+"\" width=\"30px\" height=\"30px\"></span>");
  1586. }
  1587. if($(".ol-table-pitch-box-striker2 .ol-team-name").length>=1){
  1588. $(".ol-table-pitch-box-striker2 .ol-team-name").text(strikerList[0].clubName);
  1589. }
  1590. else if($(".ol-table-pitch-box-striker2 .ol-team-name-inactive").length>=1){
  1591. $(".ol-table-pitch-box-striker2 .ol-team-name-inactive").removeClass("ol-team-name-inactive").addClass("ol-team-name");
  1592. $(".ol-table-pitch-box-striker2 .ol-team-name").text(strikerList[0].clubName);
  1593. }
  1594. $(".ol-table-pitch-box-striker2 .ol-team-name").attr("onclick","olAnchorNavigation.load('https://www.onlineliga.de/team/overview', { userId : "+strikerList[0].clubId+" });");
  1595. $(".ol-table-pitch-box-striker2 .ol-table-pitch-player-name").after("<div class=\"ol-table-pitch-average-grade\">&Oslash; "+strikerList[0].averageGrade.toFixed(2).toString().replace('.', ',')+"</div>");
  1596.  
  1597. // Angriff 3
  1598. $(".ol-table-pitch-box-striker3 .ol-player-name").text(strikerList[2].name+" ("+strikerList[2].count+")");
  1599. $(".ol-table-pitch-box-striker3 .ol-player-name").attr("onclick","olAnchorNavigation.load('player/overview', { playerId: "+strikerList[2].playerId+" });");
  1600. $(".ol-table-pitch-box-striker3 .player-quick-overview-launcher").attr("onclick","olOverlayWindow.load('/player/quickoverview', { 'playerId': "+strikerList[2].playerId+" }); event.stopPropagation();");
  1601. $(".ol-table-pitch-box-striker3 .player-quick-overview-launcher").next().remove();
  1602. if(strikerList[2].clubLogo.substring(0, 4)=="icon"){
  1603. $(".ol-table-pitch-box-striker3 .ol-table-pitch-logo .user-badge").empty();
  1604. let spanClass = $(".ol-table-pitch-box-striker3 .ol-table-pitch-logo .user-badge").attr("class");
  1605. spanClass = spanClass.split(" ");
  1606. $(".ol-table-pitch-box-striker3 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1607. $(".ol-table-pitch-box-striker3 .ol-table-pitch-logo .user-badge").addClass(strikerList[2].clubLogo);
  1608. }
  1609. else{
  1610. $(".ol-table-pitch-box-striker3 .ol-table-pitch-logo .user-badge").empty();
  1611. $(".ol-table-pitch-box-striker3 .ol-table-pitch-logo .user-badge").empty();
  1612. let spanClass = $(".ol-table-pitch-box-striker3 .ol-table-pitch-logo .user-badge").attr("class");
  1613. spanClass = spanClass.split(" ");
  1614. $(".ol-table-pitch-box-striker3 .ol-table-pitch-logo .user-badge").removeClass(spanClass[1]);
  1615. $(".ol-table-pitch-box-striker3 .ol-table-pitch-logo .user-badge").addClass("icon-badge-custom-min");
  1616. $(".ol-table-pitch-box-striker3 .ol-table-pitch-logo .user-badge").append("<span style=\"margin-left: -0px; margin-top: -0px;\"><img style=\"transform: scale(1);\" src=\""+strikerList[2].clubLogo+"\" width=\"30px\" height=\"30px\"></span>");
  1617. }
  1618. if($(".ol-table-pitch-box-striker3 .ol-team-name").length>=1){
  1619. $(".ol-table-pitch-box-striker3 .ol-team-name").text(strikerList[2].clubName);
  1620. }
  1621. else if($(".ol-table-pitch-box-striker3 .ol-team-name-inactive").length>=1){
  1622. $(".ol-table-pitch-box-striker3 .ol-team-name-inactive").removeClass("ol-team-name-inactive").addClass("ol-team-name");
  1623. $(".ol-table-pitch-box-striker3 .ol-team-name").text(strikerList[2].clubName);
  1624. }
  1625. $(".ol-table-pitch-box-striker3 .ol-team-name").attr("onclick","olAnchorNavigation.load('https://www.onlineliga.de/team/overview', { userId : "+strikerList[2].clubId+" });");
  1626. $(".ol-table-pitch-box-striker3 .ol-table-pitch-player-name").after("<div class=\"ol-table-pitch-average-grade\">&Oslash; "+strikerList[2].averageGrade.toFixed(2).toString().replace('.', ',')+"</div>");
  1627.  
  1628. $(".ol-table-pitch-average-grade").css("margin", "-7px 0px");
  1629. $(".ol-table-pitch-font").css("font-size", "12pt");
  1630. $(".ol-eleven-of-the-day-pitch-wrapper").css("font-size", "12pt");
  1631. }
  1632.  
  1633. function countNominations(playerIds){
  1634. let nominationOfPlayers = {};
  1635. $.each(playerIds, function(index, playerId){
  1636. if (nominationOfPlayers[playerId]){
  1637. nominationOfPlayers[playerId]++;
  1638. }
  1639. else{
  1640. nominationOfPlayers[playerId] = 1;
  1641. }
  1642. })
  1643. return nominationOfPlayers;
  1644. }
  1645.  
  1646. function sortNominationsFirst(playerList){
  1647. let sortPlayers = [];
  1648. $.each(playerList, function(playerId, count) {
  1649. sortPlayers.push({ playerId: playerId, count: count });
  1650. });
  1651. sortPlayers.sort(function(a, b){
  1652. return b.count - a.count;
  1653. });
  1654. return sortPlayers;
  1655. }
  1656.  
  1657. function sortNominationsSecond(playerList){
  1658. playerList.sort((a, b) => {
  1659. if (a.count === b.count) {
  1660. return a.averageGrade - b.averageGrade;
  1661. } else {
  1662. return b.count - a.count;
  1663. }
  1664. });
  1665. return playerList;
  1666. }
  1667.  
  1668. function cutNominationListFirst(playerList, numberOfNominations){
  1669. let numberOfCandidates = 0;
  1670. for(i=0;i<playerList.length;i++){
  1671. if(playerList[i].count>=playerList[numberOfNominations-1].count){
  1672. numberOfCandidates++;
  1673. }
  1674. }
  1675. playerList = playerList.slice(0, numberOfCandidates);
  1676. return playerList;
  1677. }
  1678.  
  1679. function cutNominationListSecond(playerList, numberOfNominations){
  1680. playerList = playerList.slice(0, numberOfNominations);
  1681. return playerList;
  1682. }
  1683.  
  1684. function getAverageGradesForElevenOfTheYear(playerList, numberOfNominations, season){
  1685. for(i=0;i<playerList.length;i++){
  1686. let link = "/player/performancedata?playerId="+playerList[i].playerId;
  1687. let playerHistoryData = $.ajax({type: "GET", url: link, async: false}).responseText;
  1688. let numberOfStations = parseInt($("<div>" + playerHistoryData + "</div>").find(".col-lg-3.col-md-3.col-sm-3.col-xs-2.text-center span.hidden-sm.hidden-md.hidden-lg").length);
  1689. let countVariable = 0;
  1690. for(j=0;j<numberOfStations;j++){
  1691. if(parseInt($("<div>" + playerHistoryData + "</div>").find(".col-lg-3.col-md-3.col-sm-3.col-xs-2.text-center span.hidden-sm.hidden-md.hidden-lg").eq(j).text())==season){
  1692. countVariable = j;
  1693. }
  1694. }
  1695. let clubId;
  1696. clubId = parseInt($("<div>" + playerHistoryData + "</div>").find(".player-overview-teamname-wrapper.text-overflow .ol-team-name-color-light").eq(countVariable).attr("onclick").match(/\d+/)[0]);
  1697. playerList[i].clubId = clubId;
  1698. let clubName = $("<div>" + playerHistoryData + "</div>").find(".player-overview-teamname-wrapper.text-overflow .ol-team-name-color-light").eq(countVariable).text().trim();
  1699. playerList[i].clubName = clubName;
  1700. let clubLogo = $("<div>" + playerHistoryData + "</div>").find(".player-overview-teamname-wrapper.text-overflow").eq(countVariable).prev().find(".user-badge img").attr("src");
  1701. if(typeof clubLogo === "undefined"){
  1702. let spanClass = $("<div>" + playerHistoryData + "</div>").find(".player-overview-teamname-wrapper.text-overflow").eq(countVariable).prev().find("span.user-badge").attr("class");
  1703. spanClass = spanClass.split(" ");
  1704. clubLogo = spanClass[1];
  1705. }
  1706. playerList[i].clubLogo = clubLogo;
  1707. link = "/player/performancedata/season?playerId="+playerList[i].playerId+"&season="+season+"&userId="+clubId;
  1708. let playerSeasonData = $.ajax({type: "GET", url: link, async: false}).responseText;
  1709. let numberOfLeagueData = parseInt($("<div>" + playerSeasonData + "</div>").find(".row.player-overview-performance-table.player-overview-performance-table-grid-row.collapse-row.ol-league").length);
  1710. let averageGrade = 0;
  1711. let gamesWithoutGrade = 0;
  1712. for(j=0;j<numberOfLeagueData;j++){
  1713. let helpVariable = $("<div>" + playerSeasonData + "</div>").find(".player-overview-performance-table.ol-league .player-performance-rating").eq(j)[0];
  1714. if ($(helpVariable).text().trim()=="-"){
  1715. gamesWithoutGrade += 1;
  1716. }
  1717. else{
  1718. averageGrade += parseFloat($(helpVariable).text().trim());
  1719. }
  1720. }
  1721. averageGrade = averageGrade/(numberOfLeagueData-gamesWithoutGrade);
  1722. playerList[i].averageGrade = averageGrade;
  1723. }
  1724. return playerList;
  1725. }
  1726.  
  1727. function getNameForElevenOfTheYear(playerList){
  1728. for(i=0;i<playerList.length;i++) {
  1729. let link = "/player/overview?playerId="+playerList[i].playerId;
  1730. let playerOverview = $.ajax({type: "GET", url: link, async: false}).responseText;
  1731. playerList[i].name = $("<div>" + playerOverview + "</div>").find(".col-md-8.col-lg-8.col-sm-12.col-xs-7").eq(0).text().trim();
  1732. }
  1733. return playerList;
  1734. }
  1735.  
  1736. function createDivForLeagueView(nameOfDiv, marginBottom){
  1737. return "<div id=\""+nameOfDiv+"\" style=\"margin-bottom:"+marginBottom+";\"></div>";
  1738. }
  1739.  
  1740. function createDivForMessengerResults(){
  1741. $("#messagesystem-search").after(
  1742. "<div id=\"messagesystem-results\">"+
  1743. "<span>Ergebnisse der Chatpartner anzeigen? </span>"+
  1744. "<select id=\"messagesystem-results-select\">"+
  1745. "<option value=\"0\">0</option>"+
  1746. "<option value=\"5\">5</option>"+
  1747. "<option value=\"10\">10</option>"+
  1748. "<option value=\"15\">15</option>"+
  1749. "<option value=\"20\">20</option>"+
  1750. "</select>"+
  1751. "</div>"
  1752. );
  1753. $("#messagesystem-results").attr("style", "padding:4px 0px 4px 0px;text-align:center;");
  1754. $("#messagesystem-results-select").attr("style", "width:38px;");
  1755. }
  1756.  
  1757. function createDivForPlayerProgress(){
  1758. $(".ol-training-playerdetails-header-sticky .ol-training-playerdetails-header").after(
  1759. "<div class=\"ol-training-playerdetails-progress-question\">"+
  1760. "<span>Fortschritt bis Alter 30 anzeigen? </span>"+
  1761. "<select class=\"ol-training-playerdetails-progress-question-select\">"+
  1762. "<option value=\"0\">0</option>"+
  1763. "<option value=\"5\">5</option>"+
  1764. "<option value=\"10\">10</option>"+
  1765. "<option value=\"15\">15</option>"+
  1766. "<option value=\"20\">20</option>"+
  1767. "</select>"+
  1768. "</div>"
  1769. );
  1770. $("#messagesystem-results").attr("style", "padding:4px 0px 4px 0px;text-align:center;");
  1771. $("#messagesystem-results-select").attr("style", "width:38px;");
  1772. }
  1773.  
  1774. function createInjuryResults(){
  1775. let numberOfPlayers = $(".ol-player-name").length;
  1776. let player = [];
  1777. for(i=0;i<numberOfPlayers;i++){
  1778. player[i] = new Player();
  1779. player[i].ID = parseInt($(".ol-player-name").eq(i).attr("onclick").match(/[0-9]+/g));
  1780. getPlayerInjuryData(player[i]);
  1781. $(".lblLineUpEditorCheckbox.ol-lineup-editor-checkbox").eq(i).after(
  1782. "<span class=\"ol-player-injury\" style=\"display:inline-block;font-size:15px;padding-right:5px;vertical-align:top;width:65px;\">"+
  1783. "<span class=\"ol-player-injury-number\" style=\"display:inline-block;padding-right:5px;text-align:right;\">"+player[i].numberOfInjuries+"</span>"+
  1784. "<span class=\"ol-player-injury-duration\" style=\"display:inline-block;padding-right:5px;text-align:right;\">"+player[i].lengthOfAllInjuries+"</span>"+
  1785. "<span class=\"ol-player-injury-average\" style=\"display:inline-block;padding-right:5px;text-align:right;\">"+player[i].averageLengthOfAllInjuries+"</span>"+
  1786. "</span>"
  1787. );
  1788. if(parseFloat((player[i].averageLengthOfAllInjuries).replace(/,/g, '.')) == 0){
  1789. $(".ol-player-name").eq(i).css("color", "#A9D08E");
  1790. }
  1791. else if(parseFloat((player[i].averageLengthOfAllInjuries).replace(/,/g, '.')) > 0.0 && parseFloat((player[i].averageLengthOfAllInjuries).replace(/,/g, '.')) <= 1.0){
  1792. $(".ol-player-name").eq(i).css("color", "#FFD966");
  1793. }
  1794. else if(parseFloat((player[i].averageLengthOfAllInjuries).replace(/,/g, '.')) > 1.0 && parseFloat((player[i].averageLengthOfAllInjuries).replace(/,/g, '.')) <= 2.0){
  1795. $(".ol-player-name").eq(i).css("color", "#FF5733");
  1796. }
  1797. else{
  1798. $(".ol-player-name").eq(i).css("color", "#C70039");
  1799. }
  1800. }
  1801. }
  1802.  
  1803. function createMessengerResults(){
  1804. let numberOfChatTeams = parseInt($("#messagesystem-results-select").val());
  1805. let teamInformations = new Array(numberOfChatTeams);
  1806. for(i=0;i<numberOfChatTeams;i++){
  1807. teamInformations[i] = new Team;
  1808. teamInformations[i].ID = parseInt(($(".messagesystem-userlist-button").eq(i+1).attr("onclick").match(/[0-9]+/g))[0]);
  1809. getLastGameResult(teamInformations[i]);
  1810. $(".ol-user-name.messagesystem-userlist-item").eq(i+1).after(
  1811. "<span class=\"ol-user-name-result\" style=\"background:"+teamInformations[i].lastGameResultBackgroundColor+";color:#404040;font-weight:bold;margin-left:4px;padding-left:4px;padding-right:4px;position:relative;top:22%;\">"+teamInformations[i].lastGameResultHomeGoals+":"+teamInformations[i].lastGameResultAwayGoals+"</span>"
  1812. );
  1813. }
  1814. $("#messagesystem-results-loading").remove();
  1815. }
  1816.  
  1817. function createSpanWidthQuestion(fatherDiv, question){
  1818. $("#"+fatherDiv).append(
  1819. "<span class=\""+fatherDiv+"-logo\"><a href=\"/team/overview?userId=32830\" target=\"_blank\"><img src=\"https://onlineliga.s3.eu-central-1.amazonaws.com/userimages/32830-5f7ec70c87047.png\" width=\"12\" height=\"12\" style=\"margin-right:2px;vertical-align:unset;\"></a></span>"+
  1820. "<span class=\""+fatherDiv+"-question-text\">"+question+"</span>"+
  1821. "<span class=\""+fatherDiv+"-answer\">"+
  1822. "<label class=\""+fatherDiv+"-answer-text\" style=\"margin: 0px 5px 0px 10px; font-weight: normal;\">ja</label>"+
  1823. "<input type=\"checkbox\" id=\""+fatherDiv+"-answer-checkbox\">"+
  1824. "</span>"
  1825. );
  1826. }
  1827.  
  1828. function createDivWidthQuestion(fatherDiv, divName, question){
  1829. $(fatherDiv).after(
  1830. "<div class=\""+divName+"-question\">"+
  1831. "<span class=\""+divName+"-logo\"><a href=\"/team/overview?userId=32830\" target=\"_blank\"><img src=\"https://onlineliga.s3.eu-central-1.amazonaws.com/userimages/32830-5f7ec70c87047.png\" width=\"12\" height=\"12\" style=\"margin-right:2px;vertical-align:unset;\"></a></span>"+
  1832. "<span class=\""+divName+"-question-text\">"+question+"</span>"+
  1833. "<span class=\""+divName+"-answer\">"+
  1834. "<label class=\""+divName+"-answer-text\" style=\"margin: 0px 5px 0px 10px; font-weight: normal;\">ja</label>"+
  1835. "<input type=\"checkbox\" id=\""+divName+"-answer-checkbox\">"+
  1836. "</span>"+
  1837. "</div>"
  1838. );
  1839. }
  1840.  
  1841. function createCounterDiv(fatherDiv, messageText, counterEnd){
  1842. counterNumber++;
  1843. $("#"+fatherDiv).append(
  1844. "<div class=\""+fatherDiv+"-counter-"+counterNumber+"\">"+
  1845. "<span class=\""+fatherDiv+"-counter-text\">"+messageText+"</span>"+
  1846. "<span class=\""+fatherDiv+"-counter-number-"+counterNumber+"\">"+0+" von "+counterEnd+"</span>"+
  1847. "</div>"
  1848. );
  1849. }
  1850.  
  1851. function createCounterSpan(fatherDiv, messageText, counterEnd){
  1852. $("."+fatherDiv).append(
  1853. "<span class=\""+fatherDiv+"-counter\">"+
  1854. "<span class=\""+fatherDiv+"-counter-text\">"+messageText+"</span>"+
  1855. "<span class=\""+fatherDiv+"-counter-number\">"+0+"</span>"+
  1856. "<span class=\""+fatherDiv+"-counter-end\"> von "+counterEnd+"</span>"+
  1857. "</span>"
  1858. );
  1859. }
  1860.  
  1861. async function showAgeInLineup(){
  1862. let numberOfPlayers = $(".ol-team-settings-player-lineup-name").length;
  1863. let playerIDs = new Array(numberOfPlayers);
  1864. for(i=0;i<numberOfPlayers;i++){
  1865. let playerData = document.querySelectorAll(".ol-team-settings-line-up-row.visible .ol-value-bar-small.ol-gui-lineup-attr")[i].dataset.playerAttributes.split("\"value\":");
  1866. let age = parseInt(playerData[2].match(/\d+/g)[0]);
  1867. $(".ol-team-position-complete-name").eq(i).attr("style","font-size:15px;");
  1868. $(".ol-team-settings-player-lineup-name span.ol-team-position-complete-name").eq(i).attr("style","font-size:15px;");
  1869. $(".ol-team-settings-player-lineup-name span.ol-team-position-complete-name").eq(i).before(
  1870. "<span class=\"ol-team-lineup-age\" style=\"font-size:15px;\" title=\""+age+" Jahre\">"+age+" </span>"
  1871. );
  1872. }
  1873. }
  1874.  
  1875. function getPlayerInjuryDataForTM(playerID){
  1876. let link = "/player/injuries?playerId="+playerID;
  1877. let playerData = $.ajax({type: "GET", url: link, async: false}).responseText;
  1878. let totalDuration = $("<div>" + playerData + "</div>").find("span.bandarole-second-row span.player-info-bandarole-big-font").eq(0).text().trim();
  1879. let averagePerSeason = $("<div>" + playerData + "</div>").find("span.bandarole-second-row span.player-info-bandarole-big-font").eq(1).text().trim();
  1880. $(".transfer-player-ready.text-center").append(
  1881. "<div class=\"ol-additional-injury-information\">"+
  1882. "<div class=\"ol-additional-injury-information-total-duration\">Gesamtdauer (Wochen): "+totalDuration+"</div>"+
  1883. "<div class=\"ol-additional-injury-information-average-per-season\">Ø pro Saison (Wochen): "+averagePerSeason+"</div>"+
  1884. "</div>"
  1885. );
  1886. $(".ol-additional-injury-information-total-duration").attr("style","font-size:10pt;text-align:center;");
  1887. $(".ol-additional-injury-information-average-per-season").attr("style","font-size:10pt;padding-bottom:18px;text-align:center;");
  1888. $(".ol-youth-player-spacer.transfer-player-overview-spacer").remove();
  1889. }
  1890.  
  1891. class Team{
  1892. constructor(){
  1893. this.ID;
  1894. this.name;
  1895. this.logo;
  1896. this.numberOfCurrentPlayers;
  1897. this.strengthOfCurrentPlayers;
  1898. this.topTenStrengthOfCurrentFieldPlayers;
  1899. this.topThirteenStrengthOfCurrentFieldPlayers;
  1900. this.topFifteenStrengthOfCurrentFieldPlayers;
  1901. this.topTwentyStrengthOfCurrentFieldPlayers;
  1902. this.topStrengthOfCurrentKeepers;
  1903. this.averageTopTwoStrengthOfCurrentKeepers;
  1904. this.ageOfCurrentPlayers;
  1905. this.talentOfCurrentPlayers;
  1906. this.marketValueOfCurrentPlayers;
  1907. this.salaryOfCurrentPlayers;
  1908. this.averageStrengthOfCurrentPlayers;
  1909. this.averageTopTenStrengthOfCurrentFieldPlayers;
  1910. this.averageTopThirteenStrengthOfCurrentFieldPlayers;
  1911. this.averageTopFifteenStrengthOfCurrentFieldPlayers;
  1912. this.averageTopTwentyStrengthOfCurrentFieldPlayers;
  1913. this.averageAgeOfCurrentPlayers;
  1914. this.averageTalentOfCurrentPlayers;
  1915. this.averageMarketValueOfCurrentPlayers;
  1916. this.averageSalaryOfCurrentPlayers;
  1917. this.numberOfTeamTransfers;
  1918. this.lastGameResultHomeGoals;
  1919. this.lastGameResultAwayGoals;
  1920. this.lastGameResultBackgroundColor;
  1921. }
  1922. }
  1923.  
  1924. class Player{
  1925. constructor(){
  1926. this.currentTeamID;
  1927. this.currentTeamName;
  1928. this.currentTeamLogo;
  1929. this.ID;
  1930. this.name;
  1931. this.age;
  1932. this.birthday;
  1933. this.positions;
  1934. this.strength;
  1935. this.leagueGamesThisSeason;
  1936. this.leagueGoalsThisSeason;
  1937. this.leagueAssistsThisSeason;
  1938. this.marketValue;
  1939. this.salary;
  1940. this.talent;
  1941. this.isTalentDetermined;
  1942. this.isCurrentJugiFromCurrentTeam;
  1943. this.numberOfInjuries;
  1944. this.lengthOfAllInjuries;
  1945. this.averageLengthOfAllInjuries;
  1946. this.line;
  1947. this.libero;
  1948. this.foot;
  1949. this.gameopening;
  1950. this.runout;
  1951. this.penaltyarea;
  1952. this.condition;
  1953. this.speed;
  1954. this.technique;
  1955. this.shootingtechnique;
  1956. this.shootingpower;
  1957. this.header;
  1958. this.duel;
  1959. this.tactics;
  1960. this.leftfoot;
  1961. this.rightfoot;
  1962. this.athletics;
  1963. }
  1964. }
  1965. })
  1966. })();