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.103
  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.  
  1286. console.log("https://statsxente.com/MZ1/Functions/tamper_teams.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport + linkIds)
  1287. GM_xmlhttpRequest({
  1288. method: "GET",
  1289. url: "https://statsxente.com/MZ1/Functions/tamper_teams.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport + linkIds,
  1290. headers: {
  1291. "Content-Type": "application/json"
  1292. },
  1293. onload: function (response) {
  1294. var cat = window.cats[urlParams.get('type')]
  1295. var jsonResponse = JSON.parse(response.responseText);
  1296. teams_data = jsonResponse;
  1297. var filasDatos = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  1298. for (var i = 0; i < filasDatos.length; i++) {
  1299. if (checkClassNameExists(filasDatos[i], searchClassName)) {
  1300. var celda = filasDatos[i].cells[1];
  1301. var equipo = celda.textContent.trim()
  1302. var iniIndex = celda.innerHTML.indexOf("tid=");
  1303. var lastIndex = celda.innerHTML.indexOf("\">", iniIndex + 4);
  1304. var data = String(celda.innerHTML)
  1305. var id = data.substring(iniIndex + 4, lastIndex)
  1306. var nuevaColumna = document.createElement("td");
  1307. var valor = 0;
  1308.  
  1309. if (jsonResponse[id] && jsonResponse[id][initialValues[urlParams.get('type')]] !== undefined) {
  1310. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[id][initialValues[urlParams.get('type')]]))
  1311. }
  1312. nuevaColumna.innerHTML = valor
  1313. nuevaColumna.style.textAlign = 'center';
  1314. filasDatos[i].appendChild(nuevaColumna);
  1315.  
  1316. var eloType = 1
  1317.  
  1318. if (window.sport == "soccer") { eloType = 2 }
  1319. if (cat.includes("SUB")) { eloType = 3 }
  1320. var cats_elo = {}
  1321. cats_elo["senior"] = "SENIOR";
  1322. cats_elo["seniorw"] = "SENIOR";
  1323. cats_elo["SUB23"] = "U23";
  1324. cats_elo["SUB21"] = "U21";
  1325. cats_elo["SUB18"] = "U18";
  1326. cats_elo["SUB23w"] = "U23";
  1327. cats_elo["SUB21w"] = "U21";
  1328. cats_elo["SUB18w"] = "U18";
  1329.  
  1330. var flagSenior = 0, flagSub23 = 0, flagSub21 = 0, flagSub18 = 0;
  1331. if (jsonResponse[id]["elo"] > 0) { flagSenior = 1 }
  1332. if (jsonResponse[id]["elo23"] > 0) { flagSub23 = 1 }
  1333. if (jsonResponse[id]["elo21"] > 0) { flagSub21 = 1 }
  1334. if (jsonResponse[id]["elo18"] > 0) { flagSub18 = 1 }
  1335.  
  1336. var buttonDisplay = "display:block;";
  1337. nuevaColumna = document.createElement("td");
  1338. 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;'/>";
  1339. if (GM_getValue("league_graph_button") == "checked") {
  1340. buttonDisplay = ""
  1341. } else {
  1342. buttonDisplay = "display:none;";
  1343. }
  1344. 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 + "'/>";
  1345.  
  1346. if (GM_getValue("league_report_button") == "checked") {
  1347. buttonDisplay = ""
  1348. } else {
  1349. buttonDisplay = "display:none;";
  1350. }
  1351. 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 + "'/>";
  1352.  
  1353. if (GM_getValue("league_calendar_button") == "checked") {
  1354. buttonDisplay = ""
  1355. } else {
  1356. buttonDisplay = "display:none;";
  1357. }
  1358. 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 + "'/>";
  1359. iner += "</center>";
  1360. cat = cats[urlParams.get('type')]
  1361. nuevaColumna.innerHTML = iner
  1362. filasDatos[i].appendChild(nuevaColumna);
  1363. nuevaColumna = document.createElement("td");
  1364.  
  1365.  
  1366. (function (currentId, currentLSport, lang) {
  1367. document.getElementById("but1" + currentId).addEventListener('click', function () {
  1368. var link = "https://statsxente.com/MZ1/Graficos/graficoProgresoEquipo.php?idEquipo=" + currentId + "&idioma=" + lang + "&divisa=" + GM_getValue("currency") + "&deporte=" + currentLSport;
  1369. openWindow(link, 0.95, 1.25);
  1370. });
  1371. })(id, window.lsport, window.lang);
  1372.  
  1373. (function (currentId, currentLSport, lang, currentCat) {
  1374. document.getElementById("but2" + currentId).addEventListener('click', function () {
  1375. var src = "filtroGraficoEquiposHistoricoHockey";
  1376. if (currentLSport == "F") {
  1377. src = "filtroGraficoLinealEquiposHistorico";
  1378. }
  1379. 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=-"
  1380. openWindow(link, 0.95, 1.25);
  1381. });
  1382. })(id, window.lsport, window.lang, cat);
  1383.  
  1384. (function (currentId, currentEquipo, currentCat, currentSport, lang) {
  1385. document.getElementById("but" + currentId).addEventListener('click', function () {
  1386.  
  1387. 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";
  1388. openWindow(link, 0.95, 1.25);
  1389. });
  1390. })(id, equipo, cat, window.sport, window.lang);
  1391.  
  1392. (function (currentId, type, currentCat, currentSport, lang, flagS, flagS23, flagS21, flagS18) {
  1393. document.getElementById("but3" + currentId).addEventListener('click', function () {
  1394. var link = "https://statsxente.com/MZ1/Graficos/graficoRachaEquipoELO.php?tamper=yes&team_id=" + currentId + "&idioma=" + lang + "&deporte=" + currentSport + "&type=" + type + "&cat=" + currentCat + "&flagSenior=" +
  1395. flagS + "&flagSub23=" + flagS23 + "&flagSub21=" + flagS21 + "&flagSub18=" + flagS18;
  1396. openWindow(link, 0.95, 1.25);
  1397. });
  1398. })(id, eloType, cats_elo[cat], window.sport, window.lang, flagSenior, flagSub23, flagSub21, flagSub18);
  1399.  
  1400. }
  1401.  
  1402. }
  1403.  
  1404. var thead = document.getElementsByClassName("seriesHeader")[0]
  1405. var ths = thead.querySelectorAll("th");
  1406. ths.forEach(function (th, index) {
  1407. th.addEventListener("click", function () {
  1408. if (index == 1) {
  1409. ordenarTablaText(index, true, "nice_table",true);
  1410. } else {
  1411. ordenarTabla(index, true, "nice_table",true);
  1412. }
  1413.  
  1414. });
  1415. });
  1416. }
  1417. });
  1418. }
  1419. //Clash leagues page
  1420. function clashLeagues() {
  1421.  
  1422. var urlParams = new URLSearchParams(window.location.search);
  1423.  
  1424. document.getElementById("division-select").addEventListener('change', function () {
  1425. setTimeout(function () {
  1426. clashLeagues();
  1427. }, 2000);
  1428. });
  1429.  
  1430.  
  1431. document.getElementById("season-select").addEventListener('change', function () {
  1432. setTimeout(function () {
  1433. clashLeagues();
  1434. }, 2000);
  1435. });
  1436.  
  1437.  
  1438.  
  1439.  
  1440. var elems = document.getElementsByClassName("nice_table");
  1441. var tabla = elems[0]
  1442. var thSegundo = tabla.querySelector("thead th:nth-child(2)");
  1443. thSegundo.style.width = "250px";
  1444. var values = new Map();
  1445. values.set('valueLM', 'LM Value');
  1446. values.set('elo', 'ELO Score');
  1447. values.set('teams_count', 'Number of teams');
  1448. values.set('table_index', 'Rank Position');
  1449.  
  1450. var contenidoNuevo = '<div id=testClick><center>'
  1451. getNativeTableStyles();
  1452. var idProgress = "noProgress";
  1453. if (urlParams.get('type') == "senior") {
  1454. idProgress = "divProgress"
  1455. }
  1456.  
  1457. ///MENU TABLE
  1458. contenidoNuevo += "<center><table id=showMenu border=1><thead style='background-color:" + GM_getValue("bg_native") + "; color:" + GM_getValue("color_native") + ";'><tr>";
  1459. contenidoNuevo += '<th align=center style="padding:4px;" colspan="3">Values</th></tr></thead>';
  1460. contenidoNuevo += "<tr>";
  1461. contenidoNuevo += "</tr></table></center>";
  1462. contenidoNuevo += '<table id=show3 border="0"><tr><td><label>';
  1463. contenidoNuevo += '<input class="statsxente" type="checkbox" checked id="value" value="Value">Value</label></td>';
  1464.  
  1465.  
  1466. values.forEach(function (valor, clave) {
  1467. contenidoNuevo += '<td><label><input class="statsxente" type="checkbox" value="' + valor + '" id="' + clave + '">' + valor + '</label></td>';
  1468. });
  1469. contenidoNuevo += "</tr></table></center>"
  1470. contenidoNuevo += "</div></br>";
  1471.  
  1472. values.set('value', 'Value');
  1473. elems = document.getElementsByClassName("nice_table");
  1474. tabla = elems[0]
  1475. tabla.insertAdjacentHTML('beforebegin', contenidoNuevo);
  1476.  
  1477.  
  1478.  
  1479. values.forEach(function (valor, clave) {
  1480.  
  1481. var elemento = document.getElementById(clave);
  1482. elemento.addEventListener('click', handleClickClash);
  1483.  
  1484. });
  1485. var nuevaCeldaEncabezado = document.createElement("th");
  1486. nuevaCeldaEncabezado.textContent = "Value";
  1487. nuevaCeldaEncabezado.style.textAlign = 'center';
  1488. var ser = document.getElementsByClassName("seriesHeader")
  1489. document.getElementsByClassName("nice_table")[0].querySelector('thead').querySelector('tr').appendChild(nuevaCeldaEncabezado);
  1490.  
  1491. nuevaCeldaEncabezado = document.createElement("th");
  1492. nuevaCeldaEncabezado.textContent = "Stats Xente";
  1493. nuevaCeldaEncabezado.style.textAlign = 'center';
  1494. document.getElementsByClassName("nice_table")[0].querySelector('thead').querySelector('tr').appendChild(nuevaCeldaEncabezado);
  1495.  
  1496.  
  1497. var contIds = 0
  1498. var linkIds = ""
  1499. var filasDatos = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  1500. for (var i = 0; i < filasDatos.length; i++) {
  1501. var celda = tabla.rows[i + 1].cells[1];
  1502. var imagen = celda.querySelector('img');
  1503. var url = new URL(imagen.src);
  1504. var id = url.searchParams.get('fid');
  1505. linkIds += "&id" + contIds + "=" + id
  1506. contIds++
  1507. }
  1508.  
  1509.  
  1510. GM_xmlhttpRequest({
  1511. method: "GET",
  1512. url: "https://statsxente.com/MZ1/Functions/tamper_federations.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport + linkIds,
  1513. headers: {
  1514. "Content-Type": "application/json"
  1515. },
  1516. onload: function (response) {
  1517. var jsonResponse = JSON.parse(response.responseText);
  1518. teams_data = jsonResponse;
  1519. var filasDatos = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  1520. for (var i = 0; i < filasDatos.length; i++) {
  1521. var celda = tabla.rows[i + 1].cells[1];
  1522. var imagen = celda.querySelector('img');
  1523. var url = new URL(imagen.src);
  1524. var id = url.searchParams.get('fid');
  1525. var nuevaColumna = document.createElement("td");
  1526. var valor = 0
  1527.  
  1528. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[id]["value"]))
  1529. nuevaColumna.innerHTML = valor
  1530. nuevaColumna.style.textAlign = 'center';
  1531. filasDatos[i].appendChild(nuevaColumna);
  1532.  
  1533.  
  1534. nuevaColumna = document.createElement("td");
  1535. var iner = "<center><img src='https://statsxente.com/MZ1/View/Images/detail.png' width='20px' height='20px' id='but" + id + "' style='cursor:pointer;'/>";
  1536. iner += "</center>";
  1537. var cat = cats[urlParams.get('type')]
  1538. nuevaColumna.innerHTML = iner
  1539. filasDatos[i].appendChild(nuevaColumna);
  1540.  
  1541.  
  1542. (function (currentId, currentSport, lang) {
  1543. document.getElementById("but" + currentId).addEventListener('click', function () {
  1544.  
  1545. var link = "https://statsxente.com/MZ1/Functions/loadClashFederationDetail.php?tamper=yes&idioma=" +
  1546. lang + "&modal_to_close=myModal&divisa=" + GM_getValue("currency") + "&fid=" + currentId + "&sport=" + currentSport + "&modal=yes";
  1547. openWindow(link, 0.95, 1.25);
  1548. });
  1549. })(id, window.sport, window.lang);
  1550.  
  1551. }
  1552. }
  1553. });
  1554.  
  1555. var thead = document.getElementsByClassName("nice_table")[0].querySelector('thead')
  1556. var ths = thead.querySelectorAll("th");
  1557. ths.forEach(function (th, index) {
  1558. th.addEventListener("click", function () {
  1559. ordenarTabla(index, true, "nice_table",true);
  1560. });
  1561. });
  1562. }
  1563. //Cups and FL's page
  1564. async function friendlyCupsAndLeagues() {
  1565. var urlParams = new URLSearchParams(window.location.search);
  1566. var age_restriction = "none"
  1567. var link = "https://www.managerzone.com" + document.getElementById("ui-id-1").getAttribute('href')
  1568. if (urlParams.get('fsid')) {
  1569. age_restriction = await fetchAgeRestriction(link);
  1570. } else {
  1571. age_restriction = await fetchCupAgeRestriction(link);
  1572. }
  1573.  
  1574. var detected_cat = "senior"
  1575.  
  1576. if (age_restriction !== "none") {
  1577.  
  1578.  
  1579. switch (age_restriction) {
  1580. case "U23":
  1581. detected_cat = "u23"
  1582. break;
  1583. case "U21":
  1584. detected_cat = "u21"
  1585. break;
  1586. case "U18":
  1587. detected_cat = "u18"
  1588. break;
  1589. }
  1590.  
  1591. }
  1592.  
  1593.  
  1594.  
  1595. var initialValues = {};
  1596. initialValues["senior"] = GM_getValue("league_default_senior");
  1597. initialValues["world"] = GM_getValue("league_default_senior");
  1598. initialValues["u23"] = GM_getValue("league_default_u23");
  1599. initialValues["u21"] = GM_getValue("league_default_u21");
  1600. initialValues["u18"] = GM_getValue("league_default_u18");
  1601. initialValues["u23_world"] = GM_getValue("league_default_u23");
  1602. initialValues["u21_world"] = GM_getValue("league_default_u21");
  1603. initialValues["u18_world"] = GM_getValue("league_default_u18");;
  1604.  
  1605. var linkIds = ""
  1606. var elems = document.getElementsByClassName("nice_table");
  1607. var tabla = elems[0]
  1608. var thSegundo = tabla.querySelector("thead th:nth-child(2)");
  1609. thSegundo.style.width = "250px";
  1610.  
  1611.  
  1612. var values = new Map();
  1613. values.set('valor23', 'U23 Value');
  1614. values.set('valor21', 'U21 Value');
  1615. values.set('valor18', 'U18 Value');
  1616. values.set('salario', 'Salary');
  1617. values.set('valorUPSenior', 'LM Value');
  1618. values.set('valorUPSUB23', 'U23 LM Value');
  1619. values.set('valorUPSUB21', 'U21 LM Value');
  1620. values.set('valorUPSUB18', 'U18 LM Value');
  1621. values.set('edad', 'Age');
  1622. if (window.sport == "soccer") {
  1623. values.set('valor11', 'TOP 11');
  1624. values.set('valor11_23', 'U23 TOP 11');
  1625. values.set('valor11_21', 'U21 TOP 11');
  1626. values.set('valor11_18', 'U18 TOP 11');
  1627. } else {
  1628. values.set('valor11', 'TOP 21');
  1629. values.set('valor11_23', 'U23 TOP 21');
  1630. values.set('valor11_21', 'U21 TOP 21');
  1631. values.set('valor11_18', 'U18 TOP 21');
  1632. }
  1633.  
  1634. values.set('noNac', 'Foreigners');
  1635. values.set('elo', 'ELO Score');
  1636. values.set('elo23', 'U23 ELO Score');
  1637. values.set('elo21', 'U21 ELO Score');
  1638. values.set('elo18', 'U18 ELO Score');
  1639. values.set('numJugadores', 'Number of players');
  1640. values.set('leagues', 'Leagues');
  1641. values.set('world_leagues_all', 'World Leagues');
  1642. values.set('youth_leagues_all', 'Youth Leagues');
  1643. values.set('world_youth_leagues_all', 'Youth World Leagues');
  1644. values.set('federation_leagues', 'Federation Leagues');
  1645. values.set('cup', 'Cups');
  1646. values.set('cup_u23', 'U23 Cups');
  1647. values.set('cup_u21', 'U21 Cups');
  1648. values.set('cup_u18', 'U18 Cups');
  1649. values.set('special_cup', 'Special Cups');
  1650.  
  1651. var contenidoNuevo = '<div id=testClick><center>'
  1652.  
  1653.  
  1654. getNativeTableStyles();
  1655.  
  1656. var idProgress = "noProgress";
  1657. if (urlParams.get('type') == "senior") {
  1658. idProgress = "divProgress"
  1659. }
  1660.  
  1661.  
  1662. var widthTable = "1.5em"
  1663. ///MENU TABLE
  1664. contenidoNuevo += "<center><table id=showMenu border=0><thead style='background-color:" + GM_getValue("bg_native") + "; color:" + GM_getValue("color_native") + ";'><tr>";
  1665. contenidoNuevo += '<th align=center style="padding:4px;" colspan="4">Stats Xente</th>';
  1666. contenidoNuevo += "</tr></thead>";
  1667. var styleTable = " style='display:none;'";
  1668. var styleIcon = ""
  1669. var styleSep = "style='padding-top:5px;'";
  1670.  
  1671. if (GM_getValue("show_league_selects") == true) {
  1672. styleTable = "";
  1673. styleIcon = " active"
  1674. styleSep = " style='display:none;'";
  1675.  
  1676. }
  1677.  
  1678.  
  1679. contenidoNuevo += "<tr><td></td><td style='padding-top:5px' colspan='2'>";
  1680.  
  1681. 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>';
  1682.  
  1683. contenidoNuevo += "</td><td></td></tr>";
  1684.  
  1685. contenidoNuevo += "<tr><td colspan='5' id='separatorTd'" + styleSep + "></td></tr>";
  1686.  
  1687.  
  1688.  
  1689. contenidoNuevo += "</table></center>";
  1690.  
  1691.  
  1692.  
  1693. contenidoNuevo += '<table id=show3 border="0"' + styleTable + '><tr><td><label>';
  1694.  
  1695. if ((urlParams.get('type') == 'senior') || (urlParams.get('type') == 'world')) {
  1696. if ("valor" == initialValues[detected_cat]) {
  1697. contenidoNuevo += '<input class="statsxente" type="checkbox" checked id="valor" value="Value">Value</label></td>';
  1698. } else {
  1699. contenidoNuevo += '<input class="statsxente" type="checkbox" id="valor" value="Value">Value</label></td>';
  1700. }
  1701. } else {
  1702. contenidoNuevo += '<input class="statsxente" type="checkbox" id="valor" value="Value">Value</label></td>';
  1703. }
  1704.  
  1705. values.forEach(function (valor, clave) {
  1706.  
  1707. if (clave == "valorUPSenior") {
  1708. contenidoNuevo += "</tr><tr>";
  1709. }
  1710.  
  1711. if (clave == "valor11") {
  1712. contenidoNuevo += "</tr><tr>";
  1713. }
  1714. if (clave == "elo") {
  1715. contenidoNuevo += "</tr><tr>";
  1716. }
  1717.  
  1718. if (clave == "leagues") {
  1719. contenidoNuevo += "</tr><tr>";
  1720. }
  1721.  
  1722. if (clave == "leagues_all") {
  1723. contenidoNuevo += "</tr><tr>";
  1724. }
  1725.  
  1726. if (clave == "cup") {
  1727. contenidoNuevo += "</tr><tr>";
  1728. }
  1729.  
  1730. if (clave == initialValues[detected_cat]) {
  1731. contenidoNuevo += '<td><label><input class="statsxente" type="checkbox" checked value="' + valor + '" id="' + clave + '">' + valor + '</label></td>';
  1732. } else {
  1733. contenidoNuevo += '<td><label><input class="statsxente" type="checkbox" value="' + valor + '" id="' + clave + '">' + valor + '</label></td>';
  1734. }
  1735. });
  1736. contenidoNuevo += "</tr></table></center>"
  1737. contenidoNuevo += "</div></br>";
  1738.  
  1739.  
  1740. values.set('valor', 'Value');
  1741.  
  1742. elems = document.getElementsByClassName("nice_table");
  1743. tabla = elems[0]
  1744.  
  1745.  
  1746. tabla.insertAdjacentHTML('beforebegin', contenidoNuevo);
  1747.  
  1748. if (GM_getValue("show_league_selects") == true) {
  1749.  
  1750. document.getElementById("line2").style.transform = 'rotateZ(0deg)';
  1751. document.getElementById("line1").style.transform = 'rotateZ(180deg)';
  1752. document.getElementById("moreInfo").style.transform = 'rotateZ(0deg)';
  1753. }
  1754.  
  1755.  
  1756. values.forEach(function (valor, clave) {
  1757.  
  1758. var elemento = document.getElementById(clave);
  1759. elemento.addEventListener('click', handleClick);
  1760.  
  1761. });
  1762. var nuevaCeldaEncabezado = document.createElement("th");
  1763. nuevaCeldaEncabezado.textContent = values.get(initialValues[detected_cat]);
  1764. nuevaCeldaEncabezado.style.textAlign = 'center';
  1765. nuevaCeldaEncabezado.style.maxWidth = '7.5em';
  1766. nuevaCeldaEncabezado.style.width = '7.5em';
  1767. nuevaCeldaEncabezado.style.whiteSpace = 'nowrap';
  1768. nuevaCeldaEncabezado.style.overflow = 'hidden';
  1769. nuevaCeldaEncabezado.style.textOverflow = 'ellipsis';
  1770.  
  1771. var ser = document.getElementsByClassName("seriesHeader")
  1772.  
  1773.  
  1774. var table_index = 0;
  1775. for (var kl = 0; kl < ser.length; kl++) {
  1776. if (document.getElementsByClassName("seriesHeader")[kl].parentNode.parentNode.className == "nice_table") {
  1777. table_index = kl
  1778. }
  1779.  
  1780.  
  1781. }
  1782.  
  1783. document.getElementsByClassName("seriesHeader")[table_index].cells[1].style.width = "180px"
  1784. document.getElementsByClassName("seriesHeader")[table_index].appendChild(nuevaCeldaEncabezado);
  1785.  
  1786. nuevaCeldaEncabezado = document.createElement("th");
  1787. nuevaCeldaEncabezado.textContent = "Stats Xente";
  1788. nuevaCeldaEncabezado.style.textAlign = 'center';
  1789. ser = document.getElementsByClassName("seriesHeader")
  1790. document.getElementsByClassName("seriesHeader")[table_index].appendChild(nuevaCeldaEncabezado);
  1791.  
  1792.  
  1793. if (tabla.getElementsByTagName("tbody")[0].innerHTML.includes("mazyar")) {
  1794. searchClassName = "responsive-hide"
  1795. }
  1796.  
  1797. var contIds = 0
  1798. var filasDatos = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  1799. for (var i = 0; i < filasDatos.length; i++) {
  1800. if (checkClassNameExists(tabla.rows[i + 1], searchClassName)) {
  1801. var celda = tabla.rows[i + 1].cells[1];
  1802. var equipo = celda.textContent.trim()
  1803. var iniIndex = celda.innerHTML.indexOf("tid=");
  1804. var lastIndex = celda.innerHTML.indexOf("\">", iniIndex + 4);
  1805. var data = String(celda.innerHTML)
  1806. var id = data.substring(iniIndex + 4, lastIndex)
  1807. linkIds += "&idEquipo" + contIds + "=" + id
  1808. contIds++
  1809. celda.innerHTML += "<input type='hidden' id='team_" + id + "' value='" + equipo + "'/>"
  1810. }
  1811.  
  1812. }
  1813.  
  1814.  
  1815.  
  1816. ///DIV PROGRESS
  1817. setTimeout(function () {
  1818.  
  1819.  
  1820. (function () {
  1821. document.getElementById("moreInfo").addEventListener('click', function () {
  1822. document.getElementById("moreInfo").classList.toggle('active');
  1823.  
  1824. if (document.getElementById("moreInfo").classList.contains("active")) {
  1825. document.getElementById("line2").style.transform = 'rotateZ(0deg)';
  1826. document.getElementById("line1").style.transform = 'rotateZ(180deg)';
  1827. document.getElementById("moreInfo").style.transform = 'rotateZ(0deg)';
  1828. $('#separatorTd').fadeOut(1);
  1829. document.getElementById("separatorTd").style.paddingTop = "5px";
  1830. $('#show3').fadeIn('slow');
  1831. } else {
  1832. document.getElementById("line2").style.transform = 'rotateZ(45deg)';
  1833. document.getElementById("line1").style.transform = 'rotateZ(-45deg)';
  1834. document.getElementById("moreInfo").style.transform = 'rotateZ(45deg)';
  1835. $('#separatorTd').fadeIn(1);
  1836. $('#show3').fadeOut('slow');
  1837. }
  1838.  
  1839.  
  1840.  
  1841. });
  1842. })();
  1843.  
  1844. }, 200);
  1845.  
  1846. GM_xmlhttpRequest({
  1847. method: "GET",
  1848. url: "https://statsxente.com/MZ1/Functions/tamper_teams.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport + linkIds,
  1849. headers: {
  1850. "Content-Type": "application/json"
  1851. },
  1852. onload: function (response) {
  1853. var jsonResponse = JSON.parse(response.responseText);
  1854. teams_data = jsonResponse;
  1855. var filasDatos = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  1856. for (var i = 0; i < filasDatos.length; i++) {
  1857. if (checkClassNameExists(filasDatos[i], searchClassName)) {
  1858. var celda = filasDatos[i].cells[1]
  1859. var equipo = celda.textContent.trim()
  1860. var iniIndex = celda.innerHTML.indexOf("tid=");
  1861. var lastIndex = celda.innerHTML.indexOf("\">", iniIndex + 4);
  1862. var data = String(celda.innerHTML)
  1863. var id = data.substring(iniIndex + 4, lastIndex)
  1864. var nuevaColumna = document.createElement("td");
  1865. var valor = 0;
  1866.  
  1867. if (jsonResponse[id] && jsonResponse[id][initialValues[detected_cat]] !== undefined) {
  1868. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[id][initialValues[detected_cat]]))
  1869. }
  1870. nuevaColumna.innerHTML = valor
  1871. nuevaColumna.style.textAlign = 'center';
  1872. filasDatos[i].appendChild(nuevaColumna);
  1873.  
  1874. var eloType = 1
  1875. if (window.sport == "soccer") { eloType = 2 }
  1876. var cats_elo = {}
  1877. cats_elo["senior"] = "SENIOR";
  1878. cats_elo["seniorw"] = "SENIOR";
  1879. cats_elo["SUB23"] = "U23";
  1880. cats_elo["SUB21"] = "U21";
  1881. cats_elo["SUB18"] = "U18";
  1882. cats_elo["SUB23w"] = "U23";
  1883. cats_elo["SUB21w"] = "U21";
  1884. cats_elo["SUB18w"] = "U18";
  1885.  
  1886. var cat = cats[detected_cat]
  1887.  
  1888.  
  1889. var flagSenior = 0, flagSub23 = 0, flagSub21 = 0, flagSub18 = 0;
  1890. if (jsonResponse[id]["elo"] > 0) { flagSenior = 1 }
  1891. if (jsonResponse[id]["elo23"] > 0) { flagSub23 = 1 }
  1892. if (jsonResponse[id]["elo21"] > 0) { flagSub21 = 1 }
  1893. if (jsonResponse[id]["elo18"] > 0) { flagSub18 = 1 }
  1894.  
  1895. var buttonDisplay = "display:block;";
  1896. nuevaColumna = document.createElement("td");
  1897. 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;'/>";
  1898. if (GM_getValue("league_graph_button") == "checked") {
  1899. buttonDisplay = ""
  1900. } else {
  1901. buttonDisplay = "display:none;";
  1902. }
  1903. 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 + "'/>";
  1904.  
  1905. if (GM_getValue("league_report_button") == "checked") {
  1906. buttonDisplay = ""
  1907. } else {
  1908. buttonDisplay = "display:none;";
  1909. }
  1910. 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 + "'/>";
  1911.  
  1912. if (GM_getValue("league_calendar_button") == "checked") {
  1913. buttonDisplay = ""
  1914. } else {
  1915. buttonDisplay = "display:none;";
  1916. }
  1917. 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 + "'/>";
  1918. iner += "</center>";
  1919.  
  1920. nuevaColumna.innerHTML = iner
  1921. filasDatos[i].appendChild(nuevaColumna);
  1922. nuevaColumna = document.createElement("td");
  1923. (function (currentId, currentLSport, lang) {
  1924. document.getElementById("but1" + currentId).addEventListener('click', function () {
  1925. var link = "https://statsxente.com/MZ1/Graficos/graficoProgresoEquipo.php?idEquipo=" + currentId + "&idioma=" + lang + "&divisa=" + GM_getValue("currency") + "&deporte=" + currentLSport;
  1926. openWindow(link, 0.95, 1.25);
  1927. });
  1928. })(id, window.lsport, window.lang);
  1929.  
  1930.  
  1931. (function (currentId, currentLSport, lang, currentCat) {
  1932. document.getElementById("but2" + currentId).addEventListener('click', function () {
  1933. var src = "filtroGraficoEquiposHistoricoHockey";
  1934. if (currentLSport == "F") {
  1935. src = "filtroGraficoLinealEquiposHistorico";
  1936. }
  1937.  
  1938. 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=-"
  1939. openWindow(link, 0.95, 1.25);
  1940. });
  1941. })(id, window.lsport, window.lang, cat);
  1942.  
  1943.  
  1944. (function (currentId, currentEquipo, currentCat, currentSport, lang) {
  1945. document.getElementById("but" + currentId).addEventListener('click', function () {
  1946. 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";
  1947. openWindow(link, 0.95, 1.25);
  1948. });
  1949. })(id, equipo, cat, window.sport, window.lang);
  1950.  
  1951.  
  1952.  
  1953.  
  1954. (function (currentId, type, currentCat, currentSport, lang, flagS, flagS23, flagS21, flagS18) {
  1955. document.getElementById("but3" + currentId).addEventListener('click', function () {
  1956. var link = "https://statsxente.com/MZ1/Graficos/graficoRachaEquipoELO.php?tamper=yes&team_id=" + currentId + "&idioma=" + lang + "&deporte=" + currentSport + "&type=" + type + "&cat=" + currentCat + "&flagSenior=" +
  1957. flagS + "&flagSub23=" + flagS23 + "&flagSub21=" + flagS21 + "&flagSub18=" + flagS18;
  1958. openWindow(link, 0.95, 1.25);
  1959. });
  1960. })(id, eloType, cats_elo[cat], window.sport, window.lang, flagSenior, flagSub23, flagSub21, flagSub18);
  1961.  
  1962. }
  1963.  
  1964. }
  1965. var thead = document.getElementsByClassName("seriesHeader")[table_index]
  1966. var ths = thead.querySelectorAll("th");
  1967. ths.forEach(function (th, index) {
  1968. th.addEventListener("click", function () {
  1969. ordenarTabla(index, true, "nice_table",true);
  1970. });
  1971. });
  1972. }
  1973. });
  1974.  
  1975.  
  1976. }
  1977. //Match page
  1978. async function match() {
  1979. var team_div = document.getElementsByClassName("flex-grow-0 textCenter team-table block")
  1980. if (team_div.length==0){
  1981. team_div = document.getElementsByClassName("flex-grow-0 textCenter team-table no-match-buttons block")
  1982. }
  1983. var teams_ = []
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989. var linkIds=""
  1990. var contIds=0
  1991. for (var x = 0; x < 2; x++) {
  1992. var as = team_div[x].getElementsByTagName("a")
  1993. var urlObj = new URL("https://www.managerzone.com/" + as[0].getAttribute('href'));
  1994. var params = new URLSearchParams(urlObj.search);
  1995. var tidValue = params.get('tid');
  1996. teams_[x] = { "team_name": as[0].innerHTML, "team_id": tidValue, "inserted": "" }
  1997. linkIds += "&idEquipo" + contIds + "=" + tidValue
  1998. contIds++
  1999. }
  2000.  
  2001.  
  2002.  
  2003. GM_xmlhttpRequest({
  2004. method: "GET",
  2005. url: "https://statsxente.com/MZ1/Functions/tamper_teams.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport + linkIds,
  2006. headers: {
  2007. "Content-Type": "application/json"
  2008. },
  2009. onload: function (response) {
  2010.  
  2011. var jsonResponse = JSON.parse(response.responseText);
  2012.  
  2013. const divs = document.querySelectorAll('div'); // Selecciona todos los divs
  2014. const divsConAltura15px = Array.from(divs).filter(div => {
  2015. const computedStyle = window.getComputedStyle(div);
  2016. return computedStyle.height === '15px' && div.innerHTML === "";
  2017. });
  2018.  
  2019.  
  2020. for(var m=0;m<2;m++){
  2021.  
  2022. var aux=teams_[m]['team_id']
  2023.  
  2024. var top="TOP 11"
  2025.  
  2026. if(window.sport=="hockey"){
  2027. top="TOP 21"
  2028. }
  2029.  
  2030. var teamTable='<div style="display: flex;flex-direction: column;justify-content: center;align-items: center;flex-wrap: wrap;max-height: 100%;">'
  2031. teamTable+='<table class="matchValuesTable"><thead><tr>'
  2032. teamTable+='<th id=thTransparent'+m+' style="background-color:transparent; border:0px;"></th>'
  2033. teamTable+='<th style="border-top-left-radius: 5px;">Value</th><th>LM Value</th>'
  2034. teamTable+='<th >'+top+'</th><th style="border-top-right-radius: 5px;">ELO</th></tr></thead><tbody>'
  2035. var valor=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor']))
  2036. var valorLM=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valorUPSenior']))
  2037. var valor11=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor11']))
  2038. var elo=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['elo']))
  2039. 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>'
  2040.  
  2041. valor=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor23']))
  2042. valorLM=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valorUPSUB23']))
  2043. valor11=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor11_23']))
  2044. elo=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['elo23']))
  2045. 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>'
  2046.  
  2047.  
  2048. valor=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor21']))
  2049. valorLM=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valorUPSUB21']))
  2050. valor11=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor11_21']))
  2051. elo=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['elo21']))
  2052. 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>'
  2053.  
  2054. valor=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor18']))
  2055. valorLM=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valorUPSUB18']))
  2056. valor11=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['valor11_18']))
  2057. elo=new Intl.NumberFormat(window.userLocal).format(Math.round(jsonResponse[aux]['elo18']))
  2058. teamTable+='<tr><th style="border-bottom-left-radius: 5px;">U18</th><td style="border-bottom:1px solid '+GM_getValue("bg_native")+';">'+valor+'</td>'
  2059. teamTable+='<td style="border-bottom:1px solid '+GM_getValue("bg_native")+';">'+valorLM+'</td>'
  2060. teamTable+='<td style="border-bottom:1px solid '+GM_getValue("bg_native")+';;">'+valor11+'</td>'
  2061. 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>'
  2062.  
  2063.  
  2064. teamTable+='</tbody></table></div>'
  2065.  
  2066. divsConAltura15px[m].insertAdjacentHTML('afterend',teamTable)
  2067.  
  2068.  
  2069.  
  2070. }
  2071.  
  2072.  
  2073. const thElements = document.querySelectorAll('table.matchValuesTable th');
  2074.  
  2075. // Cambia el color de fondo de cada <th>
  2076. thElements.forEach(th => {
  2077. th.style.backgroundColor = GM_getValue("bg_native");
  2078. th.style.color = GM_getValue("color_native");
  2079.  
  2080. });
  2081. document.getElementById("thTransparent0").style.backgroundColor="transparent";
  2082. document.getElementById("thTransparent1").style.backgroundColor="transparent";
  2083.  
  2084.  
  2085.  
  2086.  
  2087. }
  2088. });
  2089.  
  2090.  
  2091.  
  2092. var elems = document.getElementsByClassName("hitlist " + window.sport + " statsLite marker tablesorter");
  2093. for (x = 0; x < 2; x++) {
  2094. var linkIds = ""
  2095. var contIds = 0;
  2096. var tabla = elems[x]
  2097. var filas = tabla.getElementsByTagName("tr");
  2098. var fila = filas[1];
  2099.  
  2100. for (var i = 2; i < filas.length - 1; i++) {
  2101.  
  2102. fila = filas[i];
  2103. var tds = fila.getElementsByTagName("td");
  2104. var as_ = tds[2].getElementsByTagName("a");
  2105. urlObj = new URL("https://www.managerzone.com/" + as_[0].getAttribute("href"));
  2106. params = new URLSearchParams(urlObj.search);
  2107. var pid = params.get('pid');
  2108.  
  2109. linkIds += "&id" + contIds + "=" + pid
  2110. contIds++;
  2111. }
  2112.  
  2113. link = "http://statsxente.com/MZ1/Functions/tamper_check_stats_player.php?sport=" + window.sport + linkIds
  2114. var inserted = await fetchExistPlayers(link);
  2115. teams_[x]["inserted"]= inserted;
  2116.  
  2117. }
  2118.  
  2119.  
  2120. elems = document.getElementsByClassName("hitlist " + window.sport + " statsLite marker tablesorter");
  2121. for (x = 0; x < 2; x++) {
  2122. if (teams_[x]['inserted']['total'] > 0) {
  2123. tabla = elems[x]
  2124. var firstTrThead = tabla.querySelector('thead td');
  2125. var currentColspan = firstTrThead.getAttribute('colspan');
  2126. currentColspan = parseInt(currentColspan, 10) + 1;
  2127. firstTrThead.setAttribute('colspan', currentColspan);
  2128. var secondTrThead = tabla.querySelector('thead tr:nth-of-type(2)')
  2129. var newTd = document.createElement('td');
  2130. newTd.textContent = '';
  2131. secondTrThead.appendChild(newTd);
  2132. filas = tabla.getElementsByTagName("tr");
  2133. fila = filas[1];
  2134. var dato = document.createElement("td");
  2135. var tfoot = tabla.querySelector("tfoot");
  2136. var primeraFilaTfoot = tfoot.querySelector("tr");
  2137. var primerTDTfoot = primeraFilaTfoot.querySelector("td");
  2138. primerTDTfoot.setAttribute("colspan", "9");
  2139.  
  2140. var elems2 = document.getElementsByClassName("listHeadColor");
  2141. var lista = elems2[0]
  2142.  
  2143. var nuevoElementoDD = document.createElement("dd");
  2144. nuevoElementoDD.textContent = "Nuevo elemento";
  2145. nuevoElementoDD.className = "c6"
  2146. lista.appendChild(nuevoElementoDD);
  2147.  
  2148. var id = 1516;
  2149. for (i = 2; i < filas.length - 1; i++) {
  2150. fila = filas[i];
  2151.  
  2152. tds = fila.getElementsByTagName("td");
  2153. as_ = tds[2].getElementsByTagName("a");
  2154. urlObj = new URL("https://www.managerzone.com/" + as_[0].getAttribute("href"));
  2155. params = new URLSearchParams(urlObj.search);
  2156. pid = params.get('pid');
  2157. if (teams_[x]['inserted'][pid] == "yes") {
  2158. dato = document.createElement("td");
  2159. var iner = "<img src='https://statsxente.com/MZ1/View/Images/etiqueta_bota.png' width='20px' height='20px' id='but" + pid + "' style='cursor:pointer;'/>";
  2160. dato.innerHTML = iner
  2161. fila.appendChild(dato);
  2162.  
  2163.  
  2164.  
  2165. (function (currentId, currentTeamId, currentSport, lang, team_name, player_name) {
  2166. document.getElementById("but" + currentId).addEventListener('click', function () {
  2167.  
  2168. var link = "http://statsxente.com/MZ1/Functions/tamper_player_stats.php?sport=" + currentSport
  2169. + "&player_id=" + currentId + "&team_id=" + currentTeamId + "&idioma=" + lang + "&divisa=" + GM_getValue("currency") +
  2170. "&team_name=" + encodeURIComponent(team_name) + "&player_name=" + encodeURIComponent(player_name)
  2171. openWindow(link, 0.95, 1.25);
  2172. });
  2173. })(pid, teams_[x]['team_id'], window.sport, window.lang, teams_[x]['team_name'], as_[0].innerHTML);
  2174.  
  2175.  
  2176. }
  2177. }
  2178. }
  2179. }
  2180. }
  2181. //Players page
  2182. async function playersPage() {
  2183. setTimeout(function () {
  2184. var elementos = document.getElementsByClassName('playerContainer');
  2185.  
  2186. var player_values = {}
  2187. var tactics_list = []
  2188.  
  2189. var urlParams = new URLSearchParams(window.location.search);
  2190. var flagStats = true
  2191. if (urlParams.has('tid')) {
  2192. flagStats = false
  2193. }
  2194.  
  2195. if (flagStats) {
  2196. var habil_container = elementos[0].getElementsByClassName("player_skills")
  2197. var habil = habil_container[0].getElementsByClassName("clippable")
  2198.  
  2199. if (window.sport == "hockey") {
  2200. for (var q = 1; q < habil.length; q++) {
  2201. skills_names.push(habil[q].textContent)
  2202. }
  2203. } else {
  2204.  
  2205. for (q = 0; q < habil.length - 1; q++) {
  2206. skills_names.push(habil[q].textContent)
  2207. }
  2208.  
  2209. var player_images = document.getElementsByClassName("player-image soccer")
  2210.  
  2211. }
  2212. }
  2213.  
  2214. var ids_ = []
  2215.  
  2216. for (var i = 0; i < elementos.length; i++) {
  2217. var ids = elementos[i].getElementsByClassName('player_id_span');
  2218.  
  2219. var elementos_ = elementos[i].getElementsByClassName('p_sublinks');
  2220.  
  2221. var subheaders = elementos[i].getElementsByClassName('subheader clearfix');
  2222.  
  2223.  
  2224. var enlace = subheaders[0].querySelector('.subheader a');
  2225. var urlObj = new URL("https://www.managerzone.com/" + enlace.getAttribute('href'));
  2226. var params = new URLSearchParams(urlObj.search);
  2227. var tid = params.get('tid');
  2228. var playerName = enlace.querySelector('.player_name').textContent
  2229.  
  2230. ids_.push({ "id": ids[0].textContent, "name": playerName });
  2231.  
  2232.  
  2233. var txt = '<span id=but' + ids[0].textContent + ' class="player_icon_placeholder"><a href="#" onclick="return false"'
  2234. txt += 'title="Stats Xente" class="player_icon"><span class="player_icon_wrapper">'
  2235. 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;'
  2236. txt += 'z-index: 0;"></span><span class="player_icon_text"></span></span></a></span>'
  2237.  
  2238. elementos_[0].innerHTML += txt;
  2239.  
  2240. if (flagStats) {
  2241. var flag_gk = false;
  2242. var age_div = elementos[i].getElementsByClassName('dg_playerview_info');
  2243. var age_table = age_div[0].getElementsByTagName('table')[0];
  2244.  
  2245. var ini_age = age_table.getElementsByTagName('td')[0].textContent.indexOf(":")
  2246. var age = age_table.getElementsByTagName('td')[0].textContent.substring(ini_age + 2, ini_age + 4);
  2247.  
  2248.  
  2249. if ((window.sport == "soccer") && (player_images[i].innerHTML.includes("gk=1"))) {
  2250. flag_gk = true
  2251. }
  2252.  
  2253. var tactics = elementos[i].getElementsByClassName('player_tactic gradientSunriseIcon');
  2254.  
  2255. player_values = {
  2256. "id": ids[0].textContent,
  2257. "skills": [],
  2258. "lines": [],
  2259. "tactics-position": {},
  2260. "tactics": [],
  2261. "age": parseInt(age)
  2262. }
  2263.  
  2264. for (var j = 0; j < tactics.length; j++) {
  2265. var fin = 0;
  2266. var line = ""
  2267. var ini = tactics[j].textContent.indexOf('(');
  2268. var tactic = tactics[j].textContent.substring(0, ini - 1);
  2269.  
  2270. if (window.sport == "hockey") {
  2271.  
  2272. if (!tactics[j].textContent.includes(":")) {
  2273. ini = tactics[j].textContent.indexOf('(');
  2274. fin = tactics[j].textContent.indexOf(')');
  2275. line = tactics[j].textContent.substring(ini + 2, fin - 1);
  2276. gk_line = line;
  2277. } else {
  2278. ini = tactics[j].textContent.indexOf('(');
  2279. fin = tactics[j].textContent.indexOf(':');
  2280. line = tactics[j].textContent.substring(ini + 2, fin);
  2281. }
  2282.  
  2283. } else {
  2284. ini = tactics[j].textContent.indexOf('(');
  2285. fin = tactics[j].textContent.indexOf(')');
  2286. line = tactics[j].textContent.substring(ini + 2, fin - 1);
  2287. if (flag_gk) {
  2288. gk_line = line;
  2289. }
  2290. if (tactics[j].textContent.includes(",")) {
  2291. ini = tactics[j].textContent.indexOf('(');
  2292. fin = tactics[j].textContent.indexOf(',');
  2293. su_line = tactics[j].textContent.substring(ini + 2, fin);
  2294. }
  2295. }
  2296.  
  2297. if (!player_values['lines'].includes(line)) {
  2298. player_values['lines'].push(line);
  2299. }
  2300. if (!player_values['tactics'].includes(tactic)) {
  2301. player_values['tactics'].push(tactic);
  2302. }
  2303.  
  2304. player_values['tactics-position'][tactic] = line
  2305.  
  2306. if ((!lines.includes(line))) {
  2307. lines.push(line);
  2308. }
  2309.  
  2310. if (!tactics_list.includes(tactic)) {
  2311. tactics_list.push(tactic);
  2312. }
  2313.  
  2314.  
  2315. }
  2316. var skills = elementos[i].getElementsByClassName('skillval');
  2317. if (window.sport == "hockey") {
  2318.  
  2319. for (j = 1; j < skills.length; j++) {
  2320. var cleanedText = skills[j].textContent.replace(')', '');
  2321. cleanedText = cleanedText.replace('(', '');
  2322. let number = parseInt(cleanedText, 10);
  2323. player_values['skills'].push(number);
  2324. }
  2325.  
  2326. } else {
  2327. for (j = 0; j < skills.length - 1; j++) {
  2328. cleanedText = skills[j].textContent.replace(')', '');
  2329. cleanedText = cleanedText.replace('(', '');
  2330. let number = parseInt(cleanedText, 10);
  2331. player_values['skills'].push(number);
  2332. }
  2333. }
  2334. players.push(player_values)
  2335. }
  2336. }
  2337.  
  2338. if (flagStats) {
  2339. const container = document.getElementById("squad-search-toggle")
  2340. var contenidoNuevo = "<div id='containerTactics' style='background-color: #e3e3e3;'></br><center>"
  2341. contenidoNuevo += "<div id=selectDiv>Choose Tactic: <select id=tactics_select>"
  2342. contenidoNuevo += "<option value='All Team'>All Team</option>"
  2343. for (var x = 0; x < tactics_list.length; x++) {
  2344. var selected = ""
  2345. if (x == 0) {
  2346. selected = "selected=''";
  2347. }
  2348. contenidoNuevo += "<option " + selected + " value='" + tactics_list[x] + "'>" + tactics_list[x] + "</option>"
  2349. }
  2350. contenidoNuevo += "</select></div></br><div id=divMenu></div></center></div>"
  2351. container.innerHTML = contenidoNuevo + container.innerHTML;
  2352. skillDistrib(tactics_list[0]);
  2353. document.getElementById("tactics_select").addEventListener('change', function () {
  2354. var select = document.getElementById('tactics_select');
  2355. var valorSeleccionado = select.value;
  2356. document.getElementById("divMenu").innerHTML = ""
  2357. skillDistrib(valorSeleccionado)
  2358. });
  2359. }
  2360.  
  2361.  
  2362.  
  2363.  
  2364. for (i = 0; i < ids_.length; i++) {
  2365. (function (currentId, currentTeamId, currentSport, lang, team_name, player_name) {
  2366. document.getElementById("but" + currentId).addEventListener('click', function () {
  2367. var link = "http://statsxente.com/MZ1/Functions/tamper_player_stats.php?sport=" + currentSport
  2368. + "&player_id=" + currentId + "&team_id=" + currentTeamId + "&idioma=" + lang + "&divisa=" + GM_getValue("currency") +
  2369. "&team_name=" + encodeURIComponent(team_name) + "&player_name=" + encodeURIComponent(player_name)
  2370. openWindow(link, 0.95, 1.25);
  2371. });
  2372. })(ids_[i]['id'], tid, window.sport, window.lang, "[undefined]", ids_[i]['name'],);
  2373. }
  2374.  
  2375.  
  2376.  
  2377. }, 1000);
  2378. }
  2379. function skillDistrib(tactic) {
  2380. var t = tactic
  2381. if (window.sport == "hockey") {
  2382. var l = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  2383. } else {
  2384. l = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  2385. }
  2386.  
  2387. var li_t = {}
  2388. for (var i = 0; i < lines.length; i++) {
  2389. li_t[lines[i]] = [...l];
  2390. }
  2391.  
  2392. var no_gk_line = "Tactic -(" + gk_line + ")"
  2393. li_t["Team"] = [...l];
  2394. li_t["U23"] = [...l];
  2395. li_t["U21"] = [...l];
  2396. li_t["U18"] = [...l];
  2397. li_t["Tactic"] = [...l];
  2398. li_t[no_gk_line] = [...l];
  2399.  
  2400.  
  2401.  
  2402. for (i = 0; i < players.length; i++) {
  2403. if (players[i]['tactics'].includes(t)) {
  2404. for (var j = 0; j < players[i]['skills'].length; j++) {
  2405. li_t[players[i]['tactics-position'][t]][j] += players[i]['skills'][j]
  2406. li_t['Tactic'][j] += players[i]['skills'][j]
  2407. if (players[i]['tactics-position'][t] != "Po") {
  2408. li_t[no_gk_line][j] += players[i]['skills'][j]
  2409. }
  2410. }
  2411. li_t[players[i]['tactics-position'][t]][j] += 1
  2412. li_t['Tactic'][j] += 1
  2413. if (players[i]['tactics-position'][t] != "Po") {
  2414. li_t[no_gk_line][j] += 1
  2415. }
  2416. } else {
  2417.  
  2418. for (j = 0; j < players[i]['skills'].length; j++) {
  2419. if (players[i]['age'] <= 23) {
  2420. li_t['U23'][j] += players[i]['skills'][j]
  2421. }
  2422. if (players[i]['age'] <= 23) {
  2423. li_t['U21'][j] += players[i]['skills'][j]
  2424. }
  2425. if (players[i]['age'] <= 23) {
  2426. li_t['U18'][j] += players[i]['skills'][j]
  2427. }
  2428. li_t['Team'][j] += players[i]['skills'][j]
  2429. }
  2430.  
  2431. if (players[i]['age'] <= 23) {
  2432. li_t['U23'][li_t["U23"].length - 1] += 1
  2433. }
  2434.  
  2435. if (players[i]['age'] <= 21) {
  2436. li_t['U21'][li_t["U21"].length - 1] += 1
  2437. }
  2438. if (players[i]['age'] <= 18) {
  2439. li_t['U18'][li_t["U18"].length - 1] += 1
  2440. }
  2441. li_t['Team'][li_t["Team"].length - 1] += 1
  2442. }
  2443. }
  2444.  
  2445.  
  2446.  
  2447. const container = document.getElementById("divMenu")
  2448. 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>";
  2449. contenidoNuevo += '<th align=center style="padding:4px;">Line</th>'
  2450. for (var q = 0; q < skills_names.length; q++) {
  2451. contenidoNuevo += '<th align=center style="padding:4px;">' + skills_names[q] + '</th>'
  2452. }
  2453. contenidoNuevo += '</tr></thead>';
  2454. var l_aux = lines
  2455. l_aux = l_aux.filter(item => item !== gk_line);
  2456. l_aux.sort((a, b) => {
  2457. let numA = parseInt(a.substring(1), 10);
  2458. let numB = parseInt(b.substring(1), 10);
  2459. return numA - numB;
  2460. });
  2461.  
  2462. l_aux.unshift(gk_line);
  2463. l_aux.push("Tactic");
  2464. l_aux.push(no_gk_line);
  2465.  
  2466. if (window.sport == "hockey") {
  2467. if (li_t["L4"][10] == 0) {
  2468. let index = l_aux.indexOf('L4');
  2469. if (index !== -1) {
  2470. l_aux.splice(index, 1);
  2471. }
  2472. }
  2473. }
  2474.  
  2475. if (t == "All Team") {
  2476. l_aux = ["Team", "U23", "U21", "U18"]
  2477. }
  2478.  
  2479. l_aux = l_aux.filter(item => !item.includes(su_line));
  2480.  
  2481. for (var w = 0; w < l_aux.length; w++) {
  2482. var key = l_aux[w]
  2483. if (li_t.hasOwnProperty(key)) {
  2484. contenidoNuevo += "<tr>";
  2485. contenidoNuevo += "<td align=center style='padding:2px;'><strong>" + key + "</strong></td>";
  2486. for (var x = 0; x < li_t[key].length - 1; x++) {
  2487. contenidoNuevo += "<td align=center style='padding:2px;'>" + Math.round(li_t[key][x] / li_t[key][li_t[key].length - 1] * 100) / 100 + "</td>";
  2488. }
  2489. contenidoNuevo += "</tr>";
  2490.  
  2491. }
  2492. }
  2493. container.innerHTML += contenidoNuevo;
  2494. }
  2495. //Players links to stats
  2496. async function playersPageStats() {
  2497. var element = document.getElementById('thePlayers_0');
  2498. var elementos_ = element.getElementsByClassName('p_sublinks');
  2499. var subheaders = element.getElementsByClassName('subheader clearfix');
  2500. var enlace = subheaders[0].querySelector('.subheader a');
  2501. var urlObj = new URL("https://www.managerzone.com/" + enlace.getAttribute('href'));
  2502. var params = new URLSearchParams(urlObj.search);
  2503. var tid = params.get('tid');
  2504. var playerName = enlace.querySelector('.player_name').textContent
  2505. var ids = element.getElementsByClassName('player_id_span');
  2506. var txt = '<span id=but' + ids[0].textContent + ' class="player_icon_placeholder"><a href="#" onclick="return false"'
  2507. txt += 'title="Stats Xente" class="player_icon"><span class="player_icon_wrapper">'
  2508. 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;'
  2509. txt += 'z-index: 0;"></span><span class="player_icon_text"></span></span></a></span>'
  2510. elementos_[0].innerHTML += txt;
  2511. (function (currentId, currentTeamId, currentSport, lang, team_name, player_name) {
  2512. document.getElementById("but" + currentId).addEventListener('click', function () {
  2513. var link = "http://statsxente.com/MZ1/Functions/tamper_player_stats.php?sport=" + currentSport
  2514. + "&player_id=" + currentId + "&team_id=" + currentTeamId + "&idioma=" + lang + "&divisa=" + GM_getValue("currency") +
  2515. "&team_name=" + encodeURIComponent(team_name) + "&player_name=" + encodeURIComponent(player_name)
  2516. openWindow(link, 0.95, 1.25);
  2517. });
  2518. })(ids[0].textContent, tid, window.sport, window.lang, "[undefined]", playerName);
  2519. }
  2520. //Country ranking page
  2521. function countryRank() {
  2522. var table_values = ["players", "age", "value", "top11", "salary", "elo", "elo21", "lm", "lmu21"]
  2523. var newContent = "<center><div>";
  2524. newContent += '<label><input class="statsxente" type="checkbox" checked id="value" value="Value">Value</label>';
  2525. if (window.sport == "soccer") {
  2526. newContent += '<label><input class="statsxente" type="checkbox" id="top11" value="TOP 11">TOP 11</label>';
  2527. } else {
  2528. newContent += '<label><input class="statsxente" type="checkbox" id="top11" value="TOP 21">TOP 21</label>';
  2529. }
  2530.  
  2531. newContent += '<label><input class="statsxente" type="checkbox" id="players" value="Players">Players</label>';
  2532. newContent += '<label><input class="statsxente" type="checkbox" id="salary" value="Salary">Salary</label>';
  2533. newContent += '<label><input class="statsxente" type="checkbox" id="age" value="Age">Age</label>';
  2534. newContent += '<label><input class="statsxente" type="checkbox" checked id="elo" value="Elo">ELO</label>';
  2535. newContent += '<label><input class="statsxente" type="checkbox" checked id="elo21" value="U21 ELO">U21 ELO</label>';
  2536. newContent += '<label><input class="statsxente" type="checkbox" checked id="lm" value="LM">LM</label>';
  2537. newContent += '<label><input class="statsxente" type="checkbox" checked id="lmu21" value="U21 LM">U21 LM</label>';
  2538.  
  2539. var contenedor = document.getElementById('countryRankTable');
  2540. contenedor.insertAdjacentHTML('beforebegin', newContent);
  2541.  
  2542. GM_xmlhttpRequest({
  2543. method: "GET",
  2544. url: "https://statsxente.com/MZ1/Functions/tamper_national_teams.php?currency=" + GM_getValue("currency") + "&sport=" + window.sport,
  2545. headers: {
  2546. "Content-Type": "application/json"
  2547. },
  2548. onload: function (response) {
  2549. var jsonResponse = JSON.parse(response.responseText);
  2550. var data = jsonResponse;
  2551.  
  2552. var type = 1;
  2553. if (window.sport == "soccer") {
  2554. type = 2
  2555. }
  2556. var table = document.getElementById('countryRankTable');
  2557. for (var i = 0; i < table.rows.length; i++) {
  2558. var row = table.rows[i];
  2559. var insertIndex = row.cells.length - 1;
  2560. var raw_str = row.cells[3].innerHTML
  2561. row.deleteCell(3);
  2562. var cell_name = row.cells[2]
  2563. if (i > 0) {
  2564. cell_name.innerHTML = raw_str + " " + cell_name.innerHTML
  2565. }
  2566. var index = 0;
  2567. var cell0 = row.insertCell(insertIndex + index);
  2568. index++;
  2569. var cell1 = row.insertCell(insertIndex + index);
  2570. index++;
  2571. var cell2 = row.insertCell(insertIndex + index);
  2572. index++;
  2573. var cell3 = row.insertCell(insertIndex + index);
  2574. index++;
  2575. var cell4 = row.insertCell(insertIndex + index);
  2576. index++;
  2577. var cell5 = row.insertCell(insertIndex + index);
  2578. index++;
  2579. var cell6 = row.insertCell(insertIndex + index);
  2580. index++;
  2581. var cell7 = row.insertCell(insertIndex + index);
  2582. index++;
  2583. var cell8 = row.insertCell(insertIndex + index);
  2584. index++;
  2585. var cell9 = row.insertCell(insertIndex + index);
  2586.  
  2587.  
  2588.  
  2589. if (i === 0) {
  2590. cell0.outerHTML = "<th id='players_th' style='display:none;' class='header'><a href='#'>Players</a></th>";
  2591. cell1.outerHTML = "<th id='age_th' class='header' style='display:none;'><a href='#'>Age</a></th>";
  2592. cell2.outerHTML = "<th id='value_th' class='header' style='display:table-cell;'><a href='#'>Value</a></th>";
  2593. cell3.outerHTML = "<th id='top11_th' class='header' style='display:none;'><a href='#'>Top11</a></th>";
  2594. cell4.outerHTML = "<th id='salary_th' class='header' style='display:none;'><a href='#'>Salary</a></th>";
  2595. cell5.outerHTML = "<th id='elo_th' class='header' style='display:table-cell;'><a href='#'>ELO</a></th>";
  2596. cell6.outerHTML = "<th id='elo21_th' class='header' style='display:table-cell;'><a href='#'>U21 ELO</a></th>";
  2597. cell7.outerHTML = "<th id='lm_th' class='header' style='display:table-cell;'><a href='#'>LM</a></th>";
  2598. cell8.outerHTML = "<th id='lmu21_th' class='header' style='display:table-cell;'><a href='#'>U21 LM</a></th>";
  2599. cell9.outerHTML = "<th id='image' class='header' style='display:table-cell;'><a href='#'></a></th>";
  2600. } else {
  2601. var ini = raw_str.indexOf("s_");
  2602. var fin = raw_str.indexOf(".", ini + 1);
  2603. var c_code = raw_str.substring(ini + 2, fin)
  2604. cell0.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["numJugadores"]))
  2605. cell0.className = "players"
  2606. cell0.style.display = "none"
  2607.  
  2608. cell1.innerHTML = new Intl.NumberFormat(window.userLocal, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(data[c_code]["edad"])
  2609. cell1.className = "age"
  2610. cell1.style.display = "none"
  2611.  
  2612. cell2.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["valor"]))
  2613. cell2.className = "value"
  2614. cell2.style.display = "table-cell"
  2615.  
  2616. cell3.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["valor11"]))
  2617. cell3.className = "top11"
  2618. cell3.style.display = "none"
  2619.  
  2620. cell4.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["salario"]))
  2621. cell4.className = "salary"
  2622. cell4.style.display = "none"
  2623.  
  2624. cell5.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["elo"]))
  2625. cell5.className = "elo"
  2626. cell5.style.display = "table-cell"
  2627.  
  2628. cell6.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["elo21"]))
  2629. cell6.className = "elo21"
  2630. cell6.style.display = "table-cell"
  2631.  
  2632. cell7.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["valorLM"]))
  2633. cell7.className = "lm"
  2634. cell7.style.display = "table-cell"
  2635.  
  2636. cell8.innerHTML = new Intl.NumberFormat(window.userLocal).format(Math.round(data[c_code]["valorLM21"]))
  2637. cell8.className = "lmu21"
  2638. cell8.style.display = "table-cell"
  2639.  
  2640. cell9.innerHTML = '<img style="cursor:pointer;" src="https://statsxente.com/MZ1/View/Images/calendar.png" width="20" height="20">'
  2641. var actual_id = "image" + i
  2642. cell9.id = actual_id
  2643. cell9.style.display = "table-cell";
  2644.  
  2645.  
  2646. (function (id, code, type_) {
  2647. document.getElementById(id).addEventListener('click', function () {
  2648. var link = "https://www.statsxente.com/MZ1/Graficos/graficoRachaEquipoELONT.php?tamper=yes&team_id=" + data[code]["idSenior"] +
  2649. "&team_id_u21=" + data[code]["idSub21"] + "&idioma=" + window.lang + "&type=" + type_ + "&cat=SENIOR&sport=" + window.sport;
  2650. openWindow(link, 0.95, 1.25);
  2651. });
  2652. })(actual_id, c_code, type);
  2653. }
  2654. }
  2655.  
  2656. setTimeout(function () {
  2657. for (var f = 0; f < table_values.length; f++) {
  2658.  
  2659. (function (actual_value, f) {
  2660.  
  2661. document.getElementById(actual_value + "_th").addEventListener('click', function () {
  2662. if (document.getElementById(actual_value + "_th").className == "header") {
  2663. document.getElementById(actual_value + "_th").className = "header headerSortDown";
  2664. } else {
  2665.  
  2666. if (document.getElementById(actual_value + "_th").className == "header headerSortDown") {
  2667. document.getElementById(actual_value + "_th").className = "header headerSortUp";
  2668. } else {
  2669. document.getElementById(actual_value + "_th").className = "header headerSortDown";
  2670. }
  2671.  
  2672. }
  2673. var index_ = 3 + f
  2674. ordenarTabla(index_, false, "countryRankTable",false)
  2675. });
  2676. document.getElementById(actual_value).addEventListener('click', function () {
  2677. var display = "table-cell"
  2678. if (document.getElementById(actual_value + "_th").style.display == "table-cell") {
  2679. display = "none"
  2680. }
  2681. var elementos = document.getElementsByClassName(actual_value)
  2682. Array.prototype.forEach.call(elementos, function (elemento) {
  2683. var aux_display = "table-cell"
  2684. if (document.getElementById(actual_value + "_th").style.display == "table-cell") {
  2685. aux_display = "none"
  2686. }
  2687. elemento.style.display = aux_display;
  2688. });
  2689. document.getElementById(actual_value + "_th").style.display = display
  2690. });
  2691. })(table_values[f], f);
  2692. }
  2693. }, 1000);
  2694. }
  2695. });
  2696. }
  2697. //Stats Xente competitions matches
  2698. function StatsXenteNextMatchesClubhouse() {
  2699. var h1Elements = document.querySelectorAll('h1.box_dark');
  2700. var team_name = h1Elements[0].innerText
  2701. var team_id = document.getElementById("tid1").value;
  2702.  
  2703. GM_xmlhttpRequest({
  2704. method: "GET",
  2705. url: "https://statsxente.com/MZ1/Functions/tamper_user_next_matches.php?team_id=" + team_id,
  2706. headers: {
  2707. "Content-Type": "application/json"
  2708. },
  2709. onload: function (response) {
  2710. var jsonResponse = JSON.parse(response.responseText);
  2711. var data = jsonResponse;
  2712. if (data.length > 0) {
  2713.  
  2714.  
  2715. GM_xmlhttpRequest({
  2716. method: "GET",
  2717. url: "http://www.managerzone.com/xml/team_matchlist.php?sport_id=" + window.sport_id + "&team_id=" + team_id + "&match_status=2&limit=100",
  2718. headers: {
  2719. "Content-Type": "application/json"
  2720. },
  2721. onload: function (response) {
  2722.  
  2723. var matchesDate = []
  2724. var parser = new DOMParser();
  2725. var xmlDoc = parser.parseFromString(response.responseText, "text/xml");
  2726. var matches = xmlDoc.getElementsByTagName("Match");
  2727.  
  2728. var last_date = ""
  2729.  
  2730.  
  2731. for (var i = 0; i < matches.length; i++) {
  2732. var dateOnly = matches[i].getAttribute("date").split(" ")[0];
  2733. last_date = dateOnly
  2734. var teams = matches[i].getElementsByTagName("Team");
  2735.  
  2736. for (var j = 0; j < teams.length; j++) {
  2737. if (teams[j].getAttribute("teamId") != team_id) {
  2738. matchesDate.push(teams[j].getAttribute("teamId") + "-" + dateOnly)
  2739.  
  2740. }
  2741. }
  2742.  
  2743.  
  2744. }
  2745.  
  2746.  
  2747.  
  2748.  
  2749. var newContent = `
  2750. <div id="tour-container" class="widgets-container">
  2751. <div class="flex-wrap hub-widget-container">
  2752. <div class="flex-grow-1 box_dark">
  2753. <div id="clubhouse-widget-tour" class="widget-content clearfix">
  2754. <i class="fa minimize-button fa-minus-square" aria-hidden="true" data-time="1722549599"></i>
  2755. <span class="fa fa-stack fa-2x floatRight">
  2756. <i class="fa fa-circle fa-stack-2x fa-inverse"></i>
  2757. <i class="fa fa-thumbs-up fa-stack-1x green" aria-hidden="true"></i>
  2758. </span>
  2759. <h3 style="background-image: url('https://www.statsxente.com/MZ1/View/Images/etiqueta_bota.png');">Stats Xente</h3>
  2760. <div class="widget-content-wrapper">
  2761. <div class="flex-wrap" style="margin-bottom: 35px;">
  2762. <div class="flex-grow-0" style="margin: 0 auto">
  2763. <img src="https://www.statsxente.com/MZ1/View/Images/etiqueta_bota.png" alt="" width="114" height="127">
  2764. </div>
  2765. <div class="flex-grow-1 textLeft">`
  2766.  
  2767. data.forEach(function (match_data) {
  2768.  
  2769. var dateObj1 = new Date(last_date);
  2770. var dateObj2 = new Date(match_data['fecha']);
  2771.  
  2772.  
  2773. var icon_ = "fa-check-square"
  2774. var style_ = ""
  2775. var flagFriendly = false;
  2776. if (dateObj1 < dateObj2) {
  2777. icon_ = "fa-calendar-minus-o"
  2778. style_ = "style='color:#e5ac00;'"
  2779. flagFriendly = true;
  2780. } else {
  2781.  
  2782. if (matchesDate.includes(match_data['rival_id'] + "-" + match_data['fecha'])) {
  2783. if (window.sport == "hockey") {
  2784. style_ = "style='color:#6d93fd;'"
  2785. }
  2786. } else {
  2787. icon_ = "fa-times-square"
  2788. style_ = "style='color:#AD4039;'"
  2789. flagFriendly = true;
  2790.  
  2791.  
  2792. }
  2793.  
  2794. }
  2795.  
  2796.  
  2797. var match = '<img src="https://www.managerzone.com/dynimg/badge.php?team_id=' + match_data['idEquipoLocal'] + '&sport="' + window.sport + ' width="15px" height="15px"/> '
  2798. + 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"/>'
  2799. if (match_data['field'] == "away") {
  2800. match = '<img src="https://www.managerzone.com/dynimg/badge.php?team_id=' + match_data['idEquipoLocal'] + '&sport="' + window.sport + ' width="15px" height="15px"/> '
  2801. + 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"/>'
  2802. }
  2803.  
  2804.  
  2805. newContent += '<fieldset class="grouping self box_light_on_dark flex-nowrap" style="max-width: 555px; margin-left: 10px;">'
  2806. newContent += '<legend>' + match_data['clash_name'] + '</legend>'
  2807. newContent += '<div class="flex-grow-0 mission-icon">'
  2808. newContent += '<i class="fa ' + icon_ + ' green fa-2x t-checked" aria-hidden="true" ' + style_ + '></i>'
  2809. newContent += '</div>'
  2810. newContent += '<div class="flex-grow-1 mission">'
  2811.  
  2812. var link = "CompAmis_CALENDAR_View.php?" + 'id=' + match_data['idComp']
  2813. if (match_data['comp'] == "cup") {
  2814. link = 'CompAmis_Cup_CALENDAR_View.php?grupo=' + match_data['grupo'] + '&id=' + match_data['idComp']
  2815. }
  2816.  
  2817.  
  2818. newContent += '<p><b><a href="https://www.statsxente.com/MZ1/View/' + link + '" target="_blank">' + match + '</a></b>'
  2819. newContent += "</br></p>"
  2820. newContent += 'Date: ' + match_data['fecha']
  2821. if (flagFriendly) {
  2822. 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>"
  2823. }
  2824.  
  2825.  
  2826. newContent += '</p>'
  2827. newContent += '</div>'
  2828. newContent += '</fieldset>'
  2829. });
  2830.  
  2831.  
  2832.  
  2833.  
  2834. newContent += `</div>
  2835. </div>
  2836. </div>
  2837. </div>
  2838. </div>
  2839. </div>
  2840. </div>`;
  2841.  
  2842.  
  2843.  
  2844.  
  2845. var contenedor = document.getElementById('tour-container');
  2846. if (data.length > 0) {
  2847. contenedor.insertAdjacentHTML('beforebegin', newContent);
  2848.  
  2849. }
  2850.  
  2851.  
  2852. }
  2853.  
  2854. });
  2855.  
  2856. }
  2857.  
  2858.  
  2859. }
  2860. });
  2861.  
  2862. }
  2863.  
  2864.  
  2865. //HANDLERS FUNCTIONS
  2866. function handleClick(event) {
  2867. var urlParams = new URLSearchParams(window.location.search);
  2868. var elems = document.getElementsByClassName("nice_table");
  2869. var tabla = elems[0]
  2870. var filas = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  2871. var thSegundo = tabla.querySelector("thead th:nth-child(2)");
  2872.  
  2873. if (urlParams.get('fsid')) {
  2874. thSegundo.style.width = "180px";
  2875. } else {
  2876. thSegundo.style.width = "250px";
  2877. }
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884. for (var i = 0; i < filas.length; i++) {
  2885. if (checkClassNameExists(filas[i], searchClassName)) {
  2886. var celda = filas[i].cells[1];
  2887. var equipo = celda.textContent.trim()
  2888. var iniIndex = celda.innerHTML.indexOf("tid=");
  2889. var lastIndex = celda.innerHTML.indexOf("\">", iniIndex + 4);
  2890. var data = String(celda.innerHTML)
  2891. var id = data.substring(iniIndex + 4, lastIndex)
  2892. var celdas = filas[i].getElementsByTagName("td");
  2893. var ultimaCelda = celdas[celdas.length - 2];
  2894. var selects = document.getElementsByTagName('select');
  2895. var index_select = 1;
  2896. if (selects[index_select] === undefined) {
  2897. index_select = 0;
  2898. }
  2899.  
  2900.  
  2901. var selectedIndex = selects[index_select].selectedIndex;
  2902. var selectedOption = selects[index_select].options[selectedIndex];
  2903. var selectedText = selectedOption.text;
  2904.  
  2905.  
  2906.  
  2907. var key_actual_league = "Top";
  2908. if (selectedText.includes(".")) {
  2909. key_actual_league = selectedText.substring(0, 4)
  2910. }
  2911.  
  2912. var valor = 0;
  2913.  
  2914. if (teams_data[id] === undefined) {
  2915. valor = 0
  2916. } else {
  2917.  
  2918. var table_key = "";
  2919. var agg_value = 0;
  2920.  
  2921. switch (event.target.id) {
  2922. case 'edad':
  2923. valor = new Intl.NumberFormat(window.userLocal, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(teams_data[id][event.target.id])
  2924. break;
  2925. case "leagues":
  2926. table_key = "league"
  2927. 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']
  2928. valor = "(" + teams_data[id]['league_' + key_actual_league] + '/' + agg_value + ")"
  2929. break;
  2930.  
  2931. case "world_leagues":
  2932. table_key = "world_league"
  2933. 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']
  2934. valor = "(" + teams_data[id][table_key + '_' + key_actual_league] + '/' + agg_value + ")"
  2935. break;
  2936.  
  2937. case "youth_leagues":
  2938. var cat = GM_getValue("actual_league_cat").toLowerCase()
  2939. table_key = "league_" + cat
  2940. 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']
  2941. valor = "(" + teams_data[id][table_key + '_' + key_actual_league] + '/' + agg_value + ")"
  2942. break;
  2943.  
  2944. case "world_youth_leagues":
  2945. cat = GM_getValue("actual_league_cat").toLowerCase()
  2946. table_key = "world_league_" + cat
  2947. 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']
  2948. valor = "(" + teams_data[id][table_key + '_' + key_actual_league] + '/' + agg_value + ")"
  2949. break;
  2950.  
  2951. case "leagues_all":
  2952. table_key = "league"
  2953. valor = teams_data[id][table_key + '_Top'] + teams_data[id][table_key + '_div1'] + teams_data[id][table_key + '_div2'] + teams_data[id][table_key + '_div3'] + teams_data[id][table_key + '_div4'] + teams_data[id][table_key + '_div5']
  2954. break;
  2955.  
  2956.  
  2957. case "world_leagues_all":
  2958. table_key = "world_league"
  2959. 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']
  2960. break;
  2961.  
  2962. case "youth_leagues_all":
  2963. table_key = "league_u23"
  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_u21"
  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. table_key = "league_u18"
  2968. 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']
  2969. break;
  2970.  
  2971. case "world_youth_leagues_all":
  2972. table_key = "world_league_u23"
  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_u21"
  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. table_key = "world_league_u18"
  2977. 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']
  2978. break;
  2979.  
  2980. case "federation_leagues":
  2981. table_key = "federation_league"
  2982. 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']
  2983. valor = agg_value
  2984. break;
  2985.  
  2986.  
  2987. default:
  2988. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(teams_data[id][event.target.id]))
  2989. break;
  2990.  
  2991.  
  2992. }
  2993. }
  2994.  
  2995. ultimaCelda.innerHTML = valor;
  2996. }
  2997. }
  2998. var checkboxes = document.querySelectorAll('.statsxente');
  2999. var thead = tabla.querySelector('thead');
  3000. var tr = thead.querySelectorAll('tr');
  3001. var td = tr[0].querySelectorAll('th');
  3002. var ultimaCeldaEncabezado = td[td.length - 2];
  3003. td[td.length - 2].textContent = event.target.value;
  3004. checkboxes.forEach(function (checkbox) {
  3005. if (checkbox.id !== event.target.id) {
  3006. checkbox.checked = false;
  3007. }
  3008. });
  3009. }
  3010. function handleClickClash(event) {
  3011. var elems = document.getElementsByClassName("nice_table");
  3012. var tabla = elems[0]
  3013. var filas = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  3014. var thSegundo = tabla.querySelector("thead th:nth-child(2)");
  3015. thSegundo.style.width = "250px";
  3016. for (var i = 0; i < filas.length; i++) {
  3017. var celda = tabla.rows[i + 1].cells[1];
  3018. var imagen = celda.querySelector('img');
  3019. var url = new URL(imagen.src);
  3020. var id = url.searchParams.get('fid');
  3021.  
  3022.  
  3023. var celdas = filas[i].getElementsByTagName("td");
  3024. var ultimaCelda = celdas[celdas.length - 2];
  3025.  
  3026. var valor = 0;
  3027.  
  3028. if (teams_data[id] === undefined) {
  3029. valor = 0
  3030. } else {
  3031. if (event.target.id == "edad") {
  3032. valor = new Intl.NumberFormat(window.userLocal, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(teams_data[id][event.target.id])
  3033. } else {
  3034. valor = new Intl.NumberFormat(window.userLocal).format(Math.round(teams_data[id][event.target.id]))
  3035. }
  3036.  
  3037. }
  3038.  
  3039. ultimaCelda.innerHTML = valor;
  3040. }
  3041. var checkboxes = document.querySelectorAll('.statsxente');
  3042. var thead = tabla.querySelector('thead');
  3043. var tr = thead.querySelectorAll('tr');
  3044. var td = tr[0].querySelectorAll('th');
  3045. td[td.length - 2].textContent = event.target.value;
  3046. checkboxes.forEach(function (checkbox) {
  3047. if (checkbox.id !== event.target.id) {
  3048. checkbox.checked = false;
  3049. }
  3050. });
  3051. var columna = 12
  3052. }
  3053.  
  3054. //FETCH FUNCTIONS
  3055. function fetchAgeRestriction(url) {
  3056. return new Promise((resolve, reject) => {
  3057.  
  3058. GM_xmlhttpRequest({
  3059. method: "GET",
  3060. url: url,
  3061. headers: {
  3062. "Content-Type": "application/json"
  3063. },
  3064. onload: function (response) {
  3065. var parser = new DOMParser();
  3066. var doc = parser.parseFromString(response.responseText, "text/html");
  3067. var strongElements = doc.getElementsByTagName("b");
  3068. var nextElement = strongElements[1].nextElementSibling;
  3069. var nextSibling = strongElements[1].nextSibling;
  3070. try {
  3071. while (nextSibling && nextSibling.nodeName === "BR") {
  3072. nextSibling = nextSibling.nextSibling;
  3073. }
  3074.  
  3075. if (nextSibling && nextSibling.nodeType === Node.TEXT_NODE) {
  3076. var age_restriction = nextSibling.textContent.trim();
  3077. resolve(age_restriction);
  3078. } else {
  3079. resolve("none");
  3080. }
  3081. } catch (error) {
  3082. reject("none");
  3083. }
  3084. },
  3085. onerror: function (error) {
  3086. reject("none");
  3087. }
  3088. });
  3089. });
  3090. }
  3091. function fetchCupAgeRestriction(url) {
  3092. return new Promise((resolve, reject) => {
  3093.  
  3094. GM_xmlhttpRequest({
  3095. method: "GET",
  3096. url: url,
  3097. headers: {
  3098. "Content-Type": "application/json"
  3099. },
  3100. onload: function (response) {
  3101. var parser = new DOMParser();
  3102. try {
  3103. var doc = parser.parseFromString(response.responseText, "text/html")
  3104. var tables = doc.getElementsByTagName("table");
  3105. var table = tables[1]
  3106. var tds = table.getElementsByTagName("td");
  3107. resolve(tds[5].innerHTML)
  3108. } catch (error) {
  3109. reject("none");
  3110. }
  3111. },
  3112. onerror: function (error) {
  3113. reject("none");
  3114. }
  3115. });
  3116. });
  3117. }
  3118. function fetchExistTeam(url) {
  3119. return new Promise((resolve, reject) => {
  3120.  
  3121. GM_xmlhttpRequest({
  3122. method: "GET",
  3123. url: url,
  3124. headers: {
  3125. "Content-Type": "application/json"
  3126. },
  3127. onload: function (response) {
  3128. var jsonResponse = JSON.parse(response.responseText);
  3129. resolve(jsonResponse['inserted'])
  3130. },
  3131. onerror: function (error) {
  3132. reject("no");
  3133. }
  3134. });
  3135. });
  3136. }
  3137. function fetchExistPlayers(url) {
  3138. return new Promise((resolve, reject) => {
  3139.  
  3140. GM_xmlhttpRequest({
  3141. method: "GET",
  3142. url: url,
  3143. headers: {
  3144. "Content-Type": "application/json"
  3145. },
  3146. onload: function (response) {
  3147. var jsonResponse = JSON.parse(response.responseText);
  3148. resolve(jsonResponse)
  3149. },
  3150. onerror: function (error) {
  3151. reject("no");
  3152. }
  3153. });
  3154. });
  3155. }
  3156.  
  3157. //UTILS FUNCTIONS
  3158. function waitToDOM(function_to_execute, classToSearch, elementIndex) {
  3159. let interval = setInterval(function () {
  3160. let elements = document.querySelectorAll(classToSearch);
  3161. if (elements.length > 0 && elements[elementIndex]) {
  3162. clearInterval(interval);
  3163. clearTimeout(timeout);
  3164. function_to_execute();
  3165. }
  3166. }, 100);
  3167.  
  3168.  
  3169. let timeout = setTimeout(function () {
  3170. clearInterval(interval);
  3171. }, 10000);
  3172. }
  3173. function openWindow(link, porAncho, porAlto) {
  3174. var ventanaAncho = (window.innerWidth) * porAncho
  3175. var ventanaAlto = (window.innerHeight) * porAlto
  3176. var ventanaIzquierda = (window.innerWidth - ventanaAncho) / 2;
  3177. var ventanaArriba = (window.innerHeight - ventanaAlto) / 2;
  3178. var opcionesVentana = "width=" + ventanaAncho +
  3179. ",height=" + ventanaAlto +
  3180. ",left=" + ventanaIzquierda +
  3181. ",top=" + ventanaArriba;
  3182.  
  3183. if ((GM_getValue("tabsConfig") == false) && (GM_getValue("windowsConfig") == true)) {
  3184. window.open(link, "_blank", opcionesVentana);
  3185. }
  3186. if ((GM_getValue("tabsConfig") == true) && (GM_getValue("windowsConfig") == false)) {
  3187. window.open(link, "_blank");
  3188. }
  3189. }
  3190. function ordenarTabla(col, byClassName, param,putSortIconFlag) {
  3191. if (byClassName) {
  3192. var elems = document.getElementsByClassName(param);
  3193. var table = elems[0]
  3194. } else {
  3195. table = document.getElementById(param)
  3196. }
  3197. if(putSortIconFlag){putSortIcon(col, table)}
  3198. var rows = Array.from(table.tBodies[0].rows);
  3199. var isAsc = document.getElementById("ord_table").value === "ascendente";
  3200. rows.sort(function (a, b) {
  3201. var aNum = parseFloat(a.cells[col].textContent.trim().replace(/\./g, '').replace(/\,/g, '')) || 0;
  3202. var bNum = parseFloat(b.cells[col].textContent.trim().replace(/\./g, '').replace(/\,/g, '')) || 0;
  3203. return isAsc ? aNum - bNum : bNum - aNum;
  3204. });
  3205.  
  3206. rows.forEach(function (row) {
  3207. table.tBodies[0].appendChild(row);
  3208. });
  3209.  
  3210. if (isAsc) {
  3211. document.getElementById("ord_table").value = "descendente";
  3212. } else {
  3213. document.getElementById("ord_table").value = "ascendente";
  3214. }
  3215.  
  3216. var filas = table.getElementsByTagName("tr");
  3217. for (var i = 1; i < filas.length; i++) {
  3218. var primeraCelda = filas[i].getElementsByTagName("td")[0];
  3219. primeraCelda.textContent = i;
  3220. }
  3221.  
  3222.  
  3223. }
  3224. function ordenarTablaText(col, byClassName, param,putSortIconFlag) {
  3225. if (byClassName) {
  3226. var elems = document.getElementsByClassName(param);
  3227. var table = elems[0]
  3228. } else {
  3229. table = document.getElementById(param)
  3230. }
  3231. var rows = Array.from(table.tBodies[0].rows);
  3232. var isAsc = document.getElementById("ord_table").value === "ascendente";
  3233. if(putSortIconFlag){putSortIcon(col, table)}
  3234. rows.sort(function (a, b) {
  3235. var aText = a.cells[col].textContent.toLowerCase().trim();
  3236. var bText = b.cells[col].textContent.toLowerCase().trim();
  3237. if (aText < bText) {
  3238. return isAsc ? -1 : 1;
  3239. }
  3240. if (aText > bText) {
  3241. return isAsc ? 1 : -1;
  3242. }
  3243. return 0;
  3244. });
  3245.  
  3246. rows.forEach(function (row) {
  3247. table.tBodies[0].appendChild(row);
  3248. });
  3249.  
  3250. if (isAsc) {
  3251. document.getElementById("ord_table").value = "descendente";
  3252. } else {
  3253. document.getElementById("ord_table").value = "ascendente";
  3254. }
  3255.  
  3256.  
  3257. var filas = table.getElementsByTagName("tr");
  3258. for (var i = 1; i < filas.length; i++) {
  3259. var primeraCelda = filas[i].getElementsByTagName("td")[0];
  3260. primeraCelda.textContent = i;
  3261. }
  3262.  
  3263. }
  3264. function checkClassNameExists(element, className) {
  3265.  
  3266. if (className == "") {
  3267. return true;
  3268. } else {
  3269. return element.classList.contains(className);
  3270. }
  3271. return false;
  3272.  
  3273. }
  3274. function getCookie(nombre) {
  3275. var regex = new RegExp("(?:(?:^|.*;\\s*)" + nombre + "\\s*\\=\\s*([^;]*).*$)|^.*$");
  3276. var valorCookie = document.cookie.replace(regex, "$1");
  3277. return decodeURIComponent(valorCookie);
  3278. }
  3279. function generateValuesSelect(cat) {
  3280.  
  3281.  
  3282. var defaults = new Map();
  3283. defaults.set('senior', 'valor');
  3284. defaults.set('u23', 'valor23');
  3285. defaults.set('u21', 'valor21');
  3286. defaults.set('u18', 'valor18');
  3287.  
  3288. var values = new Map();
  3289. values.set('valor', 'Value');
  3290. values.set('valor23', 'U23 Value');
  3291. values.set('valor21', 'U21 Value');
  3292. values.set('valor18', 'U18 Value');
  3293. values.set('salario', 'Salary');
  3294. values.set('valorUPSenior', 'LM Value');
  3295. values.set('valorUPSUB23', 'U23 LM Value');
  3296. values.set('valorUPSUB21', 'U21 LM Value');
  3297. values.set('valorUPSUB18', 'U18 LM Value');
  3298. values.set('edad', 'Age');
  3299. values.set('valor11', 'TOP 11/21');
  3300. values.set('valor11_23', 'U23 TOP 11/21');
  3301. values.set('valor11_21', 'U21 TOP 11/21');
  3302. values.set('valor11_18', 'U18 TOP 11/21');
  3303. values.set('noNac', 'Foreigners');
  3304. values.set('elo', 'ELO Score');
  3305. values.set('elo23', 'U23 ELO Score');
  3306. values.set('elo21', 'U21 ELO Score');
  3307. values.set('elo18', 'U18 ELO Score');
  3308. values.set('numJugadores', 'Number of players');
  3309.  
  3310.  
  3311. var default_value = GM_getValue("league_default_" + cat, defaults.get(cat))
  3312. GM_setValue("league_default_" + cat, default_value)
  3313.  
  3314. var select = "<select id='league_default_select_" + cat + "' style='width:9em;'>";
  3315. values.forEach((valor, clave, mapa) => {
  3316. var checked = ""
  3317. if (clave == default_value) {
  3318. checked = "selected"
  3319. }
  3320. select += "<option " + checked + " value='" + clave + "'>" + valor + "</option>";
  3321. });
  3322. select += "</select>"
  3323. return select;
  3324.  
  3325. }
  3326. function createLeagueConfigOptionsListeners() {
  3327.  
  3328. var defaults = new Map();
  3329. defaults.set('senior', 'valor');
  3330. defaults.set('u23', 'valor23');
  3331. defaults.set('u21', 'valor21');
  3332. defaults.set('u18', 'valor18');
  3333.  
  3334.  
  3335.  
  3336. defaults.forEach((valor, clave, mapa) => {
  3337.  
  3338.  
  3339.  
  3340. document.getElementById("league_default_select_" + clave).addEventListener('change', function () {
  3341.  
  3342. var selectElement = document.getElementById("league_default_select_" + clave);
  3343. GM_setValue("league_default_" + clave, selectElement.value)
  3344. });
  3345.  
  3346. });
  3347. document.getElementById("league_graph_check").addEventListener('click', function () {
  3348.  
  3349. if (document.getElementById("league_graph_check").checked) {
  3350. GM_setValue("league_graph_button", "checked")
  3351. } else {
  3352. GM_setValue("league_graph_button", "")
  3353. }
  3354.  
  3355.  
  3356. });
  3357.  
  3358.  
  3359. document.getElementById("league_report_check").addEventListener('click', function () {
  3360.  
  3361. if (document.getElementById("league_report_check").checked) {
  3362. GM_setValue("league_report_button", "checked")
  3363. } else {
  3364. GM_setValue("league_report_button", "")
  3365. }
  3366.  
  3367.  
  3368. });
  3369.  
  3370. document.getElementById("league_calendar_check").addEventListener('click', function () {
  3371.  
  3372. if (document.getElementById("league_calendar_check").checked) {
  3373. GM_setValue("league_calendar_button", "checked")
  3374. } else {
  3375. GM_setValue("league_calendar_button", "")
  3376. }
  3377.  
  3378.  
  3379. });
  3380.  
  3381.  
  3382.  
  3383.  
  3384.  
  3385.  
  3386. }
  3387. function createModalMenu() {
  3388. var newElement = document.createElement("div");
  3389. newElement.id = "legendDiv";
  3390. newElement.className = "stx_legend";
  3391. var txtToInsert= '<div style="writing-mode: tb-rl;-webkit-writing-mode: vertical-rl;"><center>'
  3392. if(GM_getValue("avaliable_new_version")=="yes"){
  3393. txtToInsert+='<img src="https://statsxente.com/MZ1/View/Images/alert.png" style="width:15px;height:15px;"/>'
  3394. }
  3395. txtToInsert+='<img src="https://statsxente.com/MZ1/View/Images/etiqueta_bota.png" style="width:25px;height:25px;"/>'
  3396. txtToInsert+='</center></div>';
  3397. newElement.innerHTML=txtToInsert;
  3398. var body = document.body;
  3399. body.appendChild(newElement);
  3400.  
  3401. var newModalElement = document.createElement('div');
  3402. 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>'
  3403. body.insertBefore(newModalElement, body.firstChild);
  3404.  
  3405. if (GM_getValue("leagueFlag") === undefined) {
  3406. GM_setValue("leagueFlag", true)
  3407. }
  3408.  
  3409. if (GM_getValue("matchFlag") === undefined) {
  3410. GM_setValue("matchFlag", true)
  3411. }
  3412.  
  3413. if (GM_getValue("federationFlag") === undefined) {
  3414. GM_setValue("federationFlag", true)
  3415. }
  3416.  
  3417. if (GM_getValue("playersFlag") === undefined) {
  3418. GM_setValue("playersFlag", true)
  3419. }
  3420.  
  3421. if (GM_getValue("countryRankFlag") === undefined) {
  3422. GM_setValue("countryRankFlag", true)
  3423. }
  3424.  
  3425.  
  3426. if (GM_getValue("league_graph_button") === undefined) {
  3427. GM_setValue("league_graph_button", "checked")
  3428. }
  3429.  
  3430. if (GM_getValue("league_report_button") === undefined) {
  3431. GM_setValue("league_report_button", "checked")
  3432. }
  3433.  
  3434. if (GM_getValue("league_calendar_button") === undefined) {
  3435. GM_setValue("league_calendar_button", "checked")
  3436. }
  3437.  
  3438. if (GM_getValue("windowsConfig") === undefined) {
  3439. GM_setValue("windowsConfig", true)
  3440. }
  3441.  
  3442. if (GM_getValue("tabsConfig") === undefined) {
  3443. GM_setValue("tabsConfig", false)
  3444. }
  3445.  
  3446. if (GM_getValue("show_league_selects") === undefined) {
  3447. GM_setValue("show_league_selects", true)
  3448. }
  3449.  
  3450. if (GM_getValue("league_image_size") === undefined) {
  3451. GM_setValue("league_image_size", 20)
  3452. }
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460. var leagueFlag = "", matchFlag = "", federationFlag = "", playersFlag = "", countryRankFlag = ""
  3461.  
  3462. if (GM_getValue("federationFlag")) federationFlag = "checked"
  3463. if (GM_getValue("matchFlag")) matchFlag = "checked"
  3464. if (GM_getValue("leagueFlag")) leagueFlag = "checked"
  3465. if (GM_getValue("playersFlag")) playersFlag = "checked"
  3466. if (GM_getValue("countryRankFlag")) countryRankFlag = "checked"
  3467. 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%;">'
  3468. newContent +='</br><center><table border=0 style="width:75%"><tbody><tr>';
  3469. newContent += '<td><label class="containerPeqAmarillo">League<input type="checkbox" id="leagueSelect" ' + leagueFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  3470. newContent += '<td><label class="containerPeqAmarillo">Federation<input type="checkbox" id="federationSelect" ' + federationFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  3471. newContent += '<td><label class="containerPeqAmarillo">Match<input type="checkbox" id="matchSelect" ' + matchFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  3472. newContent += '<td><label class="containerPeqAmarillo">Players<input type="checkbox" id="playersSelect" ' + playersFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  3473. newContent += '<td><label class="containerPeqAmarillo">Country Rank<input type="checkbox" id="countryRankSelect" ' + countryRankFlag + '><span class="checkmarkPeqAmarillo"></span></td>'
  3474. newContent += "</tr></tbody></table></center>"
  3475.  
  3476. newContent += "<hr>"
  3477. newContent += "<h3 style='text-align: left; padding-left:7px;'>Leagues Config</h3>"
  3478.  
  3479. newContent += "<table border='0'><tr>"
  3480. newContent += "<td>Default Senior Param: <td>" + generateValuesSelect('senior') + "</td>";
  3481. newContent += "<td>Default U23 Param: <td>" + generateValuesSelect('u23') + "</td>";
  3482. newContent += "<td>Default U21 Param: <td>" + generateValuesSelect('u21') + "</td>";
  3483. newContent += "<td>Default U18 Param: <td>" + generateValuesSelect('u18') + "</td>";
  3484.  
  3485. newContent += "</tr><tr>"
  3486.  
  3487.  
  3488. var checked_graph = GM_getValue("league_graph_button")
  3489. var checked_report = GM_getValue("league_report_button")
  3490. var checked_calendar = GM_getValue("league_calendar_button")
  3491.  
  3492. 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>"
  3493. 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>"
  3494.  
  3495. 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>"
  3496.  
  3497. newContent += '</tr><tr>';
  3498.  
  3499. 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">'
  3500. newContent += '<img class="textMiddle" id="testImage" src="https://statsxente.com/MZ1/View/Images/calendar.png" width="20px" height="20px"/>'
  3501. newContent += '<span class="textMiddle" style="padding-left:10px;" id="sizeImageLeagueSpan"> (' + GM_getValue("league_image_size") + ')</span></label></center></td>'
  3502.  
  3503.  
  3504.  
  3505. var checkedLeagueSelects = ""
  3506. if (GM_getValue("show_league_selects")) {
  3507. checkedLeagueSelects = "checked"
  3508. }
  3509.  
  3510. 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>'
  3511. newContent += "</tr></table>"
  3512. newContent += "<hr>"
  3513. newContent += "<h3 style='text-align: left; padding-left:7px;'>Tabs Config</h3>"
  3514. newContent += "<table style='display:flex;'><tr><td>"
  3515.  
  3516. var checkedTab = ""
  3517. if (GM_getValue("tabsConfig")) {
  3518. checkedTab = "checked"
  3519. }
  3520.  
  3521. var checkedWin = ""
  3522. if (GM_getValue("windowsConfig")) {
  3523. checkedWin = "checked"
  3524. }
  3525.  
  3526.  
  3527. newContent += "<label><input type='checkbox' id='windowsConfig' " + checkedWin + ">Windows</label>";
  3528. newContent += "<label><input type='checkbox' id='tabsConfig' " + checkedTab + ">Tabs</label>";
  3529. newContent += "</td></tr></table></br></br>"
  3530.  
  3531. newContent += '<div style=padding-bottom:10px;><h2>New vesion avaliable: '+GM_getValue("stx_latest_version")+'</h2>'
  3532. newContent += '<button class="btn-update" id="updateButton"><i class="bi bi-arrow-down-circle-fill" style="font-style:normal;"> Update</i></button></div>'
  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. document.getElementById("updateButton").addEventListener('click', function () {
  3549. window.open("https://update.greasyfork.org/scripts/491442/Stats%20Xente%20Script.user.js", "_blank");
  3550. });
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556. document.getElementById("legendDiv").addEventListener('click', function () {
  3557.  
  3558. if (document.getElementById("myModal_cargando").style.display == "none") {
  3559. document.getElementById("myModal_cargando").style.display = "flex";
  3560. } else {
  3561. document.getElementById("myModal_cargando").style.display = "none";
  3562. }
  3563.  
  3564. });
  3565.  
  3566.  
  3567. document.getElementById("closeButton").addEventListener('click', function () {
  3568. document.getElementById("myModal_cargando").style.display = "none";
  3569. });
  3570.  
  3571.  
  3572. document.getElementById("saveButton").addEventListener('click', function () {
  3573. window.location.reload();
  3574. });
  3575.  
  3576.  
  3577.  
  3578.  
  3579. (function () {
  3580. document.getElementById("deleteButton").addEventListener('click', function () {
  3581. var keys = GM_listValues();
  3582. keys.forEach(function (key) {
  3583. GM_deleteValue(key);
  3584. });
  3585. window.location.reload();
  3586. });
  3587. })();
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593. // }, 3000);
  3594.  
  3595. }
  3596. function getNativeTableStyles() {
  3597. var elemento = document.querySelector('.subheader.clearfix');
  3598. if (elemento) {
  3599. var estilo = getComputedStyle(elemento);
  3600. var bg = estilo.backgroundColor
  3601. var color = "white"
  3602. if (estilo.backgroundColor == "rgba(0, 0, 0, 0)") {
  3603. bg = "#a9b0b4"
  3604. }
  3605. GM_setValue("bg_native", bg)
  3606. GM_setValue("color_native", color)
  3607. }
  3608.  
  3609.  
  3610. }
  3611. function createModalEventListeners() {
  3612. setTimeout(function () {
  3613.  
  3614.  
  3615. document.getElementById('leagueSelect').addEventListener('click', function () {
  3616. GM_setValue("leagueFlag", !GM_getValue("leagueFlag"))
  3617. });
  3618.  
  3619.  
  3620. document.getElementById('federationSelect').addEventListener('click', function () {
  3621. GM_setValue("federationFlag", !GM_getValue("federationFlag"))
  3622. });
  3623.  
  3624. document.getElementById('matchSelect').addEventListener('click', function () {
  3625. GM_setValue("matchFlag", !GM_getValue("matchFlag"))
  3626. });
  3627.  
  3628. document.getElementById('playersSelect').addEventListener('click', function () {
  3629. GM_setValue("playersFlag", !GM_getValue("playersFlag"))
  3630. });
  3631.  
  3632. document.getElementById('countryRankSelect').addEventListener('click', function () {
  3633. GM_setValue("countryRankFlag", !GM_getValue("countryRankFlag"))
  3634. });
  3635.  
  3636.  
  3637.  
  3638.  
  3639. document.getElementById('show_league_checkbox').addEventListener('click', function () {
  3640. GM_setValue("show_league_selects", !GM_getValue("show_league_selects"))
  3641. });
  3642.  
  3643.  
  3644.  
  3645. document.getElementById('windowsConfig').addEventListener('click', function () {
  3646.  
  3647. if (document.getElementById('windowsConfig').checked) {
  3648. document.getElementById('tabsConfig').checked = false;
  3649. } else {
  3650. document.getElementById('tabsConfig').checked = true;
  3651. }
  3652.  
  3653. GM_setValue("windowsConfig", !GM_getValue("windowsConfig"))
  3654. GM_setValue("tabsConfig", !GM_getValue("tabsConfig"))
  3655.  
  3656.  
  3657. });
  3658.  
  3659.  
  3660. document.getElementById('tabsConfig').addEventListener('click', function () {
  3661. if (document.getElementById('tabsConfig').checked) {
  3662. document.getElementById('windowsConfig').checked = false;
  3663. } else {
  3664. document.getElementById('windowsConfig').checked = true;
  3665. }
  3666. GM_setValue("windowsConfig", !GM_getValue("windowsConfig"))
  3667. GM_setValue("tabsConfig", !GM_getValue("tabsConfig"))
  3668.  
  3669.  
  3670. });
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676. (function () {
  3677. document.getElementById("slider_input").addEventListener('input', function () {
  3678. document.getElementById("testImage").style.width = document.getElementById("slider_input").value + "px";
  3679. document.getElementById("testImage").style.height = document.getElementById("slider_input").value + "px";
  3680.  
  3681. document.getElementById("sizeImageLeagueSpan").innerText = "(" + document.getElementById("slider_input").value + ")"
  3682.  
  3683.  
  3684. GM_setValue("league_image_size", document.getElementById("slider_input").value)
  3685.  
  3686.  
  3687. });
  3688. })();
  3689.  
  3690.  
  3691.  
  3692.  
  3693. }, 5000);
  3694.  
  3695. }
  3696. function setLangSportCats() {
  3697.  
  3698. var langs = new Map();
  3699. langs.set('es', 'SPANISH');
  3700. langs.set('ar', 'SPANISH')
  3701. langs.set('en', 'ENGLISH');
  3702. langs.set('br', 'PORTUGUES');
  3703. langs.set('pt', 'PORTUGUES');
  3704. langs.set('pl', 'POLISH');
  3705. langs.set('ro', 'ROMANIAN');
  3706. langs.set('tr', 'TURKISH');
  3707.  
  3708. var lanCookie = getCookie("MZLANG");
  3709. if (langs.has(lanCookie)) {
  3710. window.lang = langs.get(lanCookie);
  3711. } else {
  3712. window.lang = "ENGLISH";
  3713. }
  3714.  
  3715. var sportCookie = getCookie("MZSPORT");
  3716. var lsport = "F"
  3717. var sport_id = 1;
  3718. if (sportCookie == "hockey") {
  3719. lsport = "H";
  3720. sport_id = 2;
  3721. }
  3722.  
  3723. var cats = {};
  3724. cats["senior"] = "senior";
  3725. cats["world"] = "seniorw";
  3726. cats["u23"] = "SUB23";
  3727. cats["u21"] = "SUB21";
  3728. cats["u18"] = "SUB18";
  3729. cats["u23_world"] = "SUB23w";
  3730. cats["u21_world"] = "SUB21w";
  3731. cats["u18_world"] = "SUB18w";
  3732.  
  3733.  
  3734. window.cats = cats;
  3735. window.sport = sportCookie;
  3736. window.lsport = lsport;
  3737. window.sport_id = sport_id;
  3738. window.userLocal = navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language;
  3739.  
  3740. }
  3741. function getUsernameData() {
  3742. if ((GM_getValue("currency") === undefined) || (GM_getValue("currency") == "")
  3743. ||(GM_getValue("soccer_team_id") === undefined) || (GM_getValue("soccer_team_id") == "")
  3744. ||(GM_getValue("hockey_team_id") === undefined) || (GM_getValue("hockey_team_id") == "")) {
  3745. var username = document.getElementById("header-username").innerText
  3746. GM_xmlhttpRequest({
  3747. method: "GET",
  3748. url: "http://www.managerzone.com/xml/manager_data.php?sport_id=" + window.sport_id + "&username=" + username,
  3749. headers: {
  3750. "Content-Type": "application/json"
  3751. },
  3752. onload: function (response) {
  3753.  
  3754. var parser = new DOMParser();
  3755. var xmlDoc = parser.parseFromString(response.responseText, "text/xml");
  3756. var userTeamsData = xmlDoc.getElementsByTagName("Team");
  3757. var index = 1;
  3758.  
  3759. if (userTeamsData[0].getAttribute("sport")=="soccer"){
  3760. GM_setValue("soccer_team_id", userTeamsData[0].getAttribute("teamId"))
  3761. }
  3762. if (userTeamsData[0].getAttribute("sport")=="hockey"){
  3763. GM_setValue("hockey_team_id", userTeamsData[0].getAttribute("teamId"))
  3764. }
  3765.  
  3766.  
  3767. if (userTeamsData[1].getAttribute("sport")=="soccer"){
  3768. GM_setValue("soccer_team_id", userTeamsData[1].getAttribute("teamId"))
  3769. }
  3770. if (userTeamsData[1].getAttribute("sport")=="hockey"){
  3771. GM_setValue("hockey_team_id", userTeamsData[1].getAttribute("teamId"))
  3772. }
  3773.  
  3774.  
  3775.  
  3776. if (userTeamsData[0].getAttribute("sport") == window.sport) {
  3777. index = 0;
  3778. }
  3779. GM_xmlhttpRequest({
  3780. method: "GET",
  3781. url: "http://www.managerzone.com/xml/team_playerlist.php?sport_id=" + window.sport_id + "&team_id=" + userTeamsData[index].getAttribute("teamId"),
  3782. headers: {
  3783. "Content-Type": "application/json"
  3784. },
  3785. onload: function (response) {
  3786.  
  3787. var parser = new DOMParser();
  3788. var xmlDoc = parser.parseFromString(response.responseText, "text/xml");
  3789. var team_data = xmlDoc.getElementsByTagName("TeamPlayers");
  3790. GM_setValue("currency", team_data[0].getAttribute("teamCurrency"))
  3791. }
  3792. });
  3793.  
  3794.  
  3795.  
  3796.  
  3797.  
  3798. }
  3799. });
  3800.  
  3801. }
  3802.  
  3803.  
  3804. }
  3805. function getActualDate(){
  3806. const fechaActual = new Date();
  3807. const year = fechaActual.getFullYear();
  3808. const month = String(fechaActual.getMonth() + 1).padStart(2, '0');
  3809. const day = String(fechaActual.getDate()).padStart(2, '0');
  3810. const fechaFormateada = `${year}-${month}-${day}`;
  3811. return fechaFormateada;
  3812. }
  3813. function compareVersions(installedVersion, latestVersion) {
  3814. const installedParts = installedVersion.split('.').map(Number);
  3815. const latestParts = latestVersion.split('.').map(Number);
  3816. for (let i = 0; i < Math.max(installedParts.length, latestParts.length); i++) {
  3817. const installed = installedParts[i] || 0;
  3818. const latest = latestParts[i] || 0;
  3819. if (installed < latest) {
  3820. GM_setValue("avaliable_new_version","yes")
  3821. }else{
  3822. GM_setValue("avaliable_new_version","no")
  3823. }
  3824. }
  3825.  
  3826. }
  3827. function notifySnackBarNewVersion(){
  3828. console.log(GM_getValue("stx_notified_version")+" "+GM_getValue("stx_latest_version"))
  3829. if(GM_getValue("stx_notified_version")!=GM_getValue("stx_latest_version")){
  3830. GM_setValue("stx_notified_version",GM_getValue("stx_latest_version"))
  3831. var x = document.getElementById("snackbar_stx");
  3832. 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>"
  3833. txt+="<button type='button' id='button-snackbar-update'>UPDATE</button>"
  3834. x.innerHTML = txt;
  3835. x.className = "showSnackBar_stx";
  3836. document.getElementById("button-snackbar-update").addEventListener('click', function () {
  3837. window.open("https://update.greasyfork.org/scripts/491442/Stats%20Xente%20Script.user.js", "_blank");
  3838. });
  3839. setTimeout(function () { x.className = x.className.replace("showSnackBar_stx", ""); }, 8000);
  3840. }
  3841. }
  3842. async function checkScriptVersion(){
  3843. const actual_date=getActualDate()
  3844. if(actual_date!=GM_getValue("date_checked_version")){
  3845. console.log("eo")
  3846. notifySnackBarNewVersion()
  3847. GM_setValue("date_checked_version", actual_date)
  3848. const greasyForkURL = 'https://greasyfork.org/es/scripts/491442-stats-xente-script';
  3849. fetch(greasyForkURL)
  3850. .then(response => response.text())
  3851. .then(data => {
  3852. const parser = new DOMParser();
  3853. const doc = parser.parseFromString(data, 'text/html');
  3854. const versionElement = doc.querySelector('dd.script-show-version');
  3855. const latestVersion = versionElement ? versionElement.textContent.trim() : 'No se encontró versión';
  3856. const installedVersion = GM_info.script.version;
  3857. GM_setValue("stx_latest_version",latestVersion)
  3858. compareVersions(installedVersion, latestVersion);
  3859. })
  3860. .catch(error => {
  3861. console.error('Error al obtener la versión del script:', error);
  3862. });
  3863.  
  3864. }
  3865.  
  3866. }
  3867. function putSortIcon(a, tabla_) {
  3868. var filaEncabezado = tabla_.querySelector('thead tr');
  3869. var celdas = filaEncabezado.getElementsByTagName('th');
  3870. if (celdas.length == 0) {
  3871. celdas = filaEncabezado.getElementsByTagName('td');
  3872. }
  3873. var elementos = tabla_.querySelectorAll('.bi.bi-arrow-down-short');
  3874. elementos.forEach(function (elemento) {
  3875. elemento.remove();
  3876. })
  3877.  
  3878. elementos = tabla_.querySelectorAll('.bi.bi-arrow-up-short');
  3879. elementos.forEach(function (elemento) {
  3880. elemento.remove();
  3881. })
  3882.  
  3883.  
  3884. 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>'
  3885. 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>'
  3886.  
  3887.  
  3888. 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>'
  3889. 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>'
  3890.  
  3891. var icon = iconAsc;
  3892. if (document.getElementById("ord_table").value == "descendente") {
  3893. icon = iconDesc;
  3894. }
  3895.  
  3896.  
  3897. celdas[a].innerHTML = icon + celdas[a].innerHTML;
  3898. }
  3899. function ordenarTablaq(columna, byClassName, param) {
  3900. if (byClassName) {
  3901. var elems = document.getElementsByClassName(param);
  3902. var tabla = elems[0]
  3903. } else {
  3904. tabla = document.getElementById(param)
  3905. }
  3906. var filas, switching, i, x, y, debeCambiar, direccion, cambioRealizado;
  3907. switching = true;
  3908. direccion = document.getElementById("ord_table").value
  3909. while (switching) {
  3910. switching = false;
  3911. filas = tabla.rows;
  3912. for (i = 1; i < (filas.length - 1); i++) {
  3913. debeCambiar = false;
  3914. x = filas[i].getElementsByTagName("td")[columna];
  3915. y = filas[i + 1].getElementsByTagName("td")[columna];
  3916. var xValue = parseFloat(x.innerHTML.replace(/\./g, "").replace(/[^0-9,-]+/g, "").replace(",", "."));
  3917. var yValue = parseFloat(y.innerHTML.replace(/\./g, "").replace(/[^0-9,-]+/g, "").replace(",", "."));
  3918. if (direccion == "ascendente") {
  3919. if (isNaN(xValue)) {
  3920. if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
  3921. debeCambiar = true;
  3922. break;
  3923. }
  3924. } else {
  3925. if (xValue > yValue) {
  3926. debeCambiar = true;
  3927. break;
  3928. }
  3929. }
  3930. } else if (direccion == "descendente") {
  3931. if (isNaN(xValue)) {
  3932. if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
  3933. debeCambiar = true;
  3934. break;
  3935. }
  3936. } else {
  3937. if (xValue < yValue) {
  3938. debeCambiar = true;
  3939. break;
  3940. }
  3941. }
  3942. }
  3943. }
  3944.  
  3945.  
  3946.  
  3947. if (debeCambiar) {
  3948. filas[i].parentNode.insertBefore(filas[i + 1], filas[i]);
  3949. switching = true;
  3950. cambioRealizado = true;
  3951. } else {
  3952. if (!cambioRealizado && direccion == "descendente") {
  3953. //direccion = "ascendente";
  3954. switching = true;
  3955. }
  3956. }
  3957. }
  3958.  
  3959. if (document.getElementById("ord_table").value == "descendente") {
  3960. document.getElementById("ord_table").value = "ascendente";
  3961. } else {
  3962. document.getElementById("ord_table").value = "descendente";
  3963. }
  3964.  
  3965.  
  3966. filas = tabla.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
  3967. for (i = 0; i < filas.length; i++) {
  3968. var primerTd = filas[i].querySelector("td");
  3969. primerTd.innerHTML = (i + 1);
  3970. }
  3971. }
  3972. function setCSSStyles(){
  3973. var link = document.createElement('link');
  3974. link.href = 'https://fonts.googleapis.com/css?family=Roboto&display=swap';
  3975. link.rel = 'stylesheet';
  3976.  
  3977. var link1 = document.createElement('link');
  3978. link1.href = 'https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css';
  3979. link1.rel = 'stylesheet';
  3980. document.head.appendChild(link)
  3981. document.head.appendChild(link1)
  3982.  
  3983. var inputHidden = document.createElement('input');
  3984. inputHidden.type = 'hidden';
  3985. inputHidden.id = 'ord_table';
  3986. inputHidden.value = 'ascendente';
  3987. document.body.appendChild(inputHidden);
  3988. GM_addStyle(`#snackbar_stx {
  3989. visibility: hidden;
  3990. position: fixed;
  3991. /*display: flex;*/
  3992. align-items: center;
  3993. left: 50%;
  3994. transform: translate(-50%, -50%);
  3995. min-width: 350px;
  3996. background-color: #323232;
  3997. color: #ffffffb3;
  3998. text-align: center;
  3999. border-radius: 2px;
  4000. padding: 16px;
  4001. z-index: 1;
  4002. bottom: 30px;
  4003. font-size: 17px;
  4004. border-radius: 5px;
  4005. box-shadow: 0 3px 5px -1px #0003, 0 6px 10px #00000024, 0 1px 18px #0000001f;
  4006. }
  4007.  
  4008. #snackbar_stx.showSnackBar_stx {
  4009. visibility: visible;
  4010. -webkit-animation: fadein 0.5s, fadeout 0.5s 8s forwards;
  4011. animation: fadein 0.5s, fadeout 0.5s 8s forwards;
  4012. }
  4013.  
  4014. @-webkit-keyframes fadein {
  4015. from {bottom: 0; opacity: 0;}
  4016. to {bottom: 30px; opacity: 1;}
  4017. }
  4018.  
  4019. @keyframes fadein {
  4020. from {bottom: 0; opacity: 0;}
  4021. to {bottom: 30px; opacity: 1;}
  4022. }
  4023.  
  4024. @-webkit-keyframes fadeout {
  4025. from {bottom: 30px; opacity: 1;}
  4026. to {bottom: 0; opacity: 0;}
  4027. }
  4028.  
  4029. @keyframes fadeout {
  4030. from {bottom: 30px; opacity: 1;}
  4031. to {bottom: 0; opacity: 0;}
  4032. }
  4033.  
  4034.  
  4035. .divAlert {
  4036. width: 75%;
  4037. padding: 4px 3px;
  4038. border-radius: 4px;
  4039. border-style: solid;
  4040. border-width: 1px;
  4041. font-size: 13px;
  4042. background-color: #ffc107;
  4043. color: #161515;
  4044. border-color: #ffffff;
  4045. font-weight: bold;
  4046. text-shadow: 1px 1px #ffffff;
  4047. }.modal_cargando {
  4048. display: none;
  4049. /* Hidden by default */
  4050. position: fixed;
  4051. /* Stay in place */
  4052. z-index: 150;
  4053. /* Sit on top */
  4054. padding-top: 25px;
  4055. /* Location of the box */
  4056. left: 0;
  4057. top: 0;
  4058. width: 100%;
  4059. /* Full width */
  4060. height: 100%;
  4061. /* Full height */
  4062. overflow: auto;
  4063. /* Enable scroll if needed */
  4064. background-color: rgb(0, 0, 0);
  4065. /* Fallback color */
  4066. background-color: rgba(0, 0, 0, 0.75);
  4067. /* Black w/ opacity */
  4068. justify-content: center;
  4069. align-items: center;
  4070. }
  4071.  
  4072. .modal-content_cargando {
  4073. position:relative;
  4074. border-radius:7px;
  4075. background-color: #fefefe00;
  4076. width: 90%;
  4077. height: 40%;
  4078. display: flex;
  4079. justify-content: center;
  4080. align-items: center;
  4081. }
  4082.  
  4083.  
  4084. .btn-save{
  4085. width:8em;
  4086. border-color:transparent;
  4087. border-radius: 3px;
  4088. display: inline-block;
  4089. padding: 10px 5px;
  4090. text-shadow: 0 1px 0 rgba(255,255,255,0.3);
  4091. box-shadow: 0 1px 1px rgba(0,0,0,0.3);
  4092. cursor:pointer;
  4093. color: white;
  4094. font-family: 'Roboto', sans-serif;
  4095. background-color: #3CC93F;/*Color de fondo*/
  4096. }
  4097. .btn-save:hover{
  4098. background-color: #37B839;/*Color de fondo*/
  4099. }
  4100. .btn-save:active{
  4101. background-color: #29962A;/*Color de fondo*/
  4102. }
  4103.  
  4104.  
  4105. .btn-update{
  4106. width:8em;
  4107. border-color:transparent;
  4108. border-radius: 3px;
  4109. display: inline-block;
  4110. padding: 10px 5px;
  4111. text-shadow: 0 1px 0 rgba(255,255,255,0.3);
  4112. box-shadow: 0 1px 1px rgba(0,0,0,0.3);
  4113. cursor:pointer;
  4114. color: white;
  4115. font-family: 'Roboto', sans-serif;
  4116. background-color: #2da8ef;/*Color de fondo*/
  4117. }
  4118. .btn-update:hover{
  4119. background-color: #2187c2;/*Color de fondo*/
  4120. }
  4121. .btn-update:active{
  4122. background-color: #2187c2;/*Color de fondo*/
  4123. }
  4124.  
  4125. .btn-delete{
  4126. width:8em;
  4127. border-color:transparent;
  4128. border-radius: 3px;
  4129. display: inline-block;
  4130. padding: 10px 5px;
  4131. text-decoration: none;
  4132. text-shadow: 0 1px 0 rgba(255,255,255,0.3);
  4133. box-shadow: 0 1px 1px rgba(0,0,0,0.3);
  4134. cursor:pointer;
  4135. color: white;
  4136. font-family: 'Roboto', sans-serif;
  4137. background-color: #e6413e;/*Color de fondo*/
  4138. }
  4139. .btn-delete:hover{
  4140. background-color: #C93832;/*Color de fondo*/
  4141. }
  4142. .btn-delete:active{
  4143. background-color: #ad2a24;/*Color de fondo*/
  4144. }
  4145.  
  4146. .cerrar {
  4147. position: absolute;
  4148. top: 0;
  4149. right: 0;
  4150. padding: 5px;
  4151. cursor: pointer;
  4152. color: #fff;
  4153. }
  4154.  
  4155. .close_cargando {
  4156. color: #aaaaaa;
  4157. float: right;
  4158. font-size: 28px;
  4159. font-weight: bold;
  4160. }
  4161.  
  4162. .close_cargando:hover,
  4163. .close_cargando:focus {
  4164. color: #000;
  4165. text-decoration: none;
  4166. cursor: pointer;
  4167. }.stx_legend {
  4168. z-index:300;
  4169. position: fixed;
  4170. bottom: 60%;
  4171. right: 1px;
  4172. border: 1px solid #2bacf5;
  4173. padding-right: 13px;
  4174. padding-left: 3px;
  4175. padding-top: 3px;
  4176. padding-bottom: 3px;
  4177. width: 14px;
  4178. font-size: 13px;
  4179. border-radius: 4px;
  4180. text-shadow: 1px 1px 3px #676767;
  4181. background-color: #246355;
  4182. color: #246355;
  4183. cursor: default;
  4184. cursor: pointer;
  4185. }.loader {
  4186. width: 100%;
  4187. height: 15px;
  4188. border-radius: 40px;
  4189. color: #ffc107;
  4190. border: 2px solid;
  4191. position: relative;
  4192. overflow: hidden;
  4193. }
  4194. .loader::before {
  4195. content: "";
  4196. position: absolute;
  4197. margin: 2px;
  4198. width: 14px;
  4199. top: 0;
  4200. bottom: 0;
  4201. left: -20px;
  4202. border-radius: inherit;
  4203. background: currentColor;
  4204. box-shadow: -10px 0 12px 3px currentColor;
  4205. clip-path: polygon(0 5%, 100% 0,100% 100%,0 95%,-30px 50%);
  4206. animation: l14 1s infinite linear;
  4207. }
  4208. @keyframes l14 {
  4209. 100% {left: calc(100% + 20px)}
  4210. }
  4211. .containerPeqAmarillo {
  4212. display: block;
  4213. position: relative;
  4214. padding-left: 35px;
  4215. margin-bottom: 12px;
  4216. font-size:medium;
  4217. padding-top:5px;
  4218. cursor: pointer;
  4219. -webkit-user-select: none;
  4220. -moz-user-select: none;
  4221. -ms-user-select: none;
  4222. user-select: none;
  4223. }
  4224.  
  4225. /* Hide the browser's default checkbox */
  4226. .containerPeqAmarillo input {
  4227. position: absolute;
  4228. opacity: 0;
  4229. cursor: pointer;
  4230. height: 0;
  4231. width: 0;
  4232. }
  4233.  
  4234. /* Create a custom checkbox */
  4235. .checkmarkPeqAmarillo {
  4236. position: absolute;
  4237. top: 0;
  4238. left: 0;
  4239. height: 25px;
  4240. width: 25px;
  4241. background-color: #eee;
  4242. }
  4243.  
  4244. /* On mouse-over, add a grey background color */
  4245. .containerPeqAmarillo:hover input ~ .checkmarkPeqAmarillo {
  4246. background-color: #ccc;
  4247. }
  4248.  
  4249. /* When the checkbox is checked, add a blue background */
  4250. .containerPeqAmarillo input:checked ~ .checkmarkPeqAmarillo {
  4251. background-color: #FFCC00;
  4252. }
  4253.  
  4254. /* Create the checkmark/indicator (hidden when not checked) */
  4255. .checkmarkPeqAmarillo:after {
  4256. content: "";
  4257. position: absolute;
  4258. display: none;
  4259. }
  4260.  
  4261. /* Show the checkmark when checked */
  4262. .containerPeqAmarillo input:checked ~ .checkmarkPeqAmarillo:after {
  4263. display: block;
  4264. }
  4265.  
  4266. /* Style the checkmark/indicator */
  4267. .containerPeqAmarillo .checkmarkPeqAmarillo:after {
  4268. left: 9px;
  4269. top: 5px;
  4270. width: 5px;
  4271. height: 10px;
  4272. border: solid white;
  4273. border-width: 0 3px 3px 0;
  4274. -webkit-transform: rotate(45deg);
  4275. -ms-transform: rotate(45deg);
  4276. transform: rotate(45deg);
  4277. }
  4278. #showMenu {
  4279. text-align: left;
  4280. border-collapse: collapse;
  4281. width: 75%;
  4282. font-size: 14px;
  4283. font-family: 'Roboto', sans-serif
  4284. }
  4285.  
  4286. /* #showMenu th,td {
  4287. padding: 4px;
  4288. }*/
  4289.  
  4290. #showMenu td {
  4291. background-color: white;
  4292. }
  4293.  
  4294. #showMenu thead {
  4295. background-color: #246355;
  4296. border-bottom: solid 2px #0F362D;
  4297. color: white;
  4298. }
  4299.  
  4300. #showMenu tfoot {
  4301. font-family: 'Righteous', cursive;
  4302. background-color: #246355;
  4303. border-bottom: solid 5px #0F362D;
  4304. font-size: 13px;
  4305. color: white;
  4306. }
  4307.  
  4308.  
  4309.  
  4310. #showMenu tr td,
  4311. th {
  4312. border-top-right-radius: 0;
  4313. border-top-left-radius: 0;
  4314. border-bottom-left-radius: 0;
  4315. border-bottom-right-radius: 0;
  4316. }
  4317.  
  4318. #showMenu th:first-child {
  4319. border-top-left-radius: 5px;
  4320. }
  4321.  
  4322. #showMenu th:last-child {
  4323. border-top-right-radius: 5px;
  4324. }
  4325.  
  4326. #showMenu tr {
  4327. background-color: transparent;
  4328. border-color: transparent;
  4329. font-family: 'Roboto';
  4330. }
  4331.  
  4332. #show3{
  4333.  
  4334. width: 75%;
  4335. background-color: transparent;
  4336. border-collapse: separate;
  4337. border-spacing: 0;
  4338. }
  4339.  
  4340.  
  4341.  
  4342. #show3 td {
  4343. background-color: white;
  4344. }
  4345.  
  4346. #show3 tr:last-child td:last-child {
  4347. border-bottom-right-radius: 5px;
  4348. }
  4349.  
  4350.  
  4351. #show3 tr:last-child td:first-child {
  4352. border-bottom-left-radius: 5px;
  4353. }
  4354.  
  4355. .caja_mensaje_50 {
  4356. font-family: 'Roboto', sans-serif;
  4357. background: #98D398;
  4358. color: #FFFFFF;
  4359. font-weight: bold;
  4360. padding: 4px;
  4361. text-align: center;
  4362. width: 50%;
  4363. font-size: 2.0em;
  4364. border-radius: 5px;
  4365. }
  4366.  
  4367. .modal_div_content_main{
  4368. width: 100%;
  4369. background-color: #f2f2f2;
  4370. min-height: 115px;
  4371. border-radius: 5px;
  4372. }
  4373.  
  4374.  
  4375.  
  4376.  
  4377. .expandable-icon {
  4378. right: 0px;
  4379. top: 0px;
  4380. transform: rotateZ(45deg);
  4381. border-radius: 5px;
  4382. width: 20px;
  4383. height: 20px;
  4384. background: rgb(12, 47, 94);
  4385. transition: all .3s;
  4386. }
  4387.  
  4388. .expandable-item.active .expandable-icon{
  4389. transform: rotateZ(0);
  4390. }
  4391.  
  4392. .expandable-icon .line {
  4393. width: 15px;
  4394. height: 2px;
  4395. background: white;
  4396. position: absolute;
  4397. top: 0;
  4398. left: 0;
  4399. right: 0;
  4400. bottom: 0;
  4401. margin: auto;
  4402. transition: all .4s;
  4403. }
  4404.  
  4405. .expandable-icon .line:nth-child(1) {
  4406. transform: rotateZ(45deg);
  4407. }
  4408.  
  4409. .expandable-icon .line:nth-child(2) {
  4410. transform: rotateZ(-45deg);
  4411. }
  4412.  
  4413.  
  4414. .imgMiddle {
  4415. display: inline-block;
  4416. vertical-align: middle;
  4417. }
  4418.  
  4419. .textMiddle {
  4420. display: inline-block;
  4421. vertical-align: middle;
  4422. }
  4423.  
  4424.  
  4425. table.matchValuesTable {
  4426. border-collapse: collapse;
  4427. width: 80%;
  4428. margin: 5px 0;
  4429. z-index:15;
  4430.  
  4431. }
  4432. table.matchValuesTable th, table.matchValuesTable td {
  4433. border: 1px solid #ddd;
  4434. text-align: center;
  4435. padding: 6px;
  4436. border: 0px;
  4437. }
  4438. table.matchValuesTable th {
  4439. background-color: #e4c800;
  4440. color: white;
  4441. border: 0px;
  4442. }
  4443.  
  4444. table.matchValuesTable th:first-child {
  4445. border-top: none; /* Quita el borde superior de la primera celda del encabezado */
  4446. }
  4447.  
  4448.  
  4449. #button-snackbar-update{
  4450. color: #2da8ef;
  4451. background-color: transparent;
  4452. border: 1px solid #2da8ef;
  4453. padding: .15rem .50rem;
  4454. font-size: 0.90rem;
  4455. line-height: 1.5;
  4456. border-radius: .25rem;
  4457. cursor:pointer;
  4458. }
  4459.  
  4460. #button-snackbar-update:hover{
  4461. color: white;
  4462. background-color: #2da8ef;
  4463. border: 1px solid #2da8ef;
  4464. padding: .15rem .50rem;
  4465. font-size: 0.90rem;
  4466. line-height: 1.5;
  4467. border-radius: .25rem;
  4468. cursor:pointer;
  4469. }
  4470. `)
  4471.  
  4472. }
  4473.  
  4474. })();