MZ - Clasificación

Inserta escudos en la clasificación y mejora el diseño de las tablas en ManagerZone

  1. // ==UserScript==
  2. // @name MZ - Clasificación
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.7
  5. // @description Inserta escudos en la clasificación y mejora el diseño de las tablas en ManagerZone
  6. // @author ChatGPT
  7. // @license MIT
  8. // @match https://www.managerzone.com/*
  9. // @grant GM_addStyle
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function agregarEscudos() {
  16. document.querySelectorAll('.nice_table td:nth-child(2)').forEach(td => {
  17. let equipoLink = td.querySelector('a[href*="tid="]') || td.querySelector('a');
  18. if (equipoLink) {
  19. let equipoID = obtenerIDdesdeURL(equipoLink.href) || obtenerIDdesdeData(td);
  20.  
  21. if (equipoID && !td.querySelector('.escudo-equipo')) {
  22. let imgEscudo = document.createElement('img');
  23. imgEscudo.src = `https://www.managerzone.com/dynimg/badge.php?team_id=${equipoID}&sport=soccer&location=team_main`;
  24. imgEscudo.classList.add('escudo-equipo');
  25. imgEscudo.style.width = '20px';
  26. imgEscudo.style.height = '25px';
  27. imgEscudo.style.marginRight = '5px';
  28. imgEscudo.style.verticalAlign = 'middle';
  29.  
  30. let bandera = td.querySelector('img[src*="flags"]');
  31.  
  32. if (bandera) {
  33. bandera.parentNode.insertBefore(imgEscudo, bandera);
  34. } else {
  35. td.insertBefore(imgEscudo, td.firstChild);
  36. }
  37. }
  38. }
  39. });
  40. }
  41.  
  42. function obtenerIDdesdeURL(url) {
  43. let match = url.match(/tid=(\d+)/);
  44. return match ? match[1] : null;
  45. }
  46.  
  47. function obtenerIDdesdeData(td) {
  48. let posibleID = td.innerHTML.match(/team_id=(\d+)/);
  49. return posibleID ? posibleID[1] : null;
  50. }
  51.  
  52. function iniciarObservador() {
  53. const targetNode = document.body;
  54. const config = { childList: true, subtree: true };
  55.  
  56. const observer = new MutationObserver(() => {
  57. agregarEscudos();
  58. });
  59.  
  60. observer.observe(targetNode, config);
  61. }
  62.  
  63. // Estilos para mejorar la tabla
  64. GM_addStyle(`
  65. .nice_table_container {
  66. width: 100% !important;
  67. overflow-x: auto !important;
  68. }
  69.  
  70. .nice_table td:first-child {
  71. text-align: left !important;
  72. padding-left: 12px !important;
  73. }
  74.  
  75. .nice_table tr:nth-child(even) {
  76. background-color: #ffffff !important;
  77. }
  78. .nice_table tr:nth-child(odd) {
  79. background-color: #eeeeee !important;
  80. }
  81.  
  82. .nice_table tr:nth-child(1) {
  83. background-color: #ffdd57 !important;
  84. font-weight: bold !important;
  85. color: #000 !important;
  86. }
  87.  
  88. .nice_table td, .nice_table th {
  89. padding: 9px 12px !important;
  90. }
  91.  
  92. .nice_table th:nth-child(4)::before { content: "V" !important; }
  93. .nice_table th:nth-child(5)::before { content: "E" !important; }
  94. .nice_table th:nth-child(6)::before { content: "D" !important; }
  95.  
  96. .nice_table th:nth-child(4),
  97. .nice_table th:nth-child(5),
  98. .nice_table th:nth-child(6) {
  99. color: transparent !important;
  100. position: relative;
  101. }
  102.  
  103. .nice_table th:nth-child(4)::before,
  104. .nice_table th:nth-child(5)::before,
  105. .nice_table th:nth-child(6)::before {
  106. color: black !important;
  107. position: absolute;
  108. left: 50%;
  109. transform: translateX(-50%);
  110. }
  111.  
  112. .nice_table td:nth-child(2) {
  113. text-align: left !important;
  114. padding-left: 7px !important;
  115. font-weight: normal !important;
  116. white-space: nowrap !important;
  117. text-transform: uppercase !important;
  118. }
  119.  
  120. .nice_table, .nice_table th, .nice_table td {
  121. border: none !important;
  122. }
  123.  
  124. .nice_table th, .nice_table td {
  125. padding: 7px !important;
  126. text-align: center !important;
  127. }
  128. `);
  129.  
  130. // Ejecutar la función al inicio y activar el observador
  131. agregarEscudos();
  132. iniciarObservador();
  133. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址