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