Stats Xente Script

Stats Xente script for inject own data on Managerzone site

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

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