Stats Xente Script

Stats Xente script for inject own data on Managerzone site

当前为 2024-10-16 提交的版本,查看 最新版本

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