Stats Xente Script

Stats Xente script for inject own data on Managerzone site

当前为 2024-12-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Stats Xente Script
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.117
  5. // @description Stats Xente script for inject own data on Managerzone site
  6. // @author xente
  7. // @match https://www.managerzone.com/*
  8. // @icon https://statsxente.com/MZ1/View/Images/main_icon.png
  9. // @license GNU
  10. // @grant GM_xmlhttpRequest
  11. // @grant GM_addStyle
  12. // @grant GM_getValue
  13. // @grant GM_setValue
  14. // @grant GM_deleteValue
  15. // @grant GM_listValues
  16. // @require https://code.jquery.com/jquery-3.7.1.js
  17. // ==/UserScript==
  18.  
  19. (function () {
  20. 'use strict';
  21.  
  22.  
  23. /*let keys = GM_listValues();
  24. keys.forEach(function(key) {
  25. console.log(key+" "+GM_getValue(key))
  26. });*/
  27.  
  28. /*let actual_version="0.9666"
  29. console.log(GM_info.script.version)
  30.  
  31. if(GM_info.script.version!=actual_version){
  32. console.log("here")
  33. keys = GM_listValues();
  34. keys.forEach(function (key) {
  35. GM_deleteValue(key);
  36. });
  37. }*/
  38.  
  39. setCSSStyles()
  40. createModalMenu()
  41. waitToDOMById(createModalEventListeners,"saveButton",5000)
  42. setLangSportCats()
  43. getUsernameData()
  44. checkScriptVersion()
  45.  
  46. /// FUNCTIONS MENU
  47. setTimeout(function () {
  48.  
  49. const urlParams = new URLSearchParams(window.location.search);
  50. if ((urlParams.has('p')) && (urlParams.get('p') === 'league') && (GM_getValue("leagueFlag"))) {
  51. waitToDOM(leagues, ".nice_table", 0,7000)
  52. }
  53.  
  54. if ((urlParams.has('p')) && (urlParams.get('p') === 'federations')
  55. && (urlParams.get('sub') === 'league') && (GM_getValue("federationFlag"))) {
  56. waitToDOM(clashLeagues, ".nice_table", 0,7000)
  57. }
  58.  
  59. if ((urlParams.has('p')) && (urlParams.get('p') === 'federations')
  60. && (urlParams.get('sub') === 'clash') && (GM_getValue("federationFlag"))) {
  61.  
  62. const script = document.createElement('script');
  63. script.textContent = `
  64. let newElement = document.createElement("input");
  65. newElement.id= "deviceFormatStx";
  66. newElement.type = "hidden";
  67. newElement.value=window.device;
  68. let body = document.body;
  69. body.appendChild(newElement);
  70.  
  71. `;
  72. document.documentElement.appendChild(script);
  73. script.remove();
  74.  
  75. window.stx_device=document.getElementById("deviceFormatStx").value
  76.  
  77. waitToDOM(clash, ".fed_badge", 0,7000)
  78. }
  79.  
  80. if ((urlParams.has('p')) && (urlParams.get('p') === 'match')
  81. && (urlParams.get('sub') === 'result') && (GM_getValue("matchFlag"))) {
  82. setTimeout(function () {
  83. waitToDOM(match, ".hitlist.statsLite.marker", 0,7000)
  84. }, 2000);
  85. }
  86.  
  87. if ((urlParams.has('p')) && (urlParams.get('p') === 'players') && (!urlParams.has('pid'))
  88. && (GM_getValue("playersFlag"))) {
  89. waitToDOM(playersPage, ".playerContainer", 0,7000)
  90. }
  91.  
  92. if ((urlParams.has('p')) && (urlParams.get('p') === 'players') && (urlParams.has('pid'))) {
  93. waitToDOM(playersPageStats, ".player_name", 0,7000)
  94. }
  95.  
  96.  
  97. if ((urlParams.has('p')) && (urlParams.get('p') === 'rank') && (urlParams.get('sub') === 'countryrank')
  98. && (GM_getValue("countryRankFlag"))) {
  99. countryRank();
  100. }
  101.  
  102. if ((urlParams.has('p')) && (urlParams.get('p') === 'clubhouse')) {
  103. StatsXenteNextMatchesClubhouse()
  104. }
  105.  
  106.  
  107. if ((urlParams.has('p')) && (urlParams.get('p') === 'friendlyseries')
  108. && (urlParams.get('sub') === 'standings')) {
  109. waitToDOM(friendlyCupsAndLeagues, ".nice_table", 0,7000)
  110. }
  111.  
  112.  
  113. if ((urlParams.has('p')) && (urlParams.get('p') === 'cup') && (urlParams.get('sub') === 'groupplay')) {
  114. waitToDOM(friendlyCupsAndLeagues, ".nice_table", 0,7000)
  115. }
  116.  
  117.  
  118. if ((urlParams.has('p')) && (urlParams.get('p') === 'private_cup') && (urlParams.get('sub') === 'groupplay')) {
  119. waitToDOM(friendlyCupsAndLeagues, ".nice_table", 0,7000)
  120. }
  121.  
  122.  
  123.  
  124. if ((urlParams.has('p')) && (urlParams.get('p') === 'match') && (urlParams.get('sub') === 'played')) {
  125. if(GM_getValue("eloNextMatchesFlag")){
  126. waitToDOM(nextMatches, ".group", 0,7000)
  127. }
  128. if(GM_getValue("eloPlayedMatchesFlag")){
  129. waitToDOM(lastMatchesELO, ".group", 0,7000)
  130. }
  131.  
  132. }
  133.  
  134.  
  135.  
  136.  
  137. if ((urlParams.has('p')) && (urlParams.get('p') === 'match') && (urlParams.get('sub') === 'scheduled')) {
  138. if(GM_getValue("eloNextMatchesFlag")){
  139. waitToDOM(nextMatches, ".group", 0,7000)
  140. }
  141. }
  142.  
  143.  
  144. if ((urlParams.has('p')) && (urlParams.get('p') === 'team') && (GM_getValue("teamPageFlag"))) {
  145. teamPage()
  146. }
  147.  
  148. if ((urlParams.has('p')) && (urlParams.get('p') === 'rank') && (urlParams.has('sub')) &&
  149. (urlParams.get('sub') === 'userrank')) {
  150. usersRank()
  151. }
  152.  
  153.  
  154. if ((urlParams.has('p')) && (urlParams.get('p') === 'training_report')&& (GM_getValue("trainingReportFlag"))) {
  155. waitToDOMById(training_report,"training_report",5000)
  156. }
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164. const elementos = document.querySelectorAll('.player_link'); //Adds stats icon in players page, when click on player info
  165. elementos.forEach(function (elemento) {
  166. elemento.addEventListener('click', function () {
  167. waitToDOM(playersPageStats, ".player_name", 0,7000)
  168. });
  169. });
  170.  
  171.  
  172. }, 1000);
  173.  
  174. let teams_data = "";
  175. let searchClassName = ""
  176. let players = []
  177. let lines = []
  178. let gk_line = ""
  179. let skills_names = []
  180. let su_line = "unsetted";
  181.  
  182. //BUTTONS EVENTS LISTENERS
  183. const urlParams = new URLSearchParams(window.location.search);
  184. if ((urlParams.get('p') === 'friendlyseries')||(urlParams.get('p') === 'federations')){
  185. waitToDOMById(tableFLAndClashEventListener,"ui-id-2",5000)
  186. }
  187.  
  188. if (urlParams.get('p') === 'cup'){
  189. waitToDOMById(tableCupsEventListener,"ui-id-4",5000)
  190. }
  191. waitToDOMById(tableLeaguesEventListener,"league_tab_table",5000)
  192.  
  193. function tableLeaguesEventListener(){
  194. document.getElementById("league_tab_table").addEventListener('click', function () {
  195. if (document.getElementById("showMenu") === null) {
  196. waitToDOM(leagues, ".nice_table", 0,7000)
  197. }
  198. });
  199.  
  200. }
  201.  
  202. function tableCupsEventListener(){
  203. document.getElementById("ui-id-4").parentNode.addEventListener('click', function () {
  204. if (document.getElementById("showMenu") === null) {
  205. waitToDOM(friendlyCupsAndLeagues, ".nice_table", 0,7000)
  206. }
  207.  
  208.  
  209. viewButtonCupsEventListener()
  210.  
  211.  
  212. });
  213.  
  214.  
  215. }
  216.  
  217. function viewButtonCupsEventListener(){
  218. document.addEventListener('click', function(event) {
  219. if ((event.target) &&((event.target.parentNode.id === 'view_btn')||(event.target.parentNode.parentNode.id === 'view_btn'))) {
  220. setTimeout(function () {
  221. if (document.getElementById("showMenu") === null) {
  222. waitToDOM(friendlyCupsAndLeagues, ".nice_table", 0,7000)
  223. }
  224. }, 1000);
  225. }
  226. });
  227.  
  228. }
  229.  
  230. function tableFLAndClashEventListener(){
  231. document.getElementById("ui-id-2").parentNode.addEventListener('click', function () {
  232. if (document.getElementById("showMenu") === null) {
  233. const urlParams = new URLSearchParams(window.location.search);
  234. if (urlParams.get('fsid')) {
  235. waitToDOM(friendlyCupsAndLeagues, ".nice_table", 0,7000)
  236. } else {
  237. waitToDOM(clashLeagues, ".nice_table", 0,7000)
  238. }
  239.  
  240. }
  241. });
  242. }
  243.  
  244.  
  245. function fetchAndProcessPlayerData(link,skill,toChange) {
  246. return new Promise((resolve, reject) => {
  247.  
  248. GM_xmlhttpRequest({
  249. method: 'GET',
  250. url:link,
  251. onload: function (response) {
  252.  
  253. let parser = new DOMParser();
  254. let doc = parser.parseFromString(response.responseText, 'text/html');
  255.  
  256. let player_cointainer=doc.getElementById("thePlayers_0")
  257.  
  258. let elements = player_cointainer.querySelectorAll('.skillval');
  259. elements.forEach(element => {
  260.  
  261. let previousTd = element.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling;
  262. let maxs = element.getElementsByClassName("maxed")
  263.  
  264. let clips = previousTd.getElementsByClassName("clippable")
  265. if((clips[0].innerText.trim()==skill.trim())&&(maxs.length>0)){
  266. toChange.style.backgroundColor="#db5d5d"
  267. toChange.style.fontWeight="bold"
  268. toChange.style.borderRadius="5px"
  269.  
  270.  
  271. }
  272.  
  273.  
  274. });
  275. resolve("Done")
  276. },
  277. onerror: function (error) {
  278. reject(error);
  279. }
  280. });
  281.  
  282. }
  283. );
  284.  
  285. }
  286. //Training Report
  287.  
  288. function training_report(){
  289.  
  290. if(!document.getElementById("trainingDaysId")){
  291. var elem=document.getElementsByClassName("headerPanel")
  292. elem[0].id="trainingDaysId"
  293.  
  294.  
  295. document.getElementById("trainingDaysId").addEventListener('click', function () {
  296. setTimeout(function () {
  297. waitToDOMById(training_report,"training_report",5000)
  298. }, 500);
  299.  
  300.  
  301. });
  302. }
  303. let key="ball"
  304. if(window.sport=="hockey"){
  305. key="puck"
  306. }
  307.  
  308. var clase="loader-"+window.sport
  309.  
  310. let elements0 = document.querySelectorAll('.dailyReportRightColumn');
  311. let promesas = [];
  312. elements0.forEach(element0 => {
  313. let previousTd = element0.previousElementSibling.previousElementSibling.previousElementSibling;
  314. if((!previousTd.innerHTML.includes("training_graph_icon"))&&(previousTd.innerHTML.includes("<img"))){
  315. let loaders=previousTd.getElementsByClassName("containerLoaderDiv")
  316. if(loaders.length>0){
  317. loaders[0].innerHTML='<div id="hp_loader" class="'+clase+'" style="gap: 10px;display:inline-block; width:25%"></div>'+loaders[0].innerHTML;
  318. }else{
  319. previousTd.innerHTML='<div id="hp_loader" class="'+clase+'" style="gap: 10px;display:inline-block; width:25%"></div>'+previousTd.innerHTML
  320. previousTd.innerHTML="<div class=containerLoaderDiv style='display: flex; align-items: center;gap: 8px;'>"+previousTd.innerHTML+"</div>"
  321. }
  322. }
  323. if(element0.innerHTML.includes(key)){
  324. let skills = element0.previousElementSibling.previousElementSibling;
  325. let number_skills=skills.getElementsByClassName("skillBallSeparator")
  326.  
  327. if(number_skills.length>3){
  328.  
  329. let player_td = element0.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling;
  330. let player_as=player_td.getElementsByTagName("a")
  331. var link=player_as[0].href
  332. promesas.push(fetchAndProcessPlayerData(link,previousTd.innerText,previousTd))
  333. }
  334. }
  335.  
  336. });
  337.  
  338. Promise.all(promesas)
  339. .then((resultados) => {
  340. const elementos = document.querySelectorAll('.'+clase);
  341. elementos.forEach(elemento => elemento.remove());
  342. })
  343. .catch((error) => {
  344. const elementos = document.querySelectorAll('.'+clase);
  345. elementos.forEach(elemento => elemento.remove());
  346. });
  347.  
  348.  
  349.  
  350. }
  351.  
  352.  
  353. //Users ranking page
  354. function usersRank(){
  355. let initialValues = {};
  356. initialValues["senior"] = GM_getValue("league_default_senior");
  357.  
  358. let linkIds = ""
  359. let tabla = document.getElementById("userRankTable");
  360.  
  361.  
  362. let values = new Map();
  363. values.set('valor23', 'U23 Value');
  364. values.set('valor21', 'U21 Value');
  365. values.set('valor18', 'U18 Value');
  366. values.set('salario', 'Salary');
  367. values.set('valorUPSenior', 'LM Value');
  368. values.set('valorUPSUB23', 'U23 LM Value');
  369. values.set('valorUPSUB21', 'U21 LM Value');
  370. values.set('valorUPSUB18', 'U18 LM Value');
  371. values.set('edad', 'Age');
  372. if (window.sport === "soccer") {
  373. values.set('valor11', 'TOP 11');
  374. values.set('valor11_23', 'U23 TOP 11');
  375. values.set('valor11_21', 'U21 TOP 11');
  376. values.set('valor11_18', 'U18 TOP 11');
  377. } else {
  378. values.set('valor11', 'TOP 21');
  379. values.set('valor11_23', 'U23 TOP 21');
  380. values.set('valor11_21', 'U21 TOP 21');
  381. values.set('valor11_18', 'U18 TOP 21');
  382. }
  383. values.set('noNac', 'Foreigners');
  384. values.set('elo', 'ELO Score');
  385. values.set('elo23', 'U23 ELO Score');
  386. values.set('elo21', 'U21 ELO Score');
  387. values.set('elo18', 'U18 ELO Score');
  388. values.set('numJugadores', 'Number of players');
  389. values.set('leagues_all', 'Leagues');
  390. values.set('world_leagues_all', 'World Leagues');
  391. values.set('youth_leagues_all', 'Youth Leagues');
  392. values.set('world_youth_leagues_all', 'Youth World Leagues');
  393. values.set('federation_leagues', 'Federation Leagues');
  394. values.set('cup', 'Cups');
  395. values.set('cup_u23', 'U23 Cups');
  396. values.set('cup_u21', 'U21 Cups');
  397. values.set('cup_u18', 'U18 Cups');
  398. values.set('special_cup', 'Special Cups');
  399.  
  400. let contenidoNuevo = '<div id=testClick style="margin: 0 auto;">';
  401. getNativeTableStyles();
  402.  
  403. ///MENU TABLE
  404. contenidoNuevo += "<table id=showMenu style='margin: 0 auto;'><thead style='border-color:white; margin: 0 auto; background-color:" + GM_getValue("bg_native") + "; color:" + GM_getValue("color_native") + ";'>"
  405. contenidoNuevo +="<tr>";
  406. contenidoNuevo += '<th style="text-align:center; margin: 0 auto; padding:4px;" colspan="4">Values</th>'
  407. contenidoNuevo += "</tr>";
  408.  
  409. let styleTable = " style='margin: 0 auto; display:none;'";
  410. let styleIcon = ""
  411. let styleSep = "style='padding-top:5px;'";
  412.  
  413. if (GM_getValue("show_league_selects") === true) {
  414. styleTable = " style='margin: 0 auto;'";
  415. styleIcon = " active"
  416. styleSep = " style='display:none;'";
  417. }
  418.  
  419.  
  420. contenidoNuevo += "<tr><td></td><td colspan='2' style='padding-top:5px;'>";
  421. contenidoNuevo += '<div id="moreInfo" class="expandable-icon' + styleIcon + '" style="margin: 0 auto; cursor:pointer; background-color:' + GM_getValue("bg_native") + ';"><div id="line1" class="line"></div><div id="line2" class="line"></div></div></center>';
  422. contenidoNuevo += "</td><td></td></tr>";
  423. contenidoNuevo += "<tr><td colspan='5' id='separatorTd'" + styleSep + "></td></tr>";
  424. contenidoNuevo += "</table></center>";
  425. contenidoNuevo += '<table id=show3' + styleTable + '><tr><td><label>';
  426.  
  427. if ("valor" === initialValues["senior"]) {
  428. contenidoNuevo += '<input class="statsxente" type="checkbox" checked id="valor" value="Value">Value</label></td>';
  429. } else {
  430. contenidoNuevo += '<input class="statsxente" type="checkbox" id="valor" value="Value">Value</label></td>';
  431. }
  432.  
  433. values.forEach(function (valor, clave) {
  434.  
  435. if (clave === "valorUPSenior") {
  436. contenidoNuevo += "</tr><tr>";
  437. }
  438.  
  439. if (clave === "valor11") {
  440. contenidoNuevo += "</tr><tr>";
  441. }
  442. if (clave === "elo") {
  443. contenidoNuevo += "</tr><tr>";
  444. }
  445.  
  446. if (clave === "leagues") {
  447. contenidoNuevo += "</tr><tr>";
  448. }
  449.  
  450. if (clave === "leagues_all") {
  451. contenidoNuevo += "</tr><tr>";
  452. }
  453.  
  454. if (clave === "cup") {
  455. contenidoNuevo += "</tr><tr>";
  456. }
  457.  
  458. if (clave === initialValues["senior"]) {
  459. contenidoNuevo += '<td><label><input class="statsxente" type="checkbox" checked value="' + valor + '" id="' + clave + '">' + valor + '</label></td>';
  460. } else {
  461. contenidoNuevo += '<td><label><input class="statsxente" type="checkbox" value="' + valor + '" id="' + clave + '">' + valor + '</label></td>';
  462. }
  463. });
  464. contenidoNuevo += "</tr></table></center>"
  465. contenidoNuevo += "</div></br>";
  466. values.set('valor', 'Value');
  467.  
  468. tabla.insertAdjacentHTML('beforebegin', contenidoNuevo);
  469.  
  470. if (GM_getValue("show_league_selects") === true) {
  471. document.getElementById("line2").style.transform = 'rotateZ(0deg)';
  472. document.getElementById("line1").style.transform = 'rotateZ(180deg)';
  473. document.getElementById("moreInfo").style.transform = 'rotateZ(0deg)';
  474. }
  475. values.forEach(function (valor, clave) {
  476. let elemento = document.getElementById(clave);
  477. elemento.addEventListener('click', handleClickUserRank);
  478. });
  479. (function () {
  480. document.getElementById("moreInfo").addEventListener('click', function () {
  481. document.getElementById("moreInfo").classList.toggle('active');
  482.  
  483. if (document.getElementById("moreInfo").classList.contains("active")) {
  484. document.getElementById("line2").style.transform = 'rotateZ(0deg)';
  485. document.getElementById("line1").style.transform = 'rotateZ(180deg)';
  486. document.getElementById("moreInfo").style.transform = 'rotateZ(0deg)';
  487. $('#separatorTd').fadeOut(1);
  488. document.getElementById("separatorTd").style.paddingTop = "5px";
  489. $('#show3').fadeIn('slow');
  490. } else {
  491. document.getElementById("line2").style.transform = 'rotateZ(45deg)';
  492. document.getElementById("line1").style.transform = 'rotateZ(-45deg)';
  493. document.getElementById("moreInfo").style.transform = 'rotateZ(45deg)';
  494. $('#separatorTd').fadeIn(1);
  495. $('#show3').fadeOut('slow');
  496. }
  497.  
  498. });
  499. })();
  500.  
  501.  
  502.  
  503. const filas = document.querySelectorAll("#userRankTable tr");
  504. var contIds=0;
  505. for (let i = 1; i < filas.length; i++) {
  506. const fila = filas[i];
  507. const tercerTd = fila.children[4];
  508. const cuartoTd = fila.children[5];
  509.  
  510. var data=extractTeamData(fila.children[3].getElementsByTagName("a"))
  511. linkIds += "&idEquipo" + contIds + "=" + data[0]
  512. contIds++;
  513. if (tercerTd && cuartoTd) {
  514. tercerTd.innerHTML = cuartoTd.innerHTML + " " + tercerTd.innerHTML;
  515. cuartoTd.innerHTML=""
  516. }
  517. }
  518.  
  519. let nuevaCeldaEncabezado = document.querySelector("#userRankTable th:last-of-type");
  520. nuevaCeldaEncabezado.innerHTML = "<a href='#'>"+values.get(initialValues["senior"])+"</a>"
  521. nuevaCeldaEncabezado.style.textAlign = 'center';
  522. nuevaCeldaEncabezado.style.maxWidth = '8.5em';
  523. nuevaCeldaEncabezado.style.width = '8.5em';
  524. nuevaCeldaEncabezado.style.whiteSpace = 'nowrap';
  525. nuevaCeldaEncabezado.style.overflow = 'hidden';
  526. nuevaCeldaEncabezado.style.textOverflow = 'ellipsis';
  527. nuevaCeldaEncabezado.id="stx_value"
  528.  
  529. document.getElementById("stx_value").addEventListener("click", function () {
  530. setTimeout(function () {
  531. ordenarTabla(5, false, "userRankTable",false);
  532. }, 20);
  533. });
  534.  
  535.  
  536.  
  537.  
  538.  
  539. GM_xmlhttpRequest({
  540. method: "GET",
  541. url: "https://statsxente.com/MZ1/Functions/tamper_teams.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport + linkIds,
  542. headers: {
  543. "Content-Type": "application/json"
  544. },
  545. onload: function (response) {
  546. teams_data = JSON.parse(response.responseText);
  547. const filas = document.querySelectorAll("#userRankTable tr");
  548. for (let i = 1; i < filas.length; i++) {
  549. const fila = filas[i];
  550. const tercerTd = fila.children[5];
  551. var data=extractTeamData(fila.children[3].getElementsByTagName("a"))
  552. var valor = new Intl.NumberFormat(window.userLocal).format(Math.round(teams_data[data[0]]['elo']))
  553. tercerTd.innerText=valor
  554. tercerTd.align = "center";
  555. }
  556. }});
  557. }
  558.  
  559. //Next matches page
  560. function nextMatches(){
  561.  
  562.  
  563. let selectElements = document.getElementsByName('limit');
  564. if (selectElements.length > 0) {
  565. let selectElement = selectElements[0];
  566. selectElement.addEventListener('change', function() {
  567. if(GM_getValue("eloNextMatchesFlag")){
  568. waitToDOM(nextMatches, ".group", 0,7000)
  569. }
  570. });
  571. }
  572. selectElements = document.getElementsByName('selectType');
  573. if (selectElements.length > 0) {
  574. let selectElement = selectElements[0];
  575. selectElement.addEventListener('change', function() {
  576. if(GM_getValue("eloNextMatchesFlag")){
  577. waitToDOM(nextMatches, ".group", 0,7000)
  578. }
  579. });
  580. }
  581.  
  582.  
  583. let team_id=""
  584. let urlParams = new URLSearchParams(window.location.search);
  585. if (urlParams.has('tid')){
  586. team_id=urlParams.get("tid")
  587. }else{
  588. if(window.sport==="soccer"){
  589. team_id=GM_getValue("soccer_team_id")
  590. }else{
  591. team_id=GM_getValue("hockey_team_id")
  592. }
  593. }
  594.  
  595.  
  596. let team_ids=[]
  597. let linkIds=""
  598. let contIds=0
  599. let cIds=""
  600. let contCIds=0
  601. let comps=[]
  602. let comp_ids=[]
  603. let elements0 = document.querySelectorAll('.odd');
  604.  
  605. elements0.forEach(element0 => {
  606. let cat=element0.getElementsByClassName("responsive-hide match-reference-text-wrapper flex-grow-0");
  607. if(cat.length>0){
  608. let links = cat[0].querySelectorAll('a');
  609.  
  610. if(links.length>0){
  611. let urlObj = new URL("https://www.managerzone.com/" + links[0].getAttribute('href'));
  612. let params = new URLSearchParams(urlObj.search);
  613. let type = params.get('type');
  614.  
  615. if(type===null){
  616.  
  617. if((params.get('p')==="cup")||(params.get('p')==="private_cup")){
  618.  
  619.  
  620. if(links[0].textContent.includes("U23")){
  621. comps[params.get('cid')]="U23"
  622. }else{
  623. if(links[0].textContent.includes("U21")){
  624. comps[params.get('cid')]="U21"
  625. }else{
  626.  
  627.  
  628. if(links[0].textContent.includes("U18")){
  629. comps[params.get('cid')]="U18"
  630. }else{
  631.  
  632. comps[params.get('cid')]="SENIOR";
  633. }
  634. }
  635. }
  636. }else{
  637.  
  638. let id=0;
  639.  
  640. switch(params.get('p')){
  641. case "cup":
  642. id=params.get('cid');
  643. break;
  644. case "private_cup":
  645. id=params.get('cid');
  646. break;
  647. case "friendly_series":
  648. id=params.get('fsid');
  649. break;
  650. case "friendlyseries":
  651. id=params.get('fsid');
  652. break;
  653.  
  654. }
  655.  
  656. if (!comp_ids.includes(id)) {
  657. comp_ids.push(id);
  658. cIds += "&idComp" + contCIds + "=" + id
  659. contCIds++;
  660. }
  661. }
  662. }
  663. }
  664. }
  665.  
  666.  
  667.  
  668. let elements1 = element0.querySelectorAll('.teams-wrapper .flex-grow-1');
  669. elements1.forEach(element1 => {
  670. let elements2 = element1.querySelectorAll('.clippable');
  671. elements2.forEach(element2 => {
  672. let urlObj = new URL("https://www.managerzone.com/" + element2.getAttribute('href'));
  673.  
  674. let params = new URLSearchParams(urlObj.search);
  675. let tidValue = params.get('tid');
  676. if(tidValue!==null){
  677. if (!team_ids.includes(tidValue)) {
  678. team_ids.push(tidValue);
  679. linkIds += "&idEquipo" + contIds + "=" + tidValue
  680. contIds++;
  681. }
  682. }
  683. });
  684. });
  685. });
  686.  
  687. if (!team_ids.includes(team_id)) {
  688. linkIds += "&idEquipo" + contIds + "=" + team_id
  689. }
  690.  
  691.  
  692. GM_xmlhttpRequest({
  693. method: "GET",
  694. url: "https://statsxente.com/MZ1/Functions/tamper_elo_values.php?sport=" + window.sport + linkIds+cIds,
  695. headers: {
  696. "Content-Type": "application/json"
  697. },
  698. onload: function (response) {
  699. let rawJSON = JSON.parse(response.responseText);
  700. let jsonResponse=rawJSON["teams"]
  701.  
  702.  
  703. for (let key in rawJSON["comps"]) {
  704. comps[key]=rawJSON["comps"][key]['restriction']
  705. }
  706.  
  707. let elements0 = document.querySelectorAll('.odd:not(.uxx)');
  708. elements0.forEach(element0 => {
  709. let elements1 = element0.querySelectorAll('.teams-wrapper .flex-grow-1');
  710. elements1.forEach(element1 => {
  711. let elements2 = element1.querySelectorAll('.clippable');
  712. elements2.forEach(element2 => {
  713. let urlObj = new URL("https://www.managerzone.com/" + element2.getAttribute('href'));
  714. let params = new URLSearchParams(urlObj.search);
  715. let tidValue = params.get('tid');
  716. if(tidValue!==null){
  717. tidValue=parseInt(tidValue)
  718. let valor=0;
  719. if (jsonResponse[tidValue]?.SENIOR) {
  720. valor = new Intl.NumberFormat(window.userLocal).format(Number.parseFloat(jsonResponse[tidValue]["SENIOR"]).toFixed(0))
  721. }
  722. element1.innerHTML+="</br>"+valor;
  723. }else{
  724. tidValue=parseInt(team_id)
  725. let valor=0;
  726. if (jsonResponse[tidValue]?.SENIOR) {
  727. valor = new Intl.NumberFormat(window.userLocal).format(Number.parseFloat(jsonResponse[tidValue]["SENIOR"]).toFixed(0))
  728. }
  729. element1.innerHTML+="</br>"+valor;
  730. }
  731. });
  732. });
  733. });
  734.  
  735. let temp_cats=[]
  736.  
  737. temp_cats["u23"] = "U23";
  738. temp_cats["u21"] = "U21";
  739. temp_cats["u18"] = "U18";
  740. temp_cats["u23_world"] = "U23";
  741. temp_cats["u21_world"] = "U21";
  742. temp_cats["u18_world"] = "U18";
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749. elements0 = document.querySelectorAll('.odd.uxx');
  750.  
  751. elements0.forEach(element0 => {
  752. let cat=element0.getElementsByClassName("responsive-hide match-reference-text-wrapper flex-grow-0");
  753. let links = cat[0].querySelectorAll('a');
  754. var type=null
  755. var href=""
  756. if(links[0]!=undefined){
  757. href=links[0].getAttribute('href')
  758. }
  759.  
  760. let urlObj = new URL("https://www.managerzone.com/" +href);
  761. let params = new URLSearchParams(urlObj.search);
  762. type = params.get('type');
  763.  
  764. let elo_type="SENIOR"
  765. if(type==null){
  766. if(params.get('cid')!=null){
  767. elo_type=comps[params.get('cid')]
  768. }
  769. if(params.get('fsid')!=null){
  770. elo_type=comps[params.get('fsid')]
  771. }
  772. }else{
  773. elo_type=temp_cats[type]
  774. }
  775.  
  776. let elements1 = element0.querySelectorAll('.teams-wrapper .flex-grow-1');
  777. elements1.forEach(element1 => {
  778. let elements2 = element1.querySelectorAll('.clippable');
  779. elements2.forEach(element2 => {
  780. let urlObj = new URL("https://www.managerzone.com/" + element2.getAttribute('href'));
  781. let params = new URLSearchParams(urlObj.search);
  782. let tidValue = params.get('tid');
  783. if(tidValue!==null){
  784. tidValue=parseInt(tidValue)
  785. let valor=0;
  786. if(jsonResponse[tidValue] && jsonResponse[tidValue][elo_type] !== undefined){
  787. valor = new Intl.NumberFormat(window.userLocal).format(Number.parseFloat(jsonResponse[tidValue][elo_type]).toFixed(0))
  788. }
  789. element1.innerHTML+="</br>"+valor;
  790. }else{
  791. tidValue=parseInt(team_id)
  792. let valor=0;
  793. if(jsonResponse[tidValue] && jsonResponse[tidValue][elo_type] !== undefined){
  794. valor = new Intl.NumberFormat(window.userLocal).format(Number.parseFloat(jsonResponse[tidValue][elo_type]).toFixed(0))
  795. }
  796. element1.innerHTML+="</br>"+valor;
  797. }
  798. });
  799. });
  800. });
  801. }
  802. });
  803.  
  804.  
  805. }
  806. //Team page
  807. function teamPage(){
  808. let u23_type="",u21_type="",u18_type=""
  809. let team_name_div=document.getElementsByClassName("teamDataText clippable");
  810. const team_name=encodeURI(team_name_div[0].textContent)
  811. let team_id=""
  812. let urlParams = new URLSearchParams(window.location.search);
  813. if (urlParams.has('tid')){
  814. team_id=urlParams.get("tid")
  815. }else{
  816. if(window.sport==="soccer"){
  817. team_id=GM_getValue("soccer_team_id")
  818. }else{
  819. team_id=GM_getValue("hockey_team_id")
  820. }
  821. }
  822.  
  823. let main_div=document.getElementById("infoAboutTeam")
  824. let dds = main_div.querySelectorAll('dd');
  825.  
  826. dds.forEach(dd => {
  827. let as = dd.querySelectorAll('a');
  828. if(as.length>0){
  829. let href = as[0].getAttribute('href');
  830. let urlParams = new URLSearchParams(href.split('?')[1]);
  831. let type = urlParams.get('type');
  832. if(type.includes("u23")){
  833. u23_type=window.cats[type]
  834. }
  835. if(type.includes("u21")){
  836. u21_type=window.cats[type]
  837. }
  838. if(type.includes("u18")){
  839. u18_type=window.cats[type]
  840. }
  841. }
  842. });
  843.  
  844.  
  845. GM_xmlhttpRequest({
  846. method: "GET",
  847. url: "https://statsxente.com/MZ1/Functions/tamper_detailed_teams.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport + "&idEquipo="+team_id,
  848. headers: {
  849. "Content-Type": "application/json"
  850. },
  851. onload: function (response) {
  852.  
  853. let jsonResponse = JSON.parse(response.responseText);
  854.  
  855. let aux=team_id
  856.  
  857. let top="TOP 11"
  858.  
  859. if(window.sport==="hockey"){
  860. top="TOP 21"
  861. }
  862.  
  863. let teamTable='<div style="display: flex;flex-direction: column;justify-content: center;align-items: center;flex-wrap: wrap;max-height: 100%;">'
  864. teamTable+='<table class="matchValuesTable"><thead><tr>'
  865. teamTable+='<th id=thTransparent0 style="background-color:transparent; border:0;"></th>'
  866. teamTable+='<th style="border-top-left-radius: 5px;">Value</th><th>LM Value</th>'
  867. teamTable+='<th >'+top+'</th><th>ELO</th>'
  868. teamTable+='<th>Age</th>'
  869. teamTable+='<th>Salary</th>'
  870. teamTable+='<th>Players</th>'
  871. teamTable+='<th style="border-top-right-radius: 5px;"></th>'
  872. teamTable+='</tr></thead><tbody>'
  873. let valor=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor']))
  874. let valorLM=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valorUPSenior']))
  875. let valor11=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor11']))
  876. let elo=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['elo']))
  877. let edad= Number.parseFloat(jsonResponse[aux]['edad']).toFixed(2)
  878. let salario=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['salario']))
  879. let numJugs=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['numJugadores']))
  880. teamTable+='<tr><th style="border-top-left-radius: 5px;">Senior</th><td>'+valor+'</td><td>'+valorLM+'</td><td>'+valor11+'</td><td>'+elo+'</td><td>'+edad+'</td><td>'+salario+'</td>'
  881. teamTable+='<td>'+numJugs+'</td>'
  882. teamTable+='<td style="border-right:1px solid '+GM_getValue("bg_native")+';">'
  883. teamTable+='<img alt="" style="cursor:pointer;" id="seniorButton" src="https://statsxente.com/MZ1/View/Images/detail.png" width="20px" height="20px"/>'
  884.  
  885. teamTable+='</td></tr>'
  886.  
  887. valor=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor23']))
  888. valorLM=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valorUPSUB23']))
  889. valor11=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor11_23']))
  890. elo=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['elo23']))
  891. edad=Number.parseFloat(jsonResponse[aux]['age23']).toFixed(2)
  892. salario=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['salary23']))
  893. numJugs=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['players23']))
  894. teamTable+='<tr><th>U23</th><td>'+valor+'</td><td>'+valorLM+'</td><td>'+valor11+'</td><td>'+elo+'</td><td>'+edad+'</td><td>'+salario+'</td>'
  895. teamTable+='<td>'+numJugs+'</td>'
  896. teamTable+='<td style="border-right:1px solid '+GM_getValue("bg_native")+';">'
  897. teamTable+='<img alt="" style="cursor:pointer;" id="sub23Button" src="https://statsxente.com/MZ1/View/Images/detail.png" width="20px" height="20px"/>'
  898. teamTable+='</td></tr>'
  899.  
  900.  
  901.  
  902. valor=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor21']))
  903. valorLM=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valorUPSUB21']))
  904. valor11=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor11_21']))
  905. elo=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['elo21']))
  906. edad=Number.parseFloat(jsonResponse[aux]['age21']).toFixed(2)
  907. salario=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['salary21']))
  908. numJugs=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['players21']))
  909. teamTable+='<tr><th>U21</th><td>'+valor+'</td><td>'+valorLM+'</td><td>'+valor11+'</td><td>'+elo+'</td><td>'+edad+'</td><td>'+salario+'</td>'
  910. teamTable+='<td>'+numJugs+'</td>'
  911. teamTable+='<td style="border-right:1px solid '+GM_getValue("bg_native")+';">'
  912. teamTable+='<img alt="" style="cursor:pointer;" id="sub21Button" src="https://statsxente.com/MZ1/View/Images/detail.png" width="20px" height="20px"/>'
  913. teamTable+='</td></tr>'
  914.  
  915.  
  916.  
  917.  
  918. valor=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor18']))
  919. valorLM=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valorUPSUB18']))
  920. valor11=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor11_18']))
  921. elo=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['elo18']))
  922. edad=Number.parseFloat(jsonResponse[aux]['age18']).toFixed(2)
  923. salario=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['salary18']))
  924. numJugs=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['players18']))
  925. teamTable+='<tr><th style="border-bottom-left-radius: 5px;">U18</th><td style="border-bottom:1px solid '+GM_getValue("bg_native")+';">'+valor+'</td>'
  926. teamTable+='<td style="border-bottom:1px solid '+GM_getValue("bg_native")+';">'+valorLM+'</td>'
  927. teamTable+='<td style="border-bottom:1px solid '+GM_getValue("bg_native")+';">'+valor11+'</td>'
  928. teamTable+='<td style="border-bottom:1px solid '+GM_getValue("bg_native")+';">'+elo+'</td><td style="border-bottom:1px solid '+GM_getValue("bg_native")+';">'+edad+'</td><td style="border-bottom:1px solid '+GM_getValue("bg_native")+';">'+salario+'</td>'
  929. teamTable+='<td style="border-bottom:1px solid '+GM_getValue("bg_native")+';">'+numJugs+'</td>'
  930. teamTable+='<td style="border-radius: 0 0 10px 0; border-bottom:1px solid '+GM_getValue("bg_native")+'; border-right:1px solid '+GM_getValue("bg_native")+';">'
  931. teamTable+='<img alt="" style="cursor:pointer;" id="sub18Button" src="https://statsxente.com/MZ1/View/Images/detail.png" width="20px" height="20px"/>'
  932. teamTable+='</td></tr>'
  933. teamTable+='</tbody></table>'
  934. teamTable+='<button class="btn-save" style="color:'+GM_getValue("color_native")+'; background-color:'+GM_getValue("bg_native")+'; font-family: \'Roboto\'; font-weight:bold; font-size:revert;" id="eloHistoryButton"><i class="bi bi-clock-history" style="font-style:normal;"> ELO History</i></button></div>'
  935.  
  936. let divToInserT=document.getElementById("streakAndCupInfo")
  937. divToInserT.innerHTML=teamTable+divToInserT.innerHTML
  938.  
  939. let color=GM_getValue("bg_native")
  940. let darkerColor = darkenColor(color, 25);
  941.  
  942. document.styleSheets[0].insertRule(
  943. '.btn-save:hover { background-color: '+darkerColor+' !important; }',
  944. document.styleSheets[0].cssRules.length
  945. );
  946.  
  947.  
  948. document.getElementById("eloHistoryButton").addEventListener('click', function () {
  949. let link = "https://statsxente.com/MZ1/Functions/graphLoader.php?graph=elo_history&team_id=" + team_id+"&sport=" + window.sport
  950. openWindow(link, 0.95, 1.25);
  951. });
  952.  
  953.  
  954.  
  955. document.getElementById("seniorButton").addEventListener('click', function () {
  956. let link = "https://www.statsxente.com/MZ1/Functions/tamper_teams_stats.php?team_id=" + team_id +
  957. "&category=senior&elo_category=SENIOR&sport=" + window.sport+ "&idioma=" + window.lang+"&team_name="
  958. +team_name+"&divisa=" + GM_getValue("currency")
  959. openWindow(link, 0.95, 1.25);
  960. });
  961. document.getElementById("sub23Button").addEventListener('click', function () {
  962. let link = "https://www.statsxente.com/MZ1/Functions/tamper_teams_stats.php?team_id=" + team_id +
  963. "&category="+u23_type+"&elo_category=U23&sport=" + window.sport+ "&idioma=" + window.lang+"&team_name="
  964. +team_name+"&divisa=" + GM_getValue("currency")
  965. openWindow(link, 0.95, 1.25);
  966. });
  967.  
  968. document.getElementById("sub21Button").addEventListener('click', function () {
  969. let link = "https://www.statsxente.com/MZ1/Functions/tamper_teams_stats.php?team_id=" + team_id +
  970. "&category="+u21_type+"&elo_category=U21&sport=" + window.sport+ "&idioma=" + window.lang+"&team_name="
  971. +team_name+"&divisa=" + GM_getValue("currency")
  972. openWindow(link, 0.95, 1.25);
  973. });
  974.  
  975.  
  976. document.getElementById("sub18Button").addEventListener('click', function () {
  977. let link = "https://www.statsxente.com/MZ1/Functions/tamper_teams_stats.php?team_id=" + team_id +
  978. "&category="+u18_type+"&elo_category=U18&sport=" + window.sport+ "&idioma=" + window.lang+"&team_name="
  979. +team_name+"&divisa=" + GM_getValue("currency")
  980. openWindow(link, 0.95, 1.25);
  981. });
  982.  
  983.  
  984.  
  985. const thElements = document.querySelectorAll('table.matchValuesTable th');
  986. thElements.forEach(th => {
  987. th.style.backgroundColor = GM_getValue("bg_native");
  988. th.style.color = GM_getValue("color_native");
  989. });
  990. document.getElementById("thTransparent0").style.backgroundColor="transparent";
  991. }
  992. });
  993. }
  994. //Last matches page
  995. function lastMatchesELO(){
  996. let selectElements = document.getElementsByName('limit');
  997. if (selectElements.length > 0) {
  998. let selectElement = selectElements[0];
  999. selectElement.addEventListener('change', function() {
  1000. if(GM_getValue("eloNextMatchesFlag")){
  1001. //waitToDOM(nextMatches, ".group", 0,7000)
  1002. }
  1003. if(GM_getValue("eloPlayedMatchesFlag")){
  1004. waitToDOM(lastMatchesELO, ".group", 0,7000)
  1005. }
  1006. });
  1007. }
  1008. selectElements = document.getElementsByName('selectType');
  1009. if (selectElements.length > 0) {
  1010. let selectElement = selectElements[0];
  1011. selectElement.addEventListener('change', function() {
  1012. if(GM_getValue("eloNextMatchesFlag")){
  1013. //waitToDOM(nextMatches, ".group", 0,7000)
  1014. }
  1015. if(GM_getValue("eloPlayedMatchesFlag")){
  1016. waitToDOM(lastMatchesELO, ".group", 0,7000)
  1017. }
  1018. });
  1019. }
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026. const today = new Date();
  1027.  
  1028. today.setDate(today.getDate() + 2);
  1029. const year = today.getFullYear();
  1030. const month = String(today.getMonth() + 1).padStart(2, '0');
  1031. const day = String(today.getDate()).padStart(2, '0');
  1032. let finalDate = `${year}-${month}-${day}`;
  1033.  
  1034. let initialDate="undefined"
  1035.  
  1036.  
  1037.  
  1038. let elems = document.getElementsByClassName("group");
  1039. Array.from(elems).forEach(function(elem) {
  1040. initialDate=getParsedValidDateText(elem.innerText)
  1041. });
  1042.  
  1043. getUsernameData()
  1044.  
  1045.  
  1046. let team_id
  1047. let urlParams = new URLSearchParams(window.location.search);
  1048. if (urlParams.has('tid')){
  1049. team_id=urlParams.get("tid")
  1050. }else{
  1051.  
  1052. if(window.sport==="soccer"){
  1053. team_id=GM_getValue("soccer_team_id")
  1054. }else{
  1055. team_id=GM_getValue("hockey_team_id")
  1056. }
  1057.  
  1058. }
  1059.  
  1060. var clase="loader-"+window.sport
  1061.  
  1062. elems = document.getElementsByClassName("bold score-cell-wrapper textCenter flex-grow-0");
  1063.  
  1064. Array.from(elems).forEach(function(elem) {
  1065. elem.innerHTML+="</br><div id='hp_loader' class='"+clase+"'></div>"
  1066.  
  1067. });
  1068.  
  1069. GM_xmlhttpRequest({
  1070. method: "GET",
  1071. url: "https://statsxente.com/MZ1/Functions/tamper_elo_matches.php?sport=" + window.sport + "&team_id="+team_id+"&initial_date="+initialDate+"&final_date="+finalDate,
  1072. headers: {
  1073. "Content-Type": "application/json"
  1074. },
  1075. onload: function (response) {
  1076. let jsonResponse = JSON.parse(response.responseText);
  1077.  
  1078.  
  1079.  
  1080.  
  1081. let elems = document.getElementsByClassName("bold score-cell-wrapper textCenter flex-grow-0");
  1082.  
  1083. Array.from(elems).forEach(function(elem) {
  1084.  
  1085. let links = elem.getElementsByClassName('score-hidden gray');
  1086. let href = links[0].getAttribute('href');
  1087. let urlParams = new URLSearchParams(href.split('?')[1]);
  1088. let mid = parseInt(urlParams.get('mid'));
  1089.  
  1090. if(mid in jsonResponse){
  1091.  
  1092. let diff=jsonResponse[mid]['score']-jsonResponse[mid]['old_score']
  1093. diff = diff.toFixed(2)
  1094.  
  1095. let symbol="";
  1096. let status="down";
  1097. if(diff>0){
  1098. symbol="+";
  1099. status="up";
  1100. }
  1101.  
  1102. elem.innerHTML+="<div id='showELOChange' style='display: flex;align-items: center;'>"+symbol+diff+"<img alt='' src='https://statsxente.com/MZ1/View/Images/"+status+".png' width='10px' height='10px'/></div>";
  1103. }
  1104.  
  1105.  
  1106. });
  1107.  
  1108. const elementos = document.querySelectorAll('.'+clase);
  1109. elementos.forEach(elemento => elemento.remove());
  1110.  
  1111. }
  1112.  
  1113.  
  1114.  
  1115. });
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122. }
  1123. //Federation clash page
  1124. function clash() {
  1125.  
  1126. let badges = document.getElementsByClassName("fed_badge");
  1127. let regex = /fid=(\d+)/;
  1128. let srcLocal = badges[0].getAttribute('src');
  1129. let local_id = srcLocal.match(regex);
  1130. let src_away = badges[1].getAttribute('src');
  1131. let away_id = src_away.match(regex);
  1132. let names = document.getElementsByClassName("name-score text-ellipsis")
  1133. let homeName=encodeURIComponent(names[0].innerText)
  1134. let awayName=encodeURIComponent(names[1].innerText)
  1135. let elems = document.getElementsByClassName("top-pane__deadline");
  1136. let tabla = elems[0]
  1137.  
  1138. GM_xmlhttpRequest({
  1139. method: "GET",
  1140. url: "https://statsxente.com/MZ1/Functions/tamper_federations_clash_data.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport +"&home="+local_id[1]+"&away="+away_id[1],
  1141. headers: {
  1142. "Content-Type": "application/json"
  1143. },
  1144. onload: function (response) {
  1145. let jsonResponse = JSON.parse(response.responseText);
  1146.  
  1147.  
  1148.  
  1149. let contenidoNuevo = "</br></br><table style='margin: 0 auto;'><tr><td class='subheader clearfix'>Clash Compare</td></tr><tr><td><img alt='' id=clashCompare src='https://www.statsxente.com/MZ1/View/Images/clash_icon.png' style='width:45px; height:45px; cursor:pointer;'/></center></td></tr></table></center>";
  1150. contenidoNuevo+="<table style='width:65%;margin: 0 auto; table-layout:unset;' class='hitlist challenges-list'><thead><tr>"
  1151. contenidoNuevo+="<th colspan='2'>Rank</th><th>Value</th><th>LM Value</th><th>ELO Score</th></tr></thead>"
  1152. contenidoNuevo+="<tbody>"
  1153.  
  1154. contenidoNuevo+="<tr class='odd'>"
  1155.  
  1156. contenidoNuevo+="<td style='text-align:right;'><img alt='' src='https://www.managerzone.com/dynimg/pic.php?type=federation&fid="+local_id[1]+"&size=medium&sport="+window.sport+"' width=35px height=35px/></td>"
  1157. contenidoNuevo+="<td style='text-align:left;'>#"+jsonResponse[local_id[1]]["table_index"]+"</td>"
  1158.  
  1159. let valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[local_id[1]]["value"]))
  1160. contenidoNuevo+="<td style='margin: 0 auto;'>"+valor+"</td>"
  1161. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[local_id[1]]["valueLM"]))
  1162. contenidoNuevo+="<td style='margin: 0 auto;'>"+valor+"</td>"
  1163. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[local_id[1]]["elo"]))
  1164. contenidoNuevo+="<td style='margin: 0 auto;'>"+valor+"</td>"
  1165.  
  1166. contenidoNuevo+="</tr>"
  1167.  
  1168. contenidoNuevo+="<tr class='even'>"
  1169. contenidoNuevo+="<td style='text-align:right;'><img alt='' src='https://www.managerzone.com/dynimg/pic.php?type=federation&fid="+away_id[1]+"&size=medium&sport="+window.sport+"' width=35px height=35px/></td>"
  1170. contenidoNuevo+="<td style='text-align:left;'>#"+jsonResponse[away_id[1]]["table_index"]+"</td>"
  1171.  
  1172.  
  1173. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[away_id[1]]["value"]))
  1174. contenidoNuevo+="<td style='margin: 0 auto;'>"+valor+"</td>"
  1175. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[away_id[1]]["valueLM"]))
  1176. contenidoNuevo+="<td style='margin: 0 auto;'>"+valor+"</td>"
  1177. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[away_id[1]]["elo"]))
  1178. contenidoNuevo+="<td style='margin: 0 auto;'>"+valor+"</td>"
  1179.  
  1180. contenidoNuevo+="</tr>"
  1181.  
  1182. contenidoNuevo+="</tbody>"
  1183. contenidoNuevo+="</table></center>"
  1184. tabla.insertAdjacentHTML('beforeend', contenidoNuevo)
  1185.  
  1186. document.getElementById("clashCompare").addEventListener('click', function () {
  1187. let link = "https://statsxente.com/MZ1/Functions/loadClashFederationData.php?tamper=yes&fid=" + local_id[1] + "&fid1=" + away_id[1] + "&fede=" + homeName + "&fede1=" + awayName + "&idioma=" + window.lang + "&divisa=" + GM_getValue("currency") + "&sport=" + window.sport;
  1188. openWindow(link, 0.95, 1.25);
  1189. });
  1190.  
  1191. names[0].innerText="(#"+jsonResponse[local_id[1]]["table_index"]+")"+names[0].innerText;
  1192. names[1].innerText="(#"+jsonResponse[away_id[1]]["table_index"]+")"+names[1].innerText;
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216. let users_ids={}
  1217.  
  1218.  
  1219.  
  1220.  
  1221. let tables = document.querySelectorAll('.hitlist');
  1222. let table=tables[1]
  1223.  
  1224. if(window.stx_device=="computer"){
  1225. const thead = table.querySelector("thead");
  1226.  
  1227. // Verifica si el thead no tiene th
  1228. if (thead.children.length === 0) {
  1229. const th1 = document.createElement("th");
  1230. th1.innerText = "Equipo";
  1231.  
  1232. const th2 = document.createElement("th");
  1233. th2.innerText = "Resultado";
  1234. const nuevaFila = document.createElement("tr");
  1235. nuevaFila.appendChild(th1);
  1236. nuevaFila.appendChild(th2);
  1237. thead.appendChild(nuevaFila);
  1238. }
  1239.  
  1240. }
  1241.  
  1242.  
  1243.  
  1244.  
  1245. const colCount = table.rows[0].cells.length;
  1246.  
  1247. let eloCol=0
  1248. let lmCol=1
  1249. if(colCount>2){
  1250.  
  1251. eloCol=5
  1252. lmCol=6
  1253.  
  1254. }
  1255.  
  1256.  
  1257. table.id="clash_table";
  1258.  
  1259.  
  1260. let contIds = 0
  1261. let linkIds = ""
  1262. let teamNameElement=""
  1263.  
  1264. for (let i = 0; i < table.rows.length; i++) {
  1265. let row = table.rows[i];
  1266. if(window.stx_device=="computer"){
  1267. let thirdColumnCell = row.cells[eloCol];
  1268. teamNameElement = thirdColumnCell.querySelector('.team-name');
  1269. let href = teamNameElement.getAttribute('href');
  1270. let urlParams = new URLSearchParams(href.split('?')[1]);
  1271. let tid = urlParams.get('tid');
  1272.  
  1273. linkIds += "&idEquipo" + contIds + "=" + tid
  1274. contIds++
  1275.  
  1276. }else{
  1277. let flexs_elements = row.querySelector('.flex-grow-1');
  1278. if(flexs_elements){
  1279. let as=flexs_elements.getElementsByTagName("a")
  1280. let team_data=extractTeamData(as)
  1281.  
  1282.  
  1283. linkIds += "&idEquipo" + contIds + "=" + team_data[0]
  1284. contIds++
  1285.  
  1286.  
  1287. }
  1288.  
  1289. }
  1290.  
  1291. }
  1292.  
  1293. GM_xmlhttpRequest({
  1294. method: "GET",
  1295. url: "https://statsxente.com/MZ1/Functions/tamper_teams.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport + linkIds,
  1296. headers: {
  1297. "Content-Type": "application/json"
  1298. },
  1299. onload: function (response) {
  1300. let jsonResponse = JSON.parse(response.responseText);
  1301.  
  1302.  
  1303. let valor=0
  1304. let tid=0
  1305. if(window.stx_device=="computer"){
  1306. for (let i = 0; i < table.rows.length; i++) {
  1307. let row = table.rows[i];
  1308.  
  1309.  
  1310. if(i>0){
  1311.  
  1312. let thirdColumnCell = row.cells[eloCol];
  1313. let teamNameElement = thirdColumnCell.querySelector('.team-name');
  1314. let href = teamNameElement.getAttribute('href');
  1315. let urlParams = new URLSearchParams(href.split('?')[1]);
  1316. tid = urlParams.get('tid');
  1317.  
  1318.  
  1319. }
  1320.  
  1321.  
  1322. let newCell1 = row.insertCell(eloCol);
  1323. if (i === 0) {
  1324.  
  1325. let th = document.createElement('th');
  1326. th.innerHTML = "ELO";
  1327. th.style.width="50px";
  1328. th.id="elo_th"
  1329. newCell1.replaceWith(th);
  1330.  
  1331. } else {
  1332. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[tid]["elo"]))
  1333. newCell1.innerHTML = valor;
  1334. }
  1335.  
  1336. let newCell = row.insertCell(lmCol);
  1337. if (i === 0) {
  1338.  
  1339. let th1 = document.createElement('th');
  1340. th1.innerHTML = "LM Value";
  1341. th1.style.width="80px";
  1342. th1.id="lm_th"
  1343. newCell.replaceWith(th1);
  1344. } else {
  1345. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[tid]["valorUPSenior"]))
  1346. newCell.innerHTML = valor;
  1347. }
  1348.  
  1349.  
  1350. if(eloCol===0){
  1351. let rankCell = row.insertCell(eloCol);
  1352.  
  1353. if (i === 0) {
  1354.  
  1355.  
  1356. let th2 = document.createElement('th'); // Creamos un elemento 'th'
  1357. th2.innerHTML = "Rank";
  1358. th2.style.width="50px";
  1359. rankCell.replaceWith(th2);
  1360.  
  1361.  
  1362. }else{
  1363. rankCell.innerHTML = i
  1364.  
  1365. }
  1366. }
  1367.  
  1368.  
  1369.  
  1370. }
  1371.  
  1372.  
  1373. if(eloCol===0){
  1374. eloCol++;
  1375. lmCol++;
  1376. }
  1377.  
  1378. document.getElementById("elo_th").addEventListener("click", function () {
  1379.  
  1380. ordenarTabla(eloCol, false, "clash_table",true);
  1381. });
  1382.  
  1383.  
  1384. document.getElementById("lm_th").addEventListener("click", function () {
  1385.  
  1386. ordenarTabla(lmCol, false, "clash_table",true);
  1387. });
  1388.  
  1389.  
  1390. }else{
  1391.  
  1392. //MOBILE VIEW
  1393.  
  1394. for (let i = 0; i < table.rows.length; i++) {
  1395. let row = table.rows[i];
  1396.  
  1397.  
  1398. let flexs_elements = row.querySelector('.flex-grow-1');
  1399. if(flexs_elements){
  1400. let as=flexs_elements.getElementsByTagName("a")
  1401. let team_data=extractTeamData(as)
  1402. let valor = new Intl.NumberFormat(window.userLocal).format(Number.parseFloat(jsonResponse[team_data[0]]["valorUPSenior"]).toFixed(0))
  1403. let elo = new Intl.NumberFormat(window.userLocal).format(Number.parseFloat(jsonResponse[team_data[0]]["elo"]).toFixed(0))
  1404. let txt="<table><tr><td>LM Value</td><td>"+valor+"</td></tr><tr><td>ELO</td><td>"+elo+"</td></tr></table>"
  1405.  
  1406.  
  1407. flexs_elements.innerHTML+=txt
  1408. }
  1409.  
  1410.  
  1411. }
  1412.  
  1413. }
  1414.  
  1415. }
  1416.  
  1417.  
  1418.  
  1419. });
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425. }
  1426.  
  1427. });
  1428.  
  1429.  
  1430. }
  1431. //Leagues page
  1432. function leagues() {
  1433. let urlParams = new URLSearchParams(window.location.search);
  1434. let initialValues = {};
  1435. initialValues["senior"] = GM_getValue("league_default_senior");
  1436. initialValues["world"] = GM_getValue("league_default_senior");
  1437. initialValues["u23"] = GM_getValue("league_default_u23");
  1438. initialValues["u21"] = GM_getValue("league_default_u21");
  1439. initialValues["u18"] = GM_getValue("league_default_u18");
  1440. initialValues["u23_world"] = GM_getValue("league_default_u23");
  1441. initialValues["u21_world"] = GM_getValue("league_default_u21");
  1442. initialValues["u18_world"] = GM_getValue("league_default_u18");
  1443.  
  1444. let linkIds = ""
  1445. let elems = document.getElementsByClassName("nice_table");
  1446. let tabla = elems[0]
  1447. let thSegundo = tabla.querySelector("thead th:nth-child(2)");
  1448. thSegundo.style.width = "250px";
  1449.  
  1450.  
  1451. let values = new Map();
  1452. values.set('valor23', 'U23 Value');
  1453. values.set('valor21', 'U21 Value');
  1454. values.set('valor18', 'U18 Value');
  1455. values.set('salario', 'Salary');
  1456. values.set('valorUPSenior', 'LM Value');
  1457. values.set('valorUPSUB23', 'U23 LM Value');
  1458. values.set('valorUPSUB21', 'U21 LM Value');
  1459. values.set('valorUPSUB18', 'U18 LM Value');
  1460. values.set('edad', 'Age');
  1461. if (window.sport === "soccer") {
  1462. values.set('valor11', 'TOP 11');
  1463. values.set('valor11_23', 'U23 TOP 11');
  1464. values.set('valor11_21', 'U21 TOP 11');
  1465. values.set('valor11_18', 'U18 TOP 11');
  1466. } else {
  1467. values.set('valor11', 'TOP 21');
  1468. values.set('valor11_23', 'U23 TOP 21');
  1469. values.set('valor11_21', 'U21 TOP 21');
  1470. values.set('valor11_18', 'U18 TOP 21');
  1471. }
  1472.  
  1473. values.set('noNac', 'Foreigners');
  1474. values.set('elo', 'ELO Score');
  1475. values.set('elo23', 'U23 ELO Score');
  1476. values.set('elo21', 'U21 ELO Score');
  1477. values.set('elo18', 'U18 ELO Score');
  1478. values.set('numJugadores', 'Number of players');
  1479.  
  1480. if (urlParams.get('type') === "senior") {
  1481. values.set('leagues', 'Leagues');
  1482. values.set('world_leagues_all', 'World Leagues');
  1483. values.set('youth_leagues_all', 'Youth Leagues');
  1484. values.set('world_youth_leagues_all', 'Youth World Leagues');
  1485. values.set('federation_leagues', 'Federation Leagues');
  1486. }
  1487.  
  1488.  
  1489. if (urlParams.get('type') === "world") {
  1490. values.set('leagues_all', 'Leagues');
  1491. values.set('world_leagues', 'World Leagues');
  1492. values.set('youth_leagues_all', 'Youth Leagues');
  1493. values.set('world_youth_leagues_all', 'Youth World Leagues');
  1494. values.set('federation_leagues', 'Federation Leagues');
  1495. }
  1496.  
  1497.  
  1498. if ((urlParams.get('type').includes("u")) && (!urlParams.get('type').includes("_"))) {
  1499. let actual_cat = urlParams.get('type').toUpperCase();
  1500. GM_setValue("actual_league_cat", actual_cat)
  1501. values.set('leagues_all', 'Leagues');
  1502. values.set('world_leagues_all', 'World Leagues');
  1503. values.set('youth_leagues', actual_cat + ' Youth Leagues');
  1504. values.set('world_youth_leagues_all', 'Youth World Leagues');
  1505. values.set('federation_leagues', 'Federation Leagues');
  1506. }
  1507.  
  1508.  
  1509. if ((urlParams.get('type').includes("u")) && (urlParams.get('type').includes("_"))) {
  1510. let actual_cat = urlParams.get('type').substring(0, 3).toUpperCase();
  1511. GM_setValue("actual_league_cat", actual_cat)
  1512. values.set('leagues_all', 'Leagues');
  1513. values.set('world_leagues_all', 'World Leagues');
  1514. values.set('youth_leagues_all', 'Youth Leagues');
  1515. values.set('world_youth_leagues', actual_cat + ' Youth World Leagues');
  1516. values.set('federation_leagues', 'Federation Leagues');
  1517. }
  1518. values.set('cup', 'Cups');
  1519. values.set('cup_u23', 'U23 Cups');
  1520. values.set('cup_u21', 'U21 Cups');
  1521. values.set('cup_u18', 'U18 Cups');
  1522. values.set('special_cup', 'Special Cups');
  1523.  
  1524. let contenidoNuevo = '<div id=testClick style="margin: 0 auto;">';
  1525.  
  1526.  
  1527. getNativeTableStyles();
  1528.  
  1529. let idProgress = "noProgress";
  1530. if (urlParams.get('type') === "senior") {
  1531. idProgress = "divProgress"
  1532. }
  1533.  
  1534.  
  1535. let widthTable = "1.5em"
  1536. ///MENU TABLE
  1537. contenidoNuevo += "<table id=showMenu style='margin: 0 auto;'><thead style='margin: 0 auto; background-color:" + GM_getValue("bg_native") + "; color:" + GM_getValue("color_native") + ";'><tr>";
  1538. contenidoNuevo += '<th style="text-align:center; margin: 0 auto; padding:4px;">Stats</th>'
  1539. contenidoNuevo +='<th style="text-align:center; margin: 0 auto; padding:4px;">Graph</th>';
  1540. contenidoNuevo += "<th style='text-align:center; margin: 0 auto; padding:4px;'>History</th>";
  1541. contenidoNuevo += "<th style='text-align:center; margin: 0 auto; padding:4px;'>Top Players</th></tr></thead>";
  1542. contenidoNuevo += "<tr>";
  1543. contenidoNuevo += "<td style='margin: 0 auto; text-align:center; padding:4px; max-width: " + widthTable + "; width:" + widthTable + ";'><img alt='' id='detailDivision' style='cursor:pointer;' src=https://statsxente.com/MZ1/View/Images/detail.png width=25 height=25/></td>";
  1544. contenidoNuevo += "<td style='margin: 0 auto; text-align:center; padding:4px; max-width:" + widthTable + "; width:" + widthTable + ";'><img alt='' id='graphDivision' style='cursor:pointer;' src=https://statsxente.com/MZ1/View/Images/report.png width=31 height=25/></td>";
  1545. if (idProgress === "noProgress") {
  1546. contenidoNuevo += "<td style='margin: 0 auto; text-align:center; padding:4px; max-width: " + widthTable + "; width: " + widthTable + ";'><img alt='' id='" + idProgress + "' style='cursor:pointer;' src=https://statsxente.com/MZ1/View/Images/graph_disabled.png width=25 height=25/></td>";
  1547. } else {
  1548. contenidoNuevo += "<td style='margin: 0 auto; text-align:center; padding:4px; max-width: " + widthTable + "; width: " + widthTable + ";'><img alt='' id='" + idProgress + "' style='cursor:pointer;' src=https://statsxente.com/MZ1/View/Images/graph.png width=25 height=25/></td>";
  1549. }
  1550. contenidoNuevo += "<td style='margin: 0 auto; text-align:center; padding:4px; max-width: " + widthTable + "; width: " + widthTable + ";'><img alt='' id='topPlayersDivision' style='cursor:pointer;' src=https://statsxente.com/MZ1/View/Images/top-10.png width=25 height=25/></td>";
  1551. contenidoNuevo += "</tr>";
  1552.  
  1553. let styleTable = " style='margin: 0 auto; display:none;'";
  1554. let styleIcon = ""
  1555. let styleSep = "style='padding-top:5px;'";
  1556.  
  1557. if (GM_getValue("show_league_selects") === true) {
  1558. styleTable = " style='margin: 0 auto;'";
  1559. styleIcon = " active"
  1560. styleSep = " style='display:none;'";
  1561. }
  1562.  
  1563.  
  1564. contenidoNuevo += "<tr><td></td><td colspan='2'>";
  1565. contenidoNuevo += '<div id="moreInfo" class="expandable-icon' + styleIcon + '" style="margin: 0 auto; cursor:pointer; background-color:' + GM_getValue("bg_native") + ';"><div id="line1" class="line"></div><div id="line2" class="line"></div></div></center>';
  1566. contenidoNuevo += "</td><td></td></tr>";
  1567. contenidoNuevo += "<tr><td colspan='5' id='separatorTd'" + styleSep + "></td></tr>";
  1568. contenidoNuevo += "</table></center>";
  1569. contenidoNuevo += '<table id=show3' + styleTable + '><tr><td><label>';
  1570.  
  1571. if ((urlParams.get('type') === 'senior') || (urlParams.get('type') === 'world')) {
  1572. if ("valor" === initialValues[urlParams.get('type')]) {
  1573. contenidoNuevo += '<input class="statsxente" type="checkbox" checked id="valor" value="Value">Value</label></td>';
  1574. } else {
  1575. contenidoNuevo += '<input class="statsxente" type="checkbox" id="valor" value="Value">Value</label></td>';
  1576. }
  1577. } else {
  1578. contenidoNuevo += '<input class="statsxente" type="checkbox" id="valor" value="Value">Value</label></td>';
  1579. }
  1580.  
  1581. values.forEach(function (valor, clave) {
  1582.  
  1583. if (clave === "valorUPSenior") {
  1584. contenidoNuevo += "</tr><tr>";
  1585. }
  1586.  
  1587. if (clave === "valor11") {
  1588. contenidoNuevo += "</tr><tr>";
  1589. }
  1590. if (clave === "elo") {
  1591. contenidoNuevo += "</tr><tr>";
  1592. }
  1593.  
  1594. if (clave === "leagues") {
  1595. contenidoNuevo += "</tr><tr>";
  1596. }
  1597.  
  1598. if (clave === "leagues_all") {
  1599. contenidoNuevo += "</tr><tr>";
  1600. }
  1601.  
  1602. if (clave === "cup") {
  1603. contenidoNuevo += "</tr><tr>";
  1604. }
  1605.  
  1606. if (clave === initialValues[urlParams.get('type')]) {
  1607. contenidoNuevo += '<td><label><input class="statsxente" type="checkbox" checked value="' + valor + '" id="' + clave + '">' + valor + '</label></td>';
  1608. } else {
  1609. contenidoNuevo += '<td><label><input class="statsxente" type="checkbox" value="' + valor + '" id="' + clave + '">' + valor + '</label></td>';
  1610. }
  1611. });
  1612.  
  1613. var cats_elo = {}
  1614. cats_elo["senior"] = "SENIOR";
  1615. cats_elo["world"] = "SENIOR";
  1616. cats_elo["u23"] = "U23";
  1617. cats_elo["u21"] = "U21";
  1618. cats_elo["u18"] = "U18";
  1619. cats_elo["u23_world"] = "U23";
  1620. cats_elo["u21_world"] = "U21";
  1621. cats_elo["u18_world"] = "U18";
  1622.  
  1623.  
  1624. var cats_temp=["SENIOR","U23","U21","U18"];
  1625. contenidoNuevo += "</tr>"
  1626. contenidoNuevo +="<tr style='margin: 0 auto; text-align: center;'>"
  1627. contenidoNuevo += '<td colspan="5"><label><input class="statsxente" type="checkbox" value="ELOCompare" id="ELOCompare">ELO Compare</label></td>';
  1628. contenidoNuevo +="</tr>"
  1629. contenidoNuevo +='<tr style="margin: 0 auto; text-align: center; display:none;" id="trELOCompare"><td colspan="5">Category: '
  1630. contenidoNuevo+='<select id="catSelect" style="background-color: '+GM_getValue("bg_native")+'; padding: 6px 3px; border-radius: 3px; width: 9em; border-color: white; color: '+GM_getValue("color_native")
  1631. contenidoNuevo+='; font-family: Roboto; font-weight: bold; font-size: revert;">'
  1632. for (let i = 0; i < cats_temp.length; i++) {
  1633. let tmp=""
  1634. if(cats_elo[urlParams.get('type')]===cats_temp[i]){
  1635. tmp="selected"
  1636. }
  1637. contenidoNuevo+="<option value='"+cats_temp[i]+"' "+tmp+">"+cats_temp[i]+"</option>"
  1638. }
  1639. contenidoNuevo +='</select> <button class="btn-save" style="color:'+GM_getValue("color_native")+'; background-color:'+GM_getValue("bg_native")+'; font-family: \'Roboto\'; font-weight:bold; font-size:revert;" id="eloCompareButton"><i class="bi bi-graph-up" style="font-style:normal;"> ELO Compare</i></button></td></tr>'
  1640. contenidoNuevo +="</table></center>"
  1641. contenidoNuevo += "</div></br>";
  1642. values.set('valor', 'Value');
  1643. let color=GM_getValue("bg_native")
  1644. let darkerColor = darkenColor(color, 25);
  1645. document.styleSheets[0].insertRule(
  1646. '.btn-save:hover { background-color: '+darkerColor+' !important; }',
  1647. document.styleSheets[0].cssRules.length
  1648. );
  1649.  
  1650. elems = document.getElementsByClassName("nice_table");
  1651. tabla = elems[0]
  1652. tabla.insertAdjacentHTML('beforebegin', contenidoNuevo);
  1653.  
  1654. document.getElementById("eloCompareButton").style.padding = "5px 3px";
  1655. document.getElementById("eloCompareButton").style.width = "9em";
  1656.  
  1657. document.getElementById("eloCompareButton").addEventListener('click', function () {
  1658. let elems = document.getElementsByClassName("nice_table");
  1659. let tabla = elems[0]
  1660. var link="https://statsxente.com/MZ1/Functions/graphLoader.php?graph=elo_compare&lang="+window.lang+"&category="+document.getElementById("catSelect").value+"&sport="+window.sport
  1661. var cont=0
  1662. for (var i = 0; i < tabla.rows.length; i++) {
  1663. var fila = tabla.rows[i];
  1664. if (fila.cells.length > 1) {
  1665. var checkboxes = fila.cells[1].querySelectorAll("input[type='checkbox']");
  1666. checkboxes.forEach(function(checkbox) {
  1667. if(checkbox.checked){
  1668. if(cont<5){
  1669. link+="&team_name"+cont+"="+encodeURIComponent(checkbox.value)+"&team_id"+cont+"="+checkbox.id
  1670. cont++;
  1671. }
  1672. }
  1673. });
  1674. }
  1675. }
  1676. openWindow(link, 0.95, 1.25);
  1677. });
  1678. document.getElementById("ELOCompare").addEventListener('click', function () {
  1679. let checkboxes = document.querySelectorAll('.statsxente');
  1680. checkboxes.forEach(function (checkbox) {
  1681. if (checkbox.id !== "ELOCompare") {
  1682. checkbox.checked = false;
  1683. }
  1684. });
  1685. if(!document.getElementById("eloCompareCol")){
  1686. let elems = document.getElementsByClassName("nice_table");
  1687. let tabla = elems[0]
  1688. for (let fila of tabla.rows) {
  1689. const nuevaCelda = fila.rowIndex === 0 ? document.createElement('th') : document.createElement('td');
  1690. if(fila.rowIndex>0){
  1691. let team_data=extractTeamData(fila.cells[1].getElementsByTagName('a'))
  1692. nuevaCelda.innerHTML = '<input class="statsxente1" type="checkbox" value="'+team_data[1]+'" id="'+team_data[0]+'">';
  1693. }
  1694.  
  1695. fila.insertBefore(nuevaCelda, fila.cells[1]);
  1696. if(fila.rowIndex==0){
  1697. fila.cells[1].id="eloCompareCol"
  1698. fila.cells[2].style.width="175px"
  1699. }
  1700. }
  1701. }else{
  1702. let elems = document.getElementsByClassName("nice_table");
  1703. let table = elems[0]
  1704. var th = document.getElementById("eloCompareCol");
  1705. var columnIndex = th.cellIndex;
  1706. for (var i = 0; i < table.rows.length; i++) {
  1707. var row = table.rows[i];
  1708. var cell = row.cells[columnIndex];
  1709. if (cell.style.display === 'none') {
  1710. cell.style.display = '';
  1711. th.style.fontWeight = 'normal';
  1712. } else {
  1713. cell.style.display = 'none';
  1714. th.style.fontWeight = 'bold';
  1715. }
  1716. }
  1717. }
  1718.  
  1719. if(document.getElementById("trELOCompare").style.display=="none"){
  1720. document.getElementById("trELOCompare").style.display="table-row";
  1721.  
  1722. }else{
  1723. document.getElementById("trELOCompare").style.display="none";
  1724. }
  1725.  
  1726. });
  1727.  
  1728. if (GM_getValue("show_league_selects") === true) {
  1729. document.getElementById("line2").style.transform = 'rotateZ(0deg)';
  1730. document.getElementById("line1").style.transform = 'rotateZ(180deg)';
  1731. document.getElementById("moreInfo").style.transform = 'rotateZ(0deg)';
  1732. }
  1733.  
  1734. values.forEach(function (valor, clave) {
  1735. let elemento = document.getElementById(clave);
  1736. elemento.addEventListener('click', handleClick);
  1737. });
  1738.  
  1739. let nuevaCeldaEncabezado = document.createElement("th");
  1740. nuevaCeldaEncabezado.textContent = values.get(initialValues[urlParams.get('type')]);
  1741. nuevaCeldaEncabezado.style.textAlign = 'center';
  1742. nuevaCeldaEncabezado.style.maxWidth = '6.5em';
  1743. nuevaCeldaEncabezado.style.width = '6.5em';
  1744. nuevaCeldaEncabezado.style.whiteSpace = 'nowrap';
  1745. nuevaCeldaEncabezado.style.overflow = 'hidden';
  1746. nuevaCeldaEncabezado.style.textOverflow = 'ellipsis';
  1747. document.getElementsByClassName("seriesHeader")[0].appendChild(nuevaCeldaEncabezado);
  1748.  
  1749. nuevaCeldaEncabezado = document.createElement("th");
  1750. nuevaCeldaEncabezado.textContent = "Stats Xente";
  1751. nuevaCeldaEncabezado.style.textAlign = 'center';
  1752. document.getElementsByClassName("seriesHeader")[0].appendChild(nuevaCeldaEncabezado);
  1753.  
  1754.  
  1755. if (tabla.getElementsByTagName("tbody")[0].innerHTML.includes("mazyar")) {
  1756. searchClassName = "responsive-hide"
  1757. }
  1758.  
  1759. let contIds = 0
  1760. let filasDatos = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  1761. for (let i = 0; i < filasDatos.length; i++) {
  1762. if (checkClassNameExists(tabla.rows[i + 1], searchClassName)) {
  1763. let celda = tabla.rows[i + 1].cells[1];
  1764. let team_data=extractTeamData(celda.getElementsByTagName("a"));
  1765. let id=team_data[0]
  1766. let equipo=team_data[1]
  1767. linkIds += "&idEquipo" + contIds + "=" + id
  1768. contIds++
  1769. celda.innerHTML += "<input type='hidden' id='team_" + id + "' value='" + equipo + "'/>"
  1770. }
  1771.  
  1772. }
  1773. let cat = cats[urlParams.get('type')]
  1774. let enlace = document.getElementById('league_tab_schedule');
  1775. let href = enlace.href;
  1776. let url = new URL(href);
  1777. let league_id = url.searchParams.get('sid');
  1778.  
  1779.  
  1780.  
  1781. ///DIV PROGRESS
  1782. setTimeout(function () {
  1783.  
  1784.  
  1785. if (idProgress !== "noProgress") {
  1786. (function (currentId, currentLSport, lang) {
  1787. document.getElementById("divProgress").addEventListener('click', function () {
  1788.  
  1789. let link = "https://statsxente.com/MZ1/Graficos/graficoProgresoDivision.php?idLiga=" + currentId + "&idioma=" + lang + "&divisa=" + GM_getValue("currency") + "&deporte=" + currentLSport;
  1790. openWindow(link, 0.95, 1.25);
  1791. });
  1792. })(league_id, window.lsport, window.lang);
  1793.  
  1794. }
  1795.  
  1796.  
  1797. (function () {
  1798. document.getElementById("moreInfo").addEventListener('click', function () {
  1799. document.getElementById("moreInfo").classList.toggle('active');
  1800.  
  1801. if (document.getElementById("moreInfo").classList.contains("active")) {
  1802. document.getElementById("line2").style.transform = 'rotateZ(0deg)';
  1803. document.getElementById("line1").style.transform = 'rotateZ(180deg)';
  1804. document.getElementById("moreInfo").style.transform = 'rotateZ(0deg)';
  1805. $('#separatorTd').fadeOut(1);
  1806. document.getElementById("separatorTd").style.paddingTop = "5px";
  1807. $('#show3').fadeIn('slow');
  1808. } else {
  1809. document.getElementById("line2").style.transform = 'rotateZ(45deg)';
  1810. document.getElementById("line1").style.transform = 'rotateZ(-45deg)';
  1811. document.getElementById("moreInfo").style.transform = 'rotateZ(45deg)';
  1812. $('#separatorTd').fadeIn(1);
  1813. $('#show3').fadeOut('slow');
  1814. }
  1815.  
  1816.  
  1817.  
  1818. });
  1819. })();
  1820.  
  1821. (function (currentId, currentLSport, lang, currentCat) {
  1822. document.getElementById("detailDivision").addEventListener('click', function () {
  1823. let url_ = "https://statsxente.com/MZ1/Functions/lecturaStatsDivisionesHistorico2.0.php"
  1824. if (window.sport === "hockey") {
  1825. url_ = "https://statsxente.com/MZ1/Functions/lecturaStatsDivisionesHockeyHistorico.php"
  1826. }
  1827.  
  1828. let link = url_ + "?tamper=yes&modal=yes&idLiga=" + currentId + "&idioma=" + lang + "&categoria=" + currentCat + "&season=75&season_actual=75";
  1829. openWindow(link, 0.95, 1.25);
  1830. });
  1831. })(league_id, window.lsport, window.lang, cat);
  1832.  
  1833. (function (currentId, sport, lang) {
  1834. document.getElementById("topPlayersDivision").addEventListener('click', function () {
  1835. let url_ = "https://statsxente.com/MZ1/Functions/tamper_top_players_division.php"
  1836. if (window.sport === "hockey") {
  1837. url_ = "https://statsxente.com/MZ1/Functions/tamper_top_players_division_hockey.php"
  1838. }
  1839. let link = url_ + "?league_id=" + currentId + "&sport=" + sport + "&category=" + cat + "&idioma=" + lang;
  1840. openWindow(link, 0.95, 1.25);
  1841. });
  1842. })(league_id, window.sport, window.lang, cat);
  1843.  
  1844. (function (currentId, currentLSport, lang, currentCat) {
  1845. document.getElementById("graphDivision").addEventListener('click', function () {
  1846. let url_sport = ""
  1847. if (window.sport === "hockey") {
  1848. url_sport = "Hockey"
  1849. }
  1850. let link = "https://statsxente.com/MZ1/View/filtroGraficoLinealDivisiones" + url_sport + ".php?tamper=yes&idLiga=" + currentId + "&idioma=" + lang + "&categoria=" + currentCat + "&season=75&season_actual=75&modal=yes&valor=nota";
  1851. openWindow(link, 0.95, 1.25);
  1852. });
  1853. })(league_id, window.lsport, window.lang, cat);
  1854.  
  1855.  
  1856. }, 200);
  1857.  
  1858. GM_xmlhttpRequest({
  1859. method: "GET",
  1860. url: "https://statsxente.com/MZ1/Functions/tamper_teams.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport + linkIds,
  1861. headers: {
  1862. "Content-Type": "application/json"
  1863. },
  1864. onload: function (response) {
  1865. let cat = window.cats[urlParams.get('type')]
  1866. let jsonResponse = JSON.parse(response.responseText);
  1867. teams_data = jsonResponse;
  1868. let filasDatos = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  1869. for (let i = 0; i < filasDatos.length; i++) {
  1870. if (checkClassNameExists(filasDatos[i], searchClassName)) {
  1871. let celda = filasDatos[i].cells[1];
  1872. let team_data=extractTeamData(celda.getElementsByTagName("a"));
  1873. let id=team_data[0]
  1874. let equipo=team_data[1]
  1875.  
  1876. let nuevaColumna = document.createElement("td");
  1877. let valor = 0;
  1878. if (jsonResponse[id] && jsonResponse[id][initialValues[urlParams.get('type')]] !== undefined) {
  1879. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[id][initialValues[urlParams.get('type')]]))
  1880. }
  1881. nuevaColumna.innerHTML = valor
  1882. nuevaColumna.style.textAlign = 'center';
  1883. filasDatos[i].appendChild(nuevaColumna);
  1884.  
  1885. let eloType = 1
  1886.  
  1887. if (window.sport === "soccer") { eloType = 2 }
  1888. if (cat.includes("SUB")) { eloType = 3 }
  1889.  
  1890.  
  1891. let flagSenior = 0, flagSub23 = 0, flagSub21 = 0, flagSub18 = 0;
  1892. if (jsonResponse[id]["elo"] > 0) { flagSenior = 1 }
  1893. if (jsonResponse[id]["elo23"] > 0) { flagSub23 = 1 }
  1894. if (jsonResponse[id]["elo21"] > 0) { flagSub21 = 1 }
  1895. if (jsonResponse[id]["elo18"] > 0) { flagSub18 = 1 }
  1896.  
  1897. let buttonDisplay = "display:block;";
  1898. nuevaColumna = document.createElement("td");
  1899. nuevaColumna.style.margin = '0 auto';
  1900. nuevaColumna.style.textAlign = 'center';
  1901. let iner = "<img alt='' src='https://statsxente.com/MZ1/View/Images/detail.png' width='" + GM_getValue("league_image_size") + "px' height='" + GM_getValue("league_image_size") + "px' id='but" + id + "' style='cursor:pointer;'/>";
  1902. if (GM_getValue("league_graph_button") === "checked") {
  1903. buttonDisplay = ""
  1904. } else {
  1905. buttonDisplay = "display:none;";
  1906. }
  1907. iner += "<img alt='' src='https://statsxente.com/MZ1/View/Images/graph.png' width='" + GM_getValue("league_image_size") + "px' height='" + GM_getValue("league_image_size") + "px' id='but1" + id + "' style='cursor:pointer; " + buttonDisplay + "'/>";
  1908.  
  1909. if (GM_getValue("league_report_button") === "checked") {
  1910. buttonDisplay = ""
  1911. } else {
  1912. buttonDisplay = "display:none;";
  1913. }
  1914. iner += "<img alt='' src='https://statsxente.com/MZ1/View/Images/report.png' width='" + GM_getValue("league_image_size") + "px' height='" + GM_getValue("league_image_size") + "px' id='but2" + id + "' style='cursor:pointer; " + buttonDisplay + "'/>";
  1915.  
  1916. if (GM_getValue("league_calendar_button") === "checked") {
  1917. buttonDisplay = ""
  1918. } else {
  1919. buttonDisplay = "display:none;";
  1920. }
  1921. iner += " <img alt='' src='https://statsxente.com/MZ1/View/Images/calendar.png' width='" + GM_getValue("league_image_size") + "px' height='" + GM_getValue("league_image_size") + "px' id='but3" + id + "' style='cursor:pointer; " + buttonDisplay + "'/>";
  1922. cat = cats[urlParams.get('type')]
  1923. nuevaColumna.innerHTML = iner
  1924. filasDatos[i].appendChild(nuevaColumna);
  1925. nuevaColumna = document.createElement("td");
  1926.  
  1927.  
  1928. (function (currentId, currentLSport, lang) {
  1929. document.getElementById("but1" + currentId).addEventListener('click', function () {
  1930. let link = "https://statsxente.com/MZ1/Functions/graphLoader.php?graph=team_progress&idEquipo=" + currentId + "&idioma=" + lang + "&divisa=" + GM_getValue("currency") + "&deporte=" + currentLSport;
  1931. openWindow(link, 0.95, 1.25);
  1932. });
  1933. })(id, window.lsport, window.lang);
  1934.  
  1935. (function (currentId, currentLSport, lang) {
  1936. document.getElementById("but2" + currentId).addEventListener('click', function () {
  1937. let src = "filtroGraficoEquiposHistoricoHockey";
  1938. if (currentLSport === "F") {
  1939. src = "filtroGraficoLinealEquiposHistorico";
  1940. }
  1941. let link = "https://statsxente.com/MZ1/View/" + src + ".php?tamper=yes&categoria=" + cat + "&idEquipo=" + currentId + "&idioma=" + lang + "&modal=yes&valor=nota&season=75&season_actual=75&equipo=-"
  1942. openWindow(link, 0.95, 1.25);
  1943. });
  1944. })(id, window.lsport, window.lang, cat);
  1945.  
  1946. (function (currentId, currentEquipo, currentCat, currentSport, lang) {
  1947. document.getElementById("but" + currentId).addEventListener('click', function () {
  1948.  
  1949. let link = "https://statsxente.com/MZ1/View/filtroStatsEquiposHistorico.php?tamper=no&idEquipo=" + currentId + "&idioma=" + lang + "&modal=yes&deporte=" + currentSport + "&season=77&season_actual=77&categoria=" + currentCat + "&equipo=" + currentEquipo + "&cerrar=no";
  1950. openWindow(link, 0.95, 1.25);
  1951. });
  1952. })(id, equipo, cat, window.sport, window.lang);
  1953.  
  1954. (function (currentId, type, currentCat, currentSport, lang, flagS, flagS23, flagS21, flagS18) {
  1955. document.getElementById("but3" + currentId).addEventListener('click', function () {
  1956. let link = "https://statsxente.com/MZ1/Graficos/graficoRachaEquipoELO.php?tamper=yes&team_id=" + currentId + "&idioma=" + lang + "&deporte=" + currentSport + "&type=" + type + "&cat=" + currentCat + "&flagSenior=" +
  1957. flagS + "&flagSub23=" + flagS23 + "&flagSub21=" + flagS21 + "&flagSub18=" + flagS18;
  1958. openWindow(link, 0.95, 1.25);
  1959. });
  1960. })(id, eloType, cats_elo[cat], window.sport, window.lang, flagSenior, flagSub23, flagSub21, flagSub18);
  1961.  
  1962. }
  1963.  
  1964. }
  1965.  
  1966. let thead = document.getElementsByClassName("seriesHeader")[0]
  1967. let ths = thead.querySelectorAll("th");
  1968. ths.forEach(function (th, index) {
  1969. th.addEventListener("click", function () {
  1970. if (index === 1) {
  1971. ordenarTablaText(index, true, "nice_table",true);
  1972. } else {
  1973. ordenarTabla(index, true, "nice_table",true);
  1974. }
  1975.  
  1976. });
  1977. });
  1978. }
  1979. });
  1980. }
  1981. //Clash leagues page
  1982. function clashLeagues() {
  1983.  
  1984. document.getElementById("division-select").addEventListener('change', function () {
  1985. setTimeout(function () {
  1986. clashLeagues();
  1987. }, 2000);
  1988. });
  1989.  
  1990.  
  1991. document.getElementById("season-select").addEventListener('change', function () {
  1992. setTimeout(function () {
  1993. clashLeagues();
  1994. }, 2000);
  1995. });
  1996.  
  1997.  
  1998.  
  1999.  
  2000. let elems = document.getElementsByClassName("nice_table");
  2001. let tabla = elems[0]
  2002. let thSegundo = tabla.querySelector("thead th:nth-child(2)");
  2003. thSegundo.style.width = "250px";
  2004. let values = new Map();
  2005. values.set('valueLM', 'LM Value');
  2006. values.set('elo', 'ELO Score');
  2007. values.set('teams_count', 'Number of teams');
  2008. values.set('table_index', 'Rank Position');
  2009.  
  2010. let contenidoNuevo = '<div id=testClick style="margin: 0 auto; text-align:center;">'
  2011. getNativeTableStyles();
  2012.  
  2013. ///MENU TABLE
  2014. contenidoNuevo += "<table id=showMenu style='margin: 0 auto; text-align:center;'><thead style='background-color:" + GM_getValue("bg_native") + "; color:" + GM_getValue("color_native") + ";'><tr>";
  2015. contenidoNuevo += '<th style="padding:4px; margin: 0 auto; text-align:center;" colspan="3">Values</th></tr></thead>';
  2016. contenidoNuevo += "<tr>";
  2017. contenidoNuevo += "</tr></table>";
  2018. contenidoNuevo += '<table id=show3 style="margin: 0 auto; text-align:center;"><tr><td><label>';
  2019. contenidoNuevo += '<input class="statsxente" type="checkbox" checked id="value" value="Value">Value</label></td>';
  2020.  
  2021.  
  2022. values.forEach(function (valor, clave) {
  2023. contenidoNuevo += '<td><label><input class="statsxente" type="checkbox" value="' + valor + '" id="' + clave + '">' + valor + '</label></td>';
  2024. });
  2025. contenidoNuevo += "</tr></table>"
  2026. contenidoNuevo += "</div></br>";
  2027.  
  2028. values.set('value', 'Value');
  2029. elems = document.getElementsByClassName("nice_table");
  2030. tabla = elems[0]
  2031. tabla.insertAdjacentHTML('beforebegin', contenidoNuevo);
  2032.  
  2033.  
  2034.  
  2035. values.forEach(function (valor, clave) {
  2036.  
  2037. let elemento = document.getElementById(clave);
  2038. elemento.addEventListener('click', handleClickClash);
  2039.  
  2040. });
  2041. let nuevaCeldaEncabezado = document.createElement("th");
  2042. nuevaCeldaEncabezado.textContent = "Value";
  2043. nuevaCeldaEncabezado.style.textAlign = 'center';
  2044.  
  2045. document.getElementsByClassName("nice_table")[0].querySelector('thead').querySelector('tr').appendChild(nuevaCeldaEncabezado);
  2046.  
  2047. nuevaCeldaEncabezado = document.createElement("th");
  2048. nuevaCeldaEncabezado.textContent = "Stats Xente";
  2049. nuevaCeldaEncabezado.style.textAlign = 'center';
  2050. document.getElementsByClassName("nice_table")[0].querySelector('thead').querySelector('tr').appendChild(nuevaCeldaEncabezado);
  2051.  
  2052.  
  2053. let contIds = 0
  2054. let linkIds = ""
  2055. let filasDatos = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  2056. for (let i = 0; i < filasDatos.length; i++) {
  2057. let celda = tabla.rows[i + 1].cells[1];
  2058. let imagen = celda.querySelector('img');
  2059. let url = new URL(imagen.src);
  2060. let id = url.searchParams.get('fid');
  2061. linkIds += "&id" + contIds + "=" + id
  2062. contIds++
  2063. }
  2064.  
  2065.  
  2066. GM_xmlhttpRequest({
  2067. method: "GET",
  2068. url: "https://statsxente.com/MZ1/Functions/tamper_federations.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport + linkIds,
  2069. headers: {
  2070. "Content-Type": "application/json"
  2071. },
  2072. onload: function (response) {
  2073. let jsonResponse = JSON.parse(response.responseText);
  2074. teams_data = jsonResponse;
  2075. let filasDatos = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  2076. for (let i = 0; i < filasDatos.length; i++) {
  2077. let celda = tabla.rows[i + 1].cells[1];
  2078. let imagen = celda.querySelector('img');
  2079. let url = new URL(imagen.src);
  2080. let id = url.searchParams.get('fid');
  2081. let nuevaColumna = document.createElement("td");
  2082. let valor = 0
  2083.  
  2084. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[id]["value"]))
  2085. nuevaColumna.innerHTML = valor
  2086. nuevaColumna.style.textAlign = 'center';
  2087. filasDatos[i].appendChild(nuevaColumna);
  2088.  
  2089.  
  2090. nuevaColumna = document.createElement("td");
  2091. nuevaColumna.style.margin = '0 auto';
  2092. nuevaColumna.style.textAlign = 'center';
  2093. nuevaColumna.innerHTML = "<img alt='' src='https://statsxente.com/MZ1/View/Images/detail.png' width='20px' height='20px' id='but" + id + "' style='cursor:pointer;'/>"
  2094. filasDatos[i].appendChild(nuevaColumna);
  2095.  
  2096.  
  2097. (function (currentId, currentSport, lang) {
  2098. document.getElementById("but" + currentId).addEventListener('click', function () {
  2099.  
  2100. let link = "https://statsxente.com/MZ1/Functions/loadClashFederationDetail.php?tamper=yes&idioma=" +
  2101. lang + "&modal_to_close=myModal&divisa=" + GM_getValue("currency") + "&fid=" + currentId + "&sport=" + currentSport + "&modal=yes";
  2102. openWindow(link, 0.95, 1.25);
  2103. });
  2104. })(id, window.sport, window.lang);
  2105.  
  2106. }
  2107. }
  2108. });
  2109.  
  2110. let thead = document.getElementsByClassName("nice_table")[0].querySelector('thead')
  2111. let ths = thead.querySelectorAll("th");
  2112. ths.forEach(function (th, index) {
  2113. th.addEventListener("click", function () {
  2114. ordenarTabla(index, true, "nice_table",true);
  2115. });
  2116. });
  2117. }
  2118.  
  2119.  
  2120. //Cups and FL's page
  2121. async function friendlyCupsAndLeagues() {
  2122.  
  2123. let urlParams = new URLSearchParams(window.location.search);
  2124. let age_restriction
  2125. let idComp="null"
  2126. let link = "https://www.managerzone.com" + document.getElementById("ui-id-1").getAttribute('href')
  2127. if (urlParams.get('fsid')) {
  2128. var fl_data= await fetchExistsFL(urlParams.get('fsid'))
  2129. idComp=fl_data['id']
  2130. age_restriction = await fetchAgeRestriction(link);
  2131. } else {
  2132. age_restriction = await fetchCupAgeRestriction(link);
  2133. }
  2134.  
  2135. let detected_cat = "senior"
  2136.  
  2137. if (age_restriction !== "none") {
  2138.  
  2139.  
  2140. switch (age_restriction) {
  2141. case "U23":
  2142. detected_cat = "u23"
  2143. break;
  2144. case "U21":
  2145. detected_cat = "u21"
  2146. break;
  2147. case "U18":
  2148. detected_cat = "u18"
  2149. break;
  2150. }
  2151.  
  2152. }
  2153.  
  2154.  
  2155.  
  2156. let initialValues = {};
  2157. initialValues["senior"] = GM_getValue("league_default_senior");
  2158. initialValues["world"] = GM_getValue("league_default_senior");
  2159. initialValues["u23"] = GM_getValue("league_default_u23");
  2160. initialValues["u21"] = GM_getValue("league_default_u21");
  2161. initialValues["u18"] = GM_getValue("league_default_u18");
  2162. initialValues["u23_world"] = GM_getValue("league_default_u23");
  2163. initialValues["u21_world"] = GM_getValue("league_default_u21");
  2164. initialValues["u18_world"] = GM_getValue("league_default_u18");
  2165.  
  2166. let linkIds = ""
  2167. let elems = document.getElementsByClassName("nice_table");
  2168. let tabla = elems[0]
  2169. let thSegundo = tabla.querySelector("thead th:nth-child(2)");
  2170. thSegundo.style.width = "250px";
  2171.  
  2172.  
  2173. let values = new Map();
  2174. values.set('valor23', 'U23 Value');
  2175. values.set('valor21', 'U21 Value');
  2176. values.set('valor18', 'U18 Value');
  2177. values.set('salario', 'Salary');
  2178. values.set('valorUPSenior', 'LM Value');
  2179. values.set('valorUPSUB23', 'U23 LM Value');
  2180. values.set('valorUPSUB21', 'U21 LM Value');
  2181. values.set('valorUPSUB18', 'U18 LM Value');
  2182. values.set('edad', 'Age');
  2183. if (window.sport === "soccer") {
  2184. values.set('valor11', 'TOP 11');
  2185. values.set('valor11_23', 'U23 TOP 11');
  2186. values.set('valor11_21', 'U21 TOP 11');
  2187. values.set('valor11_18', 'U18 TOP 11');
  2188. } else {
  2189. values.set('valor11', 'TOP 21');
  2190. values.set('valor11_23', 'U23 TOP 21');
  2191. values.set('valor11_21', 'U21 TOP 21');
  2192. values.set('valor11_18', 'U18 TOP 21');
  2193. }
  2194.  
  2195. values.set('noNac', 'Foreigners');
  2196. values.set('elo', 'ELO Score');
  2197. values.set('elo23', 'U23 ELO Score');
  2198. values.set('elo21', 'U21 ELO Score');
  2199. values.set('elo18', 'U18 ELO Score');
  2200. values.set('numJugadores', 'Number of players');
  2201. values.set('leagues', 'Leagues');
  2202. values.set('world_leagues_all', 'World Leagues');
  2203. values.set('youth_leagues_all', 'Youth Leagues');
  2204. values.set('world_youth_leagues_all', 'Youth World Leagues');
  2205. values.set('federation_leagues', 'Federation Leagues');
  2206. values.set('cup', 'Cups');
  2207. values.set('cup_u23', 'U23 Cups');
  2208. values.set('cup_u21', 'U21 Cups');
  2209. values.set('cup_u18', 'U18 Cups');
  2210. values.set('special_cup', 'Special Cups');
  2211.  
  2212. let contenidoNuevo = '<div id="testClick" style="margin: 0 auto; text-align:center;">'
  2213. getNativeTableStyles();
  2214.  
  2215. ///MENU TABLE
  2216. contenidoNuevo += "<table id=showMenu style='margin: 0 auto; text-align:center;'><thead style='background-color:" + GM_getValue("bg_native") + "; color:" + GM_getValue("color_native") + ";'><tr>";
  2217. contenidoNuevo += '<th style="padding:4px; margin: 0 auto; text-align:center;" colspan="4">Stats Xente</th>';
  2218. contenidoNuevo += "</tr></thead>";
  2219. let styleTable = " style='display:none;'";
  2220. let styleIcon = ""
  2221. let styleSep = "style='padding-top:5px;'";
  2222.  
  2223. if (GM_getValue("show_league_selects") === true) {
  2224. styleTable = " style='margin: 0 auto; text-align:left;'";
  2225. styleIcon = " active"
  2226. styleSep = " style='display:none;'";
  2227.  
  2228. }
  2229.  
  2230. contenidoNuevo += "<tr><td></td><td style='padding-top:5px' colspan='2'>";
  2231. contenidoNuevo += '<div id="moreInfo" class="expandable-icon' + styleIcon + '" style="margin: 0 auto; text-align:center; cursor:pointer; background-color:' + GM_getValue("bg_native") + ';"><div id="line1" class="line"></div><div id="line2" class="line"></div></div></center>';
  2232. contenidoNuevo += "</td><td></td></tr>";
  2233. contenidoNuevo += "<tr><td colspan='5' id='separatorTd'" + styleSep + "></td></tr>";
  2234. contenidoNuevo += "</table>";
  2235.  
  2236.  
  2237. contenidoNuevo += '<table id=show3' + styleTable + '><tr><td><label>';
  2238.  
  2239. if ("valor" === initialValues[detected_cat]) {
  2240. contenidoNuevo += '<input class="statsxente" type="checkbox" checked id="valor" value="Value">Value</label></td>';
  2241. } else {
  2242. contenidoNuevo += '<input class="statsxente" type="checkbox" id="valor" value="Value">Value</label></td>';
  2243. }
  2244.  
  2245.  
  2246. values.forEach(function (valor, clave) {
  2247.  
  2248. if (clave === "valorUPSenior") {
  2249. contenidoNuevo += "</tr><tr>";
  2250. }
  2251.  
  2252. if (clave === "valor11") {
  2253. contenidoNuevo += "</tr><tr>";
  2254. }
  2255. if (clave === "elo") {
  2256. contenidoNuevo += "</tr><tr>";
  2257. }
  2258.  
  2259. if (clave === "leagues") {
  2260. contenidoNuevo += "</tr><tr>";
  2261. }
  2262.  
  2263. if (clave === "leagues_all") {
  2264. contenidoNuevo += "</tr><tr>";
  2265. }
  2266.  
  2267. if (clave === "cup") {
  2268. contenidoNuevo += "</tr><tr>";
  2269. }
  2270.  
  2271. if (clave === initialValues[detected_cat]) {
  2272. contenidoNuevo += '<td><label><input class="statsxente" type="checkbox" checked value="' + valor + '" id="' + clave + '">' + valor + '</label></td>';
  2273. } else {
  2274. contenidoNuevo += '<td><label><input class="statsxente" type="checkbox" value="' + valor + '" id="' + clave + '">' + valor + '</label></td>';
  2275. }
  2276. });
  2277. contenidoNuevo += "</tr></table></center>"
  2278. contenidoNuevo += "</div></br>";
  2279.  
  2280.  
  2281. if(idComp!=="null"){
  2282.  
  2283. contenidoNuevo +="<table style='width:80%; margin: 0 auto; text-align:center;'><tr>"
  2284. let color=GM_getValue("bg_native")
  2285. contenidoNuevo +='<td><button class="btn-comp-fed" style="color:'+GM_getValue("color_native")+'; background-color:'+GM_getValue("bg_native")+'; font-family: \'Roboto\'; font-weight:bold; font-size:revert;" id="todos">All against all</button></td>'
  2286. contenidoNuevo += '<td><button class="btn-comp-fed" style="color:'+GM_getValue("color_native")+'; background-color:'+GM_getValue("bg_native")+'; font-family: \'Roboto\'; font-weight:bold; font-size:revert;" id="directosSIN">Direct confrontations [Without ties]</button></td>'
  2287. contenidoNuevo += '<td><button class="btn-comp-fed" style="color:'+GM_getValue("color_native")+'; background-color:'+GM_getValue("bg_native")+'; font-family: \'Roboto\'; font-weight:bold; font-size:revert;" id="directosCON">Direct confrontations [With ties]</button></td>'
  2288. contenidoNuevo +="</tr>"
  2289.  
  2290. contenidoNuevo += '<tr><td colspan="3"><button class="btn-comp-fed" style="color:'+GM_getValue("color_native")+'; background-color:'+GM_getValue("bg_native")+'; font-family: \'Roboto\'; font-weight:bold; font-size:revert;" id="desgloseSIN">Users Points [Without ties]</button>'
  2291. contenidoNuevo += '&nbsp;<button class="btn-comp-fed" style="color:'+GM_getValue("color_native")+'; background-color:'+GM_getValue("bg_native")+'; font-family: \'Roboto\'; font-weight:bold; font-size:revert;" id="desgloseCON">Users Points [With ties]</button></td>'
  2292.  
  2293. contenidoNuevo +="</tr>"
  2294.  
  2295. contenidoNuevo +="</table></br>"
  2296.  
  2297.  
  2298.  
  2299. let darkerColor = darkenColor(color, 25);
  2300.  
  2301. document.styleSheets[0].insertRule(
  2302. '.btn-comp-fed:hover { background-color: '+darkerColor+' !important; }',
  2303. document.styleSheets[0].cssRules.length
  2304. );
  2305.  
  2306. values.set('valor', 'Value');
  2307. elems = document.getElementsByClassName("nice_table");
  2308. tabla = elems[0]
  2309. tabla.insertAdjacentHTML('beforebegin', contenidoNuevo);
  2310.  
  2311.  
  2312. ///COM FED BUTTONS
  2313. document.getElementById("todos").addEventListener('click', function () {
  2314. let link = "https://statsxente.com/MZ1/View/FEDCOMP_ContraTodos_VIEW.php?tamper=yes&id="+idComp+"&idioma="+ window.lang
  2315. openWindow(link, 0.75, 1.1);
  2316. });
  2317. document.getElementById("directosSIN").addEventListener('click', function () {
  2318. let link = "https://statsxente.com/MZ1/View/FEDCOMP_Directos_VIEW.php?tamper=yes&id="+idComp+"&idioma="+ window.lang
  2319. openWindow(link, 0.75, 1.1);
  2320. });
  2321. document.getElementById("directosCON").addEventListener('click', function () {
  2322. let link = "https://statsxente.com/MZ1/View/FEDCOMP_DirectosEmpates_VIEW.php?tamper=yes&id="+idComp+"&idioma="+ window.lang
  2323. openWindow(link, 0.75, 1.1);
  2324. });
  2325.  
  2326. document.getElementById("desgloseSIN").addEventListener('click', function () {
  2327. let link = "https://statsxente.com/MZ1/Lecturas/getDesglosePuntosFede.php?tamper=yes&idComp="+idComp+"&idioma="+ window.lang+"&idLiga="+urlParams.get('fsid')
  2328. openWindow(link, 0.75, 1.1);
  2329. });
  2330.  
  2331. document.getElementById("desgloseCON").addEventListener('click', function () {
  2332. let link = "https://statsxente.com/MZ1/Lecturas/getDesglosePuntosFedeEmpates.php?tamper=yes&idComp="+idComp+"&idioma="+ window.lang+"&idLiga="+urlParams.get('fsid')
  2333. openWindow(link, 0.75, 1.1);
  2334. });
  2335.  
  2336. }else{
  2337.  
  2338. values.set('valor', 'Value');
  2339. elems = document.getElementsByClassName("nice_table");
  2340. tabla = elems[0]
  2341. tabla.insertAdjacentHTML('beforebegin', contenidoNuevo);
  2342.  
  2343. }
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349. if (GM_getValue("show_league_selects") === true) {
  2350.  
  2351. document.getElementById("line2").style.transform = 'rotateZ(0deg)';
  2352. document.getElementById("line1").style.transform = 'rotateZ(180deg)';
  2353. document.getElementById("moreInfo").style.transform = 'rotateZ(0deg)';
  2354. }
  2355.  
  2356.  
  2357. values.forEach(function (valor, clave) {
  2358.  
  2359. let elemento = document.getElementById(clave);
  2360. elemento.addEventListener('click', handleClick);
  2361.  
  2362. });
  2363.  
  2364. let thWidth="7.5em"
  2365.  
  2366. if(idComp!=="null"){
  2367. thWidth="5.5em"
  2368. }
  2369.  
  2370. let nuevaCeldaEncabezado = document.createElement("th");
  2371. nuevaCeldaEncabezado.textContent = values.get(initialValues[detected_cat]);
  2372. nuevaCeldaEncabezado.style.textAlign = 'center';
  2373. nuevaCeldaEncabezado.style.maxWidth = thWidth;
  2374. nuevaCeldaEncabezado.style.width = thWidth;
  2375. nuevaCeldaEncabezado.style.whiteSpace = 'nowrap';
  2376. nuevaCeldaEncabezado.style.overflow = 'hidden';
  2377. nuevaCeldaEncabezado.style.textOverflow = 'ellipsis';
  2378.  
  2379. let ser = document.getElementsByClassName("seriesHeader")
  2380.  
  2381.  
  2382. let table_index = 0;
  2383. for (let kl = 0; kl < ser.length; kl++) {
  2384. if (document.getElementsByClassName("seriesHeader")[kl].parentNode.parentNode.className === "nice_table") {
  2385. table_index = kl
  2386. }
  2387.  
  2388.  
  2389. }
  2390.  
  2391. var widthTeam="180px"
  2392.  
  2393. if(idComp!=="null"){
  2394. widthTeam="150px";
  2395. }
  2396.  
  2397.  
  2398. document.getElementsByClassName("seriesHeader")[table_index].cells[1].style.width = widthTeam
  2399. document.getElementsByClassName("seriesHeader")[table_index].appendChild(nuevaCeldaEncabezado);
  2400.  
  2401. if(idComp!=="null"){
  2402.  
  2403. let nuevaColumna1 = document.getElementsByClassName("seriesHeader")[table_index].insertCell(2);
  2404. nuevaColumna1.outerHTML = "<th>Federation</th>"
  2405. nuevaColumna1.style.textAlign = 'center';
  2406.  
  2407.  
  2408. let tds = document.querySelectorAll('.nice_table td');
  2409. let ths = document.querySelectorAll('.nice_table th');
  2410.  
  2411. tds.forEach(td => {
  2412. td.style.paddingLeft = "3px";
  2413. td.style.paddingRight = "3px";
  2414. });
  2415.  
  2416. ths.forEach(th => {
  2417. th.style.paddingLeft = "3px";
  2418. th.style.paddingRight = "3px";
  2419. });
  2420.  
  2421. }
  2422.  
  2423.  
  2424. nuevaCeldaEncabezado = document.createElement("th");
  2425. nuevaCeldaEncabezado.textContent = "Stats Xente";
  2426. nuevaCeldaEncabezado.style.textAlign = 'center';
  2427. document.getElementsByClassName("seriesHeader")[table_index].appendChild(nuevaCeldaEncabezado);
  2428.  
  2429.  
  2430. if (tabla.getElementsByTagName("tbody")[0].innerHTML.includes("mazyar")) {
  2431. searchClassName = "responsive-hide"
  2432. }
  2433.  
  2434. let contIds = 0
  2435. let filasDatos = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  2436. for (let i = 0; i < filasDatos.length; i++) {
  2437. if (checkClassNameExists(tabla.rows[i + 1], searchClassName)) {
  2438. let celda = tabla.rows[i + 1].cells[1];
  2439. let team_data=extractTeamData(celda.getElementsByTagName("a"));
  2440. let id=team_data[0]
  2441. let equipo=team_data[1]
  2442.  
  2443. linkIds += "&idEquipo" + contIds + "=" + id
  2444. contIds++
  2445. celda.innerHTML += "<input type='hidden' id='team_" + id + "' value='" + equipo + "'/>"
  2446. }
  2447.  
  2448. }
  2449.  
  2450.  
  2451.  
  2452. ///DIV PROGRESS
  2453. setTimeout(function () {
  2454.  
  2455.  
  2456. (function () {
  2457. document.getElementById("moreInfo").addEventListener('click', function () {
  2458. document.getElementById("moreInfo").classList.toggle('active');
  2459.  
  2460. if (document.getElementById("moreInfo").classList.contains("active")) {
  2461. document.getElementById("line2").style.transform = 'rotateZ(0deg)';
  2462. document.getElementById("line1").style.transform = 'rotateZ(180deg)';
  2463. document.getElementById("moreInfo").style.transform = 'rotateZ(0deg)';
  2464. $('#separatorTd').fadeOut(1);
  2465. document.getElementById("separatorTd").style.paddingTop = "5px";
  2466. $('#show3').fadeIn('slow');
  2467. } else {
  2468. document.getElementById("line2").style.transform = 'rotateZ(45deg)';
  2469. document.getElementById("line1").style.transform = 'rotateZ(-45deg)';
  2470. document.getElementById("moreInfo").style.transform = 'rotateZ(45deg)';
  2471. $('#separatorTd').fadeIn(1);
  2472. $('#show3').fadeOut('slow');
  2473. }
  2474.  
  2475.  
  2476.  
  2477. });
  2478. })();
  2479.  
  2480. }, 200);
  2481.  
  2482. GM_xmlhttpRequest({
  2483. method: "GET",
  2484. url: "https://statsxente.com/MZ1/Functions/tamper_teams.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport + linkIds,
  2485. headers: {
  2486. "Content-Type": "application/json"
  2487. },
  2488. onload: function (response) {
  2489. let jsonResponse = JSON.parse(response.responseText);
  2490. teams_data = jsonResponse;
  2491. let filasDatos = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  2492. for (let i = 0; i < filasDatos.length; i++) {
  2493. if (checkClassNameExists(filasDatos[i], searchClassName)) {
  2494. let celda = filasDatos[i].cells[1]
  2495. let team_data=extractTeamData(celda.getElementsByTagName("a"));
  2496. let id=team_data[0]
  2497. let equipo=team_data[1]
  2498.  
  2499. let nuevaColumna = document.createElement("td");
  2500. let valor = 0;
  2501.  
  2502. if (jsonResponse[id] && jsonResponse[id][initialValues[detected_cat]] !== undefined) {
  2503. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[id][initialValues[detected_cat]]))
  2504. }
  2505. nuevaColumna.innerHTML = valor
  2506. nuevaColumna.style.textAlign = 'center';
  2507. filasDatos[i].appendChild(nuevaColumna);
  2508.  
  2509.  
  2510. if(idComp!=="null"){
  2511. let nuevaColumna1 = filasDatos[i].insertCell(2);
  2512. nuevaColumna1.innerHTML = "<img src='https://www.managerzone.com/dynimg/pic.php?type=federation&fid="+fl_data["federations"][fl_data['teams'][id]['nombreFede']]['idFede']+"&size=small&sport=soccer' width='10px' height='10px'/> <span style='color:red;'>"+fl_data['teams'][id]['nombreFede']+"</span>";
  2513. nuevaColumna1.style.textAlign = 'left';
  2514. }
  2515.  
  2516. let eloType = 1
  2517. if (window.sport === "soccer") { eloType = 2 }
  2518. let cats_elo = {}
  2519. cats_elo["senior"] = "SENIOR";
  2520. cats_elo["seniorw"] = "SENIOR";
  2521. cats_elo["SUB23"] = "U23";
  2522. cats_elo["SUB21"] = "U21";
  2523. cats_elo["SUB18"] = "U18";
  2524. cats_elo["SUB23w"] = "U23";
  2525. cats_elo["SUB21w"] = "U21";
  2526. cats_elo["SUB18w"] = "U18";
  2527.  
  2528. let cat = cats[detected_cat]
  2529.  
  2530.  
  2531. let flagSenior = 0, flagSub23 = 0, flagSub21 = 0, flagSub18 = 0;
  2532. if (jsonResponse[id]["elo"] > 0) { flagSenior = 1 }
  2533. if (jsonResponse[id]["elo23"] > 0) { flagSub23 = 1 }
  2534. if (jsonResponse[id]["elo21"] > 0) { flagSub21 = 1 }
  2535. if (jsonResponse[id]["elo18"] > 0) { flagSub18 = 1 }
  2536.  
  2537. let buttonDisplay = "display:block;";
  2538. nuevaColumna = document.createElement("td");
  2539. nuevaColumna.style.margin = '0 auto';
  2540. nuevaColumna.style.textAlign = 'center';
  2541. let iner = "<img alt='' src='https://statsxente.com/MZ1/View/Images/detail.png' width='" + GM_getValue("league_image_size") + "px' height='" + GM_getValue("league_image_size") + "px' id='but" + id + "' style='cursor:pointer;'/>";
  2542. if (GM_getValue("league_graph_button") === "checked") {
  2543. buttonDisplay = ""
  2544. } else {
  2545. buttonDisplay = "display:none;";
  2546. }
  2547. iner += "<img alt='' src='https://statsxente.com/MZ1/View/Images/graph.png' width='" + GM_getValue("league_image_size") + "px' height='" + GM_getValue("league_image_size") + "px' id='but1" + id + "' style='cursor:pointer; " + buttonDisplay + "'/>";
  2548.  
  2549. if (GM_getValue("league_report_button") === "checked") {
  2550. buttonDisplay = ""
  2551. } else {
  2552. buttonDisplay = "display:none;";
  2553. }
  2554. iner += "<img alt='' src='https://statsxente.com/MZ1/View/Images/report.png' width='" + GM_getValue("league_image_size") + "px' height='" + GM_getValue("league_image_size") + "px' id='but2" + id + "' style='cursor:pointer; " + buttonDisplay + "'/>";
  2555.  
  2556. if (GM_getValue("league_calendar_button") === "checked") {
  2557. buttonDisplay = ""
  2558. } else {
  2559. buttonDisplay = "display:none;";
  2560. }
  2561. iner += " <img alt='' src='https://statsxente.com/MZ1/View/Images/calendar.png' width='" + GM_getValue("league_image_size") + "px' height='" + GM_getValue("league_image_size") + "px' id='but3" + id + "' style='cursor:pointer; " + buttonDisplay + "'/>";
  2562. iner += "</center>";
  2563.  
  2564. nuevaColumna.innerHTML = iner
  2565. filasDatos[i].appendChild(nuevaColumna);
  2566. nuevaColumna = document.createElement("td");
  2567. (function (currentId, currentLSport, lang) {
  2568. document.getElementById("but1" + currentId).addEventListener('click', function () {
  2569. let link = "https://statsxente.com/MZ1/Graficos/graficoProgresoEquipo.php?idEquipo=" + currentId + "&idioma=" + lang + "&divisa=" + GM_getValue("currency") + "&deporte=" + currentLSport;
  2570. openWindow(link, 0.95, 1.25);
  2571. });
  2572. })(id, window.lsport, window.lang);
  2573.  
  2574.  
  2575. (function (currentId, currentLSport, lang, currentCat) {
  2576. document.getElementById("but2" + currentId).addEventListener('click', function () {
  2577. let src = "filtroGraficoEquiposHistoricoHockey";
  2578. if (currentLSport === "F") {
  2579. src = "filtroGraficoLinealEquiposHistorico";
  2580. }
  2581.  
  2582. let link = "https://statsxente.com/MZ1/View/" + src + ".php?tamper=yes&categoria=" + currentCat + "&idEquipo=" + currentId + "&idioma=" + lang + "&modal=yes&valor=nota&season=75&season_actual=75&equipo=-"
  2583. openWindow(link, 0.95, 1.25);
  2584. });
  2585. })(id, window.lsport, window.lang, cat);
  2586.  
  2587.  
  2588. (function (currentId, currentEquipo, currentCat, currentSport, lang) {
  2589. document.getElementById("but" + currentId).addEventListener('click', function () {
  2590. let link = "https://statsxente.com/MZ1/View/filtroStatsEquiposHistorico.php?tamper=no&idEquipo=" + currentId + "&idioma=" + lang + "&modal=yes&deporte=" + currentSport + "&season=77&season_actual=77&categoria=" + currentCat + "&equipo=" + currentEquipo + "&cerrar=no";
  2591. openWindow(link, 0.95, 1.25);
  2592. });
  2593. })(id, equipo, cat, window.sport, window.lang);
  2594.  
  2595.  
  2596.  
  2597.  
  2598. (function (currentId, type, currentCat, currentSport, lang, flagS, flagS23, flagS21, flagS18) {
  2599. document.getElementById("but3" + currentId).addEventListener('click', function () {
  2600. let link = "https://statsxente.com/MZ1/Graficos/graficoRachaEquipoELO.php?tamper=yes&team_id=" + currentId + "&idioma=" + lang + "&deporte=" + currentSport + "&type=" + type + "&cat=" + currentCat + "&flagSenior=" +
  2601. flagS + "&flagSub23=" + flagS23 + "&flagSub21=" + flagS21 + "&flagSub18=" + flagS18;
  2602. openWindow(link, 0.95, 1.25);
  2603. });
  2604. })(id, eloType, cats_elo[cat], window.sport, window.lang, flagSenior, flagSub23, flagSub21, flagSub18);
  2605.  
  2606. }
  2607.  
  2608. }
  2609. let thead = document.getElementsByClassName("seriesHeader")[table_index]
  2610. let ths = thead.querySelectorAll("th");
  2611. ths.forEach(function (th, index) {
  2612. th.addEventListener("click", function () {
  2613. ordenarTabla(index, true, "nice_table",true);
  2614. });
  2615. });
  2616. }
  2617. });
  2618.  
  2619.  
  2620. }
  2621. //Match page
  2622. async function match() {
  2623. let team_div = document.getElementsByClassName("flex-grow-0 textCenter team-table block")
  2624. if (team_div.length===0){
  2625. team_div = document.getElementsByClassName("flex-grow-0 textCenter team-table no-match-buttons block")
  2626. }
  2627. let teams_ = []
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633. let linkIds=""
  2634. let contIds=0
  2635. for (let x = 0; x < 2; x++) {
  2636. let as = team_div[x].getElementsByTagName("a")
  2637. let urlObj = new URL("https://www.managerzone.com/" + as[0].getAttribute('href'));
  2638. let params = new URLSearchParams(urlObj.search);
  2639. let tidValue = params.get('tid');
  2640. teams_[x] = { "team_name": as[0].innerHTML, "team_id": tidValue, "inserted": "" }
  2641. linkIds += "&idEquipo" + contIds + "=" + tidValue
  2642. contIds++
  2643. }
  2644.  
  2645.  
  2646.  
  2647. GM_xmlhttpRequest({
  2648. method: "GET",
  2649. url: "https://statsxente.com/MZ1/Functions/tamper_teams.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport + linkIds,
  2650. headers: {
  2651. "Content-Type": "application/json"
  2652. },
  2653. onload: function (response) {
  2654.  
  2655. let jsonResponse = JSON.parse(response.responseText);
  2656.  
  2657. const divs = document.querySelectorAll('div'); // Selecciona todos los divs
  2658. const divsConAltura15px = Array.from(divs).filter(div => {
  2659. const computedStyle = window.getComputedStyle(div);
  2660. return computedStyle.height === '15px' && div.innerHTML === "";
  2661. });
  2662.  
  2663.  
  2664. for(let m=0;m<2;m++){
  2665.  
  2666. let aux=teams_[m]['team_id']
  2667.  
  2668. let top="TOP 11"
  2669.  
  2670. if(window.sport==="hockey"){
  2671. top="TOP 21"
  2672. }
  2673.  
  2674. let teamTable='<div style="display: flex;flex-direction: column;justify-content: center;align-items: center;flex-wrap: wrap;max-height: 100%;">'
  2675. teamTable+='<table class="matchValuesTable"><thead><tr>'
  2676. teamTable+='<th id=thTransparent'+m+' style="background-color:transparent; border:0;"></th>'
  2677. teamTable+='<th style="border-top-left-radius: 5px;">Value</th><th>LM Value</th>'
  2678. teamTable+='<th >'+top+'</th><th style="border-top-right-radius: 5px;">ELO</th></tr></thead><tbody>'
  2679. let valor=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor']))
  2680. let valorLM=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valorUPSenior']))
  2681. let valor11=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor11']))
  2682. let elo=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['elo']))
  2683. teamTable+='<tr><th style="border-top-left-radius: 5px;">Senior</th><td>'+valor+'</td><td>'+valorLM+'</td><td>'+valor11+'</td><td style="border-right:1px solid '+GM_getValue("bg_native")+';">'+elo+'</td></tr>'
  2684.  
  2685. valor=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor23']))
  2686. valorLM=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valorUPSUB23']))
  2687. valor11=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor11_23']))
  2688. elo=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['elo23']))
  2689. teamTable+='<tr><th>U23</th><td>'+valor+'</td><td>'+valorLM+'</td><td>'+valor11+'</td><td style="border-right:1px solid '+GM_getValue("bg_native")+';">'+elo+'</td></tr>'
  2690.  
  2691.  
  2692. valor=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor21']))
  2693. valorLM=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valorUPSUB21']))
  2694. valor11=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor11_21']))
  2695. elo=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['elo21']))
  2696. teamTable+='<tr><th>U21</th><td>'+valor+'</td><td>'+valorLM+'</td><td>'+valor11+'</td><td style="border-right:1px solid '+GM_getValue("bg_native")+';">'+elo+'</td></tr>'
  2697.  
  2698. valor=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor18']))
  2699. valorLM=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valorUPSUB18']))
  2700. valor11=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor11_18']))
  2701. elo=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['elo18']))
  2702. teamTable+='<tr><th style="border-bottom-left-radius: 5px;">U18</th><td style="border-bottom:1px solid '+GM_getValue("bg_native")+';">'+valor+'</td>'
  2703. teamTable+='<td style="border-bottom:1px solid '+GM_getValue("bg_native")+';">'+valorLM+'</td>'
  2704. teamTable+='<td style="border-bottom:1px solid '+GM_getValue("bg_native")+';;">'+valor11+'</td>'
  2705. teamTable+='<td style="border-radius: 0 0 10px 0; border-bottom:1px solid '+GM_getValue("bg_native")+'; border-right:1px solid '+GM_getValue("bg_native")+';">'+elo+'</td></tr>'
  2706.  
  2707.  
  2708. teamTable+='</tbody></table></div>'
  2709.  
  2710. divsConAltura15px[m].insertAdjacentHTML('afterend',teamTable)
  2711.  
  2712.  
  2713.  
  2714. }
  2715.  
  2716.  
  2717. const thElements = document.querySelectorAll('table.matchValuesTable th');
  2718.  
  2719. // Cambia el color de fondo de cada <th>
  2720. thElements.forEach(th => {
  2721. th.style.backgroundColor = GM_getValue("bg_native");
  2722. th.style.color = GM_getValue("color_native");
  2723.  
  2724. });
  2725. document.getElementById("thTransparent0").style.backgroundColor="transparent";
  2726. document.getElementById("thTransparent1").style.backgroundColor="transparent";
  2727.  
  2728.  
  2729.  
  2730.  
  2731. }
  2732. });
  2733.  
  2734.  
  2735.  
  2736. let elems = document.getElementsByClassName("hitlist " + window.sport + " statsLite marker tablesorter");
  2737. for (let x = 0; x < 2; x++) {
  2738. let linkIds = ""
  2739. let contIds = 0;
  2740. let tabla = elems[x]
  2741. let filas = tabla.getElementsByTagName("tr");
  2742. let fila = filas[1];
  2743.  
  2744. for (let i = 2; i < filas.length - 1; i++) {
  2745.  
  2746. fila = filas[i];
  2747. let tds = fila.getElementsByTagName("td");
  2748. let as_ = tds[2].getElementsByTagName("a");
  2749. let urlObj = new URL("https://www.managerzone.com/" + as_[0].getAttribute("href"));
  2750. let params = new URLSearchParams(urlObj.search);
  2751. let pid = params.get('pid');
  2752.  
  2753. linkIds += "&id" + contIds + "=" + pid
  2754. contIds++;
  2755. }
  2756.  
  2757. let link = "http://statsxente.com/MZ1/Functions/tamper_check_stats_player.php?sport=" + window.sport + linkIds
  2758. teams_[x]["inserted"]= await fetchExistPlayers(link);
  2759.  
  2760. }
  2761.  
  2762.  
  2763. elems = document.getElementsByClassName("hitlist " + window.sport + " statsLite marker tablesorter");
  2764. for (let x = 0; x < 2; x++) {
  2765. if (teams_[x]['inserted']['total'] > 0) {
  2766. let tabla = elems[x]
  2767. let firstTrThead = tabla.querySelector('thead td');
  2768. let currentColspan = firstTrThead.getAttribute('colspan');
  2769. currentColspan = parseInt(currentColspan, 10) + 1;
  2770. firstTrThead.setAttribute('colspan', currentColspan);
  2771. let secondTrThead = tabla.querySelector('thead tr:nth-of-type(2)')
  2772. let newTd = document.createElement('td');
  2773. newTd.textContent = '';
  2774. secondTrThead.appendChild(newTd);
  2775. let filas = tabla.getElementsByTagName("tr");
  2776. let dato = document.createElement("td");
  2777. let tfoot = tabla.querySelector("tfoot");
  2778. let primeraFilaTfoot = tfoot.querySelector("tr");
  2779. let primerTDTfoot = primeraFilaTfoot.querySelector("td");
  2780. primerTDTfoot.setAttribute("colspan", "9");
  2781.  
  2782. let elems2 = document.getElementsByClassName("listHeadColor");
  2783. let lista = elems2[0]
  2784.  
  2785. let nuevoElementoDD = document.createElement("dd");
  2786. nuevoElementoDD.textContent = "Nuevo elemento";
  2787. nuevoElementoDD.className = "c6"
  2788. lista.appendChild(nuevoElementoDD);
  2789.  
  2790. for (let i = 2; i < filas.length - 1; i++) {
  2791. let fila = filas[i];
  2792.  
  2793. let tds = fila.getElementsByTagName("td");
  2794. let as_ = tds[2].getElementsByTagName("a");
  2795. let urlObj = new URL("https://www.managerzone.com/" + as_[0].getAttribute("href"));
  2796. let params = new URLSearchParams(urlObj.search);
  2797. let pid = params.get('pid');
  2798. if (teams_[x]['inserted'][pid] === "yes") {
  2799. dato = document.createElement("td");
  2800. //aa
  2801.  
  2802. dato.innerHTML = "<img alt='' src='https://statsxente.com/MZ1/View/Images/main_icon.png' width='20px' height='20px' id='but" + pid + "' style='cursor:pointer;'/>"
  2803. fila.appendChild(dato);
  2804.  
  2805.  
  2806.  
  2807. (function (currentId, currentTeamId, currentSport, lang, team_name, player_name) {
  2808. document.getElementById("but" + currentId).addEventListener('click', function () {
  2809.  
  2810. let link = "http://statsxente.com/MZ1/Functions/tamper_player_stats.php?sport=" + currentSport
  2811. + "&player_id=" + currentId + "&team_id=" + currentTeamId + "&idioma=" + lang + "&divisa=" + GM_getValue("currency") +
  2812. "&team_name=" + encodeURIComponent(team_name) + "&player_name=" + encodeURIComponent(player_name)
  2813. openWindow(link, 0.95, 1.25);
  2814. });
  2815. })(pid, teams_[x]['team_id'], window.sport, window.lang, teams_[x]['team_name'], as_[0].innerHTML);
  2816.  
  2817.  
  2818. }else{
  2819. dato = document.createElement("td");
  2820. fila.appendChild(dato);
  2821. }
  2822. }
  2823. }
  2824. }
  2825. }
  2826. //Players page
  2827. async function playersPage() {
  2828. setTimeout(function () {
  2829. let player_images
  2830. let elementos = document.getElementsByClassName('playerContainer');
  2831.  
  2832. let player_values = {}
  2833. let tactics_list = []
  2834.  
  2835. let urlParams = new URLSearchParams(window.location.search);
  2836. let flagStats = true
  2837. if (urlParams.has('tid')) {
  2838. flagStats = false
  2839. }
  2840.  
  2841. if (flagStats) {
  2842. let habil_container = elementos[0].getElementsByClassName("player_skills")
  2843. let habil = habil_container[0].getElementsByClassName("clippable")
  2844.  
  2845. if (window.sport === "hockey") {
  2846. for (let q = 1; q < habil.length; q++) {
  2847. skills_names.push(habil[q].textContent)
  2848. }
  2849. } else {
  2850.  
  2851. for (let q = 0; q < habil.length - 1; q++) {
  2852. skills_names.push(habil[q].textContent)
  2853. }
  2854. player_images = document.getElementsByClassName("player-image soccer")
  2855. }
  2856. }
  2857.  
  2858. let ids_ = []
  2859.  
  2860. for (let i = 0; i < elementos.length; i++) {
  2861. let ids = elementos[i].getElementsByClassName('player_id_span');
  2862.  
  2863. let elementos_ = elementos[i].getElementsByClassName('p_sublinks');
  2864.  
  2865. let subheaders = elementos[i].getElementsByClassName('subheader clearfix');
  2866.  
  2867.  
  2868. let enlace = subheaders[0].querySelector('.subheader a');
  2869. let playerName = enlace.querySelector('.player_name').textContent
  2870.  
  2871. ids_.push({ "id": ids[0].textContent, "name": playerName });
  2872.  
  2873.  
  2874. let txt = '<span id=but' + ids[0].textContent + ' class="player_icon_placeholder"><a href="#" onclick="return false"'
  2875. txt += 'title="Stats Xente" class="player_icon"><span class="player_icon_wrapper">'
  2876. txt += '<span class="player_icon_image" style="background-image: url(\'https://www.statsxente.com/MZ1/View/Images/main_icon_mini.png\'); width: 21px; height: 20px; background-size: auto;'
  2877. txt += 'z-index: 0;"></span><span class="player_icon_text"></span></span></a></span>'
  2878.  
  2879. elementos_[0].innerHTML += txt;
  2880.  
  2881. if (flagStats) {
  2882. let flag_gk = false;
  2883. let age_div = elementos[i].getElementsByClassName('dg_playerview_info');
  2884. let age_table = age_div[0].getElementsByTagName('table')[0];
  2885.  
  2886. let ini_age = age_table.getElementsByTagName('td')[0].textContent.indexOf(":")
  2887. let age = age_table.getElementsByTagName('td')[0].textContent.substring(ini_age + 2, ini_age + 4);
  2888.  
  2889.  
  2890. if ((window.sport === "soccer") && (player_images[i].innerHTML.includes("gk=1"))) {
  2891. flag_gk = true
  2892. }
  2893.  
  2894. let tactics = elementos[i].getElementsByClassName('player_tactic gradientSunriseIcon');
  2895.  
  2896. player_values = {
  2897. "id": ids[0].textContent,
  2898. "skills": [],
  2899. "lines": [],
  2900. "tactics-position": {},
  2901. "tactics": [],
  2902. "age": parseInt(age)
  2903. }
  2904.  
  2905. for (let j = 0; j < tactics.length; j++) {
  2906. let fin = 0;
  2907. let line = ""
  2908. let ini = tactics[j].textContent.indexOf('(');
  2909. let tactic = tactics[j].textContent.substring(0, ini - 1);
  2910.  
  2911. if (window.sport === "hockey") {
  2912.  
  2913. if (!tactics[j].textContent.includes(":")) {
  2914. ini = tactics[j].textContent.indexOf('(');
  2915. fin = tactics[j].textContent.indexOf(')');
  2916. line = tactics[j].textContent.substring(ini + 2, fin - 1);
  2917. gk_line = line;
  2918. } else {
  2919. ini = tactics[j].textContent.indexOf('(');
  2920. fin = tactics[j].textContent.indexOf(':');
  2921. line = tactics[j].textContent.substring(ini + 2, fin);
  2922. }
  2923.  
  2924. } else {
  2925. ini = tactics[j].textContent.indexOf('(');
  2926. fin = tactics[j].textContent.indexOf(')');
  2927. line = tactics[j].textContent.substring(ini + 2, fin - 1);
  2928. if (flag_gk) {
  2929. gk_line = line;
  2930. }
  2931. if (tactics[j].textContent.includes(",")) {
  2932. ini = tactics[j].textContent.indexOf('(');
  2933. fin = tactics[j].textContent.indexOf(',');
  2934. su_line = tactics[j].textContent.substring(ini + 2, fin);
  2935. }
  2936. }
  2937.  
  2938. if (!player_values['lines'].includes(line)) {
  2939. player_values['lines'].push(line);
  2940. }
  2941. if (!player_values['tactics'].includes(tactic)) {
  2942. player_values['tactics'].push(tactic);
  2943. }
  2944.  
  2945. player_values['tactics-position'][tactic] = line
  2946.  
  2947. if ((!lines.includes(line))) {
  2948. lines.push(line);
  2949. }
  2950.  
  2951. if (!tactics_list.includes(tactic)) {
  2952. tactics_list.push(tactic);
  2953. }
  2954.  
  2955.  
  2956. }
  2957. let skills_container=elementos[i].getElementsByClassName('skills-container floatLeft clearfix')
  2958. let skills = skills_container[0].getElementsByClassName('skillval');
  2959.  
  2960. if (window.sport === "hockey") {
  2961.  
  2962. for (let j = 1; j < skills.length; j++) {
  2963. let cleanedText = skills[j].textContent.replace(')', '');
  2964. cleanedText = cleanedText.replace('(', '');
  2965. let number = parseInt(cleanedText, 10);
  2966. player_values['skills'].push(number);
  2967. }
  2968.  
  2969. } else {
  2970. for (let j = 0; j < skills.length - 1; j++) {
  2971.  
  2972. let cleanedText = skills[j].textContent.replace(')', '');
  2973. cleanedText = cleanedText.replace('(', '');
  2974. let number = parseInt(cleanedText, 10);
  2975. player_values['skills'].push(number);
  2976. }
  2977. }
  2978. players.push(player_values)
  2979. }
  2980. }
  2981. if (flagStats) {
  2982. const container = document.getElementById("squad-search-toggle")
  2983. let contenidoNuevo = "<div id='containerTactics' style='background-color: #e3e3e3; margin: 0 auto; text-align:center;'></br>"
  2984. contenidoNuevo += "<div id=selectDiv>Choose Tactic: <select id=tactics_select>"
  2985. contenidoNuevo += "<option value='All Team'>All Team</option>"
  2986. for (let x = 0; x < tactics_list.length; x++) {
  2987. let selected = ""
  2988. if (x === 0) {
  2989. selected = "selected=''";
  2990. }
  2991. contenidoNuevo += "<option " + selected + " value='" + tactics_list[x] + "'>" + tactics_list[x] + "</option>"
  2992. }
  2993. contenidoNuevo += "</select></div></br><div id=divMenu></div></center></div>"
  2994. container.innerHTML = contenidoNuevo + container.innerHTML;
  2995. skillDistrib(tactics_list[0]);
  2996. document.getElementById("tactics_select").addEventListener('change', function () {
  2997. let select = document.getElementById('tactics_select');
  2998. let valorSeleccionado = select.value;
  2999. document.getElementById("divMenu").innerHTML = ""
  3000. skillDistrib(valorSeleccionado)
  3001. });
  3002. }
  3003.  
  3004. let team_id
  3005. if(window.sport==="soccer"){
  3006. team_id=GM_getValue("soccer_team_id")
  3007. }else{
  3008. team_id=GM_getValue("hockey_team_id")
  3009. }
  3010.  
  3011.  
  3012. for (let i = 0; i < ids_.length; i++) {
  3013. (function (currentId, currentTeamId, currentSport, lang, team_name, player_name) {
  3014. document.getElementById("but" + currentId).addEventListener('click', function () {
  3015. let link = "http://statsxente.com/MZ1/Functions/tamper_player_stats.php?sport=" + currentSport
  3016. + "&player_id=" + currentId + "&team_id=" + currentTeamId + "&idioma=" + lang + "&divisa=" + GM_getValue("currency") +
  3017. "&team_name=" + encodeURIComponent(team_name) + "&player_name=" + encodeURIComponent(player_name)
  3018. openWindow(link, 0.95, 1.25);
  3019. });
  3020. })(ids_[i]['id'], team_id, window.sport, window.lang, "[undefined]", ids_[i]['name']);
  3021. }
  3022.  
  3023.  
  3024.  
  3025. }, 1000);
  3026. }
  3027. function skillDistrib(tactic) {
  3028. let t = tactic
  3029. let l=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  3030. if (window.sport === "hockey") {
  3031. l = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  3032. }
  3033.  
  3034. let li_t = {}
  3035. for (let i = 0; i < lines.length; i++) {
  3036. li_t[lines[i]] = [...l];
  3037. }
  3038.  
  3039. let no_gk_line = "Tactic -(" + gk_line + ")"
  3040. li_t["Team"] = [...l];
  3041. li_t["U23"] = [...l];
  3042. li_t["U21"] = [...l];
  3043. li_t["U18"] = [...l];
  3044. li_t["Tactic"] = [...l];
  3045. li_t[no_gk_line] = [...l];
  3046.  
  3047. let i,j
  3048. for (i = 0; i < players.length; i++) {
  3049. if (players[i]['tactics'].includes(t)) {
  3050. for (j = 0; j < players[i]['skills'].length; j++) {
  3051. li_t[players[i]['tactics-position'][t]][j] += players[i]['skills'][j]
  3052. li_t['Tactic'][j] += players[i]['skills'][j]
  3053. if (players[i]['tactics-position'][t] !== "Po") {
  3054. li_t[no_gk_line][j] += players[i]['skills'][j]
  3055. }
  3056. }
  3057. li_t[players[i]['tactics-position'][t]][j] += 1
  3058. li_t['Tactic'][j] += 1
  3059. if (players[i]['tactics-position'][t] !== "Po") {
  3060. li_t[no_gk_line][j] += 1
  3061. }
  3062. } else {
  3063.  
  3064. for (let j = 0; j < players[i]['skills'].length; j++) {
  3065. if (players[i]['age'] <= 23) {
  3066. li_t['U23'][j] += players[i]['skills'][j]
  3067. }
  3068. if (players[i]['age'] <= 23) {
  3069. li_t['U21'][j] += players[i]['skills'][j]
  3070. }
  3071. if (players[i]['age'] <= 23) {
  3072. li_t['U18'][j] += players[i]['skills'][j]
  3073. }
  3074. li_t['Team'][j] += players[i]['skills'][j]
  3075. }
  3076.  
  3077. if (players[i]['age'] <= 23) {
  3078. li_t['U23'][li_t["U23"].length - 1] += 1
  3079. }
  3080.  
  3081. if (players[i]['age'] <= 21) {
  3082. li_t['U21'][li_t["U21"].length - 1] += 1
  3083. }
  3084. if (players[i]['age'] <= 18) {
  3085. li_t['U18'][li_t["U18"].length - 1] += 1
  3086. }
  3087. li_t['Team'][li_t["Team"].length - 1] += 1
  3088. }
  3089. }
  3090.  
  3091. const container = document.getElementById("divMenu")
  3092. let contenidoNuevo = "<table id=showMenu style='width:95%;font-size:13px; margin: 0 auto; text-align:center;'><thead style='background-color:" + GM_getValue("bg_native") + "; color:" + GM_getValue("color_native") + ";'><tr>";
  3093. contenidoNuevo += '<th style="padding:4px; margin: 0 auto; text-align:center;">Line</th>'
  3094. for (let q = 0; q < skills_names.length; q++) {
  3095. contenidoNuevo += '<th style="padding:4px; margin: 0 auto; text-align:center;">' + skills_names[q] + '</th>'
  3096. }
  3097. contenidoNuevo += '</tr></thead>';
  3098. let l_aux = lines
  3099. l_aux = l_aux.filter(item => item !== gk_line);
  3100. l_aux.sort((a, b) => {
  3101. let numA = parseInt(a.substring(1), 10);
  3102. let numB = parseInt(b.substring(1), 10);
  3103. return numA - numB;
  3104. });
  3105.  
  3106. l_aux.unshift(gk_line);
  3107. l_aux.push("Tactic");
  3108. l_aux.push(no_gk_line);
  3109.  
  3110. if (window.sport === "hockey") {
  3111. if (li_t["L4"][10] === 0) {
  3112. let index = l_aux.indexOf('L4');
  3113. if (index !== -1) {
  3114. l_aux.splice(index, 1);
  3115. }
  3116. }
  3117. }
  3118.  
  3119. if (t === "All Team") {
  3120. l_aux = ["Team", "U23", "U21", "U18"]
  3121. }
  3122.  
  3123. l_aux = l_aux.filter(item => !item.includes(su_line));
  3124.  
  3125. for (let w = 0; w < l_aux.length; w++) {
  3126. let key = l_aux[w]
  3127. if (li_t.hasOwnProperty(key)) {
  3128. contenidoNuevo += "<tr>";
  3129. contenidoNuevo += "<td style='padding:2px; margin: 0 auto; text-align:center;'><strong>" + key + "</strong></td>";
  3130. for (let x = 0; x < li_t[key].length - 1; x++) {
  3131. contenidoNuevo += "<td style='padding:2px; margin: 0 auto; text-align:center;'>" + Math.round(li_t[key][x] / li_t[key][li_t[key].length - 1] * 100) / 100 + "</td>";
  3132. }
  3133. contenidoNuevo += "</tr>";
  3134.  
  3135. }
  3136. }
  3137. container.innerHTML += contenidoNuevo;
  3138. }
  3139. //Players links to stats
  3140. async function playersPageStats() {
  3141. let element = document.getElementById('thePlayers_0');
  3142. let elementos_ = element.getElementsByClassName('p_sublinks');
  3143. let subheaders = element.getElementsByClassName('subheader clearfix');
  3144. let enlace = subheaders[0].querySelector('.subheader a');
  3145. let urlObj = new URL("https://www.managerzone.com/" + enlace.getAttribute('href'));
  3146. let params = new URLSearchParams(urlObj.search);
  3147. let tid = params.get('tid');
  3148. let playerName = enlace.querySelector('.player_name').textContent
  3149. let ids = element.getElementsByClassName('player_id_span');
  3150. let txt = '<span id=but' + ids[0].textContent + ' class="player_icon_placeholder"><a href="#" onclick="return false"'
  3151. txt += 'title="Stats Xente" class="player_icon"><span class="player_icon_wrapper">'
  3152. txt += '<span class="player_icon_image" style="background-image: url(\'https://www.statsxente.com/MZ1/View/Images/main_icon_mini.png\'); width: 21px; height: 20px; background-size: auto;'
  3153. txt += 'z-index: 0;"></span><span class="player_icon_text"></span></span></a></span>'
  3154. elementos_[0].innerHTML += txt;
  3155. (function (currentId, currentTeamId, currentSport, lang, team_name, player_name) {
  3156. document.getElementById("but" + currentId).addEventListener('click', function () {
  3157. let link = "http://statsxente.com/MZ1/Functions/tamper_player_stats.php?sport=" + currentSport
  3158. + "&player_id=" + currentId + "&team_id=" + currentTeamId + "&idioma=" + lang + "&divisa=" + GM_getValue("currency") +
  3159. "&team_name=" + encodeURIComponent(team_name) + "&player_name=" + encodeURIComponent(player_name)
  3160. openWindow(link, 0.95, 1.25);
  3161. });
  3162. })(ids[0].textContent, tid, window.sport, window.lang, "[undefined]", playerName);
  3163. }
  3164. //Country ranking page
  3165. function countryRank() {
  3166. let table_values = ["players", "age", "value", "top11", "salary", "elo", "elo21", "lm", "lmu21"]
  3167. let newContent = "<div style='margin: 0 auto; text-align:center;'>";
  3168. newContent += '<label><input class="statsxente" type="checkbox" checked id="value" value="Value">Value</label>';
  3169. if (window.sport === "soccer") {
  3170. newContent += '<label><input class="statsxente" type="checkbox" id="top11" value="TOP 11">TOP 11</label>';
  3171. } else {
  3172. newContent += '<label><input class="statsxente" type="checkbox" id="top11" value="TOP 21">TOP 21</label>';
  3173. }
  3174.  
  3175. newContent += '<label><input class="statsxente" type="checkbox" id="players" value="Players">Players</label>';
  3176. newContent += '<label><input class="statsxente" type="checkbox" id="salary" value="Salary">Salary</label>';
  3177. newContent += '<label><input class="statsxente" type="checkbox" id="age" value="Age">Age</label>';
  3178. newContent += '<label><input class="statsxente" type="checkbox" checked id="elo" value="Elo">ELO</label>';
  3179. newContent += '<label><input class="statsxente" type="checkbox" checked id="elo21" value="U21 ELO">U21 ELO</label>';
  3180. newContent += '<label><input class="statsxente" type="checkbox" checked id="lm" value="LM">LM</label>';
  3181. newContent += '<label><input class="statsxente" type="checkbox" checked id="lmu21" value="U21 LM">U21 LM</label>';
  3182.  
  3183. let contenedor = document.getElementById('countryRankTable');
  3184. contenedor.insertAdjacentHTML('beforebegin', newContent);
  3185.  
  3186. GM_xmlhttpRequest({
  3187. method: "GET",
  3188. url: "https://statsxente.com/MZ1/Functions/tamper_national_teams.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport,
  3189. headers: {
  3190. "Content-Type": "application/json"
  3191. },
  3192. onload: function (response) {
  3193. let data = JSON.parse(response.responseText);
  3194.  
  3195. let type = 1;
  3196. if (window.sport === "soccer") {
  3197. type = 2
  3198. }
  3199. let table = document.getElementById('countryRankTable');
  3200. for (let i = 0; i < table.rows.length; i++) {
  3201. let row = table.rows[i];
  3202. let insertIndex = row.cells.length - 1;
  3203. let raw_str = row.cells[3].innerHTML
  3204. row.deleteCell(3);
  3205. let cell_name = row.cells[2]
  3206. if (i > 0) {
  3207. cell_name.innerHTML = raw_str + " " + cell_name.innerHTML
  3208. }
  3209. let index = 0;
  3210. let cell0 = row.insertCell(insertIndex + index);
  3211. index++;
  3212. let cell1 = row.insertCell(insertIndex + index);
  3213. index++;
  3214. let cell2 = row.insertCell(insertIndex + index);
  3215. index++;
  3216. let cell3 = row.insertCell(insertIndex + index);
  3217. index++;
  3218. let cell4 = row.insertCell(insertIndex + index);
  3219. index++;
  3220. let cell5 = row.insertCell(insertIndex + index);
  3221. index++;
  3222. let cell6 = row.insertCell(insertIndex + index);
  3223. index++;
  3224. let cell7 = row.insertCell(insertIndex + index);
  3225. index++;
  3226. let cell8 = row.insertCell(insertIndex + index);
  3227. index++;
  3228. let cell9 = row.insertCell(insertIndex + index);
  3229.  
  3230.  
  3231.  
  3232. if (i === 0) {
  3233. cell0.outerHTML = "<th id='players_th' style='display:none;' class='header'><a href='#'>Players</a></th>";
  3234. cell1.outerHTML = "<th id='age_th' class='header' style='display:none;'><a href='#'>Age</a></th>";
  3235. cell2.outerHTML = "<th id='value_th' class='header' style='display:table-cell;'><a href='#'>Value</a></th>";
  3236. cell3.outerHTML = "<th id='top11_th' class='header' style='display:none;'><a href='#'>Top11</a></th>";
  3237. cell4.outerHTML = "<th id='salary_th' class='header' style='display:none;'><a href='#'>Salary</a></th>";
  3238. cell5.outerHTML = "<th id='elo_th' class='header' style='display:table-cell;'><a href='#'>ELO</a></th>";
  3239. cell6.outerHTML = "<th id='elo21_th' class='header' style='display:table-cell;'><a href='#'>U21 ELO</a></th>";
  3240. cell7.outerHTML = "<th id='lm_th' class='header' style='display:table-cell;'><a href='#'>LM</a></th>";
  3241. cell8.outerHTML = "<th id='lmu21_th' class='header' style='display:table-cell;'><a href='#'>U21 LM</a></th>";
  3242. cell9.outerHTML = "<th id='image' class='header' style='display:table-cell;'><a href='#'></a></th>";
  3243. } else {
  3244. let ini = raw_str.indexOf("s_");
  3245. let fin = raw_str.indexOf(".", ini + 1);
  3246. let c_code = raw_str.substring(ini + 2, fin)
  3247. cell0.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["numJugadores"]))
  3248. cell0.className = "players"
  3249. cell0.style.display = "none"
  3250.  
  3251. cell1.innerHTML = new Intl.NumberFormat(window.userLocal, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(data[c_code]["edad"])
  3252. cell1.className = "age"
  3253. cell1.style.display = "none"
  3254.  
  3255. cell2.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["valor"]))
  3256. cell2.className = "value"
  3257. cell2.style.display = "table-cell"
  3258.  
  3259. cell3.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["valor11"]))
  3260. cell3.className = "top11"
  3261. cell3.style.display = "none"
  3262.  
  3263. cell4.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["salario"]))
  3264. cell4.className = "salary"
  3265. cell4.style.display = "none"
  3266.  
  3267. cell5.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["elo"]))
  3268. cell5.className = "elo"
  3269. cell5.style.display = "table-cell"
  3270.  
  3271. cell6.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["elo21"]))
  3272. cell6.className = "elo21"
  3273. cell6.style.display = "table-cell"
  3274.  
  3275. cell7.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["valorLM"]))
  3276. cell7.className = "lm"
  3277. cell7.style.display = "table-cell"
  3278.  
  3279. cell8.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["valorLM21"]))
  3280. cell8.className = "lmu21"
  3281. cell8.style.display = "table-cell"
  3282.  
  3283. cell9.innerHTML = '<img alt="" style="cursor:pointer;" src="https://statsxente.com/MZ1/View/Images/calendar.png" width="20" height="20">'
  3284. let actual_id = "image" + i
  3285. cell9.id = actual_id
  3286. cell9.style.display = "table-cell";
  3287.  
  3288.  
  3289. (function (id, code, type_) {
  3290. document.getElementById(id).addEventListener('click', function () {
  3291. let link = "https://www.statsxente.com/MZ1/Graficos/graficoRachaEquipoELONT.php?tamper=yes&team_id=" + data[code]["idSenior"] +
  3292. "&team_id_u21=" + data[code]["idSub21"] + "&idioma=" + window.lang + "&type=" + type_ + "&cat=SENIOR&sport=" + window.sport;
  3293. openWindow(link, 0.95, 1.25);
  3294. });
  3295. })(actual_id, c_code, type);
  3296. }
  3297. }
  3298.  
  3299. setTimeout(function () {
  3300. for (let f = 0; f < table_values.length; f++) {
  3301.  
  3302. (function (actual_value, f) {
  3303.  
  3304. document.getElementById(actual_value + "_th").addEventListener('click', function () {
  3305. if (document.getElementById(actual_value + "_th").className === "header") {
  3306. document.getElementById(actual_value + "_th").className = "header headerSortDown";
  3307. } else {
  3308.  
  3309. if (document.getElementById(actual_value + "_th").className === "header headerSortDown") {
  3310. document.getElementById(actual_value + "_th").className = "header headerSortUp";
  3311. } else {
  3312. document.getElementById(actual_value + "_th").className = "header headerSortDown";
  3313. }
  3314.  
  3315. }
  3316. let index_ = 3 + f
  3317. ordenarTabla(index_, false, "countryRankTable",false)
  3318. });
  3319. document.getElementById(actual_value).addEventListener('click', function () {
  3320. let display = "table-cell"
  3321. if (document.getElementById(actual_value + "_th").style.display === "table-cell") {
  3322. display = "none"
  3323. }
  3324. let elementos = document.getElementsByClassName(actual_value)
  3325. Array.prototype.forEach.call(elementos, function (elemento) {
  3326. let aux_display = "table-cell"
  3327. if (document.getElementById(actual_value + "_th").style.display === "table-cell") {
  3328. aux_display = "none"
  3329. }
  3330. elemento.style.display = aux_display;
  3331. });
  3332. document.getElementById(actual_value + "_th").style.display = display
  3333. });
  3334. })(table_values[f], f);
  3335. }
  3336. }, 1000);
  3337. }
  3338. });
  3339. }
  3340. //Stats Xente competitions matches
  3341. function StatsXenteNextMatchesClubhouse() {
  3342. let h1Elements = document.querySelectorAll('h1.box_dark');
  3343. let team_name = h1Elements[0].innerText
  3344. let team_id = document.getElementById("tid1").value;
  3345.  
  3346. GM_xmlhttpRequest({
  3347. method: "GET",
  3348. url: "https://statsxente.com/MZ1/Functions/tamper_user_next_matches.php?team_id=" + team_id,
  3349. headers: {
  3350. "Content-Type": "application/json"
  3351. },
  3352. onload: function (response) {
  3353. let data = JSON.parse(response.responseText);
  3354. if (data.length > 0) {
  3355.  
  3356.  
  3357. GM_xmlhttpRequest({
  3358. method: "GET",
  3359. url: "http://www.managerzone.com/xml/team_matchlist.php?sport_id=" + window.sport_id + "&team_id=" + team_id + "&match_status=2&limit=100",
  3360. headers: {
  3361. "Content-Type": "application/json"
  3362. },
  3363. onload: function (response) {
  3364.  
  3365. let matchesDate = []
  3366. let parser = new DOMParser();
  3367. let xmlDoc = parser.parseFromString(response.responseText, "text/xml");
  3368. let matches = xmlDoc.getElementsByTagName("Match");
  3369.  
  3370. let last_date = ""
  3371.  
  3372.  
  3373. for (let i = 0; i < matches.length; i++) {
  3374. let dateOnly = matches[i].getAttribute("date").split(" ")[0];
  3375. last_date = dateOnly
  3376. let teams = matches[i].getElementsByTagName("Team");
  3377.  
  3378. for (let j = 0; j < teams.length; j++) {
  3379. if (teams[j].getAttribute("teamId") !== team_id) {
  3380. matchesDate.push(teams[j].getAttribute("teamId") + "-" + dateOnly)
  3381.  
  3382. }
  3383. }
  3384.  
  3385.  
  3386. }
  3387.  
  3388.  
  3389.  
  3390.  
  3391. let newContent = `
  3392. <div id="tour-container" class="widgets-container">
  3393. <div class="flex-wrap hub-widget-container">
  3394. <div class="flex-grow-1 box_dark">
  3395. <div id="clubhouse-widget-tour" class="widget-content clearfix">
  3396. <i class="fa minimize-button fa-minus-square" aria-hidden="true" data-time="1722549599"></i>
  3397. <span class="fa fa-stack fa-2x floatRight">
  3398. <i class="fa fa-circle fa-stack-2x fa-inverse"></i>
  3399. <i class="fa fa-thumbs-up fa-stack-1x green" aria-hidden="true"></i>
  3400. </span>
  3401. <h3 style="background-image: url('https://www.statsxente.com/MZ1/View/Images/main_icon.png');">Stats Xente</h3>
  3402. <div class="widget-content-wrapper">
  3403. <div class="flex-wrap" style="margin-bottom: 35px;">
  3404. <div class="flex-grow-0" style="margin: 0 auto">
  3405. <img src="https://www.statsxente.com/MZ1/View/Images/main_icon.png" alt="" width="130" height="130">
  3406. </div>
  3407. <div class="flex-grow-1 textLeft">`
  3408.  
  3409. data.forEach(function (match_data) {
  3410.  
  3411. let dateObj1 = new Date(last_date);
  3412. let dateObj2 = new Date(match_data['fecha']);
  3413.  
  3414.  
  3415. let icon_ = "fa-check-square"
  3416. let style_ = ""
  3417. let flagFriendly = false;
  3418. if (dateObj1 < dateObj2) {
  3419. icon_ = "fa-calendar-minus-o"
  3420. style_ = "style='color:#e5ac00;'"
  3421. flagFriendly = true;
  3422. } else {
  3423.  
  3424. if (matchesDate.includes(match_data['rival_id'] + "-" + match_data['fecha'])) {
  3425. if (window.sport === "hockey") {
  3426. style_ = "style='color:#6d93fd;'"
  3427. }
  3428. } else {
  3429. icon_ = "fa-times-square"
  3430. style_ = "style='color:#AD4039;'"
  3431. flagFriendly = true;
  3432.  
  3433.  
  3434. }
  3435.  
  3436. }
  3437.  
  3438.  
  3439. let match = '<img alt="" src="https://www.managerzone.com/dynimg/badge.php?team_id=' + match_data['idEquipoLocal'] + '&sport="' + window.sport + ' width="15px" height="15px"/> '
  3440. + team_name + ' - ' + match_data['rival_name'] + ' <img alt="" src="https://www.managerzone.com/dynimg/badge.php?team_id=' + match_data['idEquipoVisitante'] + '&sport="' + window.sport + ' width="15px" height="15px"/>'
  3441. if (match_data['field'] === "away") {
  3442. match = '<img alt="" src="https://www.managerzone.com/dynimg/badge.php?team_id=' + match_data['idEquipoLocal'] + '&sport="' + window.sport + ' width="15px" height="15px"/> '
  3443. + match_data['rival_name'] + ' - ' + team_name + ' <img alt="" src="https://www.managerzone.com/dynimg/badge.php?team_id=' + match_data['idEquipoVisitante'] + '&sport="' + window.sport + ' width="15px" height="15px"/>'
  3444. }
  3445.  
  3446.  
  3447. newContent += '<fieldset class="grouping self box_light_on_dark flex-nowrap" style="max-width: 555px; margin-left: 10px;">'
  3448. newContent += '<legend>' + match_data['clash_name'] + '</legend>'
  3449. newContent += '<div class="flex-grow-0 mission-icon">'
  3450. newContent += '<i class="fa ' + icon_ + ' green fa-2x t-checked" aria-hidden="true" ' + style_ + '></i>'
  3451. newContent += '</div>'
  3452. newContent += '<div class="flex-grow-1 mission">'
  3453.  
  3454. let link = "CompAmis_CALENDAR_View.php?" + 'id=' + match_data['idComp']
  3455. if (match_data['comp'] === "cup") {
  3456. link = 'CompAmis_Cup_CALENDAR_View.php?grupo=' + match_data['grupo'] + '&id=' + match_data['idComp']
  3457. }
  3458.  
  3459.  
  3460. newContent += '<p><b><a href="https://www.statsxente.com/MZ1/View/' + link + '" target="_blank">' + match + '</a></b>'
  3461. newContent += "</br></p>"
  3462. newContent += 'Date: ' + match_data['fecha']
  3463. if (flagFriendly) {
  3464. newContent += "<a href='https://www.managerzone.com/?p=challenges&challenge-tid=" + match_data['rival_id'] + "'><i class='fa fa-thumbs-up fa-lg challenge-thumb' aria-hidden='true'></i></a>"
  3465. }
  3466.  
  3467.  
  3468. newContent += '</p>'
  3469. newContent += '</div>'
  3470. newContent += '</fieldset>'
  3471. });
  3472.  
  3473.  
  3474.  
  3475.  
  3476. newContent += `</div>
  3477. </div>
  3478. </div>
  3479. </div>
  3480. </div>
  3481. </div>
  3482. </div>`;
  3483.  
  3484.  
  3485.  
  3486.  
  3487. let contenedor = document.getElementById('tour-container');
  3488. if (data.length > 0) {
  3489. contenedor.insertAdjacentHTML('beforebegin', newContent);
  3490.  
  3491. }
  3492.  
  3493.  
  3494. }
  3495.  
  3496. });
  3497.  
  3498. }
  3499.  
  3500.  
  3501. }
  3502. });
  3503.  
  3504. }
  3505.  
  3506.  
  3507. //HANDLERS FUNCTIONS
  3508. function handleClick(event) {
  3509.  
  3510. if(document.getElementById("eloCompareCol")){
  3511. document.getElementById("trELOCompare").style.display="none";
  3512. let elems = document.getElementsByClassName("nice_table");
  3513. let table = elems[0]
  3514. var th = document.getElementById("eloCompareCol");
  3515. var columnIndex = th.cellIndex;
  3516. for (let i = 0; i < table.rows.length; i++) {
  3517. let row = table.rows[i];
  3518. if (row.cells.length > columnIndex) {
  3519. row.deleteCell(columnIndex);
  3520. }
  3521. }
  3522. }
  3523.  
  3524. let urlParams = new URLSearchParams(window.location.search);
  3525. let elems = document.getElementsByClassName("nice_table");
  3526. let tabla = elems[0]
  3527. let filas = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  3528. let thSegundo = tabla.querySelector("thead th:nth-child(2)");
  3529.  
  3530. if (urlParams.get('fsid')) {
  3531. thSegundo.style.width = "180px";
  3532. } else {
  3533. thSegundo.style.width = "250px";
  3534. }
  3535.  
  3536.  
  3537. for (let i = 0; i < filas.length; i++) {
  3538. if (checkClassNameExists(filas[i], searchClassName)) {
  3539. let celda = filas[i].cells[1];
  3540. let team_data=extractTeamData(celda.getElementsByTagName("a"));
  3541. let id=team_data[0]
  3542. let equipo=team_data[1]
  3543. let celdas = filas[i].getElementsByTagName("td");
  3544. let ultimaCelda = celdas[celdas.length - 2];
  3545. let selects = document.getElementsByTagName('select');
  3546. let index_select = 1;
  3547. if (selects[index_select] === undefined) {
  3548. index_select = 0;
  3549. }
  3550.  
  3551.  
  3552. let selectedIndex = selects[index_select].selectedIndex;
  3553. let selectedOption = selects[index_select].options[selectedIndex];
  3554. let selectedText = selectedOption.text;
  3555.  
  3556.  
  3557.  
  3558. let key_actual_league = "Top";
  3559. if (selectedText.includes(".")) {
  3560. key_actual_league = selectedText.substring(0, 4)
  3561. }
  3562.  
  3563. let valor = 0;
  3564.  
  3565. if (teams_data[id] === undefined) {
  3566. valor = 0
  3567. } else {
  3568.  
  3569. let table_key = "";
  3570. let agg_value = 0;
  3571. let cat
  3572.  
  3573. switch (event.target.id) {
  3574. case 'edad':
  3575. valor = new Intl.NumberFormat(window.userLocal, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(teams_data[id][event.target.id])
  3576. break;
  3577. case "leagues":
  3578. table_key = "league"
  3579. agg_value = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3580. valor = "(" + teams_data[id]['league_' + key_actual_league] + '/' + agg_value + ")"
  3581. break;
  3582.  
  3583. case "world_leagues":
  3584. table_key = "world_league"
  3585. agg_value = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3586. valor = "(" + teams_data[id][table_key + '_' + key_actual_league] + '/' + agg_value + ")"
  3587. break;
  3588.  
  3589. case "youth_leagues":
  3590. cat = GM_getValue("actual_league_cat").toLowerCase()
  3591. table_key = "league_" + cat
  3592. agg_value = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3593. valor = "(" + teams_data[id][table_key + '_' + key_actual_league] + '/' + agg_value + ")"
  3594. break;
  3595.  
  3596. case "world_youth_leagues":
  3597. cat = GM_getValue("actual_league_cat").toLowerCase()
  3598. table_key = "world_league_" + cat
  3599. agg_value = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3600. valor = "(" + teams_data[id][table_key + '_' + key_actual_league] + '/' + agg_value + ")"
  3601. break;
  3602.  
  3603. case "leagues_all":
  3604. table_key = "league"
  3605. valor = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3606. break;
  3607.  
  3608.  
  3609. case "world_leagues_all":
  3610. table_key = "world_league"
  3611. valor = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3612. break;
  3613.  
  3614. case "youth_leagues_all":
  3615. table_key = "league_u23"
  3616. valor += teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3617. table_key = "league_u21"
  3618. valor += teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3619. table_key = "league_u18"
  3620. valor += teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3621. break;
  3622.  
  3623. case "world_youth_leagues_all":
  3624. table_key = "world_league_u23"
  3625. valor += teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3626. table_key = "world_league_u21"
  3627. valor += teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3628. table_key = "world_league_u18"
  3629. valor += teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3630. break;
  3631.  
  3632. case "federation_leagues":
  3633. table_key = "federation_league"
  3634. agg_value = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3635. valor = agg_value
  3636. break;
  3637.  
  3638.  
  3639. default:
  3640. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(teams_data[id][event.target.id]))
  3641. break;
  3642.  
  3643.  
  3644. }
  3645. }
  3646.  
  3647. ultimaCelda.innerHTML = valor;
  3648. }
  3649. }
  3650. let checkboxes = document.querySelectorAll('.statsxente');
  3651. let thead = tabla.querySelector('thead');
  3652. let tr = thead.querySelectorAll('tr');
  3653. let td = tr[0].querySelectorAll('th');
  3654. td[td.length - 2].textContent = event.target.value;
  3655. checkboxes.forEach(function (checkbox) {
  3656. if (checkbox.id !== event.target.id) {
  3657. checkbox.checked = false;
  3658. }
  3659. });
  3660. }
  3661. function handleClickClash(event) {
  3662. let elems = document.getElementsByClassName("nice_table");
  3663. let tabla = elems[0]
  3664. let filas = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  3665. let thSegundo = tabla.querySelector("thead th:nth-child(2)");
  3666. thSegundo.style.width = "250px";
  3667. for (let i = 0; i < filas.length; i++) {
  3668. let celda = tabla.rows[i + 1].cells[1];
  3669. let imagen = celda.querySelector('img');
  3670. let url = new URL(imagen.src);
  3671. let id = url.searchParams.get('fid');
  3672.  
  3673.  
  3674. let celdas = filas[i].getElementsByTagName("td");
  3675. let ultimaCelda = celdas[celdas.length - 2];
  3676.  
  3677. let valor = 0;
  3678.  
  3679. if (teams_data[id] === undefined) {
  3680. valor = 0
  3681. } else {
  3682. if (event.target.id === "edad") {
  3683. valor = new Intl.NumberFormat(window.userLocal, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(teams_data[id][event.target.id])
  3684. } else {
  3685. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(teams_data[id][event.target.id]))
  3686. }
  3687.  
  3688. }
  3689.  
  3690. ultimaCelda.innerHTML = valor;
  3691. }
  3692. let checkboxes = document.querySelectorAll('.statsxente');
  3693. let thead = tabla.querySelector('thead');
  3694. let tr = thead.querySelectorAll('tr');
  3695. let td = tr[0].querySelectorAll('th');
  3696. td[td.length - 2].textContent = event.target.value;
  3697. checkboxes.forEach(function (checkbox) {
  3698. if (checkbox.id !== event.target.id) {
  3699. checkbox.checked = false;
  3700. }
  3701. });
  3702. }
  3703. function handleClickUserRank(event) {
  3704. let urlParams = new URLSearchParams(window.location.search);
  3705. let tabla = document.getElementById("userRankTable");
  3706. let filas = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  3707. let thSegundo = tabla.querySelector("thead th:nth-child(2)");
  3708.  
  3709.  
  3710.  
  3711. for (let i = 0; i < filas.length; i++) {
  3712. let celda = filas[i].cells[3];
  3713. let team_data=extractTeamData(celda.getElementsByTagName("a"));
  3714. let id=team_data[0]
  3715. let equipo=team_data[1]
  3716. let celdas = filas[i].getElementsByTagName("td");
  3717. let ultimaCelda = celdas[celdas.length - 1];
  3718. let selects = document.getElementsByTagName('select');
  3719. let index_select = 1;
  3720. if (selects[index_select] === undefined) {
  3721. index_select = 0;
  3722. }
  3723.  
  3724.  
  3725. let selectedIndex = selects[index_select].selectedIndex;
  3726. let selectedOption = selects[index_select].options[selectedIndex];
  3727. let selectedText = selectedOption.text;
  3728.  
  3729.  
  3730.  
  3731. let key_actual_league = "Top";
  3732. if (selectedText.includes(".")) {
  3733. key_actual_league = selectedText.substring(0, 4)
  3734. }
  3735.  
  3736. let valor = 0;
  3737.  
  3738. if (teams_data[id] === undefined) {
  3739. valor = 0
  3740. } else {
  3741.  
  3742. let table_key = "";
  3743. let agg_value = 0;
  3744. let cat
  3745.  
  3746. switch (event.target.id) {
  3747. case 'edad':
  3748. valor = new Intl.NumberFormat(window.userLocal, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(teams_data[id][event.target.id])
  3749. break;
  3750. case "leagues":
  3751. table_key = "league"
  3752. agg_value = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3753. valor = "(" + teams_data[id]['league_' + key_actual_league] + '/' + agg_value + ")"
  3754. break;
  3755.  
  3756. case "world_leagues":
  3757. table_key = "world_league"
  3758. agg_value = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3759. valor = "(" + teams_data[id][table_key + '_' + key_actual_league] + '/' + agg_value + ")"
  3760. break;
  3761.  
  3762. case "youth_leagues":
  3763. cat = GM_getValue("actual_league_cat").toLowerCase()
  3764. table_key = "league_" + cat
  3765. agg_value = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3766. valor = "(" + teams_data[id][table_key + '_' + key_actual_league] + '/' + agg_value + ")"
  3767. break;
  3768.  
  3769. case "world_youth_leagues":
  3770. cat = GM_getValue("actual_league_cat").toLowerCase()
  3771. table_key = "world_league_" + cat
  3772. agg_value = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3773. valor = "(" + teams_data[id][table_key + '_' + key_actual_league] + '/' + agg_value + ")"
  3774. break;
  3775.  
  3776. case "leagues_all":
  3777. table_key = "league"
  3778. valor = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3779. break;
  3780.  
  3781.  
  3782. case "world_leagues_all":
  3783. table_key = "world_league"
  3784. valor = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3785. break;
  3786.  
  3787. case "youth_leagues_all":
  3788. table_key = "league_u23"
  3789. valor += teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3790. table_key = "league_u21"
  3791. valor += teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3792. table_key = "league_u18"
  3793. valor += teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3794. break;
  3795.  
  3796. case "world_youth_leagues_all":
  3797. table_key = "world_league_u23"
  3798. valor += teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3799. table_key = "world_league_u21"
  3800. valor += teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3801. table_key = "world_league_u18"
  3802. valor += teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3803. break;
  3804.  
  3805. case "federation_leagues":
  3806. table_key = "federation_league"
  3807. agg_value = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  3808. valor = agg_value
  3809. break;
  3810.  
  3811.  
  3812. default:
  3813. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(teams_data[id][event.target.id]))
  3814. break;
  3815.  
  3816.  
  3817. }
  3818. }
  3819.  
  3820. ultimaCelda.innerHTML = valor;
  3821.  
  3822. }
  3823. let checkboxes = document.querySelectorAll('.statsxente');
  3824. let thead = tabla.querySelector('thead');
  3825. let tr = thead.querySelectorAll('tr');
  3826. let td = tr[0].querySelectorAll('th');
  3827. td[td.length - 1].innerHTML = '<a href="#">'+event.target.value+'</a>'
  3828. checkboxes.forEach(function (checkbox) {
  3829. if (checkbox.id !== event.target.id) {
  3830. checkbox.checked = false;
  3831. }
  3832. });
  3833. }
  3834.  
  3835. //FETCH FUNCTIONS
  3836. function fetchExistsFL(id) {
  3837. return new Promise((resolve, reject) => {
  3838.  
  3839. GM_xmlhttpRequest({
  3840. method: "GET",
  3841. url: "https://statsxente.com/MZ1/Functions/tamper_check_fl.php?fl_id="+id,
  3842. headers: {
  3843. "Content-Type": "application/json"
  3844. },
  3845. onload: function (response) {
  3846. let jsonResponse = JSON.parse(response.responseText);
  3847. resolve(jsonResponse)
  3848. },
  3849. onerror: function () {
  3850. reject("none");
  3851. }
  3852. });
  3853. });
  3854. }
  3855. function fetchAgeRestriction(url) {
  3856. return new Promise((resolve, reject) => {
  3857.  
  3858. GM_xmlhttpRequest({
  3859. method: "GET",
  3860. url: url,
  3861. headers: {
  3862. "Content-Type": "application/json"
  3863. },
  3864. onload: function (response) {
  3865. let parser = new DOMParser();
  3866. let doc = parser.parseFromString(response.responseText, "text/html");
  3867. let strongElements = doc.getElementsByTagName("b");
  3868. let nextSibling = strongElements[1].nextSibling;
  3869. try {
  3870. while (nextSibling && nextSibling.nodeName === "BR") {
  3871. nextSibling = nextSibling.nextSibling;
  3872. }
  3873.  
  3874. if (nextSibling && nextSibling.nodeType === Node.TEXT_NODE) {
  3875. let age_restriction = nextSibling.textContent.trim();
  3876. resolve(age_restriction);
  3877. } else {
  3878. resolve("none");
  3879. }
  3880. } catch (error) {
  3881. reject("none");
  3882. }
  3883. },
  3884. onerror: function () {
  3885. reject("none");
  3886. }
  3887. });
  3888. });
  3889. }
  3890. function fetchCupAgeRestriction(url) {
  3891. return new Promise((resolve, reject) => {
  3892.  
  3893. GM_xmlhttpRequest({
  3894. method: "GET",
  3895. url: url,
  3896. headers: {
  3897. "Content-Type": "application/json"
  3898. },
  3899. onload: function (response) {
  3900. let parser = new DOMParser();
  3901. try {
  3902. let doc = parser.parseFromString(response.responseText, "text/html")
  3903. let tables = doc.getElementsByTagName("table");
  3904. let table = tables[1]
  3905. let tds = table.getElementsByTagName("td");
  3906. resolve(tds[5].innerHTML)
  3907. } catch (error) {
  3908. reject("none");
  3909. }
  3910. },
  3911. onerror: function () {
  3912. reject("none");
  3913. }
  3914. });
  3915. });
  3916. }
  3917. function fetchExistTeam(url) {
  3918. return new Promise((resolve, reject) => {
  3919.  
  3920. GM_xmlhttpRequest({
  3921. method: "GET",
  3922. url: url,
  3923. headers: {
  3924. "Content-Type": "application/json"
  3925. },
  3926. onload: function (response) {
  3927. let jsonResponse = JSON.parse(response.responseText);
  3928. resolve(jsonResponse['inserted'])
  3929. },
  3930. onerror: function () {
  3931. reject("no");
  3932. }
  3933. });
  3934. });
  3935. }
  3936. function fetchExistPlayers(url) {
  3937. return new Promise((resolve, reject) => {
  3938.  
  3939. GM_xmlhttpRequest({
  3940. method: "GET",
  3941. url: url,
  3942. headers: {
  3943. "Content-Type": "application/json"
  3944. },
  3945. onload: function (response) {
  3946. let jsonResponse = JSON.parse(response.responseText);
  3947. resolve(jsonResponse)
  3948. },
  3949. onerror: function () {
  3950. reject("no");
  3951. }
  3952. });
  3953. });
  3954. }
  3955.  
  3956. //UTILS FUNCTIONS
  3957. function waitToDOM(function_to_execute, classToSearch, elementIndex,miliseconds) {
  3958. let interval = setInterval(function () {
  3959. let elements = document.querySelectorAll(classToSearch);
  3960. if (elements.length > 0 && elements[elementIndex]) {
  3961. clearInterval(interval);
  3962. clearTimeout(timeout);
  3963. function_to_execute();
  3964. }
  3965. }, 100);
  3966.  
  3967.  
  3968. let timeout = setTimeout(function () {
  3969. clearInterval(interval);
  3970. }, miliseconds);
  3971. }
  3972. function waitToDOMById(function_to_execute, idToSearch,miliseconds) {
  3973. let interval = setInterval(function () {
  3974. let element = document.getElementById(idToSearch);
  3975. if (element) {
  3976. clearInterval(interval);
  3977. clearTimeout(timeout);
  3978. function_to_execute();
  3979. }
  3980. }, 100);
  3981.  
  3982.  
  3983. let timeout = setTimeout(function () {
  3984. clearInterval(interval);
  3985. }, miliseconds);
  3986. }
  3987. function openWindow(link, porAncho, porAlto) {
  3988. let ventanaAncho = (window.innerWidth) * porAncho
  3989. let ventanaAlto = (window.innerHeight) * porAlto
  3990. let ventanaIzquierda = (window.innerWidth - ventanaAncho) / 2;
  3991. let ventanaArriba = (window.innerHeight - ventanaAlto) / 2;
  3992. let opcionesVentana = "width=" + ventanaAncho +
  3993. ",height=" + ventanaAlto +
  3994. ",left=" + ventanaIzquierda +
  3995. ",top=" + ventanaArriba;
  3996.  
  3997. if ((GM_getValue("tabsConfig") === false) && (GM_getValue("windowsConfig") === true)) {
  3998. window.open(link, "_blank", opcionesVentana);
  3999. }
  4000. if ((GM_getValue("tabsConfig") === true) && (GM_getValue("windowsConfig") === false)) {
  4001. window.open(link, "_blank");
  4002. }
  4003. }
  4004. function ordenarTabla(col, byClassName, param,putSortIconFlag) {
  4005. let table
  4006. if (byClassName) {
  4007. let elems = document.getElementsByClassName(param);
  4008. table = elems[0]
  4009. } else {
  4010. table = document.getElementById(param)
  4011. }
  4012. if(putSortIconFlag){putSortIcon(col, table)}
  4013. let rows = Array.from(table.tBodies[0].rows);
  4014. let isAsc = document.getElementById("ord_table").value === "ascendente";
  4015. rows.sort(function (a, b) {
  4016. let aNum = parseFloat(a.cells[col].textContent.trim().replace(/\./g, '').replace(/,/g, '')) || 0;
  4017. let bNum = parseFloat(b.cells[col].textContent.trim().replace(/\./g, '').replace(/,/g, '')) || 0;
  4018. return isAsc ? aNum - bNum : bNum - aNum;
  4019. });
  4020.  
  4021. rows.forEach(function (row) {
  4022. table.tBodies[0].appendChild(row);
  4023. });
  4024.  
  4025. if (isAsc) {
  4026. document.getElementById("ord_table").value = "descendente";
  4027. } else {
  4028. document.getElementById("ord_table").value = "ascendente";
  4029. }
  4030.  
  4031. let filas = table.getElementsByTagName("tr");
  4032. for (let i = 1; i < filas.length; i++) {
  4033. let primeraCelda = filas[i].getElementsByTagName("td")[0];
  4034. primeraCelda.textContent = i;
  4035. }
  4036.  
  4037.  
  4038. }
  4039. function ordenarTablaText(col, byClassName, param,putSortIconFlag) {
  4040. let table = document.getElementById(param)
  4041. let rows = Array.from(table.tBodies[0].rows);
  4042. let isAsc = document.getElementById("ord_table").value === "ascendente";
  4043. if(putSortIconFlag){putSortIcon(col, table)}
  4044. rows.sort(function (a, b) {
  4045. let aText = a.cells[col].textContent.toLowerCase().trim();
  4046. let bText = b.cells[col].textContent.toLowerCase().trim();
  4047. if (aText < bText) {
  4048. return isAsc ? -1 : 1;
  4049. }
  4050. if (aText > bText) {
  4051. return isAsc ? 1 : -1;
  4052. }
  4053. return 0;
  4054. });
  4055.  
  4056. rows.forEach(function (row) {
  4057. table.tBodies[0].appendChild(row);
  4058. });
  4059.  
  4060. if (isAsc) {
  4061. document.getElementById("ord_table").value = "descendente";
  4062. } else {
  4063. document.getElementById("ord_table").value = "ascendente";
  4064. }
  4065.  
  4066.  
  4067. let filas = table.getElementsByTagName("tr");
  4068. for (let i = 1; i < filas.length; i++) {
  4069. let primeraCelda = filas[i].getElementsByTagName("td")[0];
  4070. primeraCelda.textContent = i;
  4071. }
  4072.  
  4073. }
  4074. function checkClassNameExists(element, className) {
  4075. if (className === "") {
  4076. return true;
  4077. } else {
  4078. return element.classList.contains(className);
  4079. }
  4080. }
  4081. function getCookie(nombre) {
  4082. let regex = new RegExp("(?:(?:^|.*;\\s*)" + nombre + "\\s*\\=\\s*([^;]*).*$)|^.*$");
  4083. let valorCookie = document.cookie.replace(regex, "$1");
  4084. return decodeURIComponent(valorCookie);
  4085. }
  4086. function generateValuesSelect(cat) {
  4087.  
  4088.  
  4089. let defaults = new Map();
  4090. defaults.set('senior', 'valor');
  4091. defaults.set('u23', 'valor23');
  4092. defaults.set('u21', 'valor21');
  4093. defaults.set('u18', 'valor18');
  4094.  
  4095. let values = new Map();
  4096. values.set('valor', 'Value');
  4097. values.set('valor23', 'U23 Value');
  4098. values.set('valor21', 'U21 Value');
  4099. values.set('valor18', 'U18 Value');
  4100. values.set('salario', 'Salary');
  4101. values.set('valorUPSenior', 'LM Value');
  4102. values.set('valorUPSUB23', 'U23 LM Value');
  4103. values.set('valorUPSUB21', 'U21 LM Value');
  4104. values.set('valorUPSUB18', 'U18 LM Value');
  4105. values.set('edad', 'Age');
  4106. values.set('valor11', 'TOP 11/21');
  4107. values.set('valor11_23', 'U23 TOP 11/21');
  4108. values.set('valor11_21', 'U21 TOP 11/21');
  4109. values.set('valor11_18', 'U18 TOP 11/21');
  4110. values.set('noNac', 'Foreigners');
  4111. values.set('elo', 'ELO Score');
  4112. values.set('elo23', 'U23 ELO Score');
  4113. values.set('elo21', 'U21 ELO Score');
  4114. values.set('elo18', 'U18 ELO Score');
  4115. values.set('numJugadores', 'Number of players');
  4116.  
  4117.  
  4118. let default_value = GM_getValue("league_default_" + cat, defaults.get(cat))
  4119. GM_setValue("league_default_" + cat, default_value)
  4120.  
  4121. let select = "<select id='league_default_select_" + cat + "' style='width:9em;'>";
  4122. values.forEach((valor, clave) => {
  4123. let checked = ""
  4124. if (clave === default_value) {
  4125. checked = "selected"
  4126. }
  4127. select += "<option " + checked + " value='" + clave + "'>" + valor + "</option>";
  4128. });
  4129. select += "</select>"
  4130. return select;
  4131.  
  4132. }
  4133. function createLeagueConfigOptionsListeners() {
  4134.  
  4135. let defaults = new Map();
  4136. defaults.set('senior', 'valor');
  4137. defaults.set('u23', 'valor23');
  4138. defaults.set('u21', 'valor21');
  4139. defaults.set('u18', 'valor18');
  4140.  
  4141.  
  4142.  
  4143. defaults.forEach((valor, clave) => {
  4144.  
  4145.  
  4146.  
  4147. document.getElementById("league_default_select_" + clave).addEventListener('change', function () {
  4148.  
  4149. let selectElement = document.getElementById("league_default_select_" + clave);
  4150. GM_setValue("league_default_" + clave, selectElement.value)
  4151. });
  4152.  
  4153. });
  4154. document.getElementById("league_graph_check").addEventListener('click', function () {
  4155.  
  4156. if (document.getElementById("league_graph_check").checked) {
  4157. GM_setValue("league_graph_button", "checked")
  4158. } else {
  4159. GM_setValue("league_graph_button", "")
  4160. }
  4161.  
  4162.  
  4163. });
  4164.  
  4165.  
  4166. document.getElementById("league_report_check").addEventListener('click', function () {
  4167.  
  4168. if (document.getElementById("league_report_check").checked) {
  4169. GM_setValue("league_report_button", "checked")
  4170. } else {
  4171. GM_setValue("league_report_button", "")
  4172. }
  4173.  
  4174.  
  4175. });
  4176.  
  4177. document.getElementById("league_calendar_check").addEventListener('click', function () {
  4178.  
  4179. if (document.getElementById("league_calendar_check").checked) {
  4180. GM_setValue("league_calendar_button", "checked")
  4181. } else {
  4182. GM_setValue("league_calendar_button", "")
  4183. }
  4184.  
  4185.  
  4186. });
  4187.  
  4188.  
  4189.  
  4190.  
  4191.  
  4192.  
  4193. }
  4194. function createModalMenu() {
  4195. let newElement = document.createElement("div");
  4196. newElement.id = "legendDiv";
  4197. newElement.className = "stx_legend";
  4198. let txtToInsert= '<div style="writing-mode: tb-rl;-webkit-writing-mode: vertical-rl; margin: 0 auto; text-align:center;">'
  4199. if(GM_getValue("available_new_version")==="yes"){
  4200. txtToInsert+='<img alt="" src="https://statsxente.com/MZ1/View/Images/alert.png" style="width:15px;height:15px;"/>'
  4201. }
  4202. txtToInsert+='<img alt="" src="https://statsxente.com/MZ1/View/Images/main_icon.png" style="width:25px;height:25px;"/>'
  4203. txtToInsert+='</div>';
  4204. newElement.innerHTML=txtToInsert;
  4205. let body = document.body;
  4206. body.appendChild(newElement);
  4207.  
  4208. let newModalElement = document.createElement('div');
  4209. newModalElement.innerHTML = '<div id="snackbar_stx" style="margin: 0 auto; text-align:center;"></div><div id="myModal_cargando" class="modal_cargando"><div class="modal-content_cargando" id="modal_content_div_cargando"><div id="contenido_modal_cargando" style="overflow-x:auto; background-color:#f2f2f200;"></div></div></div>'
  4210. body.insertBefore(newModalElement, body.firstChild);
  4211.  
  4212. if (GM_getValue("leagueFlag") === undefined) {
  4213. GM_setValue("leagueFlag", true)
  4214. }
  4215.  
  4216. if (GM_getValue("matchFlag") === undefined) {
  4217. GM_setValue("matchFlag", true)
  4218. }
  4219.  
  4220. if (GM_getValue("federationFlag") === undefined) {
  4221. GM_setValue("federationFlag", true)
  4222. }
  4223.  
  4224. if (GM_getValue("playersFlag") === undefined) {
  4225. GM_setValue("playersFlag", true)
  4226. }
  4227.  
  4228. if (GM_getValue("countryRankFlag") === undefined) {
  4229. GM_setValue("countryRankFlag", true)
  4230. }
  4231.  
  4232.  
  4233. if (GM_getValue("league_graph_button") === undefined) {
  4234. GM_setValue("league_graph_button", "checked")
  4235. }
  4236.  
  4237. if (GM_getValue("league_report_button") === undefined) {
  4238. GM_setValue("league_report_button", "checked")
  4239. }
  4240.  
  4241. if (GM_getValue("league_calendar_button") === undefined) {
  4242. GM_setValue("league_calendar_button", "checked")
  4243. }
  4244.  
  4245. if (GM_getValue("windowsConfig") === undefined) {
  4246. GM_setValue("windowsConfig", true)
  4247. }
  4248.  
  4249. if (GM_getValue("tabsConfig") === undefined) {
  4250. GM_setValue("tabsConfig", false)
  4251. }
  4252.  
  4253. if (GM_getValue("show_league_selects") === undefined) {
  4254. GM_setValue("show_league_selects", true)
  4255. }
  4256.  
  4257. if (GM_getValue("league_image_size") === undefined) {
  4258. GM_setValue("league_image_size", 20)
  4259. }
  4260.  
  4261. if (GM_getValue("eloNextMatchesFlag") === undefined) {
  4262. GM_setValue("eloNextMatchesFlag", true)
  4263. }
  4264.  
  4265. if (GM_getValue("eloPlayedMatchesFlag") === undefined) {
  4266. GM_setValue("eloPlayedMatchesFlag", true)
  4267. }
  4268.  
  4269. if (GM_getValue("teamPageFlag") === undefined) {
  4270. GM_setValue("teamPageFlag", true)
  4271. }
  4272.  
  4273. if (GM_getValue("trainingReportFlag") === undefined) {
  4274. GM_setValue("trainingReportFlag", true)
  4275. }
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282. let leagueFlag = "", matchFlag = "", federationFlag = "", playersFlag = "", countryRankFlag = "",eloNextMatchesFlag="",eloPlayedMatchesFlag="",teamFlag="",trainingReportFlag=""
  4283.  
  4284. if (GM_getValue("federationFlag")) federationFlag = "checked"
  4285. if (GM_getValue("matchFlag")) matchFlag = "checked"
  4286. if (GM_getValue("leagueFlag")) leagueFlag = "checked"
  4287. if (GM_getValue("playersFlag")) playersFlag = "checked"
  4288. if (GM_getValue("countryRankFlag")) countryRankFlag = "checked"
  4289. if (GM_getValue("eloNextMatchesFlag")) eloNextMatchesFlag = "checked"
  4290. if (GM_getValue("eloPlayedMatchesFlag")) eloPlayedMatchesFlag = "checked"
  4291. if (GM_getValue("teamPageFlag")) teamFlag = "checked"
  4292.  
  4293. if (GM_getValue("trainingReportFlag")) trainingReportFlag = "checked"
  4294.  
  4295.  
  4296.  
  4297.  
  4298.  
  4299. let newContent = '<div style="margin: 0 auto; text-align:center;"><img alt="" id="closeButton" src="https://statsxente.com/MZ1/View/Images/error.png" style="width:40px; height:40px; cursor:pointer;"/></div></br></br>'
  4300. newContent += '<div style="margin: 0 auto; text-align:center;" id=alert_tittle class="caja_mensaje_50">Config</div><div id="div1" class="modal_div_content_main" style="display: flex; flex-direction: column; overflow: auto; max-width: 100%;">'
  4301. newContent +='</br><table style="width:75%; margin: 0 auto; text-align:left;"><tbody><tr>';
  4302. newContent += '<td><label class="containerPeqAmarillo">League<input type="checkbox" id="leagueSelect" ' + leagueFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  4303. newContent += '<td><label class="containerPeqAmarillo">Federation<input type="checkbox" id="federationSelect" ' + federationFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  4304. newContent += '<td><label class="containerPeqAmarillo">Match<input type="checkbox" id="matchSelect" ' + matchFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  4305. newContent += '<td><label class="containerPeqAmarillo">ELO Played Matches<input type="checkbox" id="eloPlayedSelect" ' + eloPlayedMatchesFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  4306. newContent += '<td><label class="containerPeqAmarillo">Training Report<input type="checkbox" id="trainingReportSelect" ' + trainingReportFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  4307. newContent += '</tr><tr>'
  4308. newContent += '<td><label class="containerPeqAmarillo">Players<input type="checkbox" id="playersSelect" ' + playersFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  4309. newContent += '<td><label class="containerPeqAmarillo">Country Rank<input type="checkbox" id="countryRankSelect" ' + countryRankFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  4310. newContent += '<td><label class="containerPeqAmarillo">Team<input type="checkbox" id="teamSelect" ' + teamFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  4311. newContent += '<td><label class="containerPeqAmarillo">ELO Scheduled Matches<input type="checkbox" id="eloScheduledSelect" ' + eloNextMatchesFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  4312.  
  4313. newContent += "</tr></tbody></table>"
  4314.  
  4315. newContent += "<hr>"
  4316. newContent += "<h3 style='text-align: left; padding-left:7px;'>Leagues Config</h3>"
  4317.  
  4318. newContent += "<table style='margin: 0 auto; text-align:center;'><tr>"
  4319. newContent += "<td>Default Senior Param: <td>" + generateValuesSelect('senior') + "</td>";
  4320. newContent += "<td>Default U23 Param: <td>" + generateValuesSelect('u23') + "</td>";
  4321. newContent += "<td>Default U21 Param: <td>" + generateValuesSelect('u21') + "</td>";
  4322. newContent += "<td>Default U18 Param: <td>" + generateValuesSelect('u18') + "</td>";
  4323.  
  4324. newContent += "</tr><tr>"
  4325.  
  4326.  
  4327. let checked_graph = GM_getValue("league_graph_button")
  4328. let checked_report = GM_getValue("league_report_button")
  4329. let checked_calendar = GM_getValue("league_calendar_button")
  4330.  
  4331. newContent += "<td style='margin: 0 auto; text-align:center;' colspan='8'><table style='margin: 0 auto; text-align:center;'><tr><td><label><input " + checked_graph + " type='checkbox' value='graph' class='textMiddle' id='league_graph_check'><img alt='' class='textMiddle' src='https://statsxente.com/MZ1/View/Images/graph.png' width='20px' height='20px'/> <span class='textMiddle'>Progress</span></label></td>"
  4332. newContent += "<td style='margin: 0 auto; text-align:center;'><label><input " + checked_report + " type='checkbox' value='graph' id='league_report_check' class='textMiddle'><img alt='' class='textMiddle' src='https://statsxente.com/MZ1/View/Images/report.png' width='20px' height='20px'/> <span class='textMiddle'>Graph</span></label></td>"
  4333.  
  4334. newContent += "<td style='margin: 0 auto; text-align:center;'><label><input " + checked_calendar + " type='checkbox' value='graph' id='league_calendar_check' class='textMiddle'><img alt='' class='textMiddle' src='https://statsxente.com/MZ1/View/Images/calendar.png' width='20px' height='20px'/> <span class='textMiddle'>ELO Matches</span></label></td></tr></table></td>"
  4335.  
  4336. newContent += '</tr><tr>';
  4337.  
  4338. newContent += '<td colspan="4"><label><span class="textMiddle">Icons Size</span> <input class="textMiddle" id="slider_input" class="range-slider_input" type="range" value="' + GM_getValue("league_image_size") + '" min="10" max="30">'
  4339. newContent += '<img alt="" class="textMiddle" id="testImage" src="https://statsxente.com/MZ1/View/Images/calendar.png" width="20px" height="20px"/>'
  4340. newContent += '<span class="textMiddle" style="padding-left:10px;" id="sizeImageLeagueSpan"> (' + GM_getValue("league_image_size") + ')</span></label></center></td>'
  4341.  
  4342.  
  4343.  
  4344. let checkedLeagueSelects = ""
  4345. if (GM_getValue("show_league_selects")) {
  4346. checkedLeagueSelects = "checked"
  4347. }
  4348.  
  4349. newContent += '<td style=\'margin: 0 auto; text-align:center;\' colspan="4"><label class="textMiddle"><input ' + checkedLeagueSelects + ' type="checkbox" class="textMiddle" value="graph" id="show_league_checkbox">Show selects</label></center></td>'
  4350. newContent += "</tr></table>"
  4351. newContent += "<hr>"
  4352. newContent += "<h3 style='text-align: left; padding-left:7px;'>Tabs Config</h3>"
  4353. newContent += "<table style='display:flex;'><tr><td>"
  4354.  
  4355. let checkedTab = ""
  4356. if (GM_getValue("tabsConfig")) {
  4357. checkedTab = "checked"
  4358. }
  4359.  
  4360. let checkedWin = ""
  4361. if (GM_getValue("windowsConfig")) {
  4362. checkedWin = "checked"
  4363. }
  4364.  
  4365.  
  4366. newContent += "<label><input type='checkbox' id='windowsConfig' " + checkedWin + ">Windows</label>";
  4367. newContent += "<label><input type='checkbox' id='tabsConfig' " + checkedTab + ">Tabs</label>";
  4368. newContent += "</td></tr></table></br></br>"
  4369.  
  4370. if(GM_getValue("available_new_version")==="yes"){
  4371. newContent += '<div style="padding-bottom:10px; margin: 0 auto; text-align:center;"><h2>New vesion available: '+GM_getValue("stx_latest_version")+'</h2>'
  4372. newContent += '<button class="btn-update" id="updateButton"><i class="bi bi-arrow-down-circle-fill" style="font-style:normal;"> Update</i></button></div>'
  4373. }
  4374.  
  4375.  
  4376.  
  4377.  
  4378.  
  4379. newContent += '<div style="padding-bottom:10px; margin: 0 auto; text-align:center;"><button class="btn-save" id="saveButton"><i class="bi bi-house-door-fill" style="font-style:normal;">Save</i></button><button id="deleteButton" class="btn-delete" style="margin-left:10px;"><i class="bi bi-trash-fill" style="font-style:normal;">Reset</i></button></div>'
  4380. newContent += '</div></center></br></br>';
  4381. document.getElementById("contenido_modal_cargando").innerHTML = newContent
  4382. createLeagueConfigOptionsListeners();
  4383. document.getElementById("contenido_modal_cargando").style.width = "75%";
  4384. document.getElementById("myModal_cargando").style.display = "none"
  4385. getNativeTableStyles()
  4386.  
  4387. document.getElementById("alert_tittle").style.backgroundColor = GM_getValue("bg_native")
  4388.  
  4389. if(GM_getValue("available_new_version")==="yes"){
  4390.  
  4391. document.getElementById("updateButton").addEventListener('click', function () {
  4392. GM_setValue("date_checked_version","-")
  4393. window.open("https://update.greasyfork.org/scripts/491442/Stats%20Xente%20Script.user.js", "_blank");
  4394. });
  4395. }
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401. document.getElementById("legendDiv").addEventListener('click', function () {
  4402.  
  4403. if (document.getElementById("myModal_cargando").style.display === "none") {
  4404. document.getElementById("myModal_cargando").style.display = "flex";
  4405. } else {
  4406. document.getElementById("myModal_cargando").style.display = "none";
  4407. }
  4408.  
  4409. });
  4410.  
  4411.  
  4412. document.getElementById("closeButton").addEventListener('click', function () {
  4413. document.getElementById("myModal_cargando").style.display = "none";
  4414. });
  4415.  
  4416.  
  4417. document.getElementById("saveButton").addEventListener('click', function () {
  4418. window.location.reload();
  4419. });
  4420.  
  4421.  
  4422.  
  4423.  
  4424. (function () {
  4425. document.getElementById("deleteButton").addEventListener('click', function () {
  4426. let keys = GM_listValues();
  4427. keys.forEach(function (key) {
  4428. GM_deleteValue(key);
  4429. });
  4430. window.location.reload();
  4431. });
  4432. })();
  4433.  
  4434.  
  4435.  
  4436.  
  4437.  
  4438. // }, 3000);
  4439.  
  4440. }
  4441. function getNativeTableStyles() {
  4442. let elemento = document.querySelector('.subheader.clearfix');
  4443. if (elemento) {
  4444. let estilo = getComputedStyle(elemento);
  4445. let bg = estilo.backgroundColor
  4446. let color = "white"
  4447. if (estilo.backgroundColor === "rgba(0, 0, 0, 0)") {
  4448. bg = "#a9b0b4"
  4449. }
  4450. GM_setValue("bg_native", bg)
  4451. GM_setValue("color_native", color)
  4452. }
  4453.  
  4454.  
  4455. }
  4456.  
  4457. function extractTeamData(as){
  4458. let main_a=""
  4459. Array.from(as).forEach(a => {
  4460. if (a.href.includes('tid')) {
  4461. main_a=a
  4462. return;
  4463. }
  4464. })
  4465. let href = main_a.getAttribute('href');
  4466. let urlParams = new URLSearchParams(href.split('?')[1]);
  4467. let tid = urlParams.get('tid');
  4468. return [urlParams.get('tid'),main_a.textContent]
  4469.  
  4470. }
  4471.  
  4472. function createModalEventListeners() {
  4473. document.getElementById('leagueSelect').addEventListener('click', function () {
  4474. GM_setValue("leagueFlag", !GM_getValue("leagueFlag"))
  4475. });
  4476.  
  4477.  
  4478. document.getElementById('federationSelect').addEventListener('click', function () {
  4479. GM_setValue("federationFlag", !GM_getValue("federationFlag"))
  4480. });
  4481.  
  4482. document.getElementById('matchSelect').addEventListener('click', function () {
  4483. GM_setValue("matchFlag", !GM_getValue("matchFlag"))
  4484. });
  4485.  
  4486. document.getElementById('playersSelect').addEventListener('click', function () {
  4487. GM_setValue("playersFlag", !GM_getValue("playersFlag"))
  4488. });
  4489.  
  4490. document.getElementById('countryRankSelect').addEventListener('click', function () {
  4491. GM_setValue("countryRankFlag", !GM_getValue("countryRankFlag"))
  4492. });
  4493.  
  4494. document.getElementById('eloPlayedSelect').addEventListener('click', function () {
  4495.  
  4496. GM_setValue("eloPlayedMatchesFlag", !GM_getValue("eloPlayedMatchesFlag"))
  4497. });
  4498.  
  4499. document.getElementById('eloScheduledSelect').addEventListener('click', function () {
  4500. GM_setValue("eloNextMatchesFlag", !GM_getValue("eloNextMatchesFlag"))
  4501. });
  4502.  
  4503. document.getElementById('teamSelect').addEventListener('click', function () {
  4504. GM_setValue("teamPageFlag", !GM_getValue("teamPageFlag"))
  4505. });
  4506.  
  4507. document.getElementById('trainingReportSelect').addEventListener('click', function () {
  4508. GM_setValue("trainingReportFlag", !GM_getValue("trainingReportFlag"))
  4509. });
  4510.  
  4511.  
  4512.  
  4513.  
  4514. document.getElementById('show_league_checkbox').addEventListener('click', function () {
  4515. GM_setValue("show_league_selects", !GM_getValue("show_league_selects"))
  4516. });
  4517.  
  4518.  
  4519.  
  4520. document.getElementById('windowsConfig').addEventListener('click', function () {
  4521.  
  4522. document.getElementById('tabsConfig').checked = !document.getElementById('windowsConfig').checked;
  4523.  
  4524. GM_setValue("windowsConfig", !GM_getValue("windowsConfig"))
  4525. GM_setValue("tabsConfig", !GM_getValue("tabsConfig"))
  4526.  
  4527.  
  4528. });
  4529.  
  4530.  
  4531. document.getElementById('tabsConfig').addEventListener('click', function () {
  4532. document.getElementById('windowsConfig').checked = !document.getElementById('tabsConfig').checked;
  4533. GM_setValue("windowsConfig", !GM_getValue("windowsConfig"))
  4534. GM_setValue("tabsConfig", !GM_getValue("tabsConfig"))
  4535.  
  4536.  
  4537. });
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543. (function () {
  4544. document.getElementById("slider_input").addEventListener('input', function () {
  4545. document.getElementById("testImage").style.width = document.getElementById("slider_input").value + "px";
  4546. document.getElementById("testImage").style.height = document.getElementById("slider_input").value + "px";
  4547.  
  4548. document.getElementById("sizeImageLeagueSpan").innerText = "(" + document.getElementById("slider_input").value + ")"
  4549.  
  4550.  
  4551. GM_setValue("league_image_size", document.getElementById("slider_input").value)
  4552.  
  4553.  
  4554. });
  4555. })();
  4556.  
  4557. }
  4558. function setLangSportCats() {
  4559.  
  4560. let langs = new Map();
  4561. langs.set('es', 'SPANISH');
  4562. langs.set('ar', 'SPANISH')
  4563. langs.set('en', 'ENGLISH');
  4564. langs.set('br', 'PORTUGUES');
  4565. langs.set('pt', 'PORTUGUES');
  4566. langs.set('pl', 'POLISH');
  4567. langs.set('ro', 'ROMANIAN');
  4568. langs.set('tr', 'TURKISH');
  4569.  
  4570. let lanCookie = getCookie("MZLANG");
  4571. if (langs.has(lanCookie)) {
  4572. window.lang = langs.get(lanCookie);
  4573. } else {
  4574. window.lang = "ENGLISH";
  4575. }
  4576.  
  4577. let sportCookie = getCookie("MZSPORT");
  4578. let lsport = "F"
  4579. let sport_id = 1;
  4580. if (sportCookie === "hockey") {
  4581. lsport = "H";
  4582. sport_id = 2;
  4583. }
  4584.  
  4585. let cats = {};
  4586. cats["senior"] = "senior";
  4587. cats["world"] = "seniorw";
  4588. cats["u23"] = "SUB23";
  4589. cats["u21"] = "SUB21";
  4590. cats["u18"] = "SUB18";
  4591. cats["u23_world"] = "SUB23w";
  4592. cats["u21_world"] = "SUB21w";
  4593. cats["u18_world"] = "SUB18w";
  4594.  
  4595.  
  4596. window.cats = cats;
  4597. window.sport = sportCookie;
  4598. window.lsport = lsport;
  4599. window.sport_id = sport_id;
  4600. window.userLocal = navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language;
  4601.  
  4602. }
  4603. function getUsernameData() {
  4604. if ((GM_getValue("currency") === undefined) || (GM_getValue("currency") === "")
  4605. ||(GM_getValue("soccer_team_id") === undefined) || (GM_getValue("soccer_team_id") === "")
  4606. ||(GM_getValue("hockey_team_id") === undefined) || (GM_getValue("hockey_team_id") === "")) {
  4607. let username = document.getElementById("header-username").innerText
  4608. GM_xmlhttpRequest({
  4609. method: "GET",
  4610. url: "http://www.managerzone.com/xml/manager_data.php?sport_id=" + window.sport_id + "&username=" + username,
  4611. headers: {
  4612. "Content-Type": "application/json"
  4613. },
  4614. onload: function (response) {
  4615.  
  4616. let parser = new DOMParser();
  4617. let xmlDoc = parser.parseFromString(response.responseText, "text/xml");
  4618. let userTeamsData = xmlDoc.getElementsByTagName("Team");
  4619. let index = 1;
  4620.  
  4621. if (userTeamsData[0].getAttribute("sport")==="soccer"){
  4622. GM_setValue("soccer_team_id", userTeamsData[0].getAttribute("teamId"))
  4623. }
  4624. if (userTeamsData[0].getAttribute("sport")==="hockey"){
  4625. GM_setValue("hockey_team_id", userTeamsData[0].getAttribute("teamId"))
  4626. }
  4627.  
  4628.  
  4629. if (userTeamsData[1].getAttribute("sport")==="soccer"){
  4630. GM_setValue("soccer_team_id", userTeamsData[1].getAttribute("teamId"))
  4631. }
  4632. if (userTeamsData[1].getAttribute("sport")==="hockey"){
  4633. GM_setValue("hockey_team_id", userTeamsData[1].getAttribute("teamId"))
  4634. }
  4635.  
  4636.  
  4637.  
  4638. if (userTeamsData[0].getAttribute("sport") === window.sport) {
  4639. index = 0;
  4640. }
  4641. GM_xmlhttpRequest({
  4642. method: "GET",
  4643. url: "http://www.managerzone.com/xml/team_playerlist.php?sport_id=" + window.sport_id + "&team_id=" + userTeamsData[index].getAttribute("teamId"),
  4644. headers: {
  4645. "Content-Type": "application/json"
  4646. },
  4647. onload: function (response) {
  4648. let parser = new DOMParser();
  4649. let xmlDoc = parser.parseFromString(response.responseText, "text/xml");
  4650. let team_data = xmlDoc.getElementsByTagName("TeamPlayers");
  4651. GM_setValue("currency", team_data[0].getAttribute("teamCurrency"))
  4652. }
  4653. });
  4654. }
  4655. });
  4656.  
  4657. }
  4658.  
  4659.  
  4660. }
  4661. function getActualDate(){
  4662. const fechaActual = new Date();
  4663. const year = fechaActual.getFullYear();
  4664. const month = String(fechaActual.getMonth() + 1).padStart(2, '0');
  4665. const day = String(fechaActual.getDate()).padStart(2, '0');
  4666. return `${year}-${month}-${day}`;
  4667. }
  4668. function compareVersions(installedVersion, latestVersion) {
  4669. const installedParts = installedVersion.split('.').map(Number);
  4670. const latestParts = latestVersion.split('.').map(Number);
  4671. for (let i = 0; i < Math.max(installedParts.length, latestParts.length); i++) {
  4672. const installed = installedParts[i] || 0;
  4673. const latest = latestParts[i] || 0;
  4674. if (installed < latest) {
  4675. GM_setValue("available_new_version","yes")
  4676. notifySnackBarNewVersion()
  4677. }else{
  4678. GM_setValue("available_new_version","no")
  4679. }
  4680. }
  4681.  
  4682. }
  4683.  
  4684. function getParsedValidDateText(text){
  4685. let initialDate="undefined"
  4686. let fecha=text
  4687. if(fecha.includes("-")){
  4688.  
  4689. let [day, month, year] = fecha.split("-");
  4690. initialDate = `${year}-${month}-${day}`;
  4691. }
  4692. if(fecha.includes("/")){
  4693. let [day, month, year] = fecha.split("/");
  4694. initialDate = `${year}-${month}-${day}`;
  4695.  
  4696. }
  4697.  
  4698. return initialDate
  4699.  
  4700.  
  4701.  
  4702. }
  4703.  
  4704.  
  4705.  
  4706. function getParsedValidDate(texto) {
  4707. let fecha = new Date(texto);
  4708. if (!isNaN(fecha.getTime())) {
  4709. return fecha.toISOString().split('T')[0];
  4710. } else {
  4711. let hoy = new Date();
  4712. hoy.setDate(hoy.getDate() - 5);
  4713. return hoy.toISOString().split('T')[0];
  4714. }
  4715. }
  4716.  
  4717.  
  4718. function notifySnackBarNewVersion(){
  4719. if(GM_getValue("stx_notified_version")!==GM_getValue("stx_latest_version")){
  4720. GM_setValue("stx_notified_version",GM_getValue("stx_latest_version"))
  4721. let x = document.getElementById("snackbar_stx");
  4722. let txt = "<img alt='' src='https://statsxente.com/MZ1/View/Images/main_icon.png' width='25px' height='25px'> <span style='color:#2da8ef; font-size: 17px;'>Stats Xente Script: </span>New version available</br></br>"
  4723. txt+="<button type='button' id='button-snackbar-update'>UPDATE</button>"
  4724. x.innerHTML = txt;
  4725. x.className = "showSnackBar_stx";
  4726. document.getElementById("button-snackbar-update").addEventListener('click', function () {
  4727. GM_setValue("date_checked_version","-")
  4728. window.open("https://update.greasyfork.org/scripts/491442/Stats%20Xente%20Script.user.js", "_blank");
  4729. });
  4730. setTimeout(function () { x.className = x.className.replace("showSnackBar_stx", ""); }, 8000);
  4731. }
  4732. }
  4733. async function checkScriptVersion(){
  4734. const actual_date=getActualDate()
  4735. if(actual_date!==GM_getValue("date_checked_version")){
  4736. GM_setValue("date_checked_version", actual_date)
  4737. const greasyForkURL = 'https://greasyfork.org/es/scripts/491442-stats-xente-script';
  4738. fetch(greasyForkURL)
  4739. .then(response => response.text())
  4740. .then(data => {
  4741. const parser = new DOMParser();
  4742. const doc = parser.parseFromString(data, 'text/html');
  4743. const versionElement = doc.querySelector('dd.script-show-version');
  4744. const latestVersion = versionElement ? versionElement.textContent.trim() : 'No se encontró versión';
  4745. const installedVersion = GM_info.script.version;
  4746. GM_setValue("stx_latest_version",latestVersion)
  4747. compareVersions(installedVersion, latestVersion);
  4748. })
  4749. .catch(error => {
  4750. console.error('Error al obtener la versión del script:', error);
  4751. });
  4752.  
  4753.  
  4754.  
  4755. }
  4756.  
  4757. }
  4758. function putSortIcon(a, tabla_) {
  4759. let filaEncabezado = tabla_.querySelector('thead tr');
  4760. let celdas = filaEncabezado.getElementsByTagName('th');
  4761. if (celdas.length === 0) {
  4762. celdas = filaEncabezado.getElementsByTagName('td');
  4763. }
  4764. let elementos = tabla_.querySelectorAll('.bi.bi-arrow-down-short');
  4765. elementos.forEach(function (elemento) {
  4766. elemento.remove();
  4767. })
  4768.  
  4769. elementos = tabla_.querySelectorAll('.bi.bi-arrow-up-short');
  4770. elementos.forEach(function (elemento) {
  4771. elemento.remove();
  4772. })
  4773.  
  4774.  
  4775.  
  4776. let iconAsc = '<svg class="bi bi-arrow-up-short" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="12" height="12" viewBox="0 0 320 512"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M182.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l256 0c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z"/></svg>'
  4777. let iconDesc = '<svg class="bi bi-arrow-down-short" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="12" height="12" viewBox="0 0 320 512"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M182.6 470.6c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-9.2-9.2-11.9-22.9-6.9-34.9s16.6-19.8 29.6-19.8l256 0c12.9 0 24.6 7.8 29.6 19.8s2.2 25.7-6.9 34.9l-128 128z"/></svg>'
  4778.  
  4779. let icon = iconAsc;
  4780. if (document.getElementById("ord_table").value === "descendente") {
  4781. icon = iconDesc;
  4782. }
  4783.  
  4784.  
  4785. celdas[a].innerHTML = icon + celdas[a].innerHTML;
  4786. }
  4787. function ordenarTablaq(columna, byClassName, param) {
  4788. let tabla
  4789. if (byClassName) {
  4790. let elems = document.getElementsByClassName(param);
  4791. tabla = elems[0]
  4792. } else {
  4793. tabla = document.getElementById(param)
  4794. }
  4795. let filas, switching, i, x, y, debeCambiar, direccion, cambioRealizado;
  4796. switching = true;
  4797. direccion = document.getElementById("ord_table").value
  4798. while (switching) {
  4799. switching = false;
  4800. filas = tabla.rows;
  4801. for (i = 1; i < (filas.length - 1); i++) {
  4802. debeCambiar = false;
  4803. x = filas[i].getElementsByTagName("td")[columna];
  4804. y = filas[i + 1].getElementsByTagName("td")[columna];
  4805. let xValue = parseFloat(x.innerHTML.replace(/\./g, "").replace(/[^0-9,-]+/g, "").replace(",", "."));
  4806. let yValue = parseFloat(y.innerHTML.replace(/\./g, "").replace(/[^0-9,-]+/g, "").replace(",", "."));
  4807. if (direccion === "ascendente") {
  4808. if (isNaN(xValue)) {
  4809. if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
  4810. debeCambiar = true;
  4811. break;
  4812. }
  4813. } else {
  4814. if (xValue > yValue) {
  4815. debeCambiar = true;
  4816. break;
  4817. }
  4818. }
  4819. } else if (direccion === "descendente") {
  4820. if (isNaN(xValue)) {
  4821. if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
  4822. debeCambiar = true;
  4823. break;
  4824. }
  4825. } else {
  4826. if (xValue < yValue) {
  4827. debeCambiar = true;
  4828. break;
  4829. }
  4830. }
  4831. }
  4832. }
  4833.  
  4834.  
  4835.  
  4836. if (debeCambiar) {
  4837. filas[i].parentNode.insertBefore(filas[i + 1], filas[i]);
  4838. switching = true;
  4839. cambioRealizado = true;
  4840. } else {
  4841. if (!cambioRealizado && direccion === "descendente") {
  4842. //direccion = "ascendente";
  4843. switching = true;
  4844. }
  4845. }
  4846. }
  4847.  
  4848. if (document.getElementById("ord_table").value === "descendente") {
  4849. document.getElementById("ord_table").value = "ascendente";
  4850. } else {
  4851. document.getElementById("ord_table").value = "descendente";
  4852. }
  4853.  
  4854.  
  4855. filas = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  4856. for (i = 0; i < filas.length; i++) {
  4857. let primerTd = filas[i].querySelector("td");
  4858. primerTd.innerHTML = (i + 1);
  4859. }
  4860. }
  4861. function darkenColor(rgb, percent) {
  4862. let result = rgb.match(/\d+/g);
  4863.  
  4864. // Convertir los valores RGB a enteros
  4865. let r = parseInt(result[0]);
  4866. let g = parseInt(result[1]);
  4867. let b = parseInt(result[2]);
  4868. // Reducir cada componente en un porcentaje
  4869. r = Math.floor(r * (1 - percent / 100));
  4870. g = Math.floor(g * (1 - percent / 100));
  4871. b = Math.floor(b * (1 - percent / 100));
  4872.  
  4873. // Asegurarse de que los valores estén dentro del rango válido (0-255)
  4874. r = Math.max(0, Math.min(255, r));
  4875. g = Math.max(0, Math.min(255, g));
  4876. b = Math.max(0, Math.min(255, b));
  4877.  
  4878. // Convertir de vuelta a hexadecimal y retornar el valor oscuro
  4879. return "#" + [r, g, b].map(x => {
  4880. const hex = x.toString(16);
  4881. return hex.length === 1 ? "0" + hex : hex;
  4882. }).join("");
  4883. }
  4884. function setCSSStyles(){
  4885. let link = document.createElement('link');
  4886. link.href = 'https://fonts.googleapis.com/css?family=Roboto&display=swap';
  4887. link.rel = 'stylesheet';
  4888.  
  4889. let link1 = document.createElement('link');
  4890. link1.href = 'https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css';
  4891. link1.rel = 'stylesheet';
  4892. document.head.appendChild(link)
  4893. document.head.appendChild(link1)
  4894.  
  4895. let inputHidden = document.createElement('input');
  4896. inputHidden.type = 'hidden';
  4897. inputHidden.id = 'ord_table';
  4898. inputHidden.value = 'ascendente';
  4899. document.body.appendChild(inputHidden);
  4900. GM_addStyle(`#snackbar_stx {
  4901. visibility: hidden;
  4902. position: fixed;
  4903. /*display: flex;*/
  4904. align-items: center;
  4905. left: 50%;
  4906. transform: translate(-50%, -50%);
  4907. min-width: 350px;
  4908. background-color: #323232;
  4909. color: #ffffffb3;
  4910. text-align: center;
  4911. border-radius: 2px;
  4912. padding: 16px;
  4913. z-index: 1;
  4914. bottom: 30px;
  4915. font-size: 17px;
  4916. border-radius: 5px;
  4917. box-shadow: 0 3px 5px -1px #0003, 0 6px 10px #00000024, 0 1px 18px #0000001f;
  4918. }
  4919.  
  4920. #snackbar_stx.showSnackBar_stx {
  4921. visibility: visible;
  4922. -webkit-animation: fadein 0.5s, fadeout 0.5s 8s forwards;
  4923. animation: fadein 0.5s, fadeout 0.5s 8s forwards;
  4924. }
  4925.  
  4926. @-webkit-keyframes fadein {
  4927. from {bottom: 0; opacity: 0;}
  4928. to {bottom: 30px; opacity: 1;}
  4929. }
  4930.  
  4931. @keyframes fadein {
  4932. from {bottom: 0; opacity: 0;}
  4933. to {bottom: 30px; opacity: 1;}
  4934. }
  4935.  
  4936. @-webkit-keyframes fadeout {
  4937. from {bottom: 30px; opacity: 1;}
  4938. to {bottom: 0; opacity: 0;}
  4939. }
  4940.  
  4941. @keyframes fadeout {
  4942. from {bottom: 30px; opacity: 1;}
  4943. to {bottom: 0; opacity: 0;}
  4944. }
  4945.  
  4946.  
  4947. .divAlert {
  4948. width: 75%;
  4949. padding: 4px 3px;
  4950. border-radius: 4px;
  4951. border-style: solid;
  4952. border-width: 1px;
  4953. font-size: 13px;
  4954. background-color: #ffc107;
  4955. color: #161515;
  4956. border-color: #ffffff;
  4957. font-weight: bold;
  4958. text-shadow: 1px 1px #ffffff;
  4959. }.modal_cargando {
  4960. display: none;
  4961. /* Hidden by default */
  4962. position: fixed;
  4963. /* Stay in place */
  4964. z-index: 150;
  4965. /* Sit on top */
  4966. padding-top: 25px;
  4967. /* Location of the box */
  4968. left: 0;
  4969. top: 0;
  4970. width: 100%;
  4971. /* Full width */
  4972. height: 100%;
  4973. /* Full height */
  4974. overflow: auto;
  4975. /* Enable scroll if needed */
  4976. background-color: rgb(0, 0, 0);
  4977. /* Fallback color */
  4978. background-color: rgba(0, 0, 0, 0.75);
  4979. /* Black w/ opacity */
  4980. justify-content: center;
  4981. align-items: center;
  4982. }
  4983.  
  4984. .modal-content_cargando {
  4985. position:relative;
  4986. border-radius:7px;
  4987. background-color: #fefefe00;
  4988. width: 90%;
  4989. height: 40%;
  4990. display: flex;
  4991. justify-content: center;
  4992. align-items: center;
  4993. }
  4994.  
  4995.  
  4996. .btn-save{
  4997. width:8em;
  4998. border-color:transparent;
  4999. border-radius: 3px;
  5000. display: inline-block;
  5001. padding: 10px 5px;
  5002. text-shadow: 0 1px 0 rgba(255,255,255,0.3);
  5003. box-shadow: 0 1px 1px rgba(0,0,0,0.3);
  5004. cursor:pointer;
  5005. color: white;
  5006. font-family: 'Roboto', sans-serif;
  5007. background-color: #3CC93F;/*Color de fondo*/
  5008. }
  5009. .btn-save:hover{
  5010. background-color: #37B839;/*Color de fondo*/
  5011. }
  5012. .btn-save:active{
  5013. background-color: #29962A;/*Color de fondo*/
  5014. }
  5015.  
  5016.  
  5017. .btn-update{
  5018. width:8em;
  5019. border-color:transparent;
  5020. border-radius: 3px;
  5021. display: inline-block;
  5022. padding: 10px 5px;
  5023. text-shadow: 0 1px 0 rgba(255,255,255,0.3);
  5024. box-shadow: 0 1px 1px rgba(0,0,0,0.3);
  5025. cursor:pointer;
  5026. color: white;
  5027. font-family: 'Roboto', sans-serif;
  5028. background-color: #2da8ef;/*Color de fondo*/
  5029. }
  5030. .btn-update:hover{
  5031. background-color: #2187c2;/*Color de fondo*/
  5032. }
  5033. .btn-update:active{
  5034. background-color: #2187c2;/*Color de fondo*/
  5035. }
  5036.  
  5037.  
  5038. .btn-comp-fed{
  5039. width:17em;
  5040. font-family: 'Roboto', sans-serif;
  5041. border:1px solid black;
  5042. border-radius: 5px;
  5043. display: inline-block;
  5044. padding: 7px 3px;
  5045. cursor:pointer;
  5046. color: white;
  5047. background-color: #2da8ef;/*Color de fondo*/
  5048. }
  5049. .btn-comp-fed:hover{
  5050. background-color: #2187c2;/*Color de fondo*/
  5051. }
  5052. .btn-comp-fed:active{
  5053. background-color: #2187c2;/*Color de fondo*/
  5054. }
  5055.  
  5056. .btn-delete{
  5057. width:8em;
  5058. border-color:transparent;
  5059. border-radius: 3px;
  5060. display: inline-block;
  5061. padding: 10px 5px;
  5062. text-decoration: none;
  5063. text-shadow: 0 1px 0 rgba(255,255,255,0.3);
  5064. box-shadow: 0 1px 1px rgba(0,0,0,0.3);
  5065. cursor:pointer;
  5066. color: white;
  5067. font-family: 'Roboto', sans-serif;
  5068. background-color: #e6413e;/*Color de fondo*/
  5069. }
  5070. .btn-delete:hover{
  5071. background-color: #C93832;/*Color de fondo*/
  5072. }
  5073. .btn-delete:active{
  5074. background-color: #ad2a24;/*Color de fondo*/
  5075. }
  5076.  
  5077. .cerrar {
  5078. position: absolute;
  5079. top: 0;
  5080. right: 0;
  5081. padding: 5px;
  5082. cursor: pointer;
  5083. color: #fff;
  5084. }
  5085.  
  5086. .close_cargando {
  5087. color: #aaaaaa;
  5088. float: right;
  5089. font-size: 28px;
  5090. font-weight: bold;
  5091. }
  5092.  
  5093. .close_cargando:hover,
  5094. .close_cargando:focus {
  5095. color: #000;
  5096. text-decoration: none;
  5097. cursor: pointer;
  5098. }.stx_legend {
  5099. z-index:300;
  5100. position: fixed;
  5101. bottom: 60%;
  5102. right: 1px;
  5103. border: 1px solid #2bacf5;
  5104. padding-right: 13px;
  5105. padding-left: 3px;
  5106. padding-top: 3px;
  5107. padding-bottom: 3px;
  5108. width: 14px;
  5109. font-size: 13px;
  5110. border-radius: 4px;
  5111. text-shadow: 1px 1px 3px #676767;
  5112. background-color: #246355;
  5113. color: #246355;
  5114. cursor: default;
  5115. cursor: pointer;
  5116. }.loader {
  5117. width: 100%;
  5118. height: 15px;
  5119. border-radius: 40px;
  5120. color: #ffc107;
  5121. border: 2px solid;
  5122. position: relative;
  5123. overflow: hidden;
  5124. }
  5125. .loader::before {
  5126. content: "";
  5127. position: absolute;
  5128. margin: 2px;
  5129. width: 14px;
  5130. top: 0;
  5131. bottom: 0;
  5132. left: -20px;
  5133. border-radius: inherit;
  5134. background: currentColor;
  5135. box-shadow: -10px 0 12px 3px currentColor;
  5136. clip-path: polygon(0 5%, 100% 0,100% 100%,0 95%,-30px 50%);
  5137. animation: l14 1s infinite linear;
  5138. }
  5139. @keyframes l14 {
  5140. 100% {left: calc(100% + 20px)}
  5141. }
  5142. .containerPeqAmarillo {
  5143. display: block;
  5144. position: relative;
  5145. padding-left: 35px;
  5146. margin-bottom: 12px;
  5147. font-size:medium;
  5148. padding-top:5px;
  5149. cursor: pointer;
  5150. -webkit-user-select: none;
  5151. -moz-user-select: none;
  5152. -ms-user-select: none;
  5153. user-select: none;
  5154. }
  5155.  
  5156. /* Hide the browser's default checkbox */
  5157. .containerPeqAmarillo input {
  5158. position: absolute;
  5159. opacity: 0;
  5160. cursor: pointer;
  5161. height: 0;
  5162. width: 0;
  5163. }
  5164.  
  5165. /* Create a custom checkbox */
  5166. .checkmarkPeqAmarillo {
  5167. position: absolute;
  5168. top: 0;
  5169. left: 0;
  5170. height: 25px;
  5171. width: 25px;
  5172. background-color: #a1a1a1;
  5173. }
  5174.  
  5175. /* On mouse-over, add a grey background color */
  5176. .containerPeqAmarillo:hover input ~ .checkmarkPeqAmarillo {
  5177. background-color: #5c5151;
  5178. }
  5179.  
  5180. /* When the checkbox is checked, add a blue background */
  5181. .containerPeqAmarillo input:checked ~ .checkmarkPeqAmarillo {
  5182. background-color: #FFCC00;
  5183. }
  5184.  
  5185. /* Create the checkmark/indicator (hidden when not checked) */
  5186. .checkmarkPeqAmarillo:after {
  5187. content: "";
  5188. position: absolute;
  5189. display: none;
  5190. }
  5191.  
  5192. /* Show the checkmark when checked */
  5193. .containerPeqAmarillo input:checked ~ .checkmarkPeqAmarillo:after {
  5194. display: block;
  5195. }
  5196.  
  5197. /* Style the checkmark/indicator */
  5198. .containerPeqAmarillo .checkmarkPeqAmarillo:after {
  5199. left: 9px;
  5200. top: 5px;
  5201. width: 5px;
  5202. height: 10px;
  5203. border: solid white;
  5204. border-width: 0 3px 3px 0;
  5205. -webkit-transform: rotate(45deg);
  5206. -ms-transform: rotate(45deg);
  5207. transform: rotate(45deg);
  5208. }
  5209. #showMenu {
  5210. text-align: left;
  5211. border-collapse: collapse;
  5212. width: 75%;
  5213. font-size: 14px;
  5214. font-family: 'Roboto', sans-serif
  5215. }
  5216.  
  5217. /* #showMenu th,td {
  5218. padding: 4px;
  5219. }*/
  5220.  
  5221. #showMenu td {
  5222. background-color: white;
  5223. }
  5224.  
  5225. #showMenu thead {
  5226. background-color: #246355;
  5227. border-bottom: solid 2px #0F362D;
  5228. color: white;
  5229. }
  5230.  
  5231. #showMenu tfoot {
  5232. font-family: 'Righteous', cursive;
  5233. background-color: #246355;
  5234. border-bottom: solid 5px #0F362D;
  5235. font-size: 13px;
  5236. color: white;
  5237. }
  5238.  
  5239.  
  5240.  
  5241. #showMenu tr td,
  5242. th {
  5243. border-top-right-radius: 0;
  5244. border-top-left-radius: 0;
  5245. border-bottom-left-radius: 0;
  5246. border-bottom-right-radius: 0;
  5247. }
  5248.  
  5249. #showMenu th:first-child {
  5250. border-top-left-radius: 5px;
  5251. }
  5252.  
  5253. #showMenu th:last-child {
  5254. border-top-right-radius: 5px;
  5255. }
  5256.  
  5257. #showMenu tr {
  5258. background-color: transparent;
  5259. border-color: transparent;
  5260. font-family: 'Roboto';
  5261. }
  5262.  
  5263. #show3{
  5264.  
  5265. width: 75%;
  5266. background-color: transparent;
  5267. border-collapse: separate;
  5268. border-spacing: 0;
  5269. }
  5270.  
  5271.  
  5272.  
  5273. #show3 td {
  5274. background-color: white;
  5275. }
  5276.  
  5277. #show3 tr:last-child td:last-child {
  5278. border-bottom-right-radius: 5px;
  5279. }
  5280.  
  5281.  
  5282. #show3 tr:last-child td:first-child {
  5283. border-bottom-left-radius: 5px;
  5284. }
  5285.  
  5286. .caja_mensaje_50 {
  5287. font-family: 'Roboto', sans-serif;
  5288. background: #98D398;
  5289. color: #FFFFFF;
  5290. font-weight: bold;
  5291. padding: 4px;
  5292. text-align: center;
  5293. width: 50%;
  5294. font-size: 2.0em;
  5295. border-radius: 5px;
  5296. }
  5297.  
  5298. .modal_div_content_main{
  5299. width: 100%;
  5300. background-color: #f2f2f2;
  5301. min-height: 115px;
  5302. border-radius: 5px;
  5303. }
  5304.  
  5305.  
  5306.  
  5307.  
  5308. .expandable-icon {
  5309. right: 0px;
  5310. top: 0px;
  5311. transform: rotateZ(45deg);
  5312. border-radius: 5px;
  5313. width: 20px;
  5314. height: 20px;
  5315. background: rgb(12, 47, 94);
  5316. transition: all .3s;
  5317. }
  5318.  
  5319. .expandable-item.active .expandable-icon{
  5320. transform: rotateZ(0);
  5321. }
  5322.  
  5323. .expandable-icon .line {
  5324. width: 15px;
  5325. height: 2px;
  5326. background: white;
  5327. position: absolute;
  5328. top: 0;
  5329. left: 0;
  5330. right: 0;
  5331. bottom: 0;
  5332. margin: auto;
  5333. transition: all .4s;
  5334. }
  5335.  
  5336. .expandable-icon .line:nth-child(1) {
  5337. transform: rotateZ(45deg);
  5338. }
  5339.  
  5340. .expandable-icon .line:nth-child(2) {
  5341. transform: rotateZ(-45deg);
  5342. }
  5343.  
  5344.  
  5345. .imgMiddle {
  5346. display: inline-block;
  5347. vertical-align: middle;
  5348. }
  5349.  
  5350. .textMiddle {
  5351. display: inline-block;
  5352. vertical-align: middle;
  5353. }
  5354.  
  5355.  
  5356. table.matchValuesTable {
  5357. border-collapse: collapse;
  5358. width: 80%;
  5359. margin: 5px 0;
  5360. z-index:15;
  5361.  
  5362. }
  5363. table.matchValuesTable th, table.matchValuesTable td {
  5364. border: 1px solid #ddd;
  5365. text-align: center;
  5366. padding: 6px;
  5367. border: 0px;
  5368. }
  5369. table.matchValuesTable th {
  5370. background-color: #e4c800;
  5371. color: white;
  5372. border: 0px;
  5373. }
  5374.  
  5375. table.matchValuesTable th:first-child {
  5376. border-top: none; /* Quita el borde superior de la primera celda del encabezado */
  5377. }
  5378.  
  5379.  
  5380. #button-snackbar-update{
  5381. color: #2da8ef;
  5382. background-color: transparent;
  5383. border: 1px solid #2da8ef;
  5384. padding: .15rem .50rem;
  5385. font-size: 0.90rem;
  5386. line-height: 1.5;
  5387. border-radius: .25rem;
  5388. cursor:pointer;
  5389. }
  5390.  
  5391. #button-snackbar-update:hover{
  5392. color: white;
  5393. background-color: #2da8ef;
  5394. border: 1px solid #2da8ef;
  5395. padding: .15rem .50rem;
  5396. font-size: 0.90rem;
  5397. line-height: 1.5;
  5398. border-radius: .25rem;
  5399. cursor:pointer;
  5400. }.loader-soccer {
  5401. width: 100%;
  5402. height: 15px;
  5403. border-radius: 40px;
  5404. color: #5d7f13;
  5405. border: 2px solid;
  5406. position: relative;
  5407. overflow: hidden;
  5408. }
  5409. .loader-soccer::before {
  5410. content: "";
  5411. position: absolute;
  5412. margin: 2px;
  5413. width: 14px;
  5414. top: 0;
  5415. bottom: 0;
  5416. left: -20px;
  5417. border-radius: inherit;
  5418. background: currentColor;
  5419. box-shadow: -10px 0 12px 3px currentColor;
  5420. clip-path: polygon(0 5%, 100% 0,100% 100%,0 95%,-30px 50%);
  5421. animation: l14 1s infinite linear;
  5422. }
  5423.  
  5424. .loader-hockey {
  5425. width: 100%;
  5426. height: 15px;
  5427. border-radius: 40px;
  5428. color: #148cac;
  5429. border: 2px solid;
  5430. position: relative;
  5431. overflow: hidden;
  5432. }
  5433. .loader-hockey::before {
  5434. content: "";
  5435. position: absolute;
  5436. margin: 2px;
  5437. width: 14px;
  5438. top: 0;
  5439. bottom: 0;
  5440. left: -20px;
  5441. border-radius: inherit;
  5442. background: currentColor;
  5443. box-shadow: -10px 0 12px 3px currentColor;
  5444. clip-path: polygon(0 5%, 100% 0,100% 100%,0 95%,-30px 50%);
  5445. animation: l14 1s infinite linear;
  5446. }
  5447. @keyframes l14 {
  5448. 100% {left: calc(100% + 20px)}
  5449. }
  5450. `)
  5451.  
  5452. }
  5453.  
  5454. })();