MZScript© | por cCc vAdEr & Serbini Ini

Características y funcionalidades extras para el sitio de ManagerZone

目前为 2017-07-25 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name MZScript© | por cCc vAdEr & Serbini Ini
  3. // @namespace https://greasyfork.org/scripts/1752-mzscript-por-ccc-vader-serbini-ini
  4. // @description Características y funcionalidades extras para el sitio de ManagerZone
  5. // @include http://*managerzone.*
  6. // @grant none
  7. // @version 3.3.o
  8. // @copyright Copyleft(c) 2010-2017, c_c - serbocapo
  9. // @authors c_c (c_c@managerzone.com) | serbocapo (serbocapo@managerzone.com)
  10. // @credits some icons are by Yusuke Kamiyamane [http://p.yusukekamiyamane.com/]
  11. // ==/UserScript==
  12. var navigatorAgent = navigator.userAgent;
  13. if ((verOffset = navigatorAgent.indexOf("Chrome")) != -1) {
  14. function addJQuery(callback) {
  15. var script = document.createElement("script");
  16. script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
  17. script.addEventListener('load', function () {
  18. var script = document.createElement("script");
  19. script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
  20. document.body.appendChild(script);
  21. }, false);
  22. document.body.appendChild(script);
  23. }
  24. addJQuery(mzscript);
  25. } else {
  26. mzscript();
  27. }
  28. function mzscript() {
  29. (function () {
  30. var dominios = ['ar', 'at', 'biz', 'bo', 'br', 'ch', 'cl', 'co', 'com', 'cr', 'cz', 'de', 'dk', 'do', 'ec', 'edu', 'es', 'eu', 'fm', 'fr', 'gb', 'gov', 'gr', 'gt', 'hn', 'hr', 'ie', 'info', 'int', 'it', 'jobs', 'lt', 'lv', 'ly', 'mx', 'mz', 'net', 'ni', 'org', 'pa', 'pe', 'pl', 'pr', 'pt', 'py', 'ro', 'ru', 'sv', 'se', 'th', 'tk', 'tn', 'to', 'tr', 'tv', 'tz', 'uk', 'us', 'uy', 've', 'vg', 'xxx', 'yu', 'zw'];
  31. var etiqOut = ['a', 'applet', 'area', 'embed', 'frame', 'frameset', 'head', 'iframe', 'img', 'map', 'meta', 'noscript', 'object', 'option', 'param', 'script', 'select', 'style', 'textarea', 'title'];
  32. var inArray = function (value, items) {
  33. for (var i = 0; items[i] && value != items[i]; i++)
  34. ;
  35. return value == items[i];
  36. }
  37. var regExp = /(^|[\s()\[\]_:~+@*"'>])((?:https?|ftp|irc):\/\/)?([-a-z\d;:&=+$,%_.!~*'()]+@)?((?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:(www|irc|ftp)\.)?(?:(?:[a-z\d]|[a-z\d][a-z\d-]*[a-z\d])\.)+([a-z]{2,6}))(:\d+)?(\/(?:[-\w.!~*'()%:@&=+$,;\/]*[\w~*%@&=+$\/])?(?:\?(?:[-\w;\/?:@&=+$,.!~*'()%\[\]|]*[\w\/@&=+$~*%])?)?(?:#(?:[-\w;\/?:@&=+$,.!~*'()%]*[\w\/@&=+$~*%])?)?|\b)/i
  38. var conteadorL = 0;
  39. var docAct = document.body;
  40. while (docAct) {
  41. if (docAct.nodeName == '#text' && (match = docAct.nodeValue.match(regExp)) && inArray(match[6], dominios)) {
  42. var url;
  43. if (match[3] && !match[2] && !match[5] && !match[8] && (match[3].indexOf(':') == -1 || match[3].indexOf('mailto:') == 0)) {
  44. url = (match[3].indexOf('mailto:') == -1 ? 'mailto:' : '') + match[3] + match[4];
  45. } else {
  46. url = (match[2] ? match[2] : (!match[5] || match[5] == 'www' ? 'http' : match[5]) + '://') + (match[3] ? match[3] : '') + match[4] + (match[7] ? match[7] : '') + (match[8] ? match[8] : '');
  47. }
  48. if (url) {
  49. var range = document.createRange();
  50. range.setStart(docAct, match.index + match[1].length);
  51. range.setEnd(docAct, match.index + match[0].length);
  52. var a = document.createElement('a');
  53. a.setAttribute('href', url);
  54. a.appendChild(range.extractContents());
  55. range.insertNode(a);
  56. range.detach();
  57. conteadorL++;
  58. }
  59. }
  60. if (docAct.tagName && !inArray(docAct.tagName.toLowerCase(), etiqOut) && docAct.firstChild) {
  61. docAct = docAct.firstChild;
  62. } else if (docAct.nextSibling) {
  63. docAct = docAct.nextSibling;
  64. } else {
  65. do {
  66. docAct = docAct.parentNode;
  67. } while (!docAct.nextSibling && docAct.parentNode);
  68. docAct = docAct.nextSibling;
  69. }
  70. }
  71. })();
  72. (function () {
  73. var css = "#body.body_mz,div.win_back,#win_bg,div.news_item,.odd{background-image:url(http://static.managerzone.com/img/windowbg.gif)!important;}.subnavhr{height:2px!important;}.even{background-color:#c0c0c0!important;}.age_restricted_game{background-color:#d6db93!important;border-top:solid 1px #000015!important;border-bottom:solid 1px #000015!important;}.age_restricted_game_secondary{background-color:#8ecf8b!important;border-top:solid 1px #000015!important;border-bottom:solid 1px #000015!important;}.mPoint{float:left;height:6px;margin-right:3px;margin-top:5px;width:6px;}.amar{background-color:#FF0}.black{background-color:#000}a.ctooltip span {display:none; padding:2px 3px; margin-left:8px; width:290px;}a.ctooltip:hover span{display:inline; position:absolute; z-index:1000; margin-top:-190px; border:1px solid #000000; background:#C4D1E4; color:#6c6c6c; border-radius:6px;}a.ctooltip2 span {/*display:none;*/ padding:2px 3px; margin-left:120px;margin-top:-33px;width:290px;}.divVisible{display:block;}.divHidden {display:none;}.cursor{cursor:pointer;}#link, #pe, #error {display: none}.forum_topic_last_post a{color:#990000!important;}#menuDiv ul#top_item_matches_sub li a{padding-left:10px;padding-right:10px}#menuDiv ul.topnav li{margin-right:4px}.tdStyle{color:#FFF;font-weight:bold}.buttondiv{position:static}.fbtn{width:188px}#infobar h5{margin-left:-15px}.cursor{cursor:pointer}#jugador{width:20px}#jugador img{display:block;margin:auto}#jug{padding:15px}#close{padding:3px}.impTabla td {color:#FFF;font-weight:bold;padding:5px}.impTabla td input[type='radio']{float:right}.cuadros{display:none;color:#FFF;padding:8px 8px 0 8px;width:100%}.mzs{border:0;padding:3px;border-radius:2px;color:#FFF;font-weight:bold;cursor:pointer}.tJug{float:right}.cInput{margin-top:-2px;float:left}#notifications-wrapper > a{width:17px!important;margin: 0 3px -4px;}#header-stats-wrapper{width:370px}.topnav #top_item_club > li,.topnav #top_item_club a.bg{max-width:160px!important}#stripes{margin: -8px auto 10px;padding: 5px 0}#fluid-menu-opener > div.sport-line, #top-wrapper-sport-line{background: #5d5b5f none repeat scroll 0 0}.quicklink{background-color:#4A4A4A;border-radius:4px;box-shadow:0 0 1px 0 #000;color:#FFF;display:inline-block;margin-left:4px;padding:2px 4px;text-decoration:none;}.quicklink:hover{background-color: #000000;box-shadow: 0 0 2px 0 #000000;color: #FFFFFF;text-decoration: none;}.quicklinks{padding:0 4px 8px;text-align:center}#notifications-wrapper{bottom: -2px};";
  74. if (typeof GM_addStyle != "undefined") {
  75. GM_addStyle(css);
  76. } else if (typeof PRO_addStyle != "undefined") {
  77. PRO_addStyle(css);
  78. } else if (typeof addStyle != "undefined") {
  79. addStyle(css);
  80. } else {
  81. var heads = document.getElementsByTagName("head");
  82. if (heads.length > 0) {
  83. var node = document.createElement("style");
  84. node.type = "text/css";
  85. node.appendChild(document.createTextNode(css));
  86. heads[0].appendChild(node);
  87. }
  88. }
  89. })();
  90. /*(function () {
  91. var m = document.getElementById("menuDiv").childNodes[4];
  92. if (m.className != 'arrow top') {
  93. var sede = document.getElementById('top_item_clubhouse_sub');
  94. sede.innerHTML = '<li><a href="?p=clubhouse">Comienzo</a></li><li onmouseover="document.getElementById(\'lequipo\').style.display=\'block\'" onmouseout="document.getElementById(\'lequipo\').style.display=\'none\'"><a href="?p=team">Mi Equipo</a><ul id="lequipo" style="position:absolute;width:200px;margin-left:-40px;display:none;"><li style="width:137px;"><a href="?p=team&sub=alter" style="text-align:left;">Editar Información</a></li><li style="width:137px;"><a href="?p=team&sub=alterbadge" style="text-align:left;">Editar Escudo</a></li><li style="width:137px;"><a href="?p=team&sub=alterjersey" style="text-align:left;">Editar Camiseta</a></li><li style="width:137px;"><a href="?p=team&sub=sponsor " style="text-align:left;">Sponsor</a></li><li style="width:137px;"><a href="?p=team&sub=achievements" style="text-align:left;">Logros</a></li><li style="width:137px;"><a href="?p=team&sub=story" style="text-align:left;">Rendimiento Copas</a></li><li style="width:137px;"><a href="?p=team&sub=awards" style="text-align:left;">Trofeos</a></li></ul></li></li><li onmouseover="document.getElementById(\'ljug\').style.display=\'block\'" onmouseout="document.getElementById(\'ljug\').style.display=\'none\'"><a href="?p=players">Jugadores</a><ul id="ljug" style="position:absolute;width:200px;margin-left:-40px;display:none;"><li style="width:120px;"><a href="?p=players&sub=alt" style="text-align:left;">Vista Alternativa</a></li><li style="width:120px;"><a href="?p=players&sub=unavailable" style="text-align:left;">Les./Sanc.</a></li><li style="width:120px;"><a href="?p=players&sub=changenumbers" style="text-align:left;">Cambiar Número</a></li><li style="width:120px;"><a href="?p=players&sub=retired" style="text-align:left;">Retirados</a></li><li style="width:120px;"><a href="?p=players&sub=stats " style="text-align:left;">Estadísticas (C)</a></li></ul></li><li onmouseover="document.getElementById(\'ltact\').style.display=\'block\'" onmouseout="document.getElementById(\'ltact\').style.display=\'none\'"><a href="?p=tactics&myTactic=1">Tácticas</a><ul id="ltact" style="position:absolute;width:200px;margin-left:-40px;display:none;"><li style="width:122px;"><a href="?p=tactics&sub=availability" style="text-align:left;">Disponibilidad (C)</a></li></ul></li><li onmouseover="document.getElementById(\'lentre\').style.display=\'block\'" onmouseout="document.getElementById(\'lentre\').style.display=\'none\'"><a href="?p=training_home">Entrenamiento</a><ul id="lentre" style="position:absolute;width:200px;margin-left:-40px;display:none;"><li style="width:105px;"><a href="?p=training_camp" style="text-align:left;">CE - YP</a></li><li style="width:105px;"><a href="?p=training_report" style="text-align:left;">Reporte</a></li><li style="width:105px;"><a href="?p=training" style="text-align:left;">General</a></li><li style="width:105px;"><a href="?p=training_graphs" style="text-align:left;">Gráficos (C)</a></li></ul></li><li onmouseover="document.getElementById(\'lentre2\').style.display=\'block\'" onmouseout="document.getElementById(\'lentre2\').style.display=\'none\'"><a href="?p=trainers">Entrenadores</a><ul id="lentre2" style="position:absolute;width:200px;margin-left:-40px;display:none;"><li style="width:104px;"><a href="?p=trainers&sub=negotiations" style="text-align:left;">Negociaciones</a></li><li style="width:104px;"><a href="?p=trainers&sub=freeagents" style="text-align:left;">Libres</a></li></ul></li><li onmouseover="document.getElementById(\'lmerc\').style.display=\'block\'" onmouseout="document.getElementById(\'lmerc\').style.display=\'none\'"><a href="?p=transfer">Mercado</a><ul id="lmerc" style="position:absolute;width:200px;margin-left:-40px;display:none;"><li style="width:102px;"><a href="?p=transfer&sub=yourplayers" style="text-align:left;">Monitoreo</a></li><li style="width:102px;"><a href="?p=transfer_history" style="text-align:left;">Historial</a><li style="width:102px;"><a href="?p=transfer&sub=category" style="text-align:left;">Categorías (C)</a></li></ul></li><li><a href="?p=shortlist">Seguimiento de Jugadores</a></li><li><a href="?p=youth_academy">Juveniles</a></li>';
  95. var partidos = document.getElementById('top_item_matches_sub');
  96. partidos.innerHTML = '<li><a href="?p=league&type=senior">Pos. Liga</a></li><li onmouseover="document.getElementById(\'ljug2\').style.display=\'block\'" onmouseout="document.getElementById(\'ljug2\').style.display=\'none\'"><a href="?p=match&sub=played">Jugados</a><ul id="ljug2" style="position:absolute;width:200px;margin-left:-40px;display:none;"><li style="width:109px;"><a href="?p=match&sub=played&hidescore=1" style="text-align:left;">Sin Resultados</a></li></ul></li><li><a href="?p=match&sub=scheduled">Próximos</a></li><li onmouseover="document.getElementById(\'lam\').style.display=\'block\'" onmouseout="document.getElementById(\'lam\').style.display=\'none\'"><a href="?p=challenges">Amistosos</a><ul id="lam" style="position:absolute;width:200px;margin-left:-40px;display:none;"><li style="width:83px;"><a href="?p=challenges&sub=friendly" style="text-align:left;">Aceptados</a></li></ul></li><li onmouseover="document.getElementById(\'lcop\').style.display=\'block\'" onmouseout="document.getElementById(\'lcop\').style.display=\'none\'"><a href="?p=cup&sub=cup_home">Copas</a><ul id="lcop" style="position:absolute;width:100px;margin-left:-40px;display:none;"><li style="width:75px;"><a href="?p=cup&sub=list&type=my" style="text-align:left;">Oficiales</a></li><li style="width:75px;"><a href="?p=private_cup" style="text-align:left;">Privadas</a></li><li style="width:75px;"><a href="?p=private_cup&cuptype=partner" style="text-align:left;">Socios</a></li></ul></li><li><a href="?p=friendlyseries">LAs</a></li><li><a href="?p=topteams">IM\'s</a></li><li><a href="?p=match&sub=livescores_overview">Live Scores</a><li onmouseover="document.getElementById(\'lsel\').style.display=\'block\'" onmouseout="document.getElementById(\'lsel\').style.display=\'none\'"><a href="?p=national_teams">Selecciones</a><ul id="lsel" style="position:absolute;width:200px;margin-left:-40px;display:none;"><li style="width:88px;"><a href="?p=national_teams&type=u21" style="text-align:left;">Sub21</a></li></ul></li><li><a href="?p=league&type=world">Liga Mundial</a></li><li><a href="?p=league&type=u18_world">LM U18</a></li><li><a href="?p=league&type=u18">Liga U18</a></li><li><a href="?p=league&type=u21">Liga U21</a></li><li><a href="?p=league&type=u23">Liga U23</a></li>';
  97. var ayuda = document.getElementById('top_item_help_sub');
  98. ayuda.innerHTML = '<li><a href="?p=support_form">Soporte</a></li><li><a href="?p=search">Buscador</a></li><li><a href="?p=beginners_guide">Guía principiantes</a></li><li><a href="?p=manual_faq">FAQ</a></li><li><a href="?p=rules&sub=rules_game">Reglas Generales</a></li><li><a href="?p=rules&sub=rules_forum">Reglas Foro</a></li><li><a href="?p=rules&sub=rules_nc">Reglas Selecciones Nacionales</a></li><li onmouseover="document.getElementById(\'lguias\').style.display=\'block\'" onmouseout="document.getElementById(\'lguias\').style.display=\'none\'"><a href=>Guías | Sitios</a><ul id="lguias" style="position:absolute;width:200px;margin-left:-71px;display:none;"><li style="width:168px;"><a href="?p=forum&sub=topic&topic_id=8923549&forum_id=255&sport=soccer" style="text-align:left;">[Índice] Sitios + Páginas</a></li><li style="width:168px;"><a href="?p=forum&sub=topic&topic_id=8923519&forum_id=255&sport=soccer" style="text-align:left;">[Índice] Guías + Tutoriales</a></li></ul><li><a href="?p=forum&sub=topic&topic_id=8365957&forum_id=253&sport=soccer">MZScript</a></li></li>';
  99. }
  100. })();*/
  101. function collapseExpand(divs) {
  102. var divObject = document.getElementById(divs);
  103. if (divObject.className == "divVisible") {
  104. divObject.className = "divHidden";
  105. } else {
  106. divObject.className = "divVisible";
  107. }
  108. }
  109. atajoForo('', 'p=forum&sub=topics&forum_id=254&sport=soccer', 'MER', 'Ir a Mercado', 0);
  110. atajoForo('', 'p=forum&sub=topics&forum_id=249&sport=soccer', 'AMI', 'Ir a Amistosos', 1);
  111. atajoForo('', 'p=forum&sub=topics&forum_id=253&sport=soccer', 'MZH', 'Ir a MZ Habla', 1);
  112. atajoForo('', 'p=forum&sub=topics&forum_id=255&sport=soccer', 'PYR', 'Ir a Preguntas y Respuestas', 1);
  113. atajoForo('', 'p=forum&sub=topics&forum_id=250&sport=soccer', 'DA', 'Ir a Discusión Abierta', 1);
  114. atajoForo('', 'p=forum&sub=topics&forum_id=251&sport=soccer', 'FED', 'Ir a Federaciones', 1);
  115. atajoExtInt('http://i.imgur.com/7Uttzyv.gif', '?p=transfer&sub=yourplayers', 'Ir al Monitoreo');
  116. atajoExtInt('http://i.imgur.com/DRf7WGm.gif', '?p=shortlist', 'Ir a Seguimiento');
  117. atajoExtInt('http://i.imgur.com/LhtVqWQ.gif', '?p=players&sub=alt', 'Ver Vista Alternativa');
  118. atajoExtInt('http://i.imgur.com/gG2hhct.gif', 'http://www.mzplus.info/p', 'Ir al Skiller');
  119. atajoExtInt('http://i.imgur.com/G40I9gQ.gif', 'http://imgur.com/', 'Ir a Imgur');
  120. atajoExtInt('http://i.imgur.com/V1vgq9d.gif', '?p=economy', 'Ver Finanzas');
  121. atajoExtInt('http://i.imgur.com/jzbCTLE.gif', '?p=transfer', 'Ver Mercado');
  122. atajoExtInt('http://i.imgur.com/eqx7dq1.gif', 'http://www.mzplus.info/tax', 'Calcular Impuestos');
  123. atajoExtInt('http://i.imgur.com/TzYBzYW.gif', '?p=match&sub=played', 'Ver los Partidos Jugados');
  124. atajoExtInt('http://i.imgur.com/p7ZMKSw.gif', '?p=match&sub=scheduled', 'Ver los Próximos Partidos');
  125. atajoExtInt('http://i.imgur.com/1hvSw7g.gif', '?p=tactics&myTactic=1', 'Ir a Tácticas');
  126. atajoExtInt('http://i.imgur.com/v3RoRU6.gif', '?p=players&sub=unavailable', 'Ver Lesionados/Sancionados');
  127. atajoExtInt('http://i.imgur.com/K3PXtyE.gif', '?p=training_report', 'Ver el Reporte de Entrenamiento');
  128. atajoExtInt('http://i.imgur.com/1qQmgOp.gif', '?p=training', 'Ir al Entrenamiento General');
  129. var url = window.location.href.split("=");
  130. var cid = url[3];
  131. if (url[1] == "private_cup&sub" || url[1] == "cup&sub" || (url[2] == "u18" || url[2] == "u21" || url[2] == "u23" || url[2] == "world" || url[2] == "u18_world")) {
  132. var cp = (url[1] == "private_cup&sub") ? 1 : 0;
  133. var extraMundial = (url[2] == "u18" || url[2] == "u21" || url[2] == "u23" || url[2] == "world" || url[2] == "u18_world") ? 1 : 0;
  134. var id = cp ? 'mostrarTabla3' : extraMundial ? 'mostrarTabla2' : 'mostrarTabla';
  135. var setterCountry;
  136. $('#ui-id-4').click(function () {
  137. setterCountry = setInterval(function () {
  138. divCountry();
  139. verProgMatch(cid, cp);
  140. addBtnMostrarTabla(id);
  141. }, 1000);
  142. });
  143. if (extraMundial) {
  144. setterCountry = setInterval(function () {
  145. addBtnMostrarTabla(id);
  146. }, 1000);
  147. }
  148. }
  149. function addBtnMostrarTabla(id) {
  150. var groupContainer = $(".nice_table thead tr.seriesHeader")[0];
  151. if (typeof groupContainer !== 'undefined') {
  152. clearInterval(setterCountry);
  153. var iconMostrarTabla = "<img src='http://i.imgur.com/B69WEGD.png' id='" + id + "' class='cursor' title='Compartir tabla' />";
  154. var thContainer = groupContainer.childNodes[1];
  155. thContainer.innerHTML = iconMostrarTabla;
  156. }
  157. }
  158. function verProgMatch(cid, cp) {
  159. var equipos = $(".nice_table tbody > tr");
  160. var filas = equipos.length;
  161. var tid = 0, fila, i, hrefN;
  162. for (i = 0; i < filas; i++) {
  163. fila = equipos[i].cells[1];
  164. tid = fila.childNodes[0].href.split("&")[1].replace("tid=", "");
  165. if (cp)
  166. hrefN = "?p=private_cup&sub=schedule&cid=" + cid.toString() + "&tid=" + tid.toString() + "&cuptype=partner";
  167. else
  168. hrefN = "?p=cup&sub=schedule&cid=" + cid.toString() + "&tid=" + tid.toString();
  169. var fixt = document.createElement("span");
  170. fixt.setAttribute('style', 'float:right');
  171. fixt.innerHTML = '<a href="' + hrefN + '" target="_blank" title="Ver Programa de Partidos"><img src="http://i.imgur.com/ECRix0U.png" /></a>';
  172. fila.appendChild(fixt);
  173. }
  174. }
  175. function divCountry() {
  176. var groupContainer = $('#group-stages');
  177. if (typeof groupContainer !== 'undefined') {
  178. clearInterval(setterCountry);
  179. var tablaHeader = $(".nice_table thead tr.seriesHeader")[0];
  180. var icon = tablaHeader.childNodes[3];
  181. var addIcon = document.createElement("img");
  182. addIcon.setAttribute('src', 'http://i.imgur.com/IwaQRmF.png');
  183. addIcon.setAttribute('style', 'float:right;cursor:pointer');
  184. addIcon.setAttribute('title', 'Ver división y país');
  185. addIcon.setAttribute('id', 'divCountry');
  186. icon.appendChild(addIcon);
  187. var flag = false;
  188. $("#divCountry").click(function () {
  189. console.log("click");
  190. if (!flag) {
  191. flag = true;
  192. $(".team_link").parent().width("35%");
  193. $(".nice_table").css('border-right', '1px solid #BBBBBB');
  194. $(".nice_table").css('border-bottom', '1px solid #BBBBBB');
  195. var header = tablaHeader.childNodes[4];
  196. var headerNew = document.createElement("th");
  197. headerNew.setAttribute('id', 'divCountryC');
  198. headerNew.innerHTML = "Div - País";
  199. header.parentNode.insertBefore(headerNew, header);
  200. var equipos = $(".nice_table tbody > tr");
  201. var filas = equipos.length;
  202. var equipoId = 0, fila, i;
  203. for (i = 0; i < filas; i++) {
  204. fila = equipos[i];
  205. equipoId = fila.cells[1].childNodes[0].href.split("&")[1].replace("tid=", "");
  206. xmlhttp = new XMLHttpRequest();
  207. xmlhttp.open("GET", "/xml/manager_data.php?sport_id=1&team_id=" + equipoId.toString(), false);
  208. xmlhttp.send();
  209. xmlDoc = xmlhttp.responseXML;
  210. var divNum = xmlDoc.getElementsByTagName("Team")[0].getAttribute('seriesName');
  211. var country = xmlDoc.getElementsByTagName("UserData")[0].getAttribute('countryShortname');
  212. var newCell = document.createElement("td");
  213. newCell.innerHTML = divNum + " - " + country;
  214. var place = fila.cells[2];
  215. place.parentNode.insertBefore(newCell, place);
  216. }
  217. }
  218. });
  219. }
  220. }
  221. /*var url = window.location.href.split("=");
  222. if (url[1] == "forum&sub") {
  223. var miUser = document.getElementById("logout_etc").childNodes[7].childNodes[1].childNodes[0].textContent;
  224. var cont = document.getElementById("ajaxContainer").parentNode.childNodes[2].childNodes[0].childNodes[0];
  225. var boton = document.createElement("div");
  226. boton.setAttribute('style', 'float:right; margin-right: 5px; margin-top: 2px');
  227. boton.innerHTML = "<a href='?p=forum&sub=search&search_keywords=" + miUser + "&search_keyword_type=any&search_author=&search_forum=soccer&search_range=7&search_sort_by=post_date&search_sort_order=desc' target='_blank' title='Buscar respuestas' style='padding:2px 2px 0 0;border: 2px solid black; display:block'><img src='http://imgur.com/yqXLFsG.png' style='vertical-align:center' /></a>";
  228. cont.appendChild(boton);
  229. }*/
  230. var url = window.location.href.split('=');
  231. if (url[1] == "training_report") {
  232. var flag = 1;
  233. if (flag) {
  234. var setter = setInterval(function () {
  235. trainingBalls();
  236. }, 1000);
  237. }
  238. function trainingBalls() {
  239. var container = document.getElementById("training_report");
  240. if (container == null) {
  241. clearInterval(setter);
  242. }
  243. if (container.childElementCount > 0 && flag) {
  244. flag = 0;
  245. var I, totalP = container.childNodes.length;
  246. for (I = 4; I < totalP; I++) {
  247. if (container.childNodes[I].innerHTML != undefined) {
  248. var finalContainer = container.childNodes[I].childNodes[9].childNodes[1];
  249. var numBalls = document.createElement('span');
  250. numBalls.setAttribute("style", "float:right; font-weight: bold");
  251. numBalls.innerHTML = '(' + finalContainer.childElementCount + ')';
  252. finalContainer.appendChild(numBalls);
  253. finalContainer.style.width = '125px';
  254. }
  255. }
  256. }
  257. }
  258. }
  259. var url = window.location.href.split('=');
  260. if (url[1] == "transfer") {
  261. var stats = document.getElementById("transfer_stats");
  262. var general = document.getElementById("general_search");
  263. var atri = document.getElementById("attributes_search");
  264. var filter = document.getElementById("filters_search");
  265. stats.style.display = "none";
  266. general.style.display = "none";
  267. atri.style.display = "none";
  268. filter.style.display = "none";
  269. }
  270. var url2 = window.location.href.split('&');
  271. if (url2[1] == "sub=players") {
  272. var stats = document.getElementById("transfer_stats");
  273. var search = document.getElementById("transfer_search");
  274. stats.style.display = "none";
  275. search.style.display = "none";
  276. }
  277. function crearFirma() {
  278. var guardando = document.getElementById("areaFirma").value;
  279. guardando = guardando.replace(/^(\s|\&nbsp;)*|(\s|\&nbsp;)*$/g, "");
  280. if (guardando == '' || guardando == null || guardando.lenght == 0) {
  281. alert("No ha ingresado firma");
  282. return false;
  283. } else {
  284. var armando = '\n\n\n\n\n\n\n' + '▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬' + '\n' + guardando;
  285. localStorage.setItem('firmaMZ', armando);
  286. alert("Su firma se ha creado exitosamente");
  287. }
  288. }
  289. function mostrarFirma() {
  290. var cFirma = localStorage.getItem('firmaMZ');
  291. if (cFirma == null || cFirma == '') {
  292. alert("No tiene ninguna firma creada");
  293. return false;
  294. }
  295. var url = window.location.href.split('=');
  296. var area = "message"
  297. obj = document.getElementsByName(area)[0];
  298. var textoActual = obj.value;
  299. obj.value = textoActual + cFirma;
  300. }
  301. function firmaSiempre() {
  302. var firmasi = document.getElementById('mostrarY').checked;
  303. localStorage.setItem('mostrar', firmasi);
  304. }
  305. function firmaCont(tabla) {
  306. var filaFirma = tabla.insertRow(5);
  307. var firmaBar = "<td></td><td><div class='mzbtn buttondiv button_account' title='Crear Firma'><span class='buttonClassMiddle'><span style='white-space: nowrap' id='boton3'>Crear Firma</span></span><span class='buttonClassRight'>&nbsp;</span></div>&nbsp;";
  308. firmaBar += "<div class='mzbtn buttondiv button_account' title='Crear Firma'><span class='buttonClassMiddle'><span style='white-space: nowrap' id='btnMostrar'>Mostrar Firma</span></span><span class='buttonClassRight'>&nbsp;</span></div>&nbsp;";
  309. firmaBar += "<b>Mostrar firma siempre?</b> <input type='checkbox' title='Mostrar Firma Siempre' alt='Mostrar Firma' id='mostrarY'><br />";
  310. firmaBar += "<div id='divFirma' class='divHidden'><img src='http://i915.photobucket.com/albums/ac355/ccc_vader/botones/imagen2_btn2.png' title='Insertar imagen' alt='Insertar img' id='btni'/>&nbsp;";
  311. firmaBar += "<img src='http://i915.photobucket.com/albums/ac355/ccc_vader/botones/negrita_btn2.png' title='Negrita' alt='Negrita' id='btnn'/>&nbsp;";
  312. firmaBar += "<img src='http://i915.photobucket.com/albums/ac355/ccc_vader/botones/cursiva_btn2.png' title='Cursiva' alt='Cursiva' id='btnc'/>&nbsp;";
  313. firmaBar += "<img src='http://i915.photobucket.com/albums/ac355/ccc_vader/botones/subra_btn2.png' title='Subrayado' alt='Subrayado' id='btns'/><br />";
  314. firmaBar += "<textarea id='areaFirma' name='areaFirma' rows='5' cols='50'></textarea><br />";
  315. firmaBar += "<img src='http://i915.photobucket.com/albums/ac355/ccc_vader/bot/btn_save.gif' title='Guardar Firma' alt='Guardar firma' id='btnFirma' class='cursor' /></div></td>";
  316. filaFirma.innerHTML = filaFirma.innerHTML + firmaBar;
  317. }
  318. function firmaFija() {
  319. var mostrarsi = localStorage.getItem('mostrar');
  320. if (mostrarsi == 'true') {
  321. var url = window.location.href.split('=');
  322. var area = "forum_form_message";
  323. var posteo = document.getElementById(area);
  324. posteo.innerHTML = posteo.innerHTML + mostrarFirma();
  325. }
  326. }
  327. function upload(file) {
  328. if (!file || !file.type.match(/image.*/)) {
  329. document.getElementById("error").style.display = "block";
  330. document.getElementById("pe").style.display = "none";
  331. document.getElementById("link").style.display = "none";
  332. } else {
  333. document.getElementById("pe").style.display = "block";
  334. document.getElementById("link").style.display = "none";
  335. document.getElementById("error").style.display = "none";
  336. var fd = new FormData();
  337. fd.append("image", file);
  338. var xhr = new XMLHttpRequest();
  339. xhr.open("POST", "https://api.imgur.com/3/upload.json");
  340. if (ext != null) {
  341. var ext = document.getElementById("subidor").value;
  342. var parte = ext.split(".");
  343. } else {
  344. var ext = file.name;
  345. var parte = ext.split(".");
  346. }
  347. xhr.onload = function () {
  348. document.getElementById("error").style.display = "none";
  349. document.getElementById("pe").style.display = "none";
  350. document.getElementById("link").style.display = "block";
  351. var xts = parte[1];
  352. if (xts == 'bmp' || xts == 'tiff')
  353. xts = 'png';
  354. var parseresp = JSON.parse(xhr.responseText);
  355. var imgUrl = parseresp.data.link;
  356. document.querySelector("#link").innerHTML = "<a href='" + imgUrl + "'>" + imgUrl + "</a>";
  357. }
  358. xhr.setRequestHeader('Authorization', 'Client-ID 4306d20a28c0e7a');
  359. xhr.send(fd);
  360. }
  361. }
  362. function preventDef(event) {
  363. event.preventDefault();
  364. }
  365. function preventDef2(event) {
  366. upload(event.dataTransfer.files[0]);
  367. }
  368. function subirImagen() {
  369. var estilo = document.getElementById("contenedor").style.display;
  370. if (estilo == 'none' && window.opera) {
  371. document.getElementById("contenedor").innerHTML = "<span style='color:red;padding:3px'> Opera no soporta la posibilidad de subir imágenes directamente. <br /><span style='color:green'>&nbsp;Firefox sí, apoya una web libre! <a href='https://affiliates.mozilla.org/link/banner/12520/3/18'><img src='http://affiliates-cdn.mozilla.org/media/uploads/banners/download-small-blue-ES.png' class='cursor' /></a></span></span>";
  372. document.getElementById("contenedor").style.display = "block";
  373. } else if (estilo == 'none') {
  374. document.getElementById("contenedor").style.display = "block";
  375. } else {
  376. document.getElementById("contenedor").style.display = "none";
  377. }
  378. }
  379. function armaCodigo(tag, cubo) {
  380. obj = document.getElementsByName(cubo)[0];
  381. var scroll = obj.scrollTop;
  382. var inicio = obj.selectionStart;
  383. var fin = obj.selectionEnd;
  384. obj.value = obj.value.substr(0, inicio) + '[' + tag + ']' + obj.value.substr(inicio, fin - inicio) + '[/' + tag + ']' + obj.value.substr(fin, obj.value.length);
  385. obj.scrollTop = scroll;
  386. }
  387. function addImagen(caja) {
  388. var imagen = prompt('Ingrese URL/link de la imagen');
  389. var intentos = 0;
  390. var preUrl = '[image url=';
  391. var posUrl = ']';
  392. var rtdo = '';
  393. var obj = document.getElementsByName(caja)[0];
  394. var scroll = obj.scrollTop;
  395. var inicio = obj.selectionStart;
  396. var fin = obj.selectionEnd;
  397. if (imagen != '') {
  398. img = new Image();
  399. img.src = imagen;
  400. if ((img.height == 0) || (img.width == 0)) {
  401. while (!((img.height == 0) || (img.width == 0)) && intentos < 5) {
  402. for (pausa = 0; pausa < 100; pausa++) {
  403. }
  404. img.src = imagen;
  405. }
  406. }
  407. if ((img.height == 0) || (img.width == 0)) {
  408. alert('El link/URL: ' + imagen + ' no es una imagen, y no será convertido.');
  409. } else {
  410. rtdo += preUrl + imagen + posUrl;
  411. obj.value = obj.value.substr(0, inicio) + rtdo + obj.value.substr(fin, obj.value.length);
  412. }
  413. }
  414. obj.scrollTop = scroll;
  415. }
  416. function posteaIcono(url, area) {
  417. var obj = document.getElementsByName(area)[0];
  418. var scroll = obj.scrollTop;
  419. var inicio = obj.selectionStart;
  420. var fin = obj.selectionEnd;
  421. obj.value = obj.value.substr(0, inicio) + '[image url=' + url + ']' + obj.value.substr(fin, obj.value.length);
  422. obj.scrollTop = scroll;
  423. }
  424. function posteaTabla(area) {
  425. var dato = prompt('Ingrese el usuario para la liga oficial o el ID de la liga amistosa');
  426. var obj = document.getElementsByName(area)[0];
  427. var scroll = obj.scrollTop;
  428. var inicio = obj.selectionStart;
  429. var fin = obj.selectionEnd;
  430. if (dato == '') {
  431. alert('No ha ingresado correctamente el usuario/id. Vuelva a intentarlo, por favor.');
  432. } else if (dato == null) {
  433. return false;
  434. } else if (isNaN(dato) == true) {
  435. obj.value = obj.value.substr(0, inicio) + '[image url=http://www.mzplus.info/imgdin_liga?user=' + dato + ']' + obj.value.substr(fin, obj.value.length);
  436. } else {
  437. obj.value = obj.value.substr(0, inicio) + '[image url=http://www.mzplus.info/imgdin_liga?user=&idla=' + dato + ']' + obj.value.substr(fin, obj.value.length);
  438. }
  439. obj.scrollTop = scroll;
  440. }
  441. function mostrarTabla(which) {
  442. var tabla = document.getElementById("divTabla");
  443. if (tabla) {
  444. collapseExpand("divTabla");
  445. return false;
  446. }
  447. var tablaDeTorneo = $(".nice_table tbody > tr");
  448. var controlDiv = document.getElementById("divCountryC");
  449. var header;
  450. if (controlDiv)
  451. header = "<i>[table][th][/th][th]Equipo[/th][th]Div - País[/th][th]PJ[/th][th]PG [/th][th]PE[/th][th]PP[/th][th]GF[/th][th]GC [/th][th]=[/th][th]Pts[/th]";
  452. else
  453. header = "<i>[table][th][/th][th]Equipo[/th][th]PJ[/th][th]PG [/th][th]PE[/th][th]PP[/th][th]GF[/th][th]GC [/th][th]=[/th][th]Pts[/th]";
  454. var armarLineas = "<div style='font-weight:normal'><b>Tabla - copiar todo el texto</b> <img src='http://i.imgur.com/BzYADnz.png' id='cerrar' style='float:right' class='cursor' title='Cerrar' /><br /> <br />" + header;
  455. var tablaDeTorneoL = tablaDeTorneo.length;
  456. for (var line = 0; line < tablaDeTorneoL; line++) {
  457. var trs = tablaDeTorneo[line];
  458. if (trs.cells[0].childNodes[0].tagName != "IMG") {
  459. armarLineas += "[tr][td]" + trs.cells[0].textContent + "[/td][td]" + trs.cells[1].textContent + "[/td][td]" + trs.cells[2].textContent + "[/td][td]";
  460. armarLineas += trs.cells[3].textContent + "[/td][td]" + trs.cells[4].textContent + "[/td][td]" + trs.cells[5].textContent + "[/td][td]";
  461. armarLineas += trs.cells[6].textContent + "[/td][td]" + trs.cells[7].textContent + "[/td][td]" + trs.cells[8].textContent + "[/td][td]";
  462. armarLineas += trs.cells[9].textContent + "[/td]";
  463. if (controlDiv)
  464. armarLineas += "[td]" + trs.cells[10].textContent + "[/td]";
  465. armarLineas += "[/tr]";
  466. }
  467. }
  468. armarLineas += "[/table]</i></div>";
  469. var divContenedora = document.createElement('div');
  470. divContenedora.setAttribute('id', 'divTabla');
  471. divContenedora.setAttribute('style', 'z-index:10; position:absolute; background-color:#000; color:#FFF; width:450px; height: auto; padding:10px;');
  472. divContenedora.setAttribute('class', 'divVisible');
  473. divContenedora.innerHTML = armarLineas;
  474. if (which == 'copa') {
  475. posTabla = document.evaluate('//*[@id="mostrarTabla"]', document, null, XPathResult.ANY_TYPE, null);
  476. } else if (which == 'privada') {
  477. posTabla = document.evaluate('//*[@id="mostrarTabla3"]', document, null, XPathResult.ANY_TYPE, null);
  478. } else {
  479. posTabla = document.evaluate('//*[@id="mostrarTabla2"]', document, null, XPathResult.ANY_TYPE, null);
  480. }
  481. ins = posTabla.iterateNext();
  482. ins.parentNode.insertBefore(divContenedora, ins);
  483. }
  484. var flagR = false;
  485. function verResultados() {
  486. try {
  487. if (flagR) {
  488. alert("No hay nada para cargar. Gracias Nano! ;)")
  489. return;
  490. }
  491. flagR = true;
  492. $("#fixtures-results-list > dd").each(function (idx, elm) {
  493. var elem = $(elm);
  494. var elemBtns = elem.find('dl.action-panel a');
  495. var enJuego = (elemBtns.length);
  496. if (idx > 0 && typeof (elemBtns[0]) == "undefined")
  497. return false;
  498. if (enJuego > 1) {
  499. var idMatch = elemBtns[0].href.split('&')[3].split('=')[1];
  500. xmlhttp = new XMLHttpRequest();
  501. xmlhttp.open("GET", "/xml/match_info.php?sport_id=1&match_id=" + idMatch.toString(), false);
  502. xmlhttp.send();
  503. xmlDoc = xmlhttp.responseXML;
  504. var gol1 = xmlDoc.getElementsByTagName("Team")[0].getAttribute('goals');
  505. var gol2 = xmlDoc.getElementsByTagName("Team")[1].getAttribute('goals');
  506. var res = document.createElement('div');
  507. res.setAttribute('style', 'float:right; font-weight: bold;padding-left: 3px');
  508. res.setAttribute('id', 'visible');
  509. res.innerHTML = gol1;
  510. var res2 = document.createElement('div');
  511. res2.setAttribute('style', 'float:left; font-weight: bold;padding-right: 3px');
  512. res2.innerHTML = gol2;
  513. elem.find('dd.home-team-column > a.clippable').before(res);
  514. elem.find('dd.away-team-column img').before(res2);
  515. }
  516. });
  517. } catch (e) {
  518. console.log(e);
  519. }
  520. }
  521. var url = window.location.href.split('&');
  522. if (url[1] == "sub=scheduled") {
  523. var container = document.getElementById('matchListForm').childNodes[1];
  524. var btnRes = document.createElement('div');
  525. btnRes.setAttribute('style', 'float:right;cursor:pointer;border:2px solid #2A4CB0;width:20px;height:20px;padding:4px 0 0 4px;margin:2px 165px 0 0');
  526. btnRes.setAttribute('id', 'btnRes');
  527. btnRes.innerHTML = "<img src='http://i.imgur.com/WL38HPq.png' title='Ver resultados' />";
  528. container.appendChild(btnRes);
  529. document.getElementById("btnRes").addEventListener("click", verResultados, false);
  530. }
  531. function saveCu() {
  532. var radioButtons = document.getElementsByName("moneda");
  533. for (var i = 0; i < radioButtons.length; i++) {
  534. if (radioButtons[i].checked) {
  535. var moneda = radioButtons[i].value;
  536. if (moneda != null) {
  537. localStorage.setItem('moneda', moneda);
  538. switch (moneda) {
  539. case "4":
  540. localStorage.setItem('sigla', 'UYU');
  541. break;
  542. case "13":
  543. localStorage.setItem('sigla', 'MXN');
  544. break;
  545. case "15":
  546. localStorage.setItem('sigla', 'BOB');
  547. break;
  548. }
  549. alert("Opción Moneda guardada");
  550. collapseExpand("divTabla");
  551. return false;
  552. }
  553. }
  554. }
  555. alert("No ha seleccionado ninguna opción");
  556. }
  557. function saveTact() {
  558. var radioButtons = document.getElementsByName("tactica");
  559. for (var i = 0; i < radioButtons.length; i++) {
  560. if (radioButtons[i].checked) {
  561. var tactica = radioButtons[i].value;
  562. if (tactica != null) {
  563. localStorage.setItem('tactica', tactica);
  564. alert("Opción Táctica guardada");
  565. collapseExpand("divTabla");
  566. return false;
  567. }
  568. }
  569. }
  570. alert("No ha seleccionado ninguna opción");
  571. }
  572. function resetCu() {
  573. localStorage.removeItem("moneda");
  574. localStorage.removeItem("sigla");
  575. alert("Moneda reseteada a USD");
  576. collapseExpand("divTabla");
  577. return false;
  578. }
  579. function setearMoneda() {
  580. var tabla = document.getElementById("divTabla");
  581. if (tabla) {
  582. collapseExpand("divTabla");
  583. return false;
  584. }
  585. var divContenedora = document.createElement('div');
  586. divContenedora.setAttribute('id', 'divTabla');
  587. divContenedora.setAttribute('style', 'z-index:10;position:absolute;background-color:#000;color:#FFF;width:165px;height:auto;padding:10px;border:2px solid red');
  588. divContenedora.setAttribute('class', 'divVisible');
  589. divContenedora.innerHTML = "<img src='http://i.imgur.com/BzYADnz.png' id='cerrar' style='float:right' class='cursor' title='Cerrar' /><table align='center'><tr><td class='tdStyle' colspan='2' style='font-size:13px'>Moneda local</td></tr><tr><td class='tdStyle tJug'>MXN </td><td><input type='radio' value='13' name='moneda' class='cInput' /></td><tr><td class='tdStyle tJug'>UYU </td><td> <input type='radio' value='4' name='moneda' class='cInput' /></td></tr><tr><td class='tdStyle tJug'>BOB </td><td><input type='radio' value='15' name='moneda' class='cInput' /></td></tr><tr><td style='padding-top:10px' colspan='2'><button id='saveCu' class='mzbtn button_account mzs'>Guardar</button>&nbsp;<button id='resetCu' class='mzbtn button_account mzs'>Reset</button></td></tr></table>";
  590. divContenedora.innerHTML += "<br /> <table align='center'><tr><td colspan='2' class='tdStyle' style='font-size:13px'>Mostrar táctica</td></tr><tr><td class='tdStyle tJug'>Vertical </td><td><input type='radio' name='tactica' value='1' class='cInput' /></td></tr><tr><td class='tdStyle tJug'>Horizontal </td><td><input type='radio' name='tactica' value='0' class='cInput' /></td></tr><tr><td colspan='2' style='padding-top:10px'><button id='saveTact' class='mzbtn button_account mzs'>Guardar</button></td></tr></table><span style='font-style:italic;font-size:11px;float:right'>MZScript ©</span>";
  591. var ins = document.getElementById("contentDiv");
  592. ins.parentNode.insertBefore(divContenedora, ins);
  593. document.getElementById("saveCu").addEventListener("click", saveCu, false);
  594. document.getElementById("resetCu").addEventListener("click", resetCu, false);
  595. document.getElementById("saveTact").addEventListener("click", saveTact, false);
  596. }
  597. var url = window.location.href.split('&');
  598. if (url[1] == "sub=played" && typeof url[2] == "undefined" || url[1] == "sub=played" && url[2] == "hidescore=1") {
  599. var container = document.getElementById('matchListForm').childNodes[1];
  600. var btnMon = document.createElement('div');
  601. btnMon.setAttribute('style', 'float:right;cursor:pointer;border:2px solid #2A4CB0;width:20px;height:20px;padding:4px 0 0 4px;margin:2px 165px 0 0');
  602. btnMon.setAttribute('id', 'btnMon');
  603. btnMon.innerHTML = "<img src='http://i.imgur.com/wU57xHb.png' title='Setear moneda y táctica' />";
  604. container.appendChild(btnMon);
  605. document.getElementById("btnMon").addEventListener("click", setearMoneda, false);
  606. }
  607. function convertir(valorP, origen) {
  608. var alsek = new Array(7.4234, 9.1775, 1, 1, 0.256963, 2.62589, 13.35247, 1.23522, 1.07245, 5.86737, 5.70899, 5.66999, 1.6953, 0.68576, 2.64445, 0.939, 0.001309, 0.26313, 1.95278, 0.10433, 4.70738, 1.23733, 7.4234, 0.17079, 0.03896, 0.24946, 0.06, 0.17, 1);
  609. var valor_origen = valorP;
  610. var enseks = 1 / alsek[origen];
  611. var cMoneda = localStorage.getItem('moneda');
  612. if (cMoneda) {
  613. v = Math.round(1 / alsek[cMoneda] * valor_origen / enseks);
  614. } else {
  615. v = Math.round(1 / alsek[0] * valor_origen / enseks);
  616. }
  617. return v;
  618. }
  619. function getValues(idUno, idDos) {
  620. var cont = 0, pos, teamId, sport, index;
  621. while (cont < 2) {
  622. var titular = 1;
  623. if (cont == 0) {
  624. pos = 1;
  625. teamId = idUno;
  626. index = 0;
  627. } else {
  628. pos = 2;
  629. teamId = idDos;
  630. index = 1;
  631. }
  632. if (ajaxSport == 'soccer')
  633. sport = 1;
  634. else
  635. return;
  636. try {
  637. var xmlhttp = new XMLHttpRequest();
  638. xmlhttp.open("GET", "/xml/team_playerlist.php?sport_id=" + sport + "&team_id=" + teamId.toString(), false);
  639. xmlhttp.send();
  640. var xmlDoc = xmlhttp.responseXML;
  641. var tablaDeEquipoHeader = $("#match-statistics .hitlist_wrapper_background table thead")[index];
  642. if (tablaDeEquipoHeader == null) {
  643. cont = 2;
  644. return false;
  645. }
  646. var nombre = document.createElement('td');
  647. nombre.setAttribute('style', 'font-weight: bold;');
  648. nombre.innerHTML = "Valor MZ";
  649. var trName = tablaDeEquipoHeader.parentNode.rows[0].cells[0];
  650. trName.parentNode.insertBefore(nombre, trName);
  651. var tablaDeEquipoBody = $("#match-statistics .hitlist_wrapper_background table tbody")[index];
  652. var jugador, total = 0, tablaDeEquipoL = tablaDeEquipoBody.rows.length;
  653. for (jugador = 1; jugador < tablaDeEquipoL; jugador++) {
  654. try {
  655. var celdaControl = tablaDeEquipoBody.rows[jugador].cells[0].childNodes[0].tagName;
  656. if (celdaControl == 'IMG') {
  657. tablaDeEquipoBody.rows[jugador].cells[0].colSpan = "13";
  658. } else if (celdaControl != 'IMG' || typeof celdaControl != "undefined") {
  659. var celda = tablaDeEquipoBody.rows[jugador].cells[1];
  660. var idPlayer = celda.childNodes[1].childNodes[1].href.split('&')[1].split('=')[1];
  661. var totalXml = xmlDoc.getElementsByTagName("Player").length;
  662. for (var p = 0; p < totalXml; p++) {
  663. var idP = xmlDoc.getElementsByTagName("Player")[p].getAttribute('id');
  664. if (idPlayer == idP) {
  665. var valorP = xmlDoc.getElementsByTagName("Player")[p].getAttribute('value');
  666. var currency = xmlDoc.getElementsByTagName("TeamPlayers")[0].getAttribute('teamCurrency');
  667. var cMoneda = localStorage.getItem('moneda');
  668. var cSigla = localStorage.getItem('sigla');
  669. if ((cMoneda && currency != cSigla) || (!cMoneda && currency != "USD")) {
  670. switch (currency) {
  671. case "USD":
  672. valorP = convertir(valorP, 0);
  673. break;
  674. case "EUR":
  675. valorP = convertir(valorP, 1);
  676. break;
  677. case "SEK":
  678. valorP = convertir(valorP, 2);
  679. break;
  680. case "MM":
  681. valorP = convertir(valorP, 3);
  682. break;
  683. case "UYU":
  684. valorP = convertir(valorP, 4);
  685. break;
  686. case "R$":
  687. valorP = convertir(valorP, 5);
  688. break;
  689. case "GBP":
  690. valorP = convertir(valorP, 6);
  691. break;
  692. case "DKK":
  693. valorP = convertir(valorP, 7);
  694. break;
  695. case "NOK":
  696. valorP = convertir(valorP, 8);
  697. break;
  698. case "CHF":
  699. valorP = convertir(valorP, 9);
  700. break;
  701. case "CAD":
  702. valorP = convertir(valorP, 10);
  703. break;
  704. case "AUD":
  705. valorP = convertir(valorP, 11);
  706. break;
  707. case "ILS":
  708. valorP = convertir(valorP, 12);
  709. break;
  710. case "MXN":
  711. valorP = convertir(valorP, 13);
  712. break;
  713. case "ARS":
  714. valorP = convertir(valorP, 14);
  715. break;
  716. case "BOB":
  717. valorP = convertir(valorP, 15);
  718. break;
  719. case "PYG":
  720. valorP = convertir(valorP, 16);
  721. break;
  722. case "RUB":
  723. valorP = convertir(valorP, 17);
  724. break;
  725. case "PLN":
  726. valorP = convertir(valorP, 18);
  727. break;
  728. case "ISK":
  729. valorP = convertir(valorP, 19);
  730. break;
  731. case "BGL":
  732. case "BGN":
  733. valorP = convertir(valorP, 20);
  734. break;
  735. case "ZAR":
  736. valorP = convertir(valorP, 21);
  737. break;
  738. case "US$":
  739. valorP = convertir(valorP, 22);
  740. break;
  741. case "THB":
  742. valorP = convertir(valorP, 23);
  743. break;
  744. case "SIT":
  745. valorP = convertir(valorP, 24);
  746. break;
  747. case "SKK":
  748. valorP = convertir(valorP, 25);
  749. break;
  750. case "JPY":
  751. valorP = convertir(valorP, 26);
  752. break;
  753. case "INR":
  754. valorP = convertir(valorP, 27);
  755. break;
  756. case "MZ":
  757. valorP = convertir(valorP, 28);
  758. break;
  759. }
  760. }
  761. var valorCont = document.createElement('td');
  762. valorCont.setAttribute('style', 'width:62px;text-align:right;padding-right:15px');
  763. valorCont.innerHTML = puntosMiles(valorP);
  764. var ins = tablaDeEquipoBody.rows[jugador].cells[0];
  765. ins.parentNode.insertBefore(valorCont, ins);
  766. if (titular <= 11) {
  767. total = total + parseInt(valorP);
  768. }
  769. titular++;
  770. p = xmlDoc.getElementsByTagName("Player").length;
  771. }
  772. if (p == (totalXml - 1)) {
  773. var valorCont = document.createElement('td');
  774. valorCont.setAttribute('style', 'width:62px;text-align:right;padding-right:15px');
  775. valorCont.innerHTML = " -";
  776. var ins = tablaDeEquipoBody.rows[jugador].cells[0];
  777. ins.parentNode.insertBefore(valorCont, ins);
  778. }
  779. }
  780. }
  781. } catch (e) {
  782. console.log(e);
  783. }
  784. }
  785. if (typeof idP != "undefined") {
  786. var trFinal = tablaDeEquipoBody.parentNode.childNodes[5].rows[1].cells[0];
  787. var empty = document.createElement('div');
  788. empty.setAttribute('style', 'font-weight:bold;width:65px;text-align:right');
  789. empty.innerHTML = puntosMiles(total);
  790. ;
  791. trFinal.parentNode.insertBefore(empty, trFinal);
  792. tablaDeEquipoBody.parentNode.childNodes[5].rows[3].cells[0].colSpan = "13";
  793. }
  794. cont++;
  795. } catch (e) {
  796. console.log(e);
  797. }
  798. }
  799. }
  800. function puntosMiles(number) {
  801. number = number.toString();
  802. var result = "";
  803. while (number.length > 3) {
  804. result = "." + number.substr(number.length - 3) + result;
  805. number = number.substring(0, number.length - 3);
  806. }
  807. result = number + result;
  808. return result;
  809. }
  810. var url = window.location.href.split('&');
  811. if (url[1] == "sub=stats" || url[1] == "sub=result") {
  812. var teams = $(".team-table").find('a:first');
  813. var teamOid = teams[0].href.split('&')[1].split('=')[1];
  814. var teamTid = teams[1].href.split('&')[1].split('=')[1];
  815. getValues(teamOid, teamTid);
  816. var tactValue = localStorage.getItem('tactica');
  817. if (tactValue == 1) {
  818. var css = "#tactic-board > img {margin-bottom: 0px;margin-top: 0px;transform: none;}";
  819. var heads = document.getElementsByTagName("head");
  820. if (heads.length > 0) {
  821. var node = document.createElement("style");
  822. node.type = "text/css";
  823. node.appendChild(document.createTextNode(css));
  824. heads[0].appendChild(node);
  825. }
  826. var refPoints = "<div style='width:80px;margin-left:25px'><p style='float:left;-webkit-margin-before:10px;-webkit-margin-after:0'><span class='mPoint amar'>&nbsp;</span> Local</p> <p style='clear:both'></p> <p style='float:left;margin-top:-5px!important;-webkit-margin-before:0;-webkit-margin-after:10px'><span class='mPoint black'>&nbsp;</span> Visitante</p></div>";
  827. $(refPoints).insertBefore('img.shadow');
  828. }
  829. }
  830. function comparar_por_partido(filas) {
  831. try {
  832. var jugados = (location.href.indexOf('played') != -1) ? 1 : 0;
  833. var miEquipoSched = Boolean(!(filas[0].getElementsByTagName('a')[0]));
  834. var inicio = (!jugados && miEquipoSched) ? 1 : 0;
  835. var filasL = filas.length;
  836. for (var i = inicio; i < filasL; i++) {
  837. if (filas[i].className == 'group')
  838. continue;
  839. var ad = document.createElement('a');
  840. ad.innerHTML = '<img src=\"http://www.mzcompare.com/static/img/mzc.png\" title=\"Comparar equipos con MZ Compare\" border=\"0\" width=\"22\" width=\"13\" />';
  841. var ad2 = document.createElement('a');
  842. ad2.innerHTML = '<img src=\"http://i.imgur.com/FCw8KRW.png\" title=\"Mirar rival en MZPlus\" border=\"0\" width=\"22\" width=\"13\" />';
  843. var mzc = filas[i].childNodes[3].childNodes[7].childNodes[1].childNodes[3].childNodes[1].href;
  844. mzc = mzc.substring(mzc.indexOf('&tid'));
  845. var vtm = filas[i].childNodes[3].childNodes[7].childNodes[1].childNodes[1].childNodes[1].href;
  846. if(vtm.indexOf('&tid') == -1) vtm = filas[i].childNodes[3].childNodes[7].childNodes[1].childNodes[5].childNodes[2].href;
  847. vtm = vtm.substring(vtm.indexOf('&tid'));
  848. vtm = vtm.replace('&tid=', '');
  849. ad.setAttribute('href', 'http://www.mzcompare.com/match?played=' + jugados.toString() + mzc);
  850. ad.setAttribute('target', '_blank');
  851. ad2.setAttribute('href', 'http://www.mzplus.info/i?eq=' + vtm.toString());
  852. ad2.setAttribute('target', '_blank');
  853. ad2.setAttribute('style', 'margin-left:2px');
  854. //filas[i].childNodes[3].childNodes[5].appendChild(ad);
  855. filas[i].childNodes[3].childNodes[5].appendChild(ad2);
  856. }
  857. } catch (e) {
  858. console.log(e);
  859. }
  860. }
  861. if (location.href.indexOf('scheduled') != -1 || location.href.indexOf('played') != -1) {
  862. var filas = $("#fixtures-results-list > dd");
  863. comparar_por_partido(filas);
  864. }
  865. function mzs() {
  866. try {
  867. var mzs = document.createElement('li');
  868. mzs.setAttribute('id', 'MZs_shortcut');
  869. mzs.setAttribute('class', 'icon');
  870. mzs.setAttribute('style', 'margin-right:0');
  871. mzs.innerHTML = "<a href='https://greasyfork.org/scripts/1752-mzscript-por-ccc-vader-serbini-ini' class='bg' target='_blank' title='Página MZScript'><div><img src='http://i.imgur.com/OW3vHxF.png' border='0' style='vertical-align:top'></div></a>";
  872. var sector = document.getElementById("menuDiv").childNodes[1];
  873. sector.appendChild(mzs);
  874. } catch (e) {
  875. console.log(e);
  876. }
  877. }
  878. mzs();
  879. function insertarSelect(elementID) {
  880. var divImg = document.createElement('div')
  881. divImg.setAttribute('id', 'contenedor');
  882. divImg.setAttribute('style', 'border: 5px solid green;font-weight:bold;display:none;width:380px;padding:5px; margin: 0 auto');
  883. divImg.innerHTML = 'Arrastre su imagen a este espacio <button id="btnUpImg">O clickee acá para elegirla</button> <input style="visibility: collapse; width: 0px;" id="subidor" type="file"><p id="error" style="font-weight:bold;color:red">Error. El archivo seleccionado no es una imagen.</p><p id="pe">Cargando imagen <img src="http://managerzone.se/img/loading.gif"> &nbsp;espere por favor.</p><a id="link"></a>';
  884. var ins = document.getElementById(elementID);
  885. ins.parentNode.insertBefore(divImg, ins);
  886. document.getElementById("btnUpImg").addEventListener("click", function () {
  887. return document.getElementById('subidor').click()
  888. }, false);
  889. document.getElementById("subidor").addEventListener("change", function () {
  890. return upload(this.files[0])
  891. }, false);
  892. document.getElementById("btnUpImg").addEventListener("click", preventDef, false);
  893. document.getElementById("contenedor").addEventListener("dragover", preventDef, false);
  894. document.getElementById("contenedor").addEventListener("drop", preventDef, false);
  895. document.getElementById("contenedor").addEventListener("drop", preventDef2, false);
  896. }
  897. function generarImagen(url, idImg, elementID, height) {
  898. var bimg;
  899. if (idImg == 'btnTabla2' || idImg == 'btnTabla2c') {
  900. bimg = document.createElement('div');
  901. bimg.setAttribute('class', 'mzbtn buttondiv button_account');
  902. bimg.setAttribute('title', 'Insertar Tabla LA-liga');
  903. bimg.setAttribute('style', 'margin-bottom:5px');
  904. bimg.innerHTML = "<span class='buttonClassMiddle'><span style='white-space: nowrap' id='" + idImg + "'>Tabla LA/liga</span></span><span class='buttonClassRight'>&nbsp;</span>&nbsp;";
  905. } else if (idImg == 'upImg' || idImg == 'upImgc') {
  906. bimg = document.createElement('div');
  907. bimg.setAttribute('class', 'mzbtn buttondiv button_account');
  908. bimg.setAttribute('title', 'Subir imágenes a ImgUr');
  909. bimg.innerHTML = "<span class='buttonClassMiddle'><span style='white-space: nowrap' id='" + idImg + "'>ImgUr</span></span><span class='buttonClassRight'>&nbsp;</span>&nbsp;";
  910. } else {
  911. bimg = document.createElement('img');
  912. bimg.setAttribute('src', url);
  913. bimg.setAttribute('id', idImg);
  914. }
  915. if (height != '')
  916. bimg.setAttribute('height', height + 'px');
  917. var ins = document.getElementById(elementID);
  918. ins.parentNode.insertBefore(bimg, ins);
  919. }
  920. function insBR(elementID) {
  921. var brr = document.createElement('br');
  922. var ins = document.getElementById(elementID);
  923. ins.parentNode.insertBefore(brr, ins);
  924. }
  925. function armaPanel(elementID) {
  926. console.log("arma");
  927. console.log("#" + elementID);
  928. var groupContainer = $("#" + elementID);
  929. console.log(setterBC);
  930. if (typeof groupContainer !== 'undefined') {
  931. clearInterval(setterBC);
  932. var height = '';
  933. generarImagen('http://i.imgur.com/juiRdYs.gif', 'btnTabla2', elementID, height);
  934. generarImagen('http://i.imgur.com/HGa7jFa.gif', 'upImg', elementID, height);
  935. generarImagen('http://i.imgur.com/WOpvhpS.gif', 'aIcono0', elementID, height);
  936. generarImagen('http://i.imgur.com/CcuKTNz.gif', 'aIcono1', elementID, height);
  937. generarImagen('http://i.imgur.com/NPyAJM5.gif', 'aIcono2', elementID, height);
  938. generarImagen('http://i.imgur.com/1ncAraF.gif', 'aIcono3', elementID, height);
  939. generarImagen('http://i.imgur.com/xp6xUJJ.gif', 'aIcono4', elementID, height);
  940. generarImagen('http://i.imgur.com/qOigaWi.png', 'aIcono5', elementID, height);
  941. generarImagen('http://i.imgur.com/rSqmTPO.gif', 'aIcono6', elementID, height);
  942. generarImagen('http://i.imgur.com/uLyJYhu.png', 'aIcono7', elementID, height);
  943. generarImagen('http://i.imgur.com/RUQN2Hy.gif', 'aIcono8', elementID, height);
  944. generarImagen('http://i.imgur.com/QuXS7fE.gif', 'aIcono9', elementID, height);
  945. generarImagen('http://i.imgur.com/Bf8NC56.png', 'aIcono10', elementID, height);
  946. generarImagen('http://i.imgur.com/2L3i1f4.png', 'aIcono11', elementID, height);
  947. generarImagen('http://i.imgur.com/OOsLDaW.gif', 'aIcono12', elementID, height);
  948. generarImagen('http://i.imgur.com/HEAlBlA.png', 'aIcono13', elementID, height);
  949. generarImagen('http://i.imgur.com/O2GDd6I.png', 'aIcono14', elementID, height);
  950. insBR(elementID);
  951. generarImagen('http://i.imgur.com/zpY2A6I.gif', 'aIcono26', elementID, height);
  952. height = 15;
  953. generarImagen('http://i.imgur.com/RzjaSKr.gif', 'aIcono17', elementID, height);
  954. generarImagen('http://i.imgur.com/XEHiXuO.gif', 'aIcono18', elementID, height);
  955. generarImagen('http://i.imgur.com/1t7YpCo.gif', 'aIcono19', elementID, height);
  956. generarImagen('http://i.imgur.com/BzPDfzF.gif', 'aIcono20', elementID, height);
  957. generarImagen('http://i.imgur.com/UR5t0o6.gif', 'aIcono21', elementID, height);
  958. generarImagen('http://i.imgur.com/aaPvRo4.gif', 'aIcono23', elementID, height);
  959. generarImagen('http://i.imgur.com/KKx3thu.gif', 'aIcono25', elementID, height);
  960. generarImagen('http://i.imgur.com/KnhAURP.gif', 'aIcono27', elementID, height);
  961. generarImagen('http://i.imgur.com/NA84WqF.gif', 'aIcono28', elementID, height);
  962. generarImagen('http://i.imgur.com/N2cdFNy.gif', 'aIcono29', elementID, height);
  963. generarImagen('http://i.imgur.com/oQYWBTO.gif', 'aIcono30', elementID, height);
  964. generarImagen('http://i.imgur.com/YWe8hno.gif', 'aIcono31', elementID, height);
  965. generarImagen('http://i.imgur.com/8t9ZJse.gif', 'aIcono22', elementID, height);
  966. generarImagen('http://i.imgur.com/av8bxvU.gif', 'aIcono32', elementID, height);
  967. generarImagen('http://i.imgur.com/Q3B4Dqz.gif', 'aIcono15', elementID, height);
  968. generarImagen('http://i.imgur.com/vWFv3Gt.gif', 'aIcono16', elementID, height);
  969. insertarSelect(elementID);
  970. }
  971. }
  972. function atajoExtInt(urlImagen, urlPagina, titleImg) {
  973. var ad = document.createElement('a');
  974. ad.setAttribute('href', urlPagina);
  975. ad.setAttribute('style', 'text-decoration:none; margin-bottom:0;margin-left:4px');
  976. ad.innerHTML = '<img src=\"' + urlImagen + '\" title=\"' + titleImg + '\" border=\"0\">\n';
  977. var ins = document.getElementById('contentDiv');
  978. ins.parentNode.insertBefore(ad, ins);
  979. }
  980. function atajoForo(urlImagen, urlPagina, text, titleImg, created) {
  981. if (!created) {
  982. var divC = document.createElement('div');
  983. divC.setAttribute('class', 'fbtn');
  984. divC.setAttribute('id', 'fbtn');
  985. document.getElementById('notifications-wrapper').appendChild(divC);
  986. created = 1;
  987. }
  988. //var ad = document.createElement('a');
  989. // ad.setAttribute('href', '?' + urlPagina);
  990. //ad.innerHTML = '<img src=\"' + urlImagen + '\" title=\"' + titleImg + '\" border=\"0\">';
  991. var html = '<a class="quicklink" href="?'+urlPagina+'" title="'+titleImg+'" target="_blank">'+text+'</a>';
  992. $('#fbtn').append(html);
  993. }
  994. var url = window.location.href.split('=');
  995. var setterBC;
  996. if (url[1] == "guestbook&uid" || url[1] == "guestbook" || url[1] == "friendlyseries&sub") {
  997. if (url[1] != "friendlyseries&sub") {
  998. armaPanel('writeform');
  999. } else {
  1000. $("#ui-id-5").click(function () {
  1001. setterBC = setInterval(function () {
  1002. armaPanel('writeform');
  1003. }, 1000);
  1004. });
  1005. }
  1006. }
  1007. function transformar(dato) {
  1008. switch (dato) {
  1009. case '0':
  1010. pelota = "http://static.managerzone.com/nocache-76/img/soccer/wlevel_0.gif";
  1011. break;
  1012. case '1':
  1013. pelota = "http://static.managerzone.com/nocache-76/img/soccer/wlevel_1.gif";
  1014. break;
  1015. case '2':
  1016. pelota = "http://static.managerzone.com/nocache-76/img/soccer/wlevel_2.gif";
  1017. break;
  1018. case '3':
  1019. pelota = "http://static.managerzone.com/nocache-76/img/soccer/wlevel_3.gif";
  1020. break;
  1021. case '4':
  1022. pelota = "http://static.managerzone.com/nocache-76/img/soccer/wlevel_4.gif";
  1023. break;
  1024. case '5':
  1025. pelota = "http://static.managerzone.com/nocache-76/img/soccer/wlevel_5.gif";
  1026. break;
  1027. case '6':
  1028. pelota = "http://static.managerzone.com/nocache-76/img/soccer/wlevel_6.gif";
  1029. break;
  1030. case '7':
  1031. pelota = "http://static.managerzone.com/nocache-76/img/soccer/wlevel_7.gif";
  1032. break;
  1033. case '8':
  1034. pelota = "http://static.managerzone.com/nocache-76/img/soccer/wlevel_8.gif";
  1035. break;
  1036. case '9':
  1037. pelota = "http://static.managerzone.com/nocache-76/img/soccer/wlevel_9.gif";
  1038. break;
  1039. case '10':
  1040. pelota = "http://static.managerzone.com/nocache-76/img/soccer/wlevel_10.gif";
  1041. break;
  1042. }
  1043. return pelota;
  1044. }
  1045. var url = window.location.href.split('&');
  1046. var control = window.location.href.split('=');
  1047. var configAlt = localStorage.getItem("configAlt");
  1048. if (url[1] == "sub=alt" && control[2] == "alt") {
  1049. try {
  1050. $(document).ready(function () {
  1051. var flag = 0;
  1052. $(".leftnav").parent().after("<div style='color:#FFF;width:158px;height: 20px;border: 1px solid white; margin-top:10px; padding: 6px 0 0 5px;font-weight:bold' class='cursor' id='configBox'><span style='line-height:16px'>Configuración</span> <img src='http://i.imgur.com/pQqMK52.png' style='vertical-align: middle;float:right;padding-right:3px' /></div>");
  1053. $("#configBox").after("<div style='color:#FFF; text-align:center; margin-top: 10px;font-weight:bold' class='divHidden' id='configBoxFull'>Mostrar skiller/share <br /> Sí <input type='radio' value='1' name='configOpt' /> No <input type='radio' value='0' name='configOpt' /><br /><div class='mzbtn buttondiv button_account' style='margin-top:8px;box-shadow:none!important'><span class='buttonClassMiddle'><span id='saveConfig' style='white-space: nowrap'>Guardar</span></span><span class='buttonClassRight'>&nbsp;</span></div><br /><span style='font-style:italic;font-size:11px;float:right;font-weight:normal;margin-top:5px'>MZScript ©</span></div>");
  1054. $("#configBox").bind("click", function () {
  1055. collapseExpand("configBoxFull");
  1056. if (!flag) {
  1057. $("#configBox img").attr('src', 'http://i.imgur.com/j07tHtg.png');
  1058. flag = 1;
  1059. } else {
  1060. $("#configBox img").attr('src', 'http://i.imgur.com/pQqMK52.png');
  1061. flag = 0;
  1062. }
  1063. });
  1064. $("#saveConfig").click(saveConfig);
  1065. function saveConfig() {
  1066. var option = $("input[type='radio']:checked").val();
  1067. if (typeof option != "undefined") {
  1068. localStorage.setItem('configAlt', option);
  1069. alert("La configuración ha sido guardada");
  1070. }
  1071. }
  1072. });
  1073. } catch (e) {
  1074. }
  1075. if (configAlt == 1 || configAlt == null) {
  1076. var nocm = document.getElementById("skyscraper");
  1077. var htmlCountPost, tablaDeJugadores;
  1078. if (nocm) {
  1079. htmlCountPost = document.evaluate('/html/body/div[3]/div/div[5]/div[2]/div[2]/div/div[2]/table/tbody', document, null, XPathResult.ANY_TYPE, null);
  1080. tablaDeJugadores = htmlCountPost.iterateNext();
  1081. } else {
  1082. htmlCountPost = document.evaluate('/html/body/div[3]/div/div[3]/div[2]/div[2]/div/div[2]/table/tbody', document, null, XPathResult.ANY_TYPE, null);
  1083. tablaDeJugadores = htmlCountPost.iterateNext();
  1084. }
  1085. var tdjP = tablaDeJugadores.rows.length;
  1086. for (jugador = 0; jugador < tdjP; jugador++) {
  1087. var celda = tablaDeJugadores.rows[jugador].cells[0].innerHTML;
  1088. var celdaF = tablaDeJugadores.rows[jugador].cells[1].innerHTML;
  1089. var numJug = tablaDeJugadores.rows[jugador].cells[0].innerHTML;
  1090. var nombreJug = tablaDeJugadores.rows[jugador].cells[1].childNodes[0].text;
  1091. var nombre = nombreJug.replace(/\s+/g, '%20');
  1092. var valorJug = tablaDeJugadores.rows[jugador].cells[2].innerHTML;
  1093. var sueldoJug = tablaDeJugadores.rows[jugador].cells[3].innerHTML;
  1094. var edadJug = tablaDeJugadores.rows[jugador].cells[4].innerHTML;
  1095. var season = tablaDeJugadores.rows[jugador].cells[5].innerHTML;
  1096. var altura = tablaDeJugadores.rows[jugador].cells[6].innerHTML;
  1097. var peso = tablaDeJugadores.rows[jugador].cells[7].innerHTML;
  1098. var vel = tablaDeJugadores.rows[jugador].cells[8].innerHTML;
  1099. var res = tablaDeJugadores.rows[jugador].cells[9].innerHTML;
  1100. var intel = tablaDeJugadores.rows[jugador].cells[10].innerHTML;
  1101. var pases = tablaDeJugadores.rows[jugador].cells[11].innerHTML;
  1102. var rem = tablaDeJugadores.rows[jugador].cells[12].innerHTML;
  1103. var cab = tablaDeJugadores.rows[jugador].cells[13].innerHTML;
  1104. var atajar = tablaDeJugadores.rows[jugador].cells[14].innerHTML;
  1105. var ctrl = tablaDeJugadores.rows[jugador].cells[15].innerHTML;
  1106. var ent = tablaDeJugadores.rows[jugador].cells[16].innerHTML;
  1107. var cruces = tablaDeJugadores.rows[jugador].cells[17].innerHTML;
  1108. var bp = tablaDeJugadores.rows[jugador].cells[18].innerHTML;
  1109. var expp = tablaDeJugadores.rows[jugador].cells[19].innerHTML;
  1110. var edof = tablaDeJugadores.rows[jugador].cells[20].innerHTML;
  1111. var nuevo = "&nbsp;<a class='ctooltip'><img src='http://i.imgur.com/xrFgj2d.png' style='cursor:pointer'><span><table cellpadding='0' cellspacing='0' style='width:300px'><tr><td width='290' colspan='2' style='font-weight: bold;color:#000060'>(" + numJug + ") " + nombreJug + "</td></tr><tr><td width='120'><b>Valor: </b>" + valorJug + "</td><td width='170'><b>Sueldo: </b>" + sueldoJug + "</td></tr><tr><td><b>Edad: </b>" + edadJug + "</td><td><b>Nacido Temp.: </b>" + season + "</td></tr><tr><td><b>Altura: </b>" + altura + "</td><td><b>Peso: </b>" + peso + "</td></tr><tr><td align='right' colspan='2'><i>MZScript ©</i></td></tr><tr><td width='170'><b>Velocidad </b></td><td><img src='" + transformar(vel) + "'> (" + vel + ")</td></tr><tr><td><b>Resistencia </b></td><td><img src='" + transformar(res) + "'> (" + res + ")</td></tr><tr><td><b>Inteligencia </b></td><td><img src='" + transformar(intel) + "'> (" + intel + ")</td></tr><tr><td><b>Pases </b></td><td><img src='" + transformar(pases) + "'> (" + pases + ")</td></tr><tr><td><b>Remates </b></td><td><img src='" + transformar(rem) + "'> (" + rem + ")</td></tr><tr><td><b>Cabeza </b></td><td><img src='" + transformar(cab) + "'> (" + cab + ")</td></tr><tr><td><b>Atajar </b></td><td><img src='" + transformar(atajar) + "'> (" + atajar + ")</td></tr><tr><td><b>Control </b></td><td><img src='" + transformar(ctrl) + "'> (" + ctrl + ")</td></tr><tr><td><b>Entradas </b></td><td><img src='" + transformar(ent) + "'> (" + ent + ")</td></tr><tr><td><b>Pases largos </b></td><td><img src='" + transformar(cruces) + "'> (" + cruces + ")</td></tr><tr><td><b>Balon parado </b></td><td><img src='" + transformar(bp) + "'> (" + bp + ")</td></tr><tr><td><b>Experiencia </b></td><td><img src='" + transformar(expp) + "'> (" + expp + ")</td></tr><tr><td><b>Edo. fisico </b></td><td><img src='" + transformar(edof) + "'> (" + edof + ")</td></tr></table></span></a>";
  1112. var compartir = "&nbsp;<a class='ctooltip2' title='Compartir en el foro y GB' style='text-decoration:none;'><img src='http://i.imgur.com/VmoSCYv.png' id='imagenRoja" + jugador + "'style='cursor:pointer'><span id='info" + jugador + "' style='background-color:#000;position:absolute;z-index:100;width:300px' class='divHidden'><table cellpadding='10' cellspacing='0' style='width:300px;table-layout:fixed;box-sizing:border-box'><tr><td style='color:#FFF!important'><b>Código para Foro/GB (CM)</b> <img src='http://i.imgur.com/BzYADnz.png' id='imagenCierre" + jugador + "' style='cursor:pointer; float:right' title='Cerrar'></td></tr><tr><td style='color:#FFF!important;font-style:italic;word-wrap:break-word'>[image url=http://www.mzplus.info/pimg?nombre=%20" + nombre + "%20%20&edad=" + edadJug + "&num=" + numJug + "&skills=" + vel + "," + res + "," + intel + "," + pases + "," + rem + "," + cab + "," + atajar + "," + ctrl + "," + ent + "," + cruces + "," + bp + "," + expp + "," + edof + "&lang=es]</td></tr><tr><td style='color:#FFF!important'><br /><b>Código para Foro/GB (No CM)</b></td></tr><tr><td style='color:#FFF!important;font-style:italic'>[table][tr][th]" + nombreJug + "[/th][th]Edad " + edadJug + "[/th][/tr][tr][th]Velocidad [/th][th](" + vel + ")[/th][/tr][tr][th]Resistencia [/th][th](" + res + ")[/th][/tr][tr][th]Inteligencia [/th][th](" + intel + ")[/th][/tr][tr][th]Pases [/th][th](" + pases + ")[/th][/tr][tr][th]Remates [/th][th](" + rem + ")[/th][/tr][tr][th]Cabezazos [/th][th](" + cab + ")[/th][/tr][tr][th]Atajar [/th][th](" + atajar + ")[/th][/tr][tr][th]Control [/th][th](" + ctrl + ")[/th][/tr][tr][th]Entradas [/th][th](" + ent + "[/th][/tr][tr][th]Pases largos [/th][th](" + cruces + ")[/th][/tr][tr][th]Balón parado [/th][th](" + bp + "[/th][/tr][tr][th]Experiencia [/th][th](" + expp + ")[/th][/tr][tr][th]Estado físico [/th][th](" + edof + ")[/th][/tr][/table]</td></tr></table></span></a>";
  1113. tablaDeJugadores.rows[jugador].cells[0].innerHTML = celda + nuevo;
  1114. tablaDeJugadores.rows[jugador].cells[1].innerHTML = celdaF + compartir;
  1115. var aniadoId1 = document.getElementById("imagenRoja" + jugador);
  1116. aniadoId1.addEventListener("click", function () {
  1117. collapseExpand(this.parentNode.childNodes[1].id)
  1118. }, false);
  1119. var aniadoId2 = document.getElementById("imagenCierre" + jugador);
  1120. aniadoId2.addEventListener("click", function () {
  1121. collapseExpand(this.parentNode.parentNode.parentNode.parentNode.parentNode.id)
  1122. }, false);
  1123. }
  1124. }
  1125. }
  1126. function calculando35(nrodecaso) {
  1127. if (nrodecaso == '1') {
  1128. $("#cuadro1, #cuadro2, #cuadro5, #cuadro8").css('display', 'none');
  1129. $("#cuadro3, #cuadro4, #cuadro6, #cuadro7, #cuadro10,#cuadro11").css('display', 'block');
  1130. } else if (nrodecaso == '2') {
  1131. $("#cuadro3, #cuadro5").css('display', 'none');
  1132. $("#cuadro1, #cuadro2, #cuadro6, #cuadro7,#cuadro10,#cuadro4, #cuadro8,#cuadro11").css('display', 'block');
  1133. } else if (nrodecaso == '3') {
  1134. $("#cuadro1, #cuadro2, #cuadro8").css('display', 'none');
  1135. $("#cuadro6, #cuadro7,#cuadro10,#cuadro5,#cuadro3,#cuadro4,#cuadro11").css('display', 'block');
  1136. }
  1137. }
  1138. function calculando3(obj) {
  1139. var f = document.forms[obj]
  1140. var valorVenta = f.elements["vventa"].value.replace(/[^0-9]/g, "");
  1141. var valorMz = f.elements["vMz"].value.replace(/[^0-9]/g, "");
  1142. var impuesto, porcentaje;
  1143. var ganancia = valorVenta - valorMz;
  1144. var chequeado1 = document.getElementById('cel1').checked;
  1145. var chequeado2 = document.getElementById('cel2').checked;
  1146. var chequeado3 = document.getElementById('cel3').checked;
  1147. if (!chequeado1 && !chequeado2 && !chequeado3) {
  1148. alert("Error. Elija una opción.");
  1149. return false;
  1150. }
  1151. function fechaDif(diaVenta, mesVenta, anioVenta, diaCompra, mesCompra, anioCompra) {
  1152. mesVenta = mesVenta - 1;
  1153. mesCompra = mesCompra - 1;
  1154. var msecPerDay = 86400000;
  1155. var fechaVenta = new Date(anioVenta, mesVenta, diaVenta);
  1156. var fechaCompra = new Date(anioCompra, mesCompra, diaCompra);
  1157. fechaCompra = fechaCompra.getTime() / msecPerDay;
  1158. fechaVenta = fechaVenta.getTime() / msecPerDay;
  1159. var tot = fechaVenta - fechaCompra;
  1160. if (tot < 0) {
  1161. alert("Error con las fechas");
  1162. return -1;
  1163. }
  1164. return tot;
  1165. }
  1166. var cSigla = localStorage.getItem('sigla');
  1167. if (!cSigla)
  1168. cSigla = "USD";
  1169. if (chequeado1) {
  1170. if (valorVenta == null || valorVenta == "" || valorMz == null || valorMz == "") {
  1171. alert("Error. Debe completar todos los campos.");
  1172. return false;
  1173. }
  1174. if (ganancia > 0) {
  1175. porcentaje = "15%";
  1176. impuesto = Math.round((ganancia * 15) / 100);
  1177. rganancia = Math.round(valorVenta - impuesto);
  1178. rganancia = puntosMiles(rganancia) + " " + cSigla;
  1179. } else {
  1180. porcentaje = "-";
  1181. impuesto = "-";
  1182. rganancia = "No hay ganancia con esta venta, por lo que no aplica impuestos.";
  1183. }
  1184. } else if (chequeado2) {
  1185. var fechaCompra = f.elements["fcompra"].value;
  1186. var fechaVenta = f.elements["fventa"].value;
  1187. var valorCompra = f.elements["vcompra"].value.replace(/[^0-9]/g, "");
  1188.  
  1189. var partida = fechaCompra.split('-');
  1190. var diaCompra = partida[0];
  1191. var mesCompra = partida[1];
  1192. var anioCompra = partida[2];
  1193. var partida2 = fechaVenta.split('-');
  1194. var diaVenta = partida2[0];
  1195. var mesVenta = partida2[1];
  1196. var anioVenta = partida2[2];
  1197.  
  1198. if (valorVenta == null || valorVenta == "" || valorCompra == null || valorCompra == "" || fechaCompra == null || fechaCompra == "" || fechaVenta == null || fechaVenta == "") {
  1199. alert("Error. Debe completar todos los campos.");
  1200. return false;
  1201. }
  1202. var diferencia = fechaDif(diaVenta, mesVenta, anioVenta, diaCompra, mesCompra, anioCompra);
  1203. if (diferencia < 0)
  1204. return false;
  1205. ganancia = valorVenta - valorCompra;
  1206. if (ganancia > 0 && diferencia >= 71) {
  1207. porcentaje = "15%";
  1208. impuesto = Math.round((ganancia * 15) / 100);
  1209. rganancia = Math.round(valorVenta - impuesto);
  1210. rganancia = puntosMiles(rganancia) + " " + cSigla;
  1211. } else if (ganancia > 0 && diferencia >= 28 && diferencia <= 70) {
  1212. porcentaje = "50%";
  1213. impuesto = Math.round((ganancia * 50) / 100);
  1214. rganancia = Math.round(valorVenta - impuesto);
  1215. rganancia = puntosMiles(rganancia) + " " + cSigla;
  1216. } else if (ganancia > 0 && diferencia >= 0 && diferencia <= 27) {
  1217. porcentaje = "95%";
  1218. impuesto = Math.round((ganancia * 95) / 100);
  1219. rganancia = Math.round(parseInt(valorVenta - impuesto));
  1220. rganancia = puntosMiles(rganancia) + " " + cSigla;
  1221. } else if (ganancia <= 0) {
  1222. porcentaje = "-";
  1223. impuesto = "-";
  1224. rganancia = "No hay ganancia con esta venta, por lo que no aplica impuestos.";
  1225. }
  1226. } else if (chequeado3) {
  1227. var edad = f.elements["jEdad"].value;
  1228. if (valorVenta == null || valorVenta == "" || valorMz == null || valorMz == "" || edad == null || edad == "") {
  1229. alert("Error. Debe completar todos los campos.");
  1230. return false;
  1231. }
  1232. if (ganancia > 0 && edad == 19) {
  1233. porcentaje = "25%";
  1234. impuesto = Math.round((ganancia * 25) / 100);
  1235. rganancia = Math.round(valorVenta - impuesto);
  1236. rganancia = puntosMiles(rganancia) + " " + cSigla;
  1237. } else if (ganancia > 0 && edad == 20) {
  1238. porcentaje = "20%";
  1239. impuesto = Math.round((ganancia * 20) / 100);
  1240. rganancia = Math.round(valorVenta - impuesto);
  1241. rganancia = puntosMiles(rganancia) + " " + cSigla;
  1242. } else if (ganancia > 0 && edad >= 21) {
  1243. porcentaje = "15%";
  1244. impuesto = Math.round((ganancia * 15) / 100);
  1245. rganancia = Math.round(valorVenta - impuesto);
  1246. rganancia = puntosMiles(rganancia) + " " + cSigla;
  1247. } else if (edad <= 18) {
  1248. porcentaje = "-";
  1249. impuesto = "-";
  1250. rganancia = "No se puede vender, es juvenil";
  1251. } else {
  1252. porcentaje = "-";
  1253. impuesto = "-";
  1254. rganancia = "No hay ganancia con esta venta, por lo que no aplica impuestos.";
  1255. }
  1256. }
  1257. f.elements["cimpuestos"].value = puntosMiles(impuesto) + " " + cSigla;
  1258. f.elements["cimpuestosP"].value = porcentaje;
  1259. document.getElementById("cganancia").innerHTML = rganancia;
  1260. $("#cuadro9, #cganancia").css('display', 'block');
  1261. return true;
  1262. }
  1263. function soloNumeros(valor) {
  1264. var numeric = /^[0-9]*$/;
  1265. valor.value = valor.value.replace(/[^0-9]/g, "");
  1266. }
  1267. function resetImpuestos() {
  1268. document.getElementById("fimpuestos").reset();
  1269. $("#cuadro9, #cganancia").css('display', 'none');
  1270. }
  1271. function mostrando() {
  1272. var exist = document.getElementById("contImpuestos");
  1273. if (exist) {
  1274. collapseExpand("contImpuestos");
  1275. return false;
  1276. }
  1277. var div = document.createElement('div')
  1278. div.setAttribute("id", "contImpuestos");
  1279. div.setAttribute("class", "divVisible");
  1280. div.setAttribute("style", "background-color:#000");
  1281. var contenido = '<div style="color:#FFF;font-weight:bold;padding: 10px 0 0 5px;margin-bottom:10px">Calcular Impuestos <img src="http://i.imgur.com/BzYADnz.png" id="imagenCer" style="cursor:pointer;vertical-align:middle;float:right;padding-right:5px" title="Cerrar"></div>';
  1282. contenido += '<form name="fimpuestos" id="fimpuestos">';
  1283. contenido += '<table class="impTabla" style="width:100%;padding:0 0 0 5px"><tr><td>Jugador del club</td><td> <input type="radio" name="taxes" value="1" id="cel1"></td></tr> ';
  1284. contenido += '<tr><td>Jugador comprado </td><td><input type="radio" name="taxes" value="2" id="cel2"> </td></tr> ';
  1285. contenido += '<tr><td>Ex-juvenil </td><td><input type="radio" name="taxes" value="3" id="cel3"> </td></tr></table>';
  1286. contenido += '<div id="cuadro1" class="cuadros">Valor Compra<br /> ';
  1287. contenido += '<input id="vcompra" type="text" value="" name="vcompra"></div>';
  1288. contenido += '<div id="cuadro3" class="cuadros">Valor MZ<br /> ';
  1289. contenido += '<input id="vMz" type="text" value="" name="vMz" ></div>';
  1290. contenido += '<div id="cuadro4" class="cuadros">Valor Venta<br /> ';
  1291. contenido += '<input id="vventa" type="text" value="" name="vventa"></div>';
  1292. contenido += '<div id="cuadro2" class="cuadros">Fecha Compra<br /> ';
  1293. contenido += '<input type="text" placeholder="dd-mm-aaaa" value="" name="fcompra"></div>';
  1294. contenido += '<div id="cuadro8" class="cuadros">Fecha Venta<br />';
  1295. contenido += '<input type="text" placeholder="dd-mm-aaaa" value="" name="fventa"></div>';
  1296. contenido += '<div id="cuadro5" class="cuadros">Edad<br /> ';
  1297. contenido += '<input id="jEdad" type="text" name="jEdad"></div>';
  1298. contenido += '<div id="cuadro10" class="cuadros">Impuestos <i>(%)</i><br />';
  1299. contenido += '<input name="cimpuestosP" type="text" disabled=""></div>';
  1300. contenido += '<div id="cuadro6" class="cuadros">Impuestos <i>($)</i><br /> ';
  1301. contenido += '<input name="cimpuestos" disabled=""></div>';
  1302. contenido += '<div id="cuadro9" class="cuadros" style="display:none;font-weight:bold">Ingreso final</div> ';
  1303. contenido += '<div id="cganancia" style="color: #000;background-color: #FFF;margin:8px 8px 0;width:132px;padding:5px;text-align:center;font-weight:bold;display:none"></div></div><br />';
  1304. contenido += "<div style='padding:0 12px'><div id='cuadro7' style='display:none;text-align:center;float:left'><div class='mzbtn buttondiv button_account' style='margin-top:8px;box-shadow:none!important'><span class='buttonClassMiddle'><span id='cBoton' style='white-space: nowrap'>Calcular</span></span><span class='buttonClassRight'>&nbsp;</span></div></div></form>";
  1305. contenido += "<div id='cuadro11' style='display:none;text-align:center'><div class='mzbtn buttondiv button_account' style='margin-top:8px;box-shadow:none!important'><span class='buttonClassMiddle'><span id='resetBtn' style='white-space: nowrap'>Reset</span></span><span class='buttonClassRight'>&nbsp;</span></div></div></div></form>";
  1306. contenido += "<span style='font-style:italic;font-size:11px;float:right;color:#FFF;clear:both;background-color:#000'>MZScript ©</span>";
  1307. div.innerHTML = contenido;
  1308. var ins = document.getElementById("contentDiv").childNodes[1].childNodes[1];
  1309. ins.appendChild(div);
  1310. var aniadoId1 = document.getElementById("cel1");
  1311. aniadoId1.addEventListener("click", function () {
  1312. calculando35(1)
  1313. }, false);
  1314. var aniadoId2 = document.getElementById("cel2");
  1315. aniadoId2.addEventListener("click", function () {
  1316. calculando35(2)
  1317. }, false);
  1318. var aniadoId4 = document.getElementById("cel3");
  1319. aniadoId4.addEventListener("click", function () {
  1320. calculando35(3)
  1321. }, false);
  1322. var aniadoId3 = document.getElementById("resetBtn");
  1323. aniadoId3.addEventListener("click", function () {
  1324. resetImpuestos()
  1325. }, false);
  1326. var aniadoId8 = document.getElementById("cBoton");
  1327. aniadoId8.addEventListener("click", function () {
  1328. calculando3("fimpuestos")
  1329. }, false);
  1330. var aniadoId5 = document.getElementById("vcompra");
  1331. aniadoId5.addEventListener("keyup", function () {
  1332. soloNumeros(this)
  1333. }, false);
  1334. var aniadoId6 = document.getElementById("vventa");
  1335. aniadoId6.addEventListener("keyup", function () {
  1336. soloNumeros(this)
  1337. }, false);
  1338. var aniadoId7 = document.getElementById("vMz");
  1339. aniadoId7.addEventListener("keyup", function () {
  1340. soloNumeros(this)
  1341. }, false);
  1342. }
  1343. var url = window.location.href.split('=');
  1344. if (url[1] == "players&pid") {
  1345. var contenedor = document.getElementById("thePlayers_0").childNodes[1].childNodes[1].childNodes[1].childNodes[5];
  1346. var btnImpuestos = document.createElement('a');
  1347. btnImpuestos.setAttribute("class", "mzbtn buttondiv button_blue");
  1348. btnImpuestos.innerHTML = '<span class="buttonClassMiddle"><span style="white-space: nowrap; cursor:pointer" id="imagenRed">Impuestos</span></span><span class="buttonClassRight">&nbsp;</span>';
  1349. contenedor.appendChild(btnImpuestos);
  1350. }
  1351. function botones(filaNueva) {
  1352. //var botones = '<td>CC-Bar</td><td>';
  1353. var botones = "<div class='mzbtn buttondiv button_account' title='Insertar Tabla LA-liga'><span class='buttonClassMiddle'><span style='white-space: nowrap' id='btnTabla'>Tabla LA/liga</span></span><span class='buttonClassRight'>&nbsp;</span></div>&nbsp;";
  1354. botones += "<div class='mzbtn buttondiv button_account' title='Subir imágenes a ImgUr'><span class='buttonClassMiddle'><span style='white-space: nowrap' id='upImg'>ImgUr</span></span><span class='buttonClassRight'>&nbsp;</span></div>&nbsp;&nbsp;";
  1355. botones += "<img src='http://i.imgur.com/3YitWv3.gif' alt='>' id='icono25'/>&nbsp;";
  1356. botones += "<img src='http://i.imgur.com/Q3B4Dqz.gif' title='(y)' alt='(y)' id='icono31'/>&nbsp;";
  1357. botones += "<img src='http://i.imgur.com/vWFv3Gt.gif' title='(n)' alt='(n)' id='icono32'/>&nbsp;";
  1358. botones += "<img src='http://i.imgur.com/jaT1cb4.gif' height='20px' title='wtf' alt='wtf' id='icono51'/>&nbsp;";
  1359. botones += "<img src='http://i.imgur.com/VfbyDHO.gif' height='20px' title='fail' alt='fail' id='icono44'/>&nbsp;";
  1360. botones += "<img src='http://i.imgur.com/cheJFuk.gif' height='20px' title='repost' alt='repost' id='icono45'/>&nbsp;";
  1361. botones += "<img src='http://i.imgur.com/jDjyKTf.gif' title='cri' alt='cri' id='icono52'/>&nbsp;";
  1362. botones += "<img src='http://i.imgur.com/6PopX5q.gif' title='ha-ha' alt='ha-ha' id='icono7'/>";
  1363. botones += "<img src='http://i.imgur.com/nRp5BpE.gif' title=':)' alt=':)' id='icono1'/>&nbsp;";
  1364. botones += "<img src='http://i.imgur.com/CcuKTNz.gif' title=':D' alt=':D' id='icono2'/>&nbsp;";
  1365. botones += "<img src='http://i.imgur.com/Dfl5ZGS.gif' title='D' alt='D' id='icono53'/>&nbsp;";
  1366. botones += "<img src='http://i.imgur.com/8t9ZJse.gif' title='xD' alt='xD' id='icono4'/>&nbsp;";
  1367. botones += "<img src='http://i.imgur.com/1kJhHCs.gif' title=':/' alt=':/' id='icono46'/>&nbsp;";
  1368. botones += "<img src='http://i.imgur.com/1ncAraF.gif' title=':(' alt=':(' id='icono5'/>&nbsp;";
  1369. botones += "<img src='http://i.imgur.com/xp6xUJJ.gif' title=':*(' alt=':*(' id='icono6'/>&nbsp;";
  1370. botones += "<img src='http://i.imgur.com/qOigaWi.png' title=':S' alt=':S' id='icono8'/>&nbsp;";
  1371. botones += "<img src='http://i.imgur.com/nITjZn5.gif' title='erm' alt='erm' id='icono9'/>&nbsp;";
  1372. botones += "<img src='http://i.imgur.com/rSqmTPO.gif' title='8-)' alt='8-)' id='icono10'/>&nbsp;";
  1373. botones += "<img src='http://i.imgur.com/qP1rAQ5.png' title='¬¬' alt='¬¬' id='icono11'/>&nbsp;";
  1374. botones += "<img src='http://i.imgur.com/HdNdWN0.png' title='porfi' alt='porfi' id='icono14'/>&nbsp;";
  1375. botones += "<img src='http://i.imgur.com/QuXS7fE.gif' title='O.O' alt='O.O' id='icono13'/>&nbsp;";
  1376. botones += "<img src='http://i.imgur.com/RUQN2Hy.gif' title='_hm' alt='_hm' id='icono50'/>&nbsp;";
  1377. botones += "<img src='http://i.imgur.com/QLCdFIE.gif' title='>:(' alt='>:(' id='icono15'/>&nbsp;";
  1378. botones += "<img src='http://i.imgur.com/55sAO1r.gif' title='>:)' alt='>:)' id='icono16'/>&nbsp;";
  1379. botones += "<img src='http://i.imgur.com/KbQOSgw.gif' title='flirt' alt='flirt' id='icono17'/>&nbsp;";
  1380. botones += "<img src='http://i.imgur.com/t5dALqK.gif' title=':P' alt=':P' id='icono18'/>&nbsp;";
  1381. botones += "<img src='http://i.imgur.com/zpY2A6I.gif' title='|-(' alt='|-(' id='icono19'/>&nbsp;";
  1382. botones += "<img src='http://i.imgur.com/yPtUjin.gif' title=';)' alt=';)' id='icono20'/>&nbsp;";
  1383. botones += "<img src='http://i.imgur.com/OOsLDaW.gif' title='(h)' alt='(h)' id='icono21'/>&nbsp;";
  1384. botones += "<img src='http://i.imgur.com/LdCQyai.png' title='u.u' alt='u.u' id='icono22'/>&nbsp;";
  1385. botones += "<img src='http://i.imgur.com/KnhAURP.gif' title='shh' alt='shh' id='icono26'/>&nbsp;";
  1386. botones += "<img src='http://i.imgur.com/BzPDfzF.gif' title='nana' alt='nana' id='icono28'/>";
  1387. botones += "<img src='http://i.imgur.com/XEHiXuO.gif' height='23px' title='rock' alt='rock' id='icono33'/>";
  1388. botones += "<img src='http://i.imgur.com/CsCrOnE.gif' title='grr' alt='grr' id='icono36'/>&nbsp;";
  1389. botones += "<img src='http://i.imgur.com/K2d1Mbv.gif' height='23px' title='jaja' alt='jaja' id='icono37'/>";
  1390. botones += "<img src='http://i.imgur.com/SMcjsnf.gif' title='eah' alt='eah' id='icono29'/>";
  1391. botones += "<img src='http://i.imgur.com/aaPvRo4.gif' title='clap' alt='clap' id='icono30'/>";
  1392. botones += "<img src='http://i.imgur.com/av8bxvU.gif' title='bla' alt='bla' id='icono38'/>";
  1393. botones += "<img src='http://i.imgur.com/oQYWBTO.gif' title='l' alt='l' id='icono39'/>&nbsp;";
  1394. botones += "<img src='http://i.imgur.com/z64hDgz.gif' title='grr' alt='grr' id='icono35'/>&nbsp;";
  1395. botones += "<img src='http://i.imgur.com/NA84WqF.gif' title='angel' alt='angel' id='icono40'/>&nbsp;";
  1396. botones += "<img src='http://i.imgur.com/N2cdFNy.gif' title='diablo' alt='diablo' id='icono41'/>&nbsp;";
  1397. botones += "<img src='http://i.imgur.com/YWe8hno.gif' title='baba' alt='baba' id='icono42'/>";
  1398. botones += "<img src='http://i.imgur.com/1t7YpCo.gif' height='23px' title='x)' alt='x)' id='icono43'/>&nbsp;";
  1399. botones += "<img src='http://i.imgur.com/UR5t0o6.gif' title='plz' alt='plz' id='icono3'/>&nbsp;";
  1400. botones += "<img src='http://i.imgur.com/KKx3thu.gif' title='umm' alt='umm' id='icono27'/>";
  1401. botones += "<img src='http://i.imgur.com/sC8Mgmi.gif' title='facepalm' alt='facepalm' id='icono54'/>&nbsp;";
  1402. botones += "<img src='http://i.imgur.com/gJw92DZ.gif' title='zzz' alt='zzz' id='icono48'/>";
  1403. botones += "<img src='http://i.imgur.com/RzjaSKr.gif' title='om' alt='om' id='icono34'/>";
  1404. botones += "<img src='http://i.imgur.com/7iCxtYD.gif' title='uh' alt='uh' id='icono47'/><br />";
  1405. botones += '<div id="contenedor" style="border: 5px solid green;font-weight:bold;display:none;width:430px; padding:5px;margin:auto">Arrastre su imagen a este espacio <button id="btnUpImg">O clickee acá para elegirla</button> <input style="visibility: collapse; width: 0px;" id="subidor" type="file">';
  1406. botones += '<p id="error" style="font-weight:bold;color:red">Error. El archivo seleccionado no es una imagen.</p><p id="pe">Cargando imagen <img src="http://managerzone.se/img/loading.gif"> &nbsp;espere por favor.</p><p id="link"></p></div>';
  1407. filaNueva.innerHTML = botones;
  1408. }
  1409. function addevents() {
  1410. document.getElementById("btnUpImg").addEventListener("click", preventDef, false);
  1411. document.getElementById("contenedor").addEventListener("dragover", preventDef, false);
  1412. document.getElementById("contenedor").addEventListener("drop", preventDef, false);
  1413. document.getElementById("contenedor").addEventListener("drop", preventDef2, false);
  1414. document.getElementById("btnUpImg").addEventListener("click", function () {
  1415. return document.getElementById('subidor').click()
  1416. }, false);
  1417. document.getElementById("subidor").addEventListener("change", function () {
  1418. return upload(this.files[0])
  1419. }, false);
  1420. }
  1421. var setter;
  1422. function addCCbar() {
  1423. var bbcodeContainer = $('.bbcode');
  1424. if (typeof bbcodeContainer !== 'undefined') {
  1425. clearInterval(setter);
  1426. var btnContainer = document.createElement("div");
  1427. botones(btnContainer);
  1428. $('.bbcode').before(btnContainer);
  1429. addevents();
  1430. }
  1431. return false;
  1432. }
  1433. function setCCbar() {
  1434. setter = setInterval(function () {
  1435. addCCbar();
  1436. }, 1000);
  1437. }
  1438. var url = window.location.href.split('&');
  1439. if (url[1] == "sub=topics") {
  1440. setCCbar();
  1441. var mostrarsi = localStorage.getItem('mostrar');
  1442. if (mostrarsi == 'true') {
  1443. document.getElementById('mostrarY').click();
  1444. var btnSend = document.getElementById("send_btn").childNodes[1];
  1445. btnSend.addEventListener("click", function () {
  1446. firmaFija()
  1447. }, false);
  1448. }
  1449. }
  1450. var url = window.location.href.split('&');
  1451. if (url[1] == "sub=topics") {
  1452. var link;
  1453. $("#topics-list dl.clearfix > dd").each(function (idx, elm) {
  1454. if (elm.className == 'topics-col-title') {
  1455. link = $(elm).find('a').attr('href');
  1456. }
  1457. if (elm.className == 'topics-col-counter') {
  1458. var counter = $(elm)[0];
  1459. $(counter).find("span").remove();
  1460. var cant_posts = $(counter).text();
  1461. var split = cant_posts.split('/');
  1462. var total_posts = parseInt(split[1]);
  1463. if ($.isNumeric(total_posts)) {
  1464. var cantidadDePaginas = Math.floor(parseInt(total_posts) / 50);
  1465. var nuevo = "";
  1466. if (cantidadDePaginas > 0 && total_posts != 50)
  1467. nuevo += "<a title='Ir a la página 2' href='" + link + "&offset=50'>2</a>&#160;"
  1468. if (cantidadDePaginas > 1 && total_posts != 100)
  1469. nuevo += "<a title='Ir a la página 3' href='" + link + "&offset=100'>3</a>&#160;"
  1470. if (cantidadDePaginas > 2 && total_posts != 150)
  1471. nuevo += "<a title='Ir a la página 4' href='" + link + "&offset=150'>4</a>&#160;"
  1472. if (cantidadDePaginas > 3) {
  1473. var offset;
  1474. if (total_posts % 50 == 0)
  1475. offset = total_posts - 50;
  1476. else
  1477. offset = cantidadDePaginas * 50;
  1478. nuevo += "<a title='Ir a la última página' href='" + link + "&offset=" + offset + "'>&#187;</a>"
  1479. }
  1480. if (cantidadDePaginas > 0 && total_posts != 50)
  1481. nuevo = "&#160;[" + nuevo + "]";
  1482. counter.innerHTML = counter.innerHTML + nuevo;
  1483. }
  1484. }
  1485. });
  1486. } else if (url[1] == "sub=topic") {
  1487. setCCbar();
  1488. $(".forum_content dl.hitlist_dl.forum_body").each(function (idx, elm) {
  1489. var $elm = $(elm);
  1490. var author = $elm.find('.post-author');
  1491. var $author = $(author);
  1492. var p_link_container = $author.find('a');
  1493. var id = p_link_container.attr('href').split("&")[1].replace("uid=", "");
  1494. var nombre = p_link_container.text();
  1495. var foro = url[3].replace("forum_id=", "");
  1496. var badge = $elm.find('.forum-post-badges');
  1497. var equipo = $(badge).find('img').attr('src').split("=")[1].replace("&sport", "");
  1498. var shortc = " <a title='GB de " + nombre + "' href='/?p=guestbook&uid=" + id + "' style='color:black;text-decoration:none;border:1px solid;'><b>&nbsp;GB&nbsp;</b></a>&nbsp;" + "&nbsp;<a title='Ver posts últimos 7 días de " + nombre + "' href='/index.php?p=forum&sub=search&search_keywords=&search_keyword_type=any&search_author=" + nombre + "&search_forum=" + foro + "&search_range=7&search_sort_by=post_date&search_sort_order=desc' style='color:black;text-decoration:none;border:1px solid;'><b>&nbsp;POST&nbsp;</b></a>&nbsp;" + "&nbsp;<a title='Enviar amistosos a " + nombre + "' href='/?p=team&sub=challenge&tid=" + equipo + "' style='color:black;text-decoration:none;border:1px solid;'><b>&nbsp;AMI&nbsp;</b></a>";
  1499. $author.append(shortc);
  1500. });
  1501. }
  1502. document.addEventListener("click", function (event) {
  1503. switch (event.target.id) {
  1504. case "mostrarTabla":
  1505. mostrarTabla('copa');
  1506. break;
  1507. case "mostrarTabla2":
  1508. mostrarTabla('nocopa');
  1509. break;
  1510. case "mostrarTabla3":
  1511. mostrarTabla('privada');
  1512. break;
  1513. case "cerrar":
  1514. collapseExpand("divTabla");
  1515. break;
  1516. case "btnTabla":
  1517. posteaTabla('message');
  1518. break;
  1519. case "btnTabla2":
  1520. posteaTabla('msg');
  1521. break;
  1522. case "icono1":
  1523. posteaIcono('http://i.imgur.com/nRp5BpE.gif', 'message');
  1524. break;
  1525. case "icono2":
  1526. posteaIcono('http://i.imgur.com/CcuKTNz.gif', 'message');
  1527. break;
  1528. case "icono3":
  1529. posteaIcono('http://i.imgur.com/UR5t0o6.gif', 'message');
  1530. break;
  1531. case "icono4":
  1532. posteaIcono('http://i.imgur.com/8t9ZJse.gif', 'message');
  1533. break;
  1534. case "icono5":
  1535. posteaIcono('http://i.imgur.com/1ncAraF.gif', 'message');
  1536. break;
  1537. case "icono6":
  1538. posteaIcono('http://i.imgur.com/xp6xUJJ.gif', 'message');
  1539. break;
  1540. case "icono7":
  1541. posteaIcono('http://i.imgur.com/6PopX5q.gif', 'message');
  1542. break;
  1543. case "icono8":
  1544. posteaIcono('http://i.imgur.com/qOigaWi.png', 'message');
  1545. break;
  1546. case "icono9":
  1547. posteaIcono('http://i.imgur.com/nITjZn5.gif', 'message');
  1548. break;
  1549. case "icono10":
  1550. posteaIcono('http://i.imgur.com/rSqmTPO.gif', 'message');
  1551. break;
  1552. case "icono11":
  1553. posteaIcono('http://i.imgur.com/qP1rAQ5.png', 'message');
  1554. break;
  1555. case "icono12":
  1556. posteaIcono('http://i.imgur.com/j79wNCf.gif', 'message');
  1557. break;
  1558. case "icono13":
  1559. posteaIcono('http://i.imgur.com/QuXS7fE.gif', 'message');
  1560. break;
  1561. case "icono14":
  1562. posteaIcono('http://i.imgur.com/HdNdWN0.png', 'message');
  1563. break;
  1564. case "icono15":
  1565. posteaIcono('http://i.imgur.com/lbQHCKk.gif', 'message');
  1566. break;
  1567. case "icono16":
  1568. posteaIcono('http://i.imgur.com/55sAO1r.gif', 'message');
  1569. break;
  1570. case "icono17":
  1571. posteaIcono('http://i.imgur.com/KbQOSgw.gif', 'message');
  1572. break;
  1573. case "icono18":
  1574. posteaIcono('http://i.imgur.com/t5dALqK.gif', 'message');
  1575. break;
  1576. case "icono19":
  1577. posteaIcono('http://i.imgur.com/zpY2A6I.gif', 'message');
  1578. break;
  1579. case "icono20":
  1580. posteaIcono('http://i.imgur.com/yPtUjin.gif', 'message');
  1581. break;
  1582. case "icono21":
  1583. posteaIcono('http://i.imgur.com/OOsLDaW.gif', 'message');
  1584. break;
  1585. case "icono22":
  1586. posteaIcono('http://i.imgur.com/LdCQyai.png', 'message');
  1587. break;
  1588. case "icono25":
  1589. posteaIcono('http://i.imgur.com/3YitWv3.gif', 'message');
  1590. break;
  1591. case "icono26":
  1592. posteaIcono('http://i.imgur.com/KnhAURP.gif', 'message');
  1593. break;
  1594. case "icono27":
  1595. posteaIcono('http://i.imgur.com/KKx3thu.gif', 'message');
  1596. break;
  1597. case "icono28":
  1598. posteaIcono('http://i.imgur.com/BzPDfzF.gif', 'message');
  1599. break;
  1600. case "icono29":
  1601. posteaIcono('http://i.imgur.com/SMcjsnf.gif', 'message');
  1602. break;
  1603. case "icono30":
  1604. posteaIcono('http://i.imgur.com/aaPvRo4.gif', 'message');
  1605. break;
  1606. case "icono31":
  1607. posteaIcono('http://i.imgur.com/Q3B4Dqz.gif', 'message');
  1608. break;
  1609. case "icono32":
  1610. posteaIcono('http://i.imgur.com/vWFv3Gt.gif', 'message');
  1611. break;
  1612. case "icono33":
  1613. posteaIcono('http://i.imgur.com/XEHiXuO.gif', 'message');
  1614. break;
  1615. case "icono34":
  1616. posteaIcono('http://i.imgur.com/RzjaSKr.gif', 'message');
  1617. break;
  1618. case "icono35":
  1619. posteaIcono('http://i.imgur.com/z64hDgz.gif', 'message');
  1620. break;
  1621. case "icono36":
  1622. posteaIcono('http://i.imgur.com/CsCrOnE.gif', 'message');
  1623. break;
  1624. case "icono37":
  1625. posteaIcono('http://i.imgur.com/K2d1Mbv.gif', 'message');
  1626. break;
  1627. case "icono38":
  1628. posteaIcono('http://i.imgur.com/av8bxvU.gif', 'message');
  1629. break;
  1630. case "icono39":
  1631. posteaIcono('http://i.imgur.com/oQYWBTO.gif', 'message');
  1632. break;
  1633. case "icono40":
  1634. posteaIcono('http://i.imgur.com/NA84WqF.gif', 'message');
  1635. break;
  1636. case "icono41":
  1637. posteaIcono('http://i.imgur.com/N2cdFNy.gif', 'message');
  1638. break;
  1639. case "icono42":
  1640. posteaIcono('http://i.imgur.com/YWe8hno.gif', 'message');
  1641. break;
  1642. case "icono43":
  1643. posteaIcono('http://i.imgur.com/1t7YpCo.gif', 'message');
  1644. break;
  1645. case "icono44":
  1646. posteaIcono('http://i.imgur.com/VfbyDHO.gif', 'message');
  1647. break;
  1648. case "icono45":
  1649. posteaIcono('http://i.imgur.com/cheJFuk.gif', 'message');
  1650. break;
  1651. case "icono46":
  1652. posteaIcono('http://i.imgur.com/1kJhHCs.gif', 'message');
  1653. break;
  1654. case "icono47":
  1655. posteaIcono('http://i.imgur.com/7iCxtYD.gif', 'message');
  1656. break;
  1657. case "icono48":
  1658. posteaIcono('http://i.imgur.com/gJw92DZ.gif', 'message');
  1659. break;
  1660. case "icono49":
  1661. posteaIcono('http://i.imgur.com/92QYUDu.gif', 'message');
  1662. break;
  1663. case "icono50":
  1664. posteaIcono('http://i.imgur.com/RUQN2Hy.gif', 'message');
  1665. break;
  1666. case "icono51":
  1667. posteaIcono('http://i.imgur.com/jaT1cb4.gif', 'message');
  1668. break;
  1669. case "icono52":
  1670. posteaIcono('http://i.imgur.com/jDjyKTf.gif', 'message');
  1671. break;
  1672. case "icono53":
  1673. posteaIcono('http://i.imgur.com/Dfl5ZGS.gif', 'message');
  1674. break;
  1675. case "icono54":
  1676. posteaIcono('http://i.imgur.com/sC8Mgmi.gif', 'message');
  1677. break;
  1678. case "aIcono0":
  1679. posteaIcono('http://i.imgur.com/nRp5BpE.gif', 'msg');
  1680. break;
  1681. case "aIcono1":
  1682. posteaIcono('http://i.imgur.com/CcuKTNz.gif', 'msg');
  1683. break;
  1684. case "aIcono2":
  1685. posteaIcono('http://i.imgur.com/NPyAJM5.gif', 'msg');
  1686. break;
  1687. case "aIcono3":
  1688. posteaIcono('http://i.imgur.com/1ncAraF.gif', 'msg');
  1689. break;
  1690. case "aIcono4":
  1691. posteaIcono('http://i.imgur.com/xp6xUJJ.gif', 'msg');
  1692. break;
  1693. case "aIcono5":
  1694. posteaIcono('http://i.imgur.com/qOigaWi.png', 'msg');
  1695. break;
  1696. case "aIcono6":
  1697. posteaIcono('http://i.imgur.com/rSqmTPO.gif', 'msg');
  1698. break;
  1699. case "aIcono7":
  1700. posteaIcono('http://i.imgur.com/qP1rAQ5.png', 'msg');
  1701. break;
  1702. case "aIcono8":
  1703. posteaIcono('http://i.imgur.com/RUQN2Hy.gif', 'msg');
  1704. break;
  1705. case "aIcono9":
  1706. posteaIcono('http://i.imgur.com/QuXS7fE.gif', 'msg');
  1707. break;
  1708. case "aIcono10":
  1709. posteaIcono('http://i.imgur.com/Bf8NC56.png', 'msg');
  1710. break;
  1711. case "aIcono11":
  1712. posteaIcono('http://i.imgur.com/CZT1Eec.gif', 'msg');
  1713. break;
  1714. case "aIcono12":
  1715. posteaIcono('http://i.imgur.com/OOsLDaW.gif', 'msg');
  1716. break;
  1717. case "aIcono13":
  1718. posteaIcono('http://i.imgur.com/yPtUjin.gif', 'msg');
  1719. break;
  1720. case "aIcono14":
  1721. posteaIcono('http://i.imgur.com/LdCQyai.png', 'msg');
  1722. break;
  1723. case "aIcono15":
  1724. posteaIcono('http://i.imgur.com/Q3B4Dqz.gif', 'msg');
  1725. break;
  1726. case "aIcono16":
  1727. posteaIcono('http://i.imgur.com/vWFv3Gt.gif', 'msg');
  1728. break;
  1729. case "aIcono17":
  1730. posteaIcono('http://i.imgur.com/RzjaSKr.gif', 'msg');
  1731. break;
  1732. case "aIcono18":
  1733. posteaIcono('http://i.imgur.com/XEHiXuO.gif', 'msg');
  1734. break;
  1735. case "aIcono19":
  1736. posteaIcono('http://i.imgur.com/1t7YpCo.gif', 'msg');
  1737. break;
  1738. case "aIcono20":
  1739. posteaIcono('http://i.imgur.com/BzPDfzF.gif', 'msg');
  1740. break;
  1741. case "aIcono21":
  1742. posteaIcono('http://i.imgur.com/UR5t0o6.gif', 'msg');
  1743. break;
  1744. case "aIcono22":
  1745. posteaIcono('http://i.imgur.com/8t9ZJse.gif', 'msg');
  1746. break;
  1747. case "aIcono23":
  1748. posteaIcono('http://i.imgur.com/aaPvRo4.gif', 'msg');
  1749. break;
  1750. case "aIcono24":
  1751. posteaIcono('http://i.imgur.com/XdfJFFs.gif', 'msg');
  1752. break;
  1753. case "aIcono25":
  1754. posteaIcono('http://i.imgur.com/KKx3thu.gif', 'msg');
  1755. break;
  1756. case "aIcono26":
  1757. posteaIcono('http://i.imgur.com/zpY2A6I.gif', 'msg');
  1758. break;
  1759. case "aIcono27":
  1760. posteaIcono('http://i.imgur.com/KnhAURP.gif', 'msg');
  1761. break;
  1762. case "aIcono28":
  1763. posteaIcono('http://i.imgur.com/NA84WqF.gif', 'msg');
  1764. break;
  1765. case "aIcono29":
  1766. posteaIcono('http://i.imgur.com/N2cdFNy.gif', 'msg');
  1767. break;
  1768. case "aIcono30":
  1769. posteaIcono('http://i.imgur.com/oQYWBTO.gif', 'msg');
  1770. break;
  1771. case "aIcono31":
  1772. posteaIcono('http://i.imgur.com/YWe8hno.gif', 'msg');
  1773. break;
  1774. case "aIcono32":
  1775. posteaIcono('http://i.imgur.com/av8bxvU.gif', 'msg');
  1776. break;
  1777. case "imagenRoja":
  1778. mostrarCodigo();
  1779. break;
  1780. case "imagenCierre":
  1781. cerrarCodigo();
  1782. break;
  1783. case "imagenRed":
  1784. mostrando();
  1785. break;
  1786. case "imagenCer":
  1787. collapseExpand("contImpuestos");
  1788. break;
  1789. case "boton2":
  1790. collapseExpand("divColor");
  1791. break;
  1792. case "btnFirma":
  1793. crearFirma();
  1794. break;
  1795. case "btnMostrar":
  1796. mostrarFirma();
  1797. break;
  1798. case "boton3":
  1799. collapseExpand("divFirma");
  1800. break;
  1801. case "btni":
  1802. addImagen('areaFirma');
  1803. break;
  1804. case "btnn":
  1805. armaCodigo('b', 'areaFirma');
  1806. break;
  1807. case "btnc":
  1808. armaCodigo('i', 'areaFirma');
  1809. break;
  1810. case "btns":
  1811. armaCodigo('u', 'areaFirma');
  1812. break;
  1813. case "mostrarY":
  1814. firmaSiempre();
  1815. break;
  1816. case "upImg":
  1817. subirImagen();
  1818. break;
  1819. }
  1820. }, true);
  1821. }