Stats Xente Script

Stats Xente script for inject own data on Managerzone site

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

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