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