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