Mudanças entre as edições de "MediaWiki:Common.js"

De Wiki Gla
Ir para navegação Ir para pesquisar
Etiqueta: Revertido
m
 
(677 revisões intermediárias por 7 usuários não estão sendo mostradas)
Linha 1: Linha 1:
/* Códigos JavaScript aqui colocados serão carregados por todos aqueles que acessarem alguma página deste wiki */
/* Any JavaScript here will be loaded for all users on every page load. */


// <source lang="javascript">
/* Dark mode: fallback se gla-darkmode-boot.php não estiver no servidor */
(function () {
  try {
    if (localStorage.getItem('gla-darkmode') === '1') {
      var root = document.documentElement;
      root.classList.add('client-darkmode', 'skin-theme-clientpref-night');
      if (document.cookie.indexOf('gla-darkmode=1') === -1) {
        document.cookie = 'gla-darkmode=1;path=/;max-age=31536000;SameSite=Lax';
      }
    }
  } catch (e) { }
})();
 
(function () {
  'use strict';
 
  function setupDiscordButton() {
    var a = document.querySelector('#n-Discord a');
    if (!a || a.querySelector('.gla-discord-text')) {
      return;
    }
 
    var icon = document.createElement('span');
    icon.className = 'gla-discord-icon';
    icon.setAttribute('aria-hidden', 'true');


/*
    var textWrap = document.createElement('span');
  Cross-browser tooltip support for MediaWiki.
    textWrap.className = 'gla-discord-text';
    
    textWrap.innerHTML = 'Entre no <strong>Discord</strong>';
   Author: [[User:Lupo]], March 2008
 
   License: Quadruple licensed GFDL, GPL, LGPL and Creative Commons Attribution 3.0 (CC-BY-3.0)
    a.textContent = '';
    
    a.appendChild(icon);
  Choose whichever license of these you like best :-)
    a.appendChild(textWrap);
   }
 
   if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', setupDiscordButton);
   } else {
    setupDiscordButton();
   }
})();


  Based on ideas gleaned from prototype.js and prototip.js.
(function () {
  http://www.prototypejs.org/
   'use strict';
  http://www.nickstakenburg.com/projects/prototip/
  However, since prototype is pretty large, and prototip had some
  problems in my tests, this stand-alone version was written.
 
  Note: The fancy effects from scriptaculous have not been rebuilt.
  http://script.aculo.us/
 
   See http://commons.wikimedia.org/wiki/MediaWiki_talk:Tooltips.js for
  more information including documentation and examples.
*/


var is_IE      = !!window.ActiveXObject;
  var LOGO_SRC = 'https://wiki.gla.com.br/images/b/bf/WIKIGLAlogo.png';
  var LOGO_RETRIES = 0;
  var LOGO_MAX_RETRIES = 40;


var EvtHandler = {
   function resolveLogoSrc() {
   listen_to : function (object, node, evt, f)
     if (typeof mw !== 'undefined' && mw.config && mw.config.get) {
  {
      var skinLogo = mw.config.get('wgLogo');
     var listener = EvtHandler.make_listener (object, f);
      if (skinLogo && skinLogo.indexOf('wiki.png') === -1) {
    EvtHandler.attach (node, evt, listener);
        return skinLogo;
  },
      }
 
     }
  attach : function (node, evt, f)
     return LOGO_SRC;
  {
   }
    if (node.attachEvent) node.attachEvent ('on' + evt, f);
    else if (node.addEventListener) node.addEventListener (evt, f, false);
    else node['on' + evt] = f;
  },
 
  remove : function (node, evt, f)
  {
    if (node.detachEvent) node.detachEvent ('on' + evt, f);
    else if (node.removeEventListener) node.removeEventListener (evt, f, false);
     else node['on' + evt] = null;
  },
 
  make_listener : function (obj, listener)
  {
     // Some hacking around to make sure 'this' is set correctly
    var object = obj, f = listener;
    return function (evt) { return f.apply (object, [evt || window.event]); }
   },


   mouse_offset : function ()
   function setupLogoImg() {
  {
     var a = document.querySelector('#p-logo a.mw-wiki-logo');
     // IE does some strange things...
    if (!a) {
     // This is adapted from dojo 0.9.0, see http://dojotoolkit.org
      return false;
     if (is_IE) {
     }
       var doc_elem = document.documentElement;
 
       if (doc_elem) {
     if (!a.querySelector('.gla-logo-img')) {
        if (typeof (doc_elem.getBoundingClientRect) == 'function') {
       var img = document.createElement('img');
          var tmp = doc_elem.getBoundingClientRect ();
      img.className = 'gla-logo-img';
          return {x : tmp.left, y : tmp.top};
       img.src = resolveLogoSrc();
         } else {
      img.alt = '';
           return {x : doc_elem.clientLeft, y : doc_elem.clientTop};
      img.setAttribute('decoding', 'async');
      img.setAttribute('draggable', 'false');
      img.addEventListener('error', function onLogoError() {
         if (img.src !== LOGO_SRC) {
           img.src = LOGO_SRC;
         }
         }
       }
       });
      a.appendChild(img);
    }
 
    return true;
  }
 
  function trySetupLogo() {
    if (setupLogoImg()) {
      return;
     }
     }
     return null;
     LOGO_RETRIES += 1;
  },
     if (LOGO_RETRIES < LOGO_MAX_RETRIES) {
 
       window.setTimeout(trySetupLogo, 50);
  killEvt : function (evt)
  {
     if (typeof (evt.preventDefault) == 'function') {
       evt.stopPropagation ();
      evt.preventDefault (); // Don't follow the link
    } else if (typeof (evt.cancelBubble) != 'undefined') { // IE...
      evt.cancelBubble = true;
     }
     }
    return false; // Don't follow the link (IE)
   }
   }


} // end EvtHandler
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', trySetupLogo);
  } else {
    trySetupLogo();
  }
})();


var Buttons = {
(function () {
    
  'use strict';
   buttonClasses : {},
 
    
  var STORAGE_KEY = 'gla-darkmode';
   createCSS : function (imgs, sep, id)
   var LINK_CLASS = 'darkmode-link';
  {
   var LABEL_DARK = 'Modo escuro';
     var width  = imgs[0].getAttribute ('width');
   var LABEL_LIGHT = 'Modo padr\u00e3o';
    var height  = imgs[0].getAttribute ('height');
 
   function isDark() {
     return document.documentElement.classList.contains('client-darkmode');
  }
 
  function setDarkModeCookie(on) {
     try {
     try {
       // The only way to set the :hover and :active properties through Javascript is by
       document.cookie = 'gla-darkmode=' + (on ? '1' : '0') + ';path=/;max-age=' + (on ? 31536000 : 0) + ';SameSite=Lax';
      // injecting a piece of CSS. There is no direct access within JS to these properties.
    } catch (e) { }
      var sel1  = "a" + sep + id;
  }
      var prop1 = "border:0; text-decoration:none; background-color:transparent; "
 
                + "width:" + width + "px; height:" + height + "px; "
  function setDark(on) {
                + "display:inline-block; "
    var root = document.documentElement;
                + "background-position:left; background-repeat:no-repeat; "
    root.classList.toggle('client-darkmode', on);
                + "background-image:url(" + imgs[0].src + ");";
    root.classList.toggle('skin-theme-clientpref-night', on);
      var sel2  = null, prop2 = null, sel3  = null, prop3 = null; // For IE...
    root.classList.toggle('skin-theme-clientpref-day', !on);
      var css   = sel1 + ' {' + prop1 + '}\n';                    // For real browsers
    try {
      if (imgs.length > 1 && imgs[1]) {
      localStorage.setItem(STORAGE_KEY, on ? '1' : '0');
        sel2  = "a" + sep + id + ":hover";
    } catch (e) { }
        prop2 = "background-image:url(" + imgs[1].src + ");";
    setDarkModeCookie(on);
        css   = css + sel2 + ' {' + prop2 + '}\n';
    updateLinks(on);
   }
 
  function updateLinks(on) {
    var links = document.querySelectorAll('.' + LINK_CLASS);
    var label = on ? LABEL_LIGHT : LABEL_DARK;
    for (var i = 0; i < links.length; i++) {
      links[i].textContent = label;
    }
  }
 
   function findDarkLink(el) {
    while (el && el !== document) {
      if (el.classList && el.classList.contains(LINK_CLASS)) {
        return el;
       }
       }
       if (imgs.length > 2 && imgs[2]) {
       el = el.parentNode;
        sel3  = "a" + sep + id + ":active"
    }
        prop3 = "background-image:url(" + imgs[2].src + ");";
    return null;
        css  = css + sel3 + ' {' + prop3 + '}\n';
  }
      }
 
      // Now insert a style sheet with these properties into the document (or rather, its head).
  function injectToggle() {
      var styleElem = document.createElement( 'style' );
    if (document.getElementById('pt-darkmode')) {
      styleElem.setAttribute ('type', 'text/css');
       return;
      try {
        styleElem.appendChild (document.createTextNode (css));
        document.getElementsByTagName ('head')[0].appendChild (styleElem);
      } catch (ie_bug) {
        // Oh boy, IE has a big problem here
        document.getElementsByTagName ('head')[0].appendChild (styleElem);
//        try {
          styleElem.styleSheet.cssText = css;
/*
        } catch (anything) {
          if (document.styleSheets) {
            var lastSheet = document.styleSheets[document.styleSheets.length - 1];         
            if (lastSheet && typeof (lastSheet.addRule) != 'undefined') {
              lastSheet.addRule (sel1, prop1);
              if (sel2) lastSheet.addRule (sel2, prop2);
              if (sel3) lastSheet.addRule (sel3, prop3);
            }
          }
        }
*/
      }
    } catch (ex) {
       return null;
     }
     }
     if (sep == '.') {
 
       // It's a class: remember the first image
     var ul = document.querySelector('#p-personal .vector-menu-content-list') ||
       Buttons.buttonClasses[id] = imgs[0];
       document.querySelector('#p-personal ul');
    if (!ul) {
       return;
     }
     }
     return id;
 
  }, // end createCSS
     var li = document.createElement('li');
 
    li.id = 'pt-darkmode';
  createClass : function (imgs, id)
 
  {
     var a = document.createElement('a');
     return Buttons.createCSS (imgs, '.', id);
     a.href = '#';
  },
     a.className = LINK_CLASS;
 
     a.textContent = isDark() ? LABEL_LIGHT : LABEL_DARK;
  makeButton : function (imgs, id, handler, title)
     li.appendChild(a);
  {
 
     var success    = false;
    var afterLi = document.getElementById('pt-mytalk') ||
     var buttonClass = null;
      document.getElementById('pt-anontalk') ||
     var content    = null;
       document.getElementById('pt-userpage') ||
     if (typeof (imgs) == 'string') {
       document.getElementById('pt-anonuserpage');
       buttonClass = imgs;
 
       content    = Buttons.buttonClasses[imgs];
     if (afterLi && afterLi.parentNode === ul) {
      success     = (content != null);
      afterLi.insertAdjacentElement('afterend', li);
     } else {
     } else {
       success    = (Buttons.createCSS (imgs, '#', id) != null);
       ul.insertBefore(li, ul.firstChild);
      content    = imgs[0];
     }
     }
    if (success) {
  }
      var lk = document.createElement ('a');
 
      lk.setAttribute
  function bindToggle() {
        ('title', title || content.getAttribute ('alt') || content.getAttribute ('title') || "");
    if (window.glaDarkModeBound) {
       lk.id = id;
       return;
      if (buttonClass) lk.className = buttonClass;
    }
      if (typeof (handler) == 'string') {
    window.glaDarkModeBound = true;
        lk.href = handler;
 
      } else {
    document.addEventListener('click', function (e) {
        lk.href = '#'; // Dummy, overridden by the onclick handler below.
      var link = findDarkLink(e.target);
        lk.onclick = function (evt)
      if (!link) {
          {
        return;
            var e = evt || window.event; // W3C, IE
            try {handler (e);} catch (ex) {};
            return EvtHandler.killEvt (e);
          };
       }
       }
       content = content.cloneNode (true);
       e.preventDefault();
       content.style.visibility = 'hidden';
       setDark(!isDark());
      lk.appendChild (content);
    });
       return lk;
  }
     } else {
 
       return null;
  function boot() {
    injectToggle();
    bindToggle();
    updateLinks(isDark());
  }
 
  window.glaDarkModeBoot = boot;
  window.addEventListener('load', boot);
 
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', boot);
  } else {
    boot();
  }
 
  function markThemeReady() {
    document.documentElement.classList.add('gla-theme-ready');
  }
 
  if (document.readyState === 'complete') {
    requestAnimationFrame(markThemeReady);
  } else {
    window.addEventListener('load', function () {
       requestAnimationFrame(markThemeReady);
     });
  }
 
  var tries = 0;
  var retryTimer = setInterval(function () {
    if (document.getElementById('pt-darkmode') || tries++ > 40) {
      clearInterval(retryTimer);
       return;
     }
     }
   } // end makeButton
    boot();
 
   }, 150);
} // end Button
})();
 
 


var Tooltips = {
$(document).ready(function () {
   // Helper object to force quick closure of a tooltip if another one shows up.
   //------- GLOBAL EVENTS TIMER ---------
   debug    : false, 
   (function () {
  top_tip  : null,
    var globalEventsTimer = $('#global-event-time'); // Atualizado: ID do Timer dos Global Events
  nof_tips : 0,
    var globalEventsImage = $('.global-event-image'); // Atualizado: Classe da Imagem dos Global Events
    var globalEventsInterval;


  new_id : function ()
    // Informações dos eventos
  {
    /*
    Tooltips.nof_tips++;
      0 - Domingo
    return 'tooltip_' + Tooltips.nof_tips;
      1 - Segunda-feira
  },
      2 - Terça-feira
      3 - Quarta-feira
      4 - Quinta-feira
      5 - Sexta-feira
      6 - Sábado
    */
    var globalEventsInfo = {
      0: [
        { name: 'Foxy Memory', time: '02:00:00', src: '/images/3/37/Foxy_memory_event.png' },
        { name: 'Foxy race (ship)', time: '09:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
        { name: 'Deathmatch', time: '12:00:00', src: '/images/4/46/Deathmatch_event.png' },
        { name: 'Foxy race', time: '15:00:00', src: '/images/e/e8/Foxy_race_event.png' },
        { name: 'Foxy quiz', time: '19:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
        { name: 'Foxy count', time: '22:00:00', src: '/images/f/f3/Foxy_count_event.png' },
      ],
      1: [
        { name: 'Foxy Memory', time: '02:00:00', src: '/images/3/37/Foxy_memory_event.png' },
        { name: 'Foxy race (ship)', time: '09:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
        { name: 'Deathmatch', time: '12:00:00', src: '/images/4/46/Deathmatch_event.png' },
        { name: 'Foxy race', time: '15:00:00', src: '/images/e/e8/Foxy_race_event.png' },
        { name: 'Foxy quiz', time: '19:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
        { name: 'Foxy count', time: '22:00:00', src: '/images/f/f3/Foxy_count_event.png' },
      ],
      2: [
        { name: 'Foxy race (ship)', time: '02:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
        { name: 'Deathmatch', time: '09:00:00', src: '/images/4/46/Deathmatch_event.png' },
        { name: 'Foxy race', time: '12:00:00', src: '/images/e/e8/Foxy_race_event.png' },
        { name: 'Foxy quiz', time: '15:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
        { name: 'Foxy count', time: '19:00:00', src: '/images/f/f3/Foxy_count_event.png' },
        { name: 'Foxy Memory', time: '22:00:00', src: '/images/3/37/Foxy_memory_event.png' },
      ],
      3: [
        { name: 'Deathmatch', time: '02:00:00', src: '/images/4/46/Deathmatch_event.png' },
        { name: 'Foxy race', time: '09:00:00', src: '/images/e/e8/Foxy_race_event.png' },
        { name: 'Foxy quiz', time: '12:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
        { name: 'Foxy count', time: '15:00:00', src: '/images/f/f3/Foxy_count_event.png' },
        { name: 'Foxy Memory', time: '19:00:00', src: '/images/3/37/Foxy_memory_event.png' },
        { name: 'Foxy race (ship)', time: '22:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
      ],
      4: [
        { name: 'Foxy race', time: '02:00:00', src: '/images/e/e8/Foxy_race_event.png' },
        { name: 'Foxy quiz', time: '09:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
        { name: 'Foxy count', time: '12:00:00', src: '/images/f/f3/Foxy_count_event.png' },
        { name: 'Foxy Memory', time: '15:00:00', src: '/images/3/37/Foxy_memory_event.png' },
        { name: 'Foxy race (ship)', time: '19:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
        { name: 'Deathmatch', time: '22:00:00', src: '/images/4/46/Deathmatch_event.png' },
      ],
      5: [
        { name: 'Foxy quiz', time: '02:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
        { name: 'Foxy count', time: '09:00:00', src: '/images/f/f3/Foxy_count_event.png' },
        { name: 'Foxy Memory', time: '12:00:00', src: '/images/3/37/Foxy_memory_event.png' },
        { name: 'Foxy race (ship)', time: '15:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
        { name: 'Deathmatch', time: '19:00:00', src: '/images/4/46/Deathmatch_event.png' },
        { name: 'Foxy race', time: '22:00:00', src: '/images/e/e8/Foxy_race_event.png' },
      ],
      6: [
        { name: 'Foxy count', time: '02:00:00', src: '/images/f/f3/Foxy_count_event.png' },
        { name: 'Foxy Memory', time: '09:00:00', src: '/images/3/37/Foxy_memory_event.png' },
        { name: 'Foxy race (ship)', time: '12:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
        { name: 'Deathmatch', time: '15:00:00', src: '/images/4/46/Deathmatch_event.png' },
        { name: 'Foxy race', time: '21:55:00', src: '/images/e/e8/Foxy_race_event.png' },
        { name: 'Foxy quiz', time: '22:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
      ]
    };


  register : function (new_tip)
    function pad(value) {
  {
      return value < 10 ? '0' + value : value;
    if (Tooltips.top_tip && Tooltips.top_tip != new_tip) Tooltips.top_tip.hide_now ();
     }
    Tooltips.top_tip = new_tip;
  },
 
  deregister : function (tip)
  {
     if (Tooltips.top_tip == tip) Tooltips.top_tip = null;
  },


  close : function ()
    function getBrazilTime() {
  {
      var now = new Date();
    if (Tooltips.top_tip) {
       var utc = now.getTime() + (now.getTimezoneOffset() * 60000); // Converte para UTC
       Tooltips.top_tip.hide_now ();
       return new Date(utc - (3 * 3600000)); // Ajusta para UTC-3
       Tooltips.top_tip = null;
     }
     }
  }
}


var Tooltip = function () {this.initialize.apply (this, arguments);}
    function startGlobalEventCountdown(eventStartTime, eventEndTime) {
// This is the Javascript way of creating a class. Methods are added below to Tooltip.prototype;
      if (globalEventsInterval) clearInterval(globalEventsInterval);
// one such method is 'initialize', and that will be called when a new instance is created.
// To create instances of this class, use var t = new Tooltip (...);


// Location constants
      globalEventsInterval = setInterval(function () {
Tooltip.MOUSE            = 0; // Near the mouse pointer
        var now = getBrazilTime().getTime();
Tooltip.TRACK            = 1; // Move tooltip when mouse pointer moves
Tooltip.FIXED            = 2; // Always use a fixed poition (anchor) relative to an element


// Anchors
        if (now < eventEndTime) {
Tooltip.TOP_LEFT          = 1;
          var timeRemaining = Math.ceil((eventEndTime - now) / 1000); // Segundos restantes
Tooltip.TOP_RIGHT         = 2;
          var minutes = Math.floor(timeRemaining / 60);
Tooltip.BOTTOM_LEFT       = 3;
          var seconds = timeRemaining % 60;
Tooltip.BOTTOM_RIGHT      = 4;
          globalEventsTimer.html('Iniciando: ' + pad(minutes) + ":" + pad(seconds));
         } else {
          clearInterval(globalEventsInterval);
          setGlobalEvent();
        }
       }, 1000);
    }


// Activation constants
    function setGlobalEvent() {
Tooltip.NONE              = -1; // You must show the tooltip explicitly in this case.
      var now = getBrazilTime(); // Usa o horário do Brasil
Tooltip.HOVER            = 1;
      var dayEvents = globalEventsInfo[now.getDay()];
Tooltip.FOCUS            =  2; // always uses the FIXED position
Tooltip.CLICK            = 4;
Tooltip.ALL_ACTIVATIONS  =  7;


// Deactivation constants
      if (!dayEvents || dayEvents.length === 0) {
        globalEventsImage.attr('src', '/images/0/0a/Anyevent.png'); // Imagem padrão
        globalEventsTimer.html('Acabaram os eventos por hoje');
        return;
      }


Tooltip.MOUSE_LEAVE       = 1; // Mouse leaves target, alternate target, and tooltip
       for (var i = 0; i < dayEvents.length; i++) {
Tooltip.LOSE_FOCUS        =  2; // Focus changes away from target
        var event = dayEvents[i];
Tooltip.CLICK_ELEM        = 4; // Target is clicked
         var timeParts = event.time.split(':');
Tooltip.CLICK_TIP         = 8; // Makes only sense if not tracked
        var eventStartTime = new Date(
Tooltip.ESCAPE            = 16;
          now.getFullYear(),
Tooltip.ALL_DEACTIVATIONS = 31;
          now.getMonth(),
Tooltip.LEAVE            = Tooltip.MOUSE_LEAVE | Tooltip.LOSE_FOCUS;
          now.getDate(),
          parseInt(timeParts[0], 10),
          parseInt(timeParts[1], 10),
          parseInt(timeParts[2], 10)
        ).getTime();
        var eventEndTime = eventStartTime + 5 * 60 * 1000; // Evento dura 5 minutos para entrada


// On IE, use the mouseleave/mouseenter events, which fire only when the boundaries of the
        if (now >= eventStartTime && now < eventEndTime) {
// element are left (but not when the element if left because the mouse moved over some
          // Durante o período de entrada do evento
// contained element)
          globalEventsImage.attr('src', event.src);
          startGlobalEventCountdown(eventStartTime, eventEndTime);
          return;
        }


Tooltip.mouse_in    = (is_IE ? 'mouseenter' : 'mouseover');
        if (now < eventStartTime) {
Tooltip.mouse_out  = (is_IE ? 'mouseleave' : 'mouseout');
          // Antes do evento, exibe o horário fixo
          globalEventsImage.attr('src', event.src);
          globalEventsTimer.html(
            new Date(eventStartTime).toLocaleTimeString('pt-BR', {
              hour: '2-digit',
              minute: '2-digit',
            })
          );


Tooltip.prototype =
          // Só inicia a contagem regressiva quando estiver próximo (faltando 5 minutos ou menos)
{
          if (eventStartTime - now <= 5 * 60 * 1000) {
  initialize : function (on_element, tt_content, opt, css)
            startGlobalEventCountdown(eventStartTime, eventEndTime);
  {
          }
    if (!on_element || !tt_content) return;
           return;
    this.tip_id      = Tooltips.new_id ();
         }
    // Registering event handlers via attacheEvent on IE is apparently a time-consuming
    // operation. When you add many tooltips to a page, this can add up to a noticeable delay.
    // We try to mitigate that by only adding those handlers we absolutely need when the tooltip
    // is created: those for showing the tooltip. The ones for hiding it again are added the
    // first time the tooltip is actually shown. We thus record which handlers are installed to
    // avoid installing them multiple times:
    //  event_state: -1 : nothing set, 0: activation set, 1: all set
    //  tracks:      true iff there is a mousemove handler for tracking installed.
    // This change bought us about half a second on IE (for 13 tooltips on one page). On FF, it
    // doesn't matter at all; in Firefoy, addEventListener is fast anyway.
    this.event_state = -1;
    this.tracks      = false;
    // We clone the node, wrap it, and re-add it at the very end of the
    // document to make sure we're not within some nested container with
    // position='relative', as this screws up all absolute positioning
    // (We always position in global document coordinates.)
    // In my tests, it appeared as if Nick Stakenburg's "prototip" has
    // this problem...
    if (typeof (tt_content) == 'function') {
      this.tip_creator = tt_content;
      this.css        = css;
      this.content    = null;
    } else {
      this.tip_creator = null;
      this.css        = null;
      if (tt_content.parentNode) {
        if (tt_content.ownerDocument != document)
           tt_content = document.importNode (tt_content, true);
         else
          tt_content = tt_content.cloneNode (true);
       }
       }
       tt_content.id = this.tip_id;
 
       this.content  = tt_content;
      // Após o último evento do dia
       globalEventsImage.attr('src', '/images/0/0a/Anyevent.png'); // Imagem padrão
       globalEventsTimer.html('Acabaram os eventos por hoje');
     }
     }
    // Wrap it
 
     var wrapper = document.createElement ('div');
     $(document).ready(function () {
     wrapper.className = 'tooltipContent';
      setGlobalEvent();
    // On IE, 'relative' triggers lots of float:right bugs (floats become invisible or are
     });
    // mispositioned).
  })();
    //if (!is_IE) wrapper.style.position = 'relative';
  //------- GLOBAL EVENTS TIMER ---------
     if (this.content) wrapper.appendChild (this.content);
  //------- TOOLTIP IMAGE---------
    this.popup = document.createElement ('div');
  /*
    this.popup.style.display = 'none';
      Tooltip image consiste em uma funcionalidade que insere uma tag IMG
    this.popup.style.position = 'absolute';
      quando o usuario passa o mouse por cima de uma imagem com a classe "tooltip-image"
     this.popup.style.top = "0px";
      ao fazer é inserido no body uma tag IMG com a mesma "src" 1.3 vezes maior do que a imagem
    this.popup.style.left = "0px";
      que o usuario está com o mouse em coma, esta tag IMG terá o mesmo X e Y do mouse + um offset
    this.popup.appendChild (wrapper);
      para manter um distanciamento.
    // Set the options
  */
    this.options = {
 
      mode        : Tooltip.TRACK              // Where to display the tooltip.
  //Distanciamento / margem do mouse
      ,activate     : Tooltip.HOVER              // When to activate
  const offset = { x: 20, y: 10 };
      ,deactivate  : Tooltip.LEAVE | Tooltip.CLICK_ELEM | Tooltip.ESCAPE // When to deactivate
 
      ,mouse_offset : {x: 5, y: 5, dx: 1, dy: 1} // Pixel offsets and direction from mouse pointer
  $('.tooltip-image').on('mouseenter',
      ,fixed_offset : {x:10, y: 5, dx: 1, dy: 1} // Pixel offsets from anchor position
     function (e) {
      ,anchor      : Tooltip.BOTTOM_LEFT        // Anchor for fixed position
      var src = $(this).attr('src');
      ,target      : null                      // Optional alternate target for fixed display.
      var size = $(this).width() * 1.3;
      ,max_width    :   0.6         // Percent of window width (1.0 == 100%)
 
      ,max_pixels  :   0          // If > 0, maximum width in pixels
      $('<img src="' + src + '" id="bigImage" />').css('left', e.pageX + offset.x).css('top', e.pageY + offset.y).css('width', size + "px").appendTo('body').hide().fadeIn(500);
      ,z_index      : 1000          // On top of everything
     }).on('mouseleave',
      ,open_delay  : 500          // Millisecs, set to zero to open immediately
      function () {
      ,hide_delay  : 1000          // Millisecs, set to zero to close immediately
        $('#bigImage').remove();
      ,close_button : null          // Either a single image, or an array of up to three images
      });
                                    // for the normal, hover, and active states, in that order
 
      ,onclose      : null          // Callback to be called when the tooltip is hidden. Should be
  $('.tooltip-image').mousemove(function (e) {
                                    // a function taking a single argument 'this' (this Tooltip)
    $('#bigImage').css('left', e.pageX + offset.x).css('top', e.pageY + offset.y);
                                    // an an optional second argument, the event.
  });
      ,onopen      : null          // Ditto, called after opening.
  //------- TOOLTIP IMAGE---------
     };
 
     // The lower of max_width and max_pixels limits the tooltip's width.
  //------- FUNCIONALIDADES PACIENTES KUREHA ---------
     if (opt) { // Merge in the options
  const pacients = {
      for (var option in opt) {
    "bafo": { image: "/images/c/ce/Bafo_static.png", gif: "/images/e/e0/Bafo.gif" },
        if (option == 'mouse_offset' || option == 'fixed_offset') {
     "espirrando": { image: "/images/thumb/5/5b/Espirro_static.png/180px-Espirro_static.png", gif: "/images/thumb/9/90/Espirro.gif/180px-Espirro.gif", audio: "/images/2/2b/Espirrando.ogg" },
          try {
    "enjoado": { image: "/images/thumb/5/52/Enjoado_static.png/180px-Enjoado_static.png", gif: "/images/thumb/7/76/Enjoado.gif/180px-Enjoado.gif", audio: "/images/5/5b/Vomito.ogg" },
            for (var attr in opt[option]) {
    "tremendo": { image: "/images/thumb/3/35/Tremendo_static.png/180px-Tremendo_static.png", gif: "/images/thumb/f/f4/Tremendo.gif/180px-Tremendo.gif" },
              this.options[option][attr] = opt[option][attr];
    "tossindo": { image: "/images/thumb/e/ef/Tosse_static.png/180px-Tosse_static.png", gif: "/images/thumb/a/a4/Tosse.gif/180px-Tosse.gif", audio: "/images/f/f9/Tossindo.ogg" },
            }
    "solucando": { image: "/images/thumb/c/c0/Soluco_static.png/180px-Soluco_static.png", gif: "/images/thumb/6/67/Soluco.gif/180px-Soluco.gif", audio: "/images/e/e2/Solucando.ogg" },
          } catch (ex) {
    "funk": { image: "/images/thumb/e/e8/Funkeiro_static.png/180px-Funkeiro_static.png ", gif: "/images/thumb/7/79/Funkeiro.gif/180px-Funkeiro.gif", audio: "/images/d/d2/Funk.ogg" },
          }
    "fedendo": { image: "/images/thumb/1/1e/Fedido_static.png/180px-Fedido_static.png", gif: "/images/thumb/c/c9/Fedido.gif/180px-Fedido.gif" },
        } else
    "febre": { image: "/images/thumb/1/14/Febre_static.png/180px-Febre_static.png", gif: "/images/thumb/7/75/Febre.gif/180px-Febre.gif" },
          this.options[option] = opt[option];
     "endemoniado": { audio: "/images/3/32/Risada_maligna.ogg" },
       }
     "fome": { audio: "/images/3/37/Estomago_roncando.ogg" },
     "cardiaco": { audio: "/images/2/27/Coracao_batendo.ogg" }
  };
 
  const audioPlayer = document.querySelector("#audio");
 
  $(".pacient-audio").on("click", function (e) {
    id = $(this).attr('id');
 
    if (pacients[id]) {
      audioPlayer.src = pacients[id].audio;
       audioPlayer.play();
     }
     }
    // Set up event handlers as appropriate
    this.eventShow  = EvtHandler.make_listener (this, this.show);
    this.eventToggle = EvtHandler.make_listener (this, this.toggle);
    this.eventFocus  = EvtHandler.make_listener (this, this.show_focus);
    this.eventClick  = EvtHandler.make_listener (this, this.show_click);
    this.eventHide  = EvtHandler.make_listener (this, this.hide);
    this.eventTrack  = EvtHandler.make_listener (this, this.track);
    this.eventClose  = EvtHandler.make_listener (this, this.hide_now);
    this.eventKey    = EvtHandler.make_listener (this, this.key_handler);


    this.close_button      = null;
  });
     this.close_button_width = 0;
 
     if (this.options.close_button) {
  $('.interactive-pacient').on('mouseenter', function (e) {
      this.makeCloseButton ();
     id = $(this).attr('id');
       if (this.close_button) {
 
        // Only a click on the close button will close the tip.
     if (pacients[id])
        this.options.deactivate = this.options.deactivate & ~Tooltip.CLICK_TIP;
      $(this).attr('src', pacients[id].gif);
        // And escape is always active if we have a close button
  }).on('mouseleave', function (e) {
        this.options.deactivate = this.options.deactivate | Tooltip.ESCAPE;
    id = $(this).attr('id');
        // Don't track, you'd have troubles ever getting to the close button.
 
        if (this.options.mode == Tooltip.TRACK) this.options.mode = Tooltip.MOUSE;
    if (pacients[id])
        this.has_links = true;
       $(this).attr('src', pacients[id].image);
       }
  });
 
  //------- FUNCIONALIDADES PACIENTES KUREHA ---------
  //------- FUNCIONALIDADES BUZINAS ---------
  const horns = {
    "Buzinadelacucha": { audio: "/images/5/55/Buzinadelacucha-audio.ogg" },
    "Buzinadefumaca": { audio: "/images/3/3a/Buzinadefumaca-audio.ogg" },
    "Buzinadecaminhao": { audio: "/images/e/e4/Buzinadecaminhao-audio.ogg" },
    "Buzinadetrem": { audio: "/images/3/34/Buzinadetrem-audio.ogg" },
    "Buzinadeesporte": { audio: "/images/2/2b/Buzinadeesporte-audio.ogg" },
    "Buzinadear": { audio: "/images/9/95/Buzinadear-audio.ogg" },
    "Buzinadepalhaco": { audio: "/images/a/a4/Buzinadepalhaco-audio.ogg" },
    "Buzinadeinvestida": { audio: "/images/f/ff/Buzinadeinvestida-audio.ogg" },
    "Buzinadebicicleta": { audio: "/images/1/15/Buzinadebicicleta-audio.ogg" },
    "Buzinadeneblina": { audio: "/images/6/64/Buzinadeneblina-audio.ogg" }
  };
 
  const hornAudioPlayer = document.querySelector("#audio");
 
  $(".horn-audio").on("click", function (e) {
    const id = $(this).attr('id');
    if (horns[id]) {
      hornAudioPlayer.src = horns[id].audio;
       hornAudioPlayer.play();
     }
     }
     if (this.options.activate == Tooltip.NONE) {
  });
       this.options.activate = 0;
 
  //------- FUNCIONALIDADES BUZINAS ---------
});
 
 
/**
* Script JavaScript para o componente de abas MediaWiki
* Adicione este script na sua MediaWiki (Common.js ou página de scripts)
*/
 
(function () {
  'use strict';
 
  // Inicializa todos os componentes de abas na página
  function initTabbers() {
    const tabbers = document.querySelectorAll('[data-tabber]');
 
    tabbers.forEach(function (tabber) {
      const tabs = tabber.querySelectorAll('.mw-tabber-tab');
      const panels = tabber.querySelectorAll('.mw-tabber-panel');
 
      tabs.forEach(function (tab) {
        tab.addEventListener('click', function () {
          const targetTab = this.getAttribute('data-tab');
 
          // Remove classe active de todas as abas
          tabs.forEach(function (t) {
            t.classList.remove('active');
          });
 
          // Remove classe active de todos os painéis
          panels.forEach(function (p) {
            p.classList.remove('active');
          });
 
          // Adiciona classe active na aba clicada
          this.classList.add('active');
 
          // Adiciona classe active no painel correspondente
          const targetPanel = tabber.querySelector('[data-panel="' + targetTab + '"]');
          if (targetPanel) {
            targetPanel.classList.add('active');
          }
        });
      });
     });
  }
 
  // Inicializa quando o DOM estiver pronto
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', initTabbers);
  } else {
    initTabbers();
  }
 
  // Suporte para MediaWiki (quando o conteúdo é carregado dinamicamente)
  if (typeof mw !== 'undefined' && mw.hook) {
    mw.hook('wikipage.content').add(function () {
       initTabbers();
    });
  }
})();
 
 
/* =============================================================================
  GLA pages legacy (provisório) — personagens, wanted, skills, calc XP, abas
  Extraído de antigo_common.js
  ============================================================================= */
 
$(document).ready(function () {
  //------- PERSONAGENS ---------
 
  const characters = [
    { name: "Silvers Rayleigh", types: ["slasher", "dps", "diamond", "break_wall"], link: "/Silvers_Rayleigh", img: "/images/f/f1/Rayleigh_Card.png" },
    { name: "Monkey D Garp", types: ["fighter", "dps", "marine", "diamond", "break_wall"], link: "/Monkey_D_Garp", img: "/images/a/a1/GarpCard.png" },
    { name: "Aokiji Dio", types: ["slasher", "especialist", "tank", "marine", "diamond", "break_wall", "bridge"], link: "/Aokiji", img: "/images/6/67/Aokiji_card.png" },
    { name: "Bartolomew Kuma", types: ["especialist", "tank", "diamond", "break_wall"], link: "/Kuma", img: "/images/b/b5/Card-kuma.png" },
    { name: "Boa Hancock", types: ["fighter", "dps", "diamond"], link: "/Boa_Hancock", img: "/images/4/47/Card-hancock.png" },
    { name: "Borsalino Kizaru", types: ["especialist", "shooter", "dps", "diamond", "break_wall"], link: "/Kizaru", img: "/images/3/32/Card-kizaru.png" },
    { name: "Brook (TS)", types: ["slasher", "support", "diamond", "bridge"], link: "/Brook_(Timeskip)", img: "/images/1/1d/Card-brookts.png" },
    { name: "Tony Tony Chopper (TS) Gurren", types: ["fighter", "support", "diamond", "break_wall"], link: "/Chopper_(Timeskip)", img: "/images/5/53/Card-chopperts.png" },
    { name: "Doflamingo", types: ["shooter", "especialist", "dps", "diamond", "break_wall", "bridge"], link: "/Doflamingo", img: "/images/8/8d/Card-doflamingo.png" },
    { name: "Dracule Mihawk", types: ["slasher", "dps", "diamond", "break_wall"], link: "/Mihawk", img: "/images/9/91/Card-mihawk.png" },
    { name: "Emporio Ivankov", types: ["fighter", "support", "diamond", "break_wall"], link: "/Ivankov", img: "/images/c/ca/Card-ivankov.png" },
    { name: "Enel", types: ["shooter", "especialist", "diamond", "dps"], link: "/Enel", img: "/images/8/85/Enel_card.png" },
    { name: "Franky (TS) Sanitaria", types: ["shooter", "tank", "diamond", "break_wall"], link: "/Franky_(Timeskip)", img: "/images/d/d0/Card-frankyts.png" },
    { name: "Jinbe", types: ["fighter", "tank", "diamond", "break_wall"], link: "/Jinbe", img: "/images/2/2e/Card-jinbe.png" },
    { name: "Marshall D. Teach Barba Negra", types: ["especialist", "bruiser", "diamond"], link: "/Marshall_D._Teach", img: "/images/f/ff/Card-kurohige.png" },
    { name: "Marco Abacaxi", types: ["especialist", "fighter", "support", "diamond"], link: "/Marco", img: "/images/2/2b/Marco_card.png" },
    { name: "Monkey D. Luffy (TS) Visno", types: ["fighter", "dps", "diamond", "break_wall"], link: "/Luffy_(Timeskip)", img: "/images/e/ed/Card-luffyts.png" },
    { name: "Nami (TS)", types: ["especialist", "dps", "diamond"], link: "/Nami_(timeskip)", img: "/images/3/35/Card-namits.png" },
    { name: "Portgas D. Ace Duduh", types: ["especialist", "shooter", "dps", "diamond"], link: "/Ace", img: "/images/4/40/Card-ace.png" },
    { name: "Robin (TS)", types: ["especialist", "dps", "diamond", "break_wall", "bridge"], link: "/Robin_(Timeskip)", img: "/images/b/b0/Card-robints.png" },
    { name: "Roronoa Zoro (TS)", types: ["slasher", "dps", "diamond", "break_wall"], link: "/Zoro_(Timeskip)", img: "/images/7/74/Card-zorots.png" },
    { name: "Sabo", types: ["fighter", "especialist", "dps", "diamond", "break_wall"], link: "/Sabo", img: "/images/0/04/Card-sabo.png" },
    { name: "Sakazuki Akainu", types: ["especialist", "fighter", "dps", "diamond", "break_wall"], link: "/Akainu", img: "/images/b/b0/Card_akainu.png" },
    { name: "Shanks", types: ["slasher", "bruiser", "diamond", "break_wall"], link: "/Shanks", img: "/images/a/aa/Card-shanks.png" },
    { name: "Usopp (TS)", types: ["shooter", "dps", "diamond", "break_wall"], link: "/Usopp_(Timeskip)", img: "/images/c/cc/Card-usoppts.png" },
    { name: "Uta", types: ["especialist", "dps", "diamond", "break_wall"], link: "/Uta", img: "/images/2/22/Card_uta.png" },
    { name: "Vinsmoke Sanji (TS)", types: ["fighter", "dps", "diamond", "break_wall"], link: "/Sanji_(Timeskip)", img: "/images/7/7a/Card-sanjits.png" },
 
    { name: "Kalifa", types: ["support", "gold", "especialist", "break_wall"], link: "/Kalifa", img: "/images/3/39/Kalifa_card.png" },
    { name: "Jabra", types: ["slasher", "dps", "gold", "break_wall"], link: "/Jabra", img: "/images/9/98/Jabra_card.png" },
    { name: "Kaku", types: ["slasher", "shooter", "dps", "gold", "break_wall"], link: "/Kaku", img: "/images/9/98/Kaku_card.png" },
    { name: "Rob Lucci", types: ["fighter", "dps", "gold", "break_wall"], link: "/Rob Lucci", img: "/images/b/b1/Rob_Lucci_card.png" },
    { name: "Blueno", types: ["fighter", "dps", "gold", "break_wall"], link: "/Blueno", img: "/images/5/55/Blueno_card.png" },
    { name: "Marguerite", types: ["shooter", "dps", "gold", "break_wall"], link: "/Marguerite", img: "/images/1/1c/Marguerite_Card.png" },
    { name: "Baby 5", types: ["slasher", "shooter", "gold", "dps"], link: "/Baby_5", img: "/images/5/5e/Baby5_card.png" },
    { name: "Bartolomeo", types: ["especialist", "dps", "gold", "break_wall", "bridge"], link: "/Bartolomeo", img: "/images/a/a9/Card-barto.png" },
    { name: "Basil Hawkins Lost", types: ["especialist", "bruiser", "gold", "bridge"], link: "/Basil_Hawkins", img: "/images/8/89/Card-hawkins.png" },
    { name: "Bastille", types: ["slasher", "tank", "gold", "break_wall"], link: "/Bastille", img: "/images/1/13/Card-bastille.png" },
    { name: "Bellamy", types: ["fighter", "dps", "gold", "break_wall"], link: "/Bellamy", img: "/images/7/7e/Card-bellamy.png" },
    { name: "Bonney Poseidon", types: ["fighter", "support", "gold"], link: "/Bonney", img: "/images/9/91/Card-bonney.png" },
    { name: "Brook", types: ["slasher", "support", "gold"], link: "/brook", img: "/images/7/76/Card-brook.png" },
    { name: "Capone gang bege", types: ["shooter", "dps", "gold", "break_wall"], link: "/Capone_Bege", img: "/images/c/c0/Card-capone.png" },
    { name: "Carrot", types: ["slasher", "especialist", "dps", "gold"], link: "/Carrot", img: "/images/8/8d/Card-carrot.png" },
    { name: "Tony Tony Chopper Gurren", types: ["fighter", "support", "gold", "break_wall"], link: "/Chopper", img: "/images/1/19/Card-chopper.png" },
    { name: "Crocodile", types: ["especialist", "tank", "gold", "break_wall", "bridge"], link: "/Crocodile", img: "/images/5/5d/Card-crocodile.png" },
    { name: "Dalmatian", types: ["slasher", "bruiser", "gold", "break_wall"], link: "/Dalmatian", img: "/images/9/99/Card-dalmatian.png" },
    { name: "Franky Sanitaria", types: ["shooter", "bruiser", "gold", "break_wall"], link: "/Franky", img: "/images/6/61/Card-franky.png" },
    { name: "Gecko Moria Coxinha", types: ["slasher", "support", "gold"], link: "/Gecko_Moria", img: "/images/f/fc/Moria_card.png" },
    { name: "Hina", types: ["fighter", "bruiser", "gold", "break_wall", "bridge"], link: "/Hina", img: "/images/5/57/Card-hina.png" },
    { name: "Jesus Burgess", types: ["fighter", "tank", "gold", "break_wall"], link: "/Jesus_Burgess", img: "/images/2/28/Card-burgess.png" },
    { name: "Eustass Kid Rag", types: ["shooter", "tank", "gold", "break_wall", "bridge"], link: "/Kid", img: "/images/9/9a/Card-kid.png" },
    { name: "Killer", types: ["slasher", "dps", "gold"], link: "/Killer", img: "/images/b/b2/Card-killer.png" },
    { name: "Koala", types: ["fighter", "dps", "gold"], link: "/Koala", img: "/images/f/f3/Card-koala.png" },
    { name: "Leo & Mansherry", types: ["especialist", "support", "gold", "bridge"], link: "/Leo", img: "/images/d/d9/Card-leo.png" },
    { name: "Monkey D. Luffy Visno", types: ["fighter", "bruiser", "gold", "break_wall"], link: "/Luffy", img: "/images/a/af/Card-luffy.png" },
    { name: "Nami", types: ["especialist", "dps", "gold", "break_wall"], link: "/nami", img: "/images/0/08/Card-nami.png" },
    { name: "Perona", types: ["especialist", "support", "gold", "break_wall"], link: "/Perona", img: "/images/6/6d/Card-perona.png" },
    { name: "Rebecca Ghoul Den Berry", types: ["slasher", "tank", "gold"], link: "/Rebecca", img: "/images/9/91/Card-rebecca.png" },
    { name: "Nico Robin", types: ["especialist", "dps", "gold", "break_wall", "bridge"], link: "/Robin", img: "/images/3/3f/Card-robin.png" },
    { name: "Roronoa zoro", types: ["slasher", "bruiser", "gold", "break_wall"], link: "/Roronoa_Zoro", img: "/images/6/6f/Card-zoro.png" },
    { name: "Ryuma", types: ["slasher", "dps", "gold"], link: "/Ryuma", img: "/images/a/ac/Card-ryuma.png" },
    { name: "Scratchmen Apoo", types: ["shooter", "support", "gold"], link: "/Apoo", img: "/images/9/90/Card-apoo.png" },
    { name: "Smoker Piseiro", types: ["fighter", "tank", "gold"], link: "/Smoker", img: "/images/f/fb/Card-smoker.png" },
    { name: "Trafalgar Law", types: ["slasher", "especialist", "dps", "gold", "break_wall"], link: "/Trafalgar_Law", img: "/images/b/b9/Card-law.png" },
    { name: "Urouge", types: ["fighter", "tank", "gold", "break_wall"], link: "/Urouge", img: "/images/9/98/Card-urouge.png" },
    { name: "Usopp", types: ["shooter", "dps", "gold", "break_wall"], link: "/Usopp", img: "/images/a/ac/Card-usopp.png" },
    { name: "Van Augur", types: ["shooter", "dps", "gold", "break_wall"], link: "/Van Augur", img: "/images/c/c7/Card-vanaugur.png" },
    { name: "Vinsmoke Ichiji", types: ["fighter", "bruiser", "gold", "break_wall"], link: "/Ichiji", img: "/images/8/8c/Card-ichiji.png" },
    { name: "Vinsmoke Niji", types: ["shooter", "dps", "gold"], link: "/Niji", img: "/images/6/66/Card-niji.png" },
    { name: "Vinsmoke Reiju Athena", types: ["especialist", "support", "gold"], link: "/Reiju", img: "/images/2/23/Card-reiju.png" },
    { name: "Vinsmoke Sanji", types: ["fighter", "dps", "gold", "break_wall"], link: "/Sanji", img: "/images/0/04/Card-sanji.png" },
    { name: "Vinsmoke Yonji", types: ["fighter", "tank", "gold", "break_wall"], link: "/Yonji", img: "/images/7/73/Card-yonji.png" },
    { name: "X-drake", types: ["fighter", "bruiser", "gold", "break_wall"], link: "/X_Drake", img: "/images/6/69/Card-drake.png" },
    { name: "Satori", types: ["support", "shooter", "especialist", "silver"], link: "/Satori", img: "/images/f/f3/Satori_card.png" },
    { name: "Gedatsu", types: ["fighter", "dps", "silver"], link: "/Gedatsu", img: "/images/f/f6/Gedatsu_card.png" },
    { name: "Ohm", types: ["tank", "slasher", "silver"], link: "/Ohm", img: "/images/1/1e/Ohm_card.png" },
    { name: "Shura", types: ["slasher", "dps", "silver"], link: "/Shura", img: "/images/2/2e/Shura_card.png" },
    { name: "Arlong", types: ["fighter", "bruiser", "silver", "break_wall"], link: "/Arlong", img: "/images/1/1e/Card-arlong.png" },
    { name: "Bepo", types: ["fighter", "dps", "silver"], link: "/Bepo", img: "/images/1/1d/Card-bepo.png" },
    { name: "Mr.2", types: ["fighter", "dps", "silver"], link: "/mr.2", img: "/images/2/27/Card-bonchan.png" },
    { name: "Buggy", types: ["shooter", "dps", "silver", "break_wall"], link: "/buggy", img: "/images/c/ca/Card-buggy.png" },
    { name: "Daddy Masterson", types: ["shooter", "dps", "silver"], link: "/Daddy_Masterson", img: "/images/2/20/Card-daddy.png" },
    { name: "mr.1 Daz Bonez Kolivier", types: ["slasher", "tank", "silver"], link: "/mr.1", img: "/images/6/61/Card-dazbonez.png" },
    { name: "Miss Doublefinger Zala", types: ["slasher", "bruiser", "silver"], link: "/Miss_Doublefinger", img: "/images/5/5f/Card-doublefinger.png" },
    { name: "Don Krieg", types: ["shooter", "dps", "silver"], link: "/don_Krieg", img: "/images/8/8f/Card-krieg.png" },
    { name: "Kuro", types: ["slasher", "dps", "silver"], link: "/kuro", img: "/images/3/3d/Card-kuro.png" },
    { name: "mr.3 Galdino", types: ["especialist", "support", "silver", "bridge"], link: "/mr.3", img: "/images/7/75/Card-mr3.png" },
    { name: "Tashigi", types: ["slasher", "dps", "silver"], link: "/tashigi", img: "/images/b/b8/Card-tashigi.png" },
    { name: "Nefertari Vivi", types: ["slasher", "support", "silver"], link: "/Vivi", img: "/images/9/9c/Card-vivi.png" },
    { name: "Wapol", types: ["shooter", "tank", "silver", "break_wall"], link: "/wapol", img: "/images/b/ba/Card-wapol.png" },
    { name: "Alvida", types: ["fighter", "support", "bronze"], link: "/Alvida", img: "/images/8/83/Card-alvida.png" },
    { name: "Buchi & Sham", types: ["slasher", "bruiser", "bronze"], link: "/Buchi", img: "/images/0/0b/Card-buchi.png" },
    { name: "Cabaji", types: ["slasher", "dps", "bronze"], link: "/Cabaji", img: "/images/9/9d/Card-cabaji.png" },
    { name: "Chew", types: ["shooter", "dps", "bronze", "break_wall"], link: "/Chew", img: "/images/0/0f/Card-chew.png" },
    { name: "Eric", types: ["shooter", "slasher", "dps", "bronze"], link: "/Eric", img: "/images/3/31/Card-eric.png" },
    { name: "Gin", types: ["fighter", "shooter", "dps", "bronze"], link: "/Gin", img: "/images/1/18/Card-gin.png" },
    { name: "Miss Goldenweek", types: ["support", "especialist", "bronze"], link: "/Goldenweek", img: "/images/0/0e/Card-goldenweek.png" },
    { name: "Hatchan", types: ["slasher", "support", "bronze"], link: "/Hatchan", img: "/images/3/31/Card-hatchan.png" },
    { name: "Jango", types: ["shooter", "support", "bronze"], link: "/Jango", img: "/images/4/48/Card-jango.png" },
    { name: "Kuroobi", types: ["fighter", "tank", "bronze", "break_wall"], link: "/Kuroobi", img: "/images/6/6a/Card-kuroobi.png" },
    { name: "Mohji", types: ["especialist", "bruiser", "bronze"], link: "/Mohji", img: "/images/5/58/Card-mohji.png" },
    { name: "Morgan", types: ["slasher", "bruiser", "bronze"], link: "/Morgan", img: "/images/4/43/Card-morgan.png" },
    { name: "Mr.4", types: ["shooter", "bruiser", "bronze"], link: "/Mr.4", img: "/images/9/90/Card-mr4.png" },
    { name: "Mr.5", types: ["shooter", "dps", "bronze"], link: "/Mr.5", img: "/images/4/49/Card-mr5.png" },
    { name: "Pearl", types: ["fighter", "especialist", "tank", "bronze"], link: "/Pearl", img: "/images/d/de/Card-pearl.png" },
  ];
 
  $(".filter--icon").on("click", function () {
    const id = $(this).attr("id");
 
    if ($(this).hasClass("all")) {
      $('.filter--icon.active').removeClass('active');
      $(".characters").addClass('show');
      $(".filter--icon.all").addClass('active');
      return false;
     } else {
     } else {
       if ((this.options.activate & Tooltip.ALL_ACTIVATIONS) == 0) {
       $(".filter--icon.all").removeClass('active');
        if (on_element.nodeName.toLowerCase () == 'a')
          this.options.activate = Tooltip.CLICK;
        else
          this.options.activate = Tooltip.HOVER;
      }
     }
     }
     if ((this.options.deactivate & Tooltip.ALL_DEACTIVATIONS) == 0 && !this.close_button)
 
       this.options.deactivate = Tooltip.LEAVE | Tooltip.CLICK_ELEM | Tooltip.ESCAPE;
     if ($(this).hasClass("active")) {
    document.body.appendChild (this.popup);
      $(this).removeClass('active');
    if (this.content) this.apply_styles (this.content, css); // After adding it to the document
       actives = $('.filter--icon.active');
     // Clickable links?
      query = "";
    if (this.content && this.options.mode == Tooltip.TRACK) {
 
      this.setHasLinks ();
      $.each(actives, function (key, item) {
      if (this.has_links) {
        query += "[data-type-" + item.id + "]";
         // If you track a tooltip with links, you'll never be able to click the links
      });
        this.options.mode = Tooltip.MOUSE;
 
      $(".characters" + query).addClass('show');
     } else {
      if ($(this).hasClass("tier")) {
         $('.filter--icon.tier.active').removeClass('active');
       }
       }
      $(this).addClass('active');
      $(".characters").removeClass('show');
      query = "";
      actives = $('.filter--icon.active');
      $.each(actives, function (key, item) {
        query += "[data-type-" + item.id + "]";
      });
      $(".characters" + query).addClass('show');
     }
     }
    // No further option checks. If nonsense is passed, you'll get nonsense or an exception.
  });
     this.popup.style.zIndex = "" + this.options.z_index;
 
     this.target            = on_element;
  $.each(characters, function (key, item) {
    this.open_timeout_id    = null;
     data = '';
    this.hide_timeout_id    = null;
     id = item.name.replace(/\s/g, '_').toLowerCase();
    this.size              = {width : 0, height : 0};
 
     this.setupEvents (EvtHandler.attach, 0);
     $.each(item.types, function (key, value) {
     this.ieFix = null;
      data += "data-type-" + value + " ";
     if (is_IE) {
     });
      // Display an invisible IFrame of the same size as the popup beneath it to make popups
 
       // correctly cover "windowed controls" such as form input fields in IE. For IE >=5.5, but
     $("#characters-container").append(
      // who still uses older IEs?? The technique is also known as a "shim". A good
       "<div id=" + id + " class='characters show' " + data + " >" +
       // description is at http://dev2dev.bea.com/lpt/a/39
       "<a href='https://wiki.gla.com.br/index.php" + item.link + "'>" +
      this.ieFix = document.createElement ('iframe');
       "<img src='" + item.img + "' alt='imagem de " + item.name + "' />" +
       this.ieFix.style.position = 'absolute';
      "</a>" +
       this.ieFix.style.border  = '0';
       "</div>"
      this.ieFix.style.margin   = '0';
    );
      this.ieFix.style.padding  = '0';
   });
      this.ieFix.style.zIndex  = "" + (this.options.z_index - 1); // Below the popup
 
      this.ieFix.tabIndex      = -1;
  $(".filter--searchButton").on("click", function () {
      this.ieFix.frameBorder    = '0';
    $(".filter--icon.active").removeClass('active');
      this.ieFix.style.display  = 'none';
    $(".characters.show").removeClass('show');
      document.body.appendChild (this.ieFix);
    if ($("#f-input").val().toLowerCase() != '') {
       this.ieFix.style.filter  = 'alpha(Opacity=0)'; // Ensure transparency
       $(".characters[id*=" + $("#f-input").val().toLowerCase() + "]").addClass('show');
     }  
     } else {
  },
      $(".characters").addClass('show');
 
  apply_styles : function (node, css)
  {
    if (css) {
      for (var styledef in css) node.style[styledef] = css[styledef];
     }
     }
    if (this.close_button) node.style.opacity = "1.0"; // Bug workaround.
  });
    // FF doesn't handle the close button at all if it is (partially) transparent...
    if (node.style.display == 'none') node.style.display = "";
  },


   setHasLinks : function ()
   $('#f-input').keypress(function (e) {
  {
     const key = e.which;
    if (this.close_button) { this.has_links = true; return; }
     if (key == 13) // the enter key code
     var lks = this.content.getElementsByTagName ('a');
     this.has_links = false;
    for (var i=0; i < lks.length; i++) {
      var href = lks[i].getAttribute ('href');
      if (href && href.length > 0) { this.has_links = true; return; }
    }
    // Check for form elements
    function check_for (within, names)
     {
     {
       if (names) {
       $('.filter--searchButton').click();
        for (var i=0; i < names.length; i++) {
          var elems = within.getElementsByTagName (names[i]);
          if (elems && elems.length > 0) return true;
        }
      }
       return false;
       return false;
     }
     }
     this.has_links = check_for (this.content, ['form', 'textarea', 'input', 'button', 'select']);
  });
  },
 
  //------- PERSONAGENS ---------
 
  //------- WANTED ---------
  const wanted_slashers = [
    { name: "Baby 5", wanteds: ["nami", "usopp", "mr. 3", "jango"], img: "/images/5/5e/Baby5_card.png" },
    { name: "Ohm", wanteds: ["robin", "nami", "brook", "zoro", "luffy", "sanji", "urouge", "ryuma", "van augur", "law", "niji", "crocodile", "cabaji"], img: "/images/1/1e/Ohm_card.png" },
     { name: "Roronoa Zoro", wanteds: ["robin", "nami", "brook", "chopper", "franky", "luffy", "sanji", "perona", "usopp", "capone", "kid", "van augur", "law", "yonji", "ichiji", "mr. 1", "mr. 2", "mr. 3", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "koala", "buggy", "gin", "mohji", "drake", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/6/6f/Card-zoro.png" },
    { name: "Shanks", wanteds: ["robin", "nami", "brook", "franky", "zoro", "luffy", "sanji", "bonney", "leo", "apoo", "rebecca", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "law", "yonji", "niji", "ichiji", "baby 5", "mr. 1", "mr. 2", "mr. 3", "doublefinger", "goldenweek", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "bellamy"], img: "/images/a/aa/Card-shanks.png" },
    { name: "Dracule Mihawk", wanteds: ["robin", "nami", "chopper", "luffy", "sanji", "bonney", "leo", "apoo", "urouge", "perona", "usopp", "ryuma", "capone", "van augur", "law", "reiju", "yonji", "niji", "ichiji", "baby 5", "mr. 2", "mr. 3", "doublefinger", "goldenweek", "mr. 4", "pearl", "arlong", "hatchan", "chew", "jango", "kuroobi", "buggy", "kuro", "krieg", "mohji", "morgan", "hawkins", "alvida", "crocodile"], img: "/images/9/91/Card-mihawk.png" },
    { name: "Killer", wanteds: ["rebecca", "van augur", "pearl", "jango", "buggy", "alvida"], img: "/images/b/b2/Card-killer.png" },
    { name: "Tashigi", wanteds: ["chopper", "zoro", "luffy", "sanji", "bonney", "urouge", "perona", "ryuma", "killer", "burgess", "kid", "reiju", "yonji", "baby 5", "mr. 1", "mr. 2", "mr. 4", "pearl", "arlong", "hatchan", "buchi", "jango", "kuroobi", "koala", "kuro", "gin", "mohji", "morgan", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/b/b8/Card-tashigi.png" },
    { name: "Roronoa Zoro (TS)", wanteds: ["chopper", "leo", "perona", "usopp", "capone", "mr. 3", "goldenweek", "pearl", "hatchan", "buchi", "jango", "buggy", "alvida"], img: "/images/7/74/Card-zorots.png" },
    { name: "Rebbeca", wanteds: ["franky", "luffy", "sanji", "urouge", "usopp", "ryuma", "killer", "capone", "van augur", "law", "yonji", "niji", "mr. 2", "doublefinger", "mr. 4", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "buggy", "kuro", "gin", "krieg", "morgan", "drake", "alvida"], img: "/images/9/91/Card-rebecca.png" },
    { name: "Carrot", wanteds: ["nami", "chopper", "luffy", "sanji", "leo", "leo", "usopp", "capone", "kid", "van augur", "law", "niji", "ichiji", "mr. 3", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "krieg", "mohji", "drake", "alvida"], img: "/images/8/8d/Card-carrot.png" },
    { name: "Shimotsuki Ryuma", wanteds: ["nami", "brook", "chopper", "franky", "sanji", "leo", "urouge", "perona", "capone", "law", "reiju", "yonji", "niji", "baby 5", "doublefinger", "goldenweek", "mr. 4", "bepo", "pearl", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "gin", "mohji", "morgan", "drake", "alvida", "crocodile"], img: "/images/a/ac/Card-ryuma.png" },
    { name: "Trafalgar Law", wanteds: ["luffy", "sanji", "leo", "apoo", "usopp", "kid", "reiju", "yonji", "niji", "ichiji", "baby 5", "doublefinger", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "buggy", "krieg", "drake", "alvida"], img: "/images/b/b9/Card-law.png" },
    { name: "Mr. 1", wanteds: ["chopper", "perona", "killer", "capone", "law", "niji", "baby 5", "mr. 2", "doublefinger", "mr. 4", "bepo", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "kuro", "krieg", "mohji", "morgan", "alvida", "wapol", "crocodile"], img: "/images/6/61/Card-dazbonez.png" },
    { name: "Bastille", wanteds: ["chopper", "zoro", "law", "doublefinger", "mr. 4", "arlong", "buchi", "kuro", "gin", "alvida", "bellamy"], img: "/images/1/13/Card-bastille.png" },
    { name: "Dalmatian", wanteds: ["capone", "mr. 2", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "mohji", "morgan", "alvida", "crocodile"], img: "/images/9/99/Card-dalmatian.png" },
    { name: "Morgan", wanteds: ["robin", "nami", "leo", "van augur", "baby 5", "goldenweek", "buchi", "chew", "jango", "alvida"], img: "/images/4/43/Card-morgan.png" },
    { name: "Cabaji", wanteds: ["nami", "chopper", "chew", "jango", "alvida"], img: "/images/9/9d/Card-cabaji.png" },
    { name: "Kuro", wanteds: ["nami", "pearl", "hatchan", "buchi", "jango", "koala", "krieg", "mohji", "alvida", "bellamy"], img: "/images/3/3d/Card-kuro.png" },
    { name: "Eric", wanteds: ["nami", "brook", "apoo", "usopp", "reiju", "mr. 3", "goldenweek", "mr. 5", "jango", "buggy", "alvida"], img: "/images/3/31/Card-eric.png" },
    { name: "Miss Doublefinger", wanteds: ["chopper", "luffy", "sanji", "urouge", "rebecca", "perona", "usopp", "burgess", "capone", "kid", "reiju", "yonji", "pearl", "hatchan", "buchi", "jango", "kuroobi", "mohji", "alvida", "wapol"], img: "/images/5/5f/Card-doublefinger.png" },
  ];
 
  const wanted_shooters = [
    { name: "Baby 5", wanteds: ["nami", "usopp", "mr. 3", "jango"], img: "/images/5/5e/Baby5_card.png" },
    { name: "Daddy Masterson", wanteds: ["robin", "nami", "apoo", "apoo", "usopp", "niji", "mr. 3", "goldenweek", "mr. 5", "chew", "jango", "buggy", "krieg"], img: "/images/2/20/Card-daddy.png" },
    { name: "Enel", wanteds: ["robin", "usopp", "jango", "cabaji"], img: "/images/8/85/Enel_card.png" },
    { name: "Capone Gang Bege", wanteds: ["robin", "nami", "brook", "chopper", "franky", "luffy", "sanji", "leo", "apoo", "rebecca", "usopp", "killer", "burgess", "van augur", "law", "reiju", "yonji", "niji", "ichiji", "baby 5", "mr. 2", "mr. 3", "goldenweek", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "krieg", "mohji", "morgan", "alvida", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/c/c0/Card-capone.png" },
    { name: "Franky", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "leo", "urouge", "usopp", "ryuma", "burgess", "capone", "kid", "van augur", "law", "yonji", "niji", "ichiji", "baby 5", "mr. 1", "mr. 2", "doublefinger", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "mohji", "morgan", "hawkins", "alvida", "crocodile", "cabaji"], img: "/images/6/61/Card-franky.png" },
    { name: "Eustass kid", wanteds: ["chopper", "luffy", "usopp", "kid", "baby 5", "mr. 1", "mr. 2", "doublefinger", "mr. 4", "pearl", "buchi", "gin", "hawkins", "alvida", "crocodile"], img: "/images/9/9a/Card-kid.png" },
    { name: "Van Augur", wanteds: ["robin", "nami", "brook", "chopper", "franky", "luffy", "bonney", "leo", "apoo", "urouge", "usopp", "killer", "capone", "van augur", "law", "reiju", "yonji", "niji", "ichiji", "baby 5", "mr. 2", "mr. 3", "goldenweek", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "krieg", "mohji", "morgan", "drake", "alvida", "wapol", "cabaji"], img: "/images/c/c7/Card-vanaugur.png" },
    { name: "Portgas D. Ace", wanteds: ["nami", "brook", "chopper", "bonney", "leo", "apoo", "perona", "usopp", "kid", "van augur", "niji", "mr. 3", "mr. 5", "bepo", "arlong", "buchi", "chew", "jango", "kuroobi", "buggy", "krieg", "mohji"], img: "/images/4/40/Card-ace.png" },
    { name: "Usopp (TS)", wanteds: ["brook", "chopper", "leo", "apoo", "perona", "usopp", "van augur", "niji", "mr. 3", "goldenweek", "mr. 5", "hatchan", "chew", "jango", "buggy", "krieg", "alvida"], img: "/images/c/cc/Card-usoppts.png" },
    { name: "Donquixote Doflamingo", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "bonney", "leo", "apoo", "urouge", "perona", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "law", "reiju", "yonji", "niji", "ichiji", "mr. 2", "mr. 3", "doublefinger", "goldenweek", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "buchi", "jango", "kuroobi", "koala", "buggy", "gin", "krieg", "mohji", "morgan", "drake", "alvida"], img: "/images/8/8d/Card-doflamingo.png" },
    { name: "Buggy", wanteds: ["nami", "chopper", "bonney", "apoo", "perona", "usopp", "van augur", "baby 5", "mr. 4", "mr. 5", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "krieg", "mohji", "alvida", "cabaji"], img: "/images/c/ca/Card-buggy.png" },
    { name: "Vinsmoke Niji", wanteds: ["nami", "apoo", "van augur", "reiju", "mr. 3", "mr. 5", "buchi", "jango", "buggy", "krieg", "alvida"], img: "/images/6/66/Card-niji.png" },
    { name: "Wapol", wanteds: ["robin", "nami", "brook", "chopper", "zoro", "luffy", "sanji", "urouge", "rebecca", "perona", "ryuma", "killer", "burgess", "kid", "law", "reiju", "yonji", "ichiji", "baby 5", "mr. 1", "doublefinger", "mr. 4", "pearl", "arlong", "buchi", "jango", "kuroobi", "kuro", "mohji", "morgan", "hawkins", "wapol", "crocodile"], img: "/images/b/ba/Card-wapol.png" },
    { name: "Franky (TS)", wanteds: ["chopper", "zoro", "usopp", "capone", "kid", "yonji", "mr. 1", "doublefinger", "mr. 4", "pearl", "arlong", "buchi", "kuro", "alvida"], img: "/images/d/d0/Card-frankyts.png" },
    { name: "Borsalino Kizaru", wanteds: ["capone", "jango", "drake", "alvida"], img: "/images/3/32/Card-kizaru.png" },
    { name: "Don Krieg", wanteds: ["brook", "chopper", "apoo", "capone", "reiju", "goldenweek", "mr. 5", "hatchan", "buchi", "chew", "jango", "buggy", "drake", "alvida"], img: "/images/8/8f/Card-krieg.png" },
    { name: "Eric", wanteds: ["nami", "brook", "apoo", "usopp", "reiju", "mr. 3", "goldenweek", "mr. 5", "jango", "buggy", "alvida"], img: "/images/3/31/Card-eric.png" },
    { name: "Mr. 4", wanteds: ["chopper", "zoro", "bonney", "goldenweek", "buchi", "jango", "morgan"], img: "/images/9/90/Card-mr4.png" },
    { name: "Mr. 5", wanteds: ["brook", "sanji", "bonney", "goldenweek", "jango", "kuroobi"], img: "/images/4/49/Card-mr5.png" },
    { name: "Gin", wanteds: ["chopper", "capone", "van augur", "baby 5", "mr. 3", "goldenweek", "bepo", "buchi", "gin", "krieg", "mohji", "drake", "alvida", "cabaji"], img: "/images/1/18/Card-gin.png" },
    { name: "Chew", wanteds: ["mr. 5"], img: "/images/0/0f/Card-chew.png" },
    { name: "Usopp", wanteds: ["nami", "brook", "chopper", "leo", "apoo", "reiju", "niji", "mr. 3", "mr. 5", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "buggy", "krieg", "alvida", "wapol"], img: "/images/a/ac/Card-usopp.png" },
  ];


   setupEvents : function (op, state)
   const wanted_fighters = [
  {
    { name: "Sabo", wanteds: ["nami", "niji", "mr. 2", "mr. 3", "goldenweek", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "cabaji"], img: "/images/0/04/Card-sabo.png" },
     if (state < 0 || state == 0 && this.event_state < state) {
    { name: "X-Drake", wanteds: ["robin", "brook", "chopper", "franky", "zoro", "sanji", "bonney", "leo", "apoo", "urouge", "rebecca", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "law", "reiju", "yonji", "ichiji", "baby 5", "mr. 1", "mr. 3", "doublefinger", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji", "bellamy"], img: "/images/6/69/Card-drake.png" },
      if (this.options.activate & Tooltip.HOVER)
    { name: "Hina", wanteds: ["robin", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "leo", "urouge", "rebecca", "perona", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "reiju", "yonji", "ichiji", "baby 5", "mr. 1", "mr. 3", "doublefinger", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/5/57/Card-hina.png" },
        op (this.target, Tooltip.mouse_in, this.eventShow);
    { name: "Smoker", wanteds: ["robin", "nami", "zoro", "luffy", "urouge", "capone", "van augur", "law", "baby 5", "mr. 1", "mr. 2", "mr. 3", "mr. 5", "krieg", "alvida"], img: "/images/f/fb/Card-smoker.png" },
      if (this.options.activate & Tooltip.FOCUS)
    { name: "Bellamy", wanteds: ["nami", "brook", "chopper", "zoro", "luffy", "sanji", "apoo", "urouge", "rebecca", "ryuma", "burgess", "van augur", "law", "yonji", "ichiji", "baby 5", "mr. 1", "mr. 2", "doublefinger", "goldenweek", "mr. 4", "bepo", "pearl", "arlong", "buchi", "jango", "kuroobi", "koala", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/7/7e/Card-bellamy.png" },
        op (this.target, 'focus', this.eventFocus);
    { name: "Urouge", wanteds: ["nami", "sanji", "apoo", "usopp", "capone", "chew"], img: "/images/9/98/Card-urouge.png" },
      if (   (this.options.activate & Tooltip.CLICK)
    { name: "Boa Hancock", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "leo", "urouge", "perona", "usopp", "ryuma", "burgess", "capone", "van augur", "law", "reiju", "yonji", "ichiji", "baby 5", "mr. 1", "mr. 3", "mr. 5", "bepo", "arlong", "hatchan", "chew", "jango", "kuroobi", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji", "bellamy"], img: "/images/4/47/Card-hancock.png" },
          && (this.options.deactivate & Tooltip.CLICK_ELEM)) {
    { name: "VinsmokeYonji", wanteds: ["mr. 4", "kuro"], img: "/images/7/73/Card-yonji.png" },
        op (this.target, 'click', this.eventToggle);
    { name: "Vinsmoke Ichiji", wanteds: ["robin", "nami", "brook", "sanji", "apoo", "urouge", "rebecca", "usopp", "capone", "ichiji", "baby 5", "mr. 3", "mr. 5", "bepo", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/8/8c/Card-ichiji.png" },
      } else {
    { name: "Mr. 2", wanteds: ["bonney", "usopp", "hatchan", "krieg", "alvida"], img: "/images/2/27/Card-bonchan.png" },
        if (this.options.activate & Tooltip.CLICK)
    { name: "Vinsmoke Sanji (TS)", wanteds: ["nami", "chopper", "usopp", "law", "mr. 2", "doublefinger", "mr. 4", "mr. 5", "bepo", "pearl", "buchi", "chew", "jango", "koala", "buggy", "krieg", "mohji", "morgan", "alvida", "wapol", "cabaji"], img: "/images/7/7a/Card-sanjits.png" },
          op (this.target, 'click', this.eventClick);
    { name: "Monkey D. Luffy (TS)", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "leo", "apoo", "urouge", "rebecca", "perona", "usopp", "ryuma", "killer", "burgess", "kid", "law", "yonji", "niji", "ichiji", "mr. 1", "mr. 2", "doublefinger", "goldenweek", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "buggy", "kuro", "gin", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/e/ed/Card-luffyts.png" },
        if (this.options.deactivate & Tooltip.CLICK_ELEM)
    { name: "Koala", wanteds: ["robin", "nami", "brook", "franky", "zoro", "luffy", "sanji", "leo", "apoo", "urouge", "usopp", "killer", "burgess", "capone", "van augur", "law", "reiju", "yonji", "mr. 1", "mr. 2", "doublefinger", "mr. 4", "bepo", "pearl", "arlong", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "crocodile", "cabaji", "bellamy"], img: "/images/f/f3/Card-koala.png" },
          op (this.target, 'click', this.eventClose);
    { name: "Burgess", wanteds: ["robin", "nami", "brook", "franky", "zoro", "luffy", "sanji", "rebecca", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "law", "yonji", "niji", "ichiji", "mr. 1", "mr. 2", "doublefinger", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "kuroobi", "koala", "buggy", "kuro", "gin", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/2/28/Card-burgess.png" },
    { name: "Monkey D. Luffy", wanteds: ["brook", "chopper", "franky", "sanji", "leo", "usopp", "burgess", "kid", "law", "mr. 1", "mr. 2", "mr. 4", "mr. 5", "pearl", "arlong", "hatchan", "chew", "jango", "kuroobi", "koala", "buggy", "morgan", "alvida", "wapol", "cabaji"], img: "/images/a/af/Card-luffy.png" },
    { name: "Bepo", wanteds: ["zoro", "luffy", "sanji", "pearl", "arlong", "buchi", "kuro", "mohji", "morgan", "drake", "alvida"], img: "/images/1/1d/Card-bepo.png" },
     { name: "Vinsmoke Sanji", wanteds: ["brook", "chopper", "usopp", "kid", "mr. 4", "mr. 5", "pearl", "hatchan", "buchi", "chew", "jango", "kuroobi", "buggy", "gin", "morgan", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/0/04/Card-sanji.png" },
    { name: "Arlong", wanteds: ["mr. 2", "chew", "alvida"], img: "/images/1/1e/Card-arlong.png" },
    { name: "Gin", wanteds: ["chopper", "capone", "van augur", "baby 5", "mr. 3", "goldenweek", "bepo", "buchi", "gin", "krieg", "mohji", "drake", "alvida", "cabaji"], img: "/images/1/18/Card-gin.png" },
  ];
 
  const wanted_especialists = [
    { name: "Sakazuki Akainu", wanteds: ["capone", "bellamy"], img: "/images/b/b0/Card_akainu.png" },
    { name: "Uta", wanteds: ["nami", "usopp", "jango", "buggy"], img: "/images/2/22/Card_uta.png" },
    { name: "Sabo", wanteds: ["nami", "niji", "mr. 2", "mr. 3", "goldenweek", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "cabaji"], img: "/images/0/04/Card-sabo.png" },
    { name: "Enel", wanteds: ["robin", "usopp", "jango", "cabaji"], img: "/images/8/85/Enel_card.png" },
    { name: "Vinsmoke Reiju", wanteds: ["brook", "bonney", "urouge", "rebecca", "killer", "burgess", "kid", "reiju", "yonji", "baby 5", "mr. 2", "doublefinger", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "koala", "kuro", "gin", "mohji", "morgan", "hawkins", "alvida", "crocodile", "cabaji"], img: "/images/2/23/Card-reiju.png" },
    { name: "Portgas D. Ace", wanteds: ["nami", "brook", "chopper", "bonney", "leo", "apoo", "perona", "usopp", "kid", "van augur", "niji", "mr. 3", "mr. 5", "bepo", "arlong", "buchi", "chew", "jango", "kuroobi", "buggy", "krieg", "mohji"], img: "/images/4/40/Card-ace.png" },
    { name: "Donquixte Doflamingo", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "bonney", "leo", "apoo", "urouge", "perona", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "law", "reiju", "yonji", "niji", "ichiji", "mr. 2", "mr. 3", "doublefinger", "goldenweek", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "buchi", "jango", "kuroobi", "koala", "buggy", "gin", "krieg", "mohji", "morgan", "drake", "alvida"], img: "/images/8/8d/Card-doflamingo.png" },
    { name: "Borsalino Kizaru", wanteds: ["capone", "jango", "drake", "alvida"], img: "/images/3/32/Card-kizaru.png" },
    { name: "Trafalgar Law", wanteds: ["luffy", "sanji", "leo", "apoo", "usopp", "kid", "reiju", "yonji", "niji", "ichiji", "baby 5", "doublefinger", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "buggy", "krieg", "drake", "alvida"], img: "/images/b/b9/Card-law.png" },
    { name: "Carrot", wanteds: ["nami", "chopper", "luffy", "sanji", "leo", "leo", "usopp", "capone", "kid", "van augur", "law", "niji", "ichiji", "mr. 3", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "krieg", "mohji", "drake", "alvida"], img: "/images/8/8d/Card-carrot.png" },
    { name: "Nami (TS)", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "bonney", "leo", "apoo", "urouge", "rebecca", "usopp", "ryuma", "killer", "kid", "law", "reiju", "yonji", "niji", "ichiji", "baby 5", "mr. 1", "mr. 2", "mr. 3", "doublefinger", "goldenweek", "mr. 4", "mr. 5", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/3/35/Card-namits.png" },
    { name: "Nami", wanteds: ["chopper", "bonney", "leo", "apoo", "burgess", "law", "niji", "mr. 3", "doublefinger", "goldenweek", "mr. 5", "pearl", "hatchan", "buchi", "chew", "jango", "buggy", "krieg", "mohji", "alvida"], img: "/images/0/08/Card-nami.png" },
    { name: "Nico Robin", wanteds: ["nami", "chopper", "leo", "apoo", "usopp", "mr. 3", "arlong", "buchi", "chew", "jango", "buggy", "mohji", "alvida"], img: "/images/3/3f/Card-robin.png" },
    { name: "Nico Robin (TS)", wanteds: ["bonney", "leo", "apoo", "perona", "mr. 3", "buchi", "chew", "jango", "alvida"], img: "/images/b/b0/Card-robints.png" },
    { name: "Bartolomeo", wanteds: ["urouge", "reiju", "pearl", "arlong", "jango", "kuroobi", "koala", "morgan", "drake", "alvida"], img: "/images/a/a9/Card-barto.png" },
    { name: "Marshall D. Teach", wanteds: ["bonney", "perona", "killer", "capone", "mr. 2", "goldenweek", "mr. 5", "pearl", "buchi", "chew", "jango", "buggy", "alvida"], img: "/images/f/ff/Card-kurohige.png" },
    { name: "Crocodile", wanteds: ["nami", "yonji", "mr. 1", "alvida"], img: "/images/5/5d/Card-crocodile.png" },
    { name: "Bartolomew Kuma", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "urouge", "rebecca", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "yonji", "niji", "ichiji", "baby 5", "mr. 1", "mr. 2", "mr. 3", "doublefinger", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji", "bellamy"], img: "/images/b/b5/Card-kuma.png" },
    { name: "Basil Hawkins", wanteds: ["luffy", "urouge", "yonji", "pearl", "kuroobi", "alvida"], img: "/images/8/89/Card-hawkins.png" },
    { name: "Mohji", wanteds: ["alvida", "bonney", "buggy", "pearl", "van augur"], img: "/images/5/58/Card-mohji.png" },
    { name: "Leo & Mansherry", wanteds: ["alvida", "bonney", "mohji"], img: "/images/d/d9/Card-leo.png" },
  ];
 
  function filterAndAppend(array, value, id) {
    whoDo = array.filter(
      function (v) {
        return v.wanteds.includes(value);
       }
       }
       this.event_state = state;
    );
 
    $.each(whoDo, function (key, item) {
       $(".wantedPortraits#" + id).append(
        "<div class='wantedPortrait' >" +
        "<img src='" + item.img + "' alt='imagem de " + item.name + "' />" +
        "</div>"
      );
    })
  }
 
  $("#selectbox-wanted").on("input", function () {
    const value = $(this).val();
 
    if ($(".wantedPortrait"))
      $(".wantedPortrait").remove();
 
    filterAndAppend(wanted_shooters, value, "wanted-shooter");
    filterAndAppend(wanted_slashers, value, "wanted-slasher");
    filterAndAppend(wanted_fighters, value, "wanted-fighter");
    filterAndAppend(wanted_especialists, value, "wanted-especialist");
  });
  //------- WANTED ---------
 
  //------- SKILL TAB ---------
  $('.tab-skill').on('click', function () {
    $('.tab-skill.active').removeClass('active');
    $(this).addClass('active');
    const skillId = $(this).data('skill-id');
    if ($(".skillInfo[data-skill-id=" + skillId + "]")) {
      $(".skillInfo.active").removeClass('active');
      $(".skillInfo[data-skill-id=" + skillId + "]").addClass('active');
     }
     }
    if (state < 0 || state == 1 && this.event_state < state) {
  });
      if (this.options.deactivate & Tooltip.MOUSE_LEAVE) {
  //------- SKILL TAB ---------
        op (this.target, Tooltip.mouse_out, this.eventHide);
 
        op (this.popup, Tooltip.mouse_out, this.eventHide);
  //------- CALCULATOR XP ---------
        if (this.options.target) op (this.options.target, Tooltip.mouse_out, this.eventHide);
  const maximum_level = 110;
      }
  const tier_values = {
      if (this.options.deactivate & Tooltip.LOSE_FOCUS)
    "diamond": 1,
        op (this.target, 'blur', this.eventHide);
    "gold": 1,
      if (   (this.options.deactivate & Tooltip.CLICK_TIP)
    "silver": 2,
          && (this.options.mode != Tooltip.TRACK))
    "bronze": 3
        op (this.popup, 'click', this.eventClose);      
  };
     
 
      // Some more event handling
  $(".calcXp--tierIcon").on("click", function () {
      if (this.hide_delay > 0) {
    $(".calcXp--tierIcon.active").removeClass('active');
        if (!(this.options.activate & Tooltip.HOVER))
    $(this).addClass('active');
          op (this.popup, Tooltip.mouse_in, this.eventShow);
  });
        op (this.popup, 'mousemove', this.eventShow);
 
      }
  $("#calculate-btn").on('click', function () {
      this.event_state = state;
    getNeededPotions();
     }
  });
    if (state < 0 && this.tracks)
 
      op (this.target, 'mousemove', this.eventTrack);
   function calcMissingXpInPotions() {
  },
    const currentPercentOfXp = $("#char-currentPercentOfXp").val() != "" ? $("#char-currentPercentOfXp").val() : 100;
 
    const currentLevel = $("#char-level").val() != "" ? $("#char-level").val() : 1;
  remove: function ()
    const levelToUp = $("#char-levelToUp").val() != "" ? $("#char-levelToUp").val() : 110;
  {
    const charTier = $(".calcXp--tierIcon.active").length != 0 ? tier_values[$(".calcXp--tierIcon.active").attr('id')] : tier_values["gold"];
    this.hide_now ();
 
     this.setupEvents (EvtHandler.remove, -1);
    const percentToUp = 100 - currentPercentOfXp;
     this.tip_creator = null;
     const currentXp = ((50 * (Math.pow((currentLevel - 1), 3)) - 150 * (Math.pow((currentLevel - 1), 2)) + 400 * (currentLevel - 1)) / 3) + ((50 * Math.pow(currentLevel, 2) - 150 * currentLevel + 200) * percentToUp / 100);
     document.body.removeElement (this.popup);
     const desiredXp = (50 * (Math.pow((levelToUp - 1), 3)) - 150 * (Math.pow((levelToUp - 1), 2)) + 400 * (levelToUp - 1)) / 3;
    if (this.ieFix) document.body.removeElement (this.ieFix);
     const missingXp = Math.round((desiredXp - currentXp));
  },
 
 
     const missingPotions = {
  show : function (evt)
      "small": Math.ceil((missingXp / (1000 * charTier))),
  {
      "medium": (missingXp / (10000 * charTier)).toFixed(1),
     this.show_tip (evt, true);
      "big": (missingXp / (100000 * charTier)).toFixed(2)
   },
    };
 
 
   show_focus : function (evt) // Show on focus
     return missingPotions;
  {
   }
     this.show_tip (evt, false);
 
  },
   function calcPotions() {
 
     const missingPotions = calcMissingXpInPotions();
  show_click : function (evt)
 
  {
    var complementaryPotS;
     this.show_tip (evt, false);
    var complementaryPotM;
     if (this.target.nodeName.toLowerCase () == 'a') return EvtHandler.killEvt (evt); else return false;
    potS = missingPotions['small'];
  },
     potM = missingPotions['medium'];
 
     potB = missingPotions['big'];
  toggle : function (evt)
 
  {
     if (String(potS).slice(-1) == "0") {
     if (this.popup.style.display != 'none' && this.popup.style.display != null) {
       potM = Math.ceil(parseFloat(potM));
       this.hide_now (evt);
     } else {
     } else {
       this.show_tip (evt, true);
       potM = Math.floor(potM);
      complementaryPotS = potS - potM * 10;
     }
     }
    if (this.target.nodeName.toLowerCase () == 'a') return EvtHandler.killEvt (evt); else return false;
  },


  show_tip : function (evt, is_mouse_evt)
     if (String(potM).slice(-1) == "0") {
  {
       potM = Math.ceil((parseFloat(potM)));
     if (this.hide_timeout_id != null) window.clearTimeout (this.hide_timeout_id);
       potB = Math.floor(potB);
    this.hide_timeout_id = null;
    if (this.popup.style.display != 'none' && this.popup.style.display != null) return;
    if (this.tip_creator) {
       // Dynamically created tooltip.
      try {
        this.content = this.tip_creator (evt);
      } catch (ex) {
        // Oops! Indicate that something went wrong!
        var error_msg = document.createElement ('div');
        error_msg.appendChild (
          document.createElement ('b').appendChild (
            document.createTextNode ('Exception: ' + ex.name)));
        error_msg.appendChild(document.createElement ('br'));
        error_msg.appendChild (document.createTextNode (ex.message));
        if (typeof (ex.fileName) != 'undefined' &&
            typeof (ex.lineNumber) != 'undefined') {
          error_msg.appendChild(document.createElement ('br'));
          error_msg.appendChild (document.createTextNode ('File ' + ex.fileName));
          error_msg.appendChild(document.createElement ('br'));
          error_msg.appendChild (document.createTextNode ('Line ' + ex.lineNumber));
        }
        this.content = error_msg;
      }
      // Our wrapper has at most two children: the close button, and the content. Don't remove
      // the close button, if any.
       if (this.popup.firstChild.lastChild && this.popup.firstChild.lastChild != this.close_button)
        this.popup.firstChild.removeChild (this.popup.firstChild.lastChild);
      this.popup.firstChild.appendChild (this.content);
      this.apply_styles (this.content, this.css);
      if (this.options.mode == Tooltip.TRACK) this.setHasLinks ();
     }
     }
     // Position it now. It must be positioned before the timeout below!
     else {
    this.position_tip (evt, is_mouse_evt);
      potB = Math.floor(potB)
    if (Tooltips.debug) {
       complementaryPotM = potM - potB * 10
       alert ('Position: x = ' + this.popup.style.left + ' y = ' + this.popup.style.top);
     }
     }
    this.setupEvents (EvtHandler.attach, 1);
 
     if (this.options.mode == Tooltip.TRACK) {
     const potions = {
       if (this.has_links) {
       "small": complementaryPotS,
        if (this.tracks) EvtHandler.remove (this.target, 'mousemove', this.eventTrack);
       "medium": complementaryPotM,
        this.tracks = false;
       "big": potB
       } else {
        if (!this.tracks) EvtHandler.attach (this.target, 'mousemove', this.eventTrack);
        this.tracks = true;
       }
     }
     }
     if (this.options.open_delay > 0) {
 
      var obj = this;
     return potions;
      this.open_timout_id =
  }
        window.setTimeout (function () {obj.show_now (obj);}, this.options.open_delay);
 
     } else
  function getNeededPotions() {
      this.show_now (this);
    const potions = calcPotions();
  },
     const resultsArea = $("#calc-result");
 
 
  show_now : function (elem)
     resultsArea.html('');
  {
 
     if (elem.popup.style.display != 'none' && elem.popup.style.display != null) return;
     if (potions["big"]) {
    Tooltips.register (elem);
       resultsArea.append(
     if (elem.ieFix) {
        "<div class='badge'>" +
       elem.ieFix.style.top    = elem.popup.style.top;
        "<img src='/images/a/a5/Bigexppot.png' class='calcXp--xpIcon' />" +
      elem.ieFix.style.left    = elem.popup.style.left;
        "<span class='calcXp--numberOfPots'>" + potions['big'] + "</span>" +
      elem.ieFix.style.width  = elem.size.width + "px";
        "</div>"
      elem.ieFix.style.height  = elem.size.height + "px";
       );
       elem.ieFix.style.display = "";
     }
     }
     elem.popup.style.display = ""; // Finally show it
 
    if (  (elem.options.deactivate & Tooltip.ESCAPE)
 
         && typeof (elem.popup.focus) == 'function') {
     if (potions["medium"]) {
      // We need to attach this event globally.
      resultsArea.append(
       EvtHandler.attach (document, 'keydown', elem.eventKey);
        "<div class='badge'>" +
        "<img src='/images/d/df/Medexppot.png' class='calcXp--xpIcon' />" +
         "<span class='calcXp--numberOfPots'>" + potions['medium'] + "</span>" +
        "</div>"
       );
     }
     }
    elem.open_timeout_id = null;
 
    // Callback
 
     if (typeof (elem.options.onopen) == 'function') elem.options.onopen (elem);
     if (potions["small"]) {
  },
      resultsArea.append(
 
        "<div class='badge'>" +
  track : function (evt)
        "<img src='/images/5/5a/Smallexppot.png' class='calcXp--xpIcon' />" +
  {
        "<span class='calcXp--numberOfPots'>" + potions['small'] + "</span>" +
    this.position_tip (evt, true);
        "</div>"
    // Also move the shim!
      );
    if (this.ieFix) {
      this.ieFix.style.top    = this.popup.style.top;
      this.ieFix.style.left    = this.popup.style.left;
      this.ieFix.style.width  = this.size.width + "px";
      this.ieFix.style.height  = this.size.height + "px";
     }
     }
   },
   }
    
   //------- CALCULATOR XP ---------
   size_change : function ()
 
  {
  //------- VIDEO SELECTOR ---------
     // If your content is such that it changes, make sure this is called after each size change.
   $(".video-selector").on("click", function () {
     // Unfortunately, I have found no way of monitoring size changes of this.popup and then doing
     $(".video-selector.active").removeClass("active");
     // this automatically. See for instance the "toggle" example (the 12th) on the example page at
     $(this).addClass("active");
     // http://commons.wikimedia.org/wiki/MediaWiki:Tooltips.js/Documentation/Examples
 
     if (this.popup.style.display != 'none' && this.popup.style.display != null) {
     const value = $(this).data("value");
      // We're visible. Make sure the shim gets resized, too!
    const obj = eval('(' + value + ')');
       this.size = {width : this.popup.offsetWidth, height: this.popup.offsetHeight};
     $("video[data-type-" + obj.select + "].active").removeClass('active');
       if (this.ieFix) {
    const index = obj.showId - 1;
         this.ieFix.style.top    = this.popup.style.top;
     $("video[data-type-" + obj.select + "]").eq(index).addClass('active');
         this.ieFix.style.left    = this.popup.style.left;
  });
         this.ieFix.style.width  = this.size.width + "px";
  //------- VIDEO SELECTOR ---------
         this.ieFix.style.height  = this.size.height + "px";
  //-------- gurren
  $(document).ready(function () {
    // Alternar entre mostrar e ocultar abas ao clicar
    $('.mostrar-aba').click(function () {
       var aba_id = $(this).attr('data-aba');
      var aba_selecionada = $("#aba-" + aba_id);
 
       if (aba_selecionada.hasClass('atual')) {
         aba_selecionada.removeClass('atual'); // Oculta a aba se já estiver ativa
        $(this).removeClass('ativa'); // Remove a classe ativa do botão
      } else {
        $('.aba').removeClass('atual'); // Oculta todas as abas
         aba_selecionada.addClass('atual'); // Exibe a aba correspondente
         $('.mostrar-aba').removeClass('ativa'); // Remove a classe ativa de outros botões
         $(this).addClass('ativa'); // Adiciona a classe ativa ao botão clicado
       }
       }
    });
    // Exibir aba correspondente ao hash da URL
    var url = location.href;
    var hash = url.split('#')[1];
    if (hash != null && hash.length > 0) {
      $("#aba-" + hash).addClass('atual'); // Exibe a aba do hash
      $('*[data-aba="' + hash + '"]').addClass('ativa'); // Ativa o botão correspondente
     }
     }
   },
   });
   
});
  position_tip : function (evt, is_mouse_evt)
 
  {
 
     var view = {width  : this.viewport ('Width'),
//------- 2222222222222222222222222222222222222222222222222222222222222222222222 ---------
                height : this.viewport ('Height')};
/*
     var off  = {left  : this.scroll_offset ('Left'),
(function () {
                top    : this.scroll_offset ('Top')};
     'use strict';
     var x = 0, y = 0;
 
     var offset = null;
     var STORAGE_KEY = 'gla-wiki-theme';
    // Calculate the position
     var DARK_CLASS = 'gla-dark-mode';
     if (is_mouse_evt && this.options.mode != Tooltip.FIXED) {
     var BUTTON_ID = 'gla-darkmode-toggle';
      var mouse_delta = EvtHandler.mouse_offset ();
 
      if (Tooltips.debug && mouse_delta) {
     function getSavedTheme() {
         alert ("Mouse offsets: x = " + mouse_delta.x + ", y = " + mouse_delta.y);
        try {
      }
            return localStorage.getItem(STORAGE_KEY);
      x = (evt.pageX || (evt.clientX + off.left - (mouse_delta ? mouse_delta.x : 0)));
        } catch (e) {
      y = (evt.pageY || (evt.clientY + off.top - (mouse_delta ? mouse_delta.y : 0)));
            return null;
      offset = 'mouse_offset';
         }
    } else {
    }
      var tgt = this.options.target || this.target;
 
      var pos = this.position (tgt);
    function saveTheme(theme) {
      switch (this.options.anchor) {
        try {
        default:
            localStorage.setItem(STORAGE_KEY, theme);
        case Tooltip.BOTTOM_LEFT:
        } catch (e) {
          x = pos.x; y = pos.y + tgt.offsetHeight;
            // Ignora caso o navegador bloqueie localStorage
          break;
         }
         case Tooltip.BOTTOM_RIGHT:
          x = pos.x + tgt.offsetWidth; y = pos.y + tgt.offsetHeight;
          break;
        case Tooltip.TOP_LEFT:
          x = pos.x; y = pos.y;
          break;
        case Tooltip.TOP_RIGHT:
          x = pos.x + tgt.offsetWidth; y = pos.y;
          break;
      }
      offset = 'fixed_offset';
     }
     }
   
    x = x + this.options[offset].x * this.options[offset].dx;
    y = y + this.options[offset].y * this.options[offset].dy;


     this.size = this.calculate_dimension ();
     function isDarkMode() {
    if (this.options[offset].dx < 0) x = x - this.size.width;
        return document.documentElement.classList.contains(DARK_CLASS);
    if (this.options[offset].dy < 0) y = y - this.size.height;
   
    // Now make sure we're within the view.
    if (x + this.size.width > off.left + view.width) x = off.left + view.width - this.size.width;
    if (x < off.left) x = off.left;
    if (y + this.size.height > off.top + view.height) y = off.top + view.height - this.size.height;
    if (y < off.top) y = off.top;
   
    this.popup.style.top  = y + "px";
    this.popup.style.left = x + "px";
  },
 
  hide : function (evt)
  {
    if (this.popup.style.display == 'none') return;
    // Get mouse position
    var mouse_delta = EvtHandler.mouse_offset ();
    var x = evt.pageX
        || (evt.clientX + this.scroll_offset ('Left') - (mouse_delta ? mouse_delta.x : 0));
    var y = evt.pageY
        || (evt.clientY + this.scroll_offset ('Top') - (mouse_delta ? mouse_delta.y : 0));
    // We hide it if we're neither within this.target nor within this.content nor within the
    // alternate target, if one was given.
    if (Tooltips.debug) {
      var tp = this.position (this.target);
      var pp = this.position (this.popup);
      alert ("x = " + x + " y = " + y + '\n' +
            "t: " + tp.x + "/" + tp.y + "/" +
              this.target.offsetWidth + "/" + this.target.offsetHeight + '\n' +
            (tp.n ? "t.m = " + tp.n.nodeName + "/" + tp.n.getAttribute ('margin') + "/"
                    + tp.n.getAttribute ('marginTop')
                    + "/" + tp.n.getAttribute ('border') + '\n'
                  : "") +
            "p: " + pp.x + "/" + pp.y + "/" +
              this.popup.offsetWidth + "/" + this.popup.offsetHeight + '\n' +
            (pp.n ? "p.m = " + pp.n.nodeName + "/" + pp.n.getAttribute ('margin') + "/"
                    + pp.n.getAttribute ('marginTop')
                    + "/" + pp.n.getAttribute ('border') + '\n'
                  : "") +
            "e: " + evt.pageX + "/" + evt.pageY + " "
              + evt.clientX + "/" + this.scroll_offset ('Left') + " "
              + evt.clientY + "/" + this.scroll_offset ('Top') + '\n' +
            (mouse_delta ? "m : " + mouse_delta.x + "/" + mouse_delta.y + '\n' : "")
            );
     }
     }
     if (  !this.within (this.target, x, y)
 
         && !this.within (this.popup, x, y)
     function applyTheme(theme) {
         && (!this.options.target || !this.within (this.options.target, x, y))) {
         var dark = theme === 'dark';
      if (this.open_timeout_id != null) window.clearTimeout (this.open_timeout_id);
 
      this.open_timeout_id = null;
         document.documentElement.classList.toggle(DARK_CLASS, dark);
      var event_copy = evt;
 
      if (this.options.hide_delay > 0) {
        if (document.body) {
        var obj = this;
            document.body.classList.toggle(DARK_CLASS, dark);
        this.hide_timeout_id =
        }
          window.setTimeout (
 
              function () {obj.hide_popup (obj, event_copy);}
         updateButton();
            , this.options.hide_delay
          );
      } else
         this.hide_popup (this, event_copy);
     }
     }
  },
 
  hide_popup : function (elem, event)
  {
    if (elem.popup.style.display == 'none') return; // Already hidden, recursion from onclose?
    elem.popup.style.display = 'none';
    if (elem.ieFix) elem.ieFix.style.display = 'none';
    elem.hide_timeout_id = null;
    Tooltips.deregister (elem);
    if (elem.options.deactivate & Tooltip.ESCAPE)
      EvtHandler.remove (document, 'keydown', elem.eventKey);
    // Callback
    if (typeof (elem.options.onclose) == 'function') elem.options.onclose (elem, event);
  },
 
  hide_now : function (evt)
  {
    if (this.open_timeout_id != null) window.clearTimeout (this.open_timeout_id);
    this.open_timeout_id = null;
    var event_copy = evt || null;
    this.hide_popup (this, event_copy);
    if (evt && this.target.nodeName.toLowerCase == 'a') return EvtHandler.killEvt (evt); else return false;
  },
 
  key_handler : function (evt)
  {
    if (Tooltips.debug) alert ('key evt ' + evt.keyCode);
    if (evt.DOM_VK_ESCAPE && evt.keyCode == evt.DOM_VK_ESCAPE || evt.keyCode == 27)
      this.hide_now (evt);
    return true;
  },


  setZIndex : function (z_index)
    function updateButton() {
  {
        var button = document.getElementById(BUTTON_ID);
    if (z_index === null || isNaN (z_index) || z_index < 2) return;
 
    z_index = Math.floor (z_index);
        if (!button) {
    if (z_index == this.options.z_index) return; // No change
            return;
    if (this.ieFix) {
        }
      // Always keep the shim below the actual popup.
 
      if (z_index > this.options.z_index) {
        var dark = isDarkMode();
         this.popup.style.zIndex = z_index;
 
         this.ieFix.style.zIndex = "" + (z_index - 1);
         button.setAttribute('aria-pressed', dark ? 'true' : 'false');
      } else {
         button.setAttribute('title', dark ? 'Alternar para modo claro' : 'Alternar para modo escuro');
         this.ieFix.style.zIndex = "" + (z_index - 1);
 
        this.popup.style.zIndex = z_index;
         button.innerHTML = dark
      }
            ? '<span class="gla-darkmode-icon">☀</span><span class="gla-darkmode-text">Modo claro</span>'
    } else {
            : '<span class="gla-darkmode-icon">☾</span><span class="gla-darkmode-text">Modo escuro</span>';
      this.popup.style.zIndex = z_index;
     }
     }
    this.options.z_index = z_index;
  },


  makeCloseButton : function ()
    function createButton() {
  {
        if (document.getElementById(BUTTON_ID)) {
    this.close_button = null;
            return;
    if (!this.options.close_button) return;
        }
    var imgs = null;
 
    if (typeof (this.options.close_button.length) != 'undefined')
        var button = document.createElement('button');
      imgs = this.options.close_button; // Also if it's a string (name of previously created class)
 
    else
        button.id = BUTTON_ID;
      imgs = [this.options.close_button];
        button.type = 'button';
    if (!imgs || imgs.length == 0) return; // Paranoia
        button.className = 'gla-darkmode-button';
    var lk = Buttons.makeButton (imgs, this.tip_id + '_button', this.eventClose);  
        button.setAttribute('aria-label', 'Alternar modo escuro');
        button.setAttribute('aria-pressed', isDarkMode() ? 'true' : 'false');
 
        button.addEventListener('click', function () {
            var nextTheme = isDarkMode() ? 'light' : 'dark';
 
            saveTheme(nextTheme);
            applyTheme(nextTheme);
        });
 
        document.body.appendChild(button);
        updateButton();
    }


     if (lk) {
     function ready(fn) {
      var width = lk.firstChild.getAttribute ('width');
        if (document.readyState === 'loading') {
      if (!is_IE) {
            document.addEventListener('DOMContentLoaded', fn);
        lk.style.cssFloat = 'right';
         } else {
      } else {
            fn();
        // IE is incredibly broken on right floats.
         }
        var container = document.createElement ('div');
         container.style.display      = 'inline';
        container.style.styleFloat  = 'right';
        container.appendChild (lk);
         lk = container;
      }
      lk.style.paddingTop  = '2px';
      lk.style.paddingRight = '2px';
      this.popup.firstChild.insertBefore (lk, this.popup.firstChild.firstChild);
      this.close_button = lk;
      this.close_button_width = parseInt ("" + width, 10);
     }
     }
  },


  within : function (node, x, y)
     var savedTheme = getSavedTheme();
  {
    if (!node) return false;
    var pos = this.position (node);
    return    (x == null || x > pos.x && x < pos.x + node.offsetWidth)
          && (y == null || y > pos.y && y < pos.y + node.offsetHeight);
  },
 
  position : (function ()
  {
    // The following is the jQuery.offset implementation. We cannot use jQuery yet in globally
     // activated scripts (it has strange side effects for Opera 8 users who can't log in anymore,
    // and it breaks the search box for some users). Note that jQuery does not support Opera 8.
    // Until the WMF servers serve jQuery by default, this copy from the jQuery 1.3.2 sources is
    // needed here. If and when we have jQuery available officially, the whole thing here can be
    // replaced by "var tmp = jQuery (node).offset(); return {x:tmp.left, y:tmp.top};"
    // Kudos to the jQuery development team. Any errors in this adaptation are my own. (Lupo,
    // 2009-08-24).
    //  Note: I have virtually the same code also in LAPI.js, but I cannot import that here
    // because I know that at least one gadget at the French Wikipedia includes this script here
    // directly from here. I'd have to use importScriptURI instead of importScript to keep that
    // working, but I'd run the risk that including LAPI at the French Wikipedia might break
    // something there. I *hate* it when people hotlink scripts across projects!


     var data = null;
     if (savedTheme === 'dark') {
        document.documentElement.classList.add(DARK_CLASS);
    }


     function jQuery_init ()
     ready(function () {
    {
        if (savedTheme === 'dark') {
      data = {};
            document.body.classList.add(DARK_CLASS);
      // Capability check from jQuery.
        }
      var body = document.body;
 
      var container = document.createElement('div');
         createButton();
      var html =
         updateButton();
          '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;'
    });
         + 'padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;'
})();
         + 'top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" '
*/
        + 'cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
/**
      var rules = { position: 'absolute', visibility: 'hidden'
* Script JavaScript para o componente de abas MediaWiki
                  ,top: 0, left: 0
* Adicione este script na sua MediaWiki (Common.js ou página de scripts)
                  ,margin: 0, border: 0
*/
                  ,width: '1px', height: '1px'
                  };
      Object.merge (rules, container.style);


      container.innerHTML = html;
(function () {
      body.insertBefore(container, body.firstChild);
  'use strict';
      var innerDiv = container.firstChild;
      var checkDiv = innerDiv.firstChild;
      var td = innerDiv.nextSibling.firstChild.firstChild;


      data.doesNotAddBorder = (checkDiv.offsetTop !== 5);
  // Inicializa todos os componentes de abas na página
      data.doesAddBorderForTableAndCells = (td.offsetTop === 5);
  function initTabbers() {
    const tabbers = document.querySelectorAll('[data-tabber]');


       innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
    tabbers.forEach(function (tabber) {
       data.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
       const tabs = tabber.querySelectorAll('.mw-tabber-tab');
       const panels = tabber.querySelectorAll('.mw-tabber-panel');


       var bodyMarginTop    = body.style.marginTop;
       tabs.forEach(function (tab) {
      body.style.marginTop = '1px';
        tab.addEventListener('click', function () {
      data.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
          const targetTab = this.getAttribute('data-tab');
      body.style.marginTop = bodyMarginTop;


      body.removeChild(container);
          // Remove classe active de todas as abas
    };
          tabs.forEach(function (t) {
            t.classList.remove('active');
          });


    function jQuery_offset (node)
          // Remove classe active de todos os painéis
    {
          panels.forEach(function (p) {
      if (node === node.ownerDocument.body) return jQuery_bodyOffset (node);
            p.classList.remove('active');
      if (node.getBoundingClientRect) {
          });
        var box    = node.getBoundingClientRect ();
        var scroll = {x : this.scroll_offset ('Left'), y: this.scroll_offset ('Top')};
        return {x : (box.left + scroll.x), y : (box.top + scroll.y)};
      }
      if (!data) jQuery_init ();
      var elem              = node;
      var offsetParent      = elem.offsetParent;
      var prevOffsetParent  = elem;
      var doc              = elem.ownerDocument;
      var prevComputedStyle = doc.defaultView.getComputedStyle(elem, null);
      var computedStyle;


      var top  = elem.offsetTop;
          // Adiciona classe active na aba clicada
      var left = elem.offsetLeft;
          this.classList.add('active');


      while ( (elem = elem.parentNode) && elem !== doc.body && elem !== doc.documentElement ) {
          // Adiciona classe active no painel correspondente
        computedStyle = doc.defaultView.getComputedStyle(elem, null);
          const targetPanel = tabber.querySelector('[data-panel="' + targetTab + '"]');
        top -= elem.scrollTop, left -= elem.scrollLeft;
           if (targetPanel) {
        if ( elem === offsetParent ) {
             targetPanel.classList.add('active');
          top += elem.offsetTop, left += elem.offsetLeft;
           if (   data.doesNotAddBorder
              && !(data.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName))
            )
          {
             top  += parseInt (computedStyle.borderTopWidth,  10) || 0;
            left += parseInt (computedStyle.borderLeftWidth, 10) || 0;
           }
           }
          prevOffsetParent = offsetParent; offsetParent = elem.offsetParent;
        });
        }
      });
        if (data.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== 'visible')
    });
        {
  }
          top  += parseInt (computedStyle.borderTopWidth,  10) || 0;
 
          left += parseInt (computedStyle.borderLeftWidth, 10) || 0;
  // Inicializa quando o DOM estiver pronto
         }
  if (document.readyState === 'loading') {
        prevComputedStyle = computedStyle;
    document.addEventListener('DOMContentLoaded', initTabbers);
       }
  } else {
    initTabbers();
  }
 
});
 
/* =============================================================================
  GLA language switch (glaLang) - global toggle + page panes + gla:langChanged
  Contrato: localStorage "glaLang" (pt-br | en), evento window "gla:langChanged"
  ============================================================================= */
(function () {
  'use strict';
 
  var STORAGE_KEY = 'glaLang';
  var UI_LANGS = ['pt-br', 'en'];
  var FLAG_IMG = {
    'pt-br': 'https://wiki.gla.com.br/images/8/8c/Brazil.png',
    'en': 'https://wiki.gla.com.br/images/0/0a/Usa.png'
  };
 
  function normalizeLang(s) {
    s = (s || '').toLowerCase();
    if (s === 'pt-br' || s === 'pt_br' || s === 'ptbr' || s === 'pt') return 'pt';
    return (s.split('-')[0] || 'pt');
  }
 
  function toLangTag(langFull) {
    var tag = (langFull || 'pt-br').toLowerCase();
    if (tag === 'pt') return 'pt-br';
    return UI_LANGS.indexOf(tag) >= 0 ? tag : 'pt-br';
  }
 
  function paneMatches(paneLang, langTag) {
    var pane = (paneLang || '').toLowerCase();
    var tag = (langTag || 'pt-br').toLowerCase();
    if (pane === tag) return true;
    if ((pane === 'pt' || pane === 'pt-br') && (tag === 'pt' || tag === 'pt-br')) return true;
    return pane.split('-')[0] === tag.split('-')[0];
  }
 
  function getStored() {
    try {
      var saved = (localStorage.getItem(STORAGE_KEY) || '').toLowerCase();
      if (saved && UI_LANGS.indexOf(saved) >= 0) return saved;
    } catch (e) { }
    return 'pt-br';
  }
 
  function markFlags(langTag) {
    document.querySelectorAll('.gla-lang-flag[data-lang]').forEach(function (btn) {
      btn.classList.toggle('active', paneMatches(btn.getAttribute('data-lang'), langTag));
    });
  }
 
  function updatePanes(langTag) {
    document.querySelectorAll('.gla-i18n').forEach(function (wrap) {
      var mode = (wrap.getAttribute('data-gla-i18n-mode') || 'panes').toLowerCase();
      if (mode === 'client') return;
      var panes = wrap.querySelectorAll(':scope > .gla-i18n-pane');
      if (!panes.length) return;
      panes.forEach(function (pane) {
        var show = paneMatches(pane.getAttribute('data-lang'), langTag);
        pane.hidden = !show;
         pane.style.display = show ? '' : 'none';
      });
    });
  }
 
  function applyLang(langFull, opts) {
    opts = opts || {};
    var langTag = toLangTag(langFull);
    var norm = normalizeLang(langTag);
 
    document.documentElement.lang = langTag;
    document.documentElement.setAttribute('data-gla-lang', norm);
    try {
       localStorage.setItem(STORAGE_KEY, langTag);
    } catch (e) { }
 
    markFlags(langTag);
    updatePanes(langTag);


      if (prevComputedStyle.position === 'relative' || prevComputedStyle.position === 'static') {
    if (opts.silent !== true) {
        top  += doc.body.offsetTop;
      try {
         left += doc.body.offsetLeft;
         window.dispatchEvent(new CustomEvent('gla:langChanged', { detail: { norm: norm, tag: langTag } }));
      }
       } catch (e2) { }
      if (prevComputedStyle.position === 'fixed') {
        top  += Math.max (doc.documentElement.scrollTop, doc.body.scrollTop);
        left += Math.max (doc.documentElement.scrollLeft, doc.body.scrollLeft);
       }
      return {x: left, y: top};           
     }
     }


     function jQuery_bodyOffset (body)
     return norm;
     {
  }
      if (!data) jQuery_init();
 
       var top = body.offsetTop, left = body.offsetLeft;
  function pageHasI18n() {
       if (data.doesNotIncludeMarginInBodyOffset) {
     return !!document.querySelector(
        var styles;
       '[data-gla-i18n], .gla-i18n, .item-wrapper, .item-tooltip-enc, ' +
        if (  body.ownerDocument.defaultView
       '.gla-item-chip, .gla-quest-item-chip, [data-gla-item-chip], .character-box'
            && body.ownerDocument.defaultView.getComputedStyle)
    );
        { // Gecko etc.
  }
          styles = body.ownerDocument.defaultView.getComputedStyle (body, null);
 
          top  += parseInt (style.getPropertyValue ('margin-top' ), 10) || 0;
  function shouldShowToggle() {
          left += parseInt (style.getPropertyValue ('margin-left'), 10) || 0;
    return pageHasI18n();
        } else {
  }
          function to_px (element, val) {
 
            // Convert em etc. to pixels. Kudos to Dean Edwards; see
  function injectToggle() {
            // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
    if (!shouldShowToggle() || document.getElementById('pt-langtoggle')) {
            if (!/^\d+(px)?$/i.test (val) && /^\d/.test (val) && body.runtimeStyle) {
       return;
              var style                = element.style.left;
              var runtimeStyle          = element.runtimeStyle.left;
              element.runtimeStyle.left = element.currentStyle.left;
              element.style.left        = result || 0;
              val = elem.style.pixelLeft + "px";
              element.style.left        = style;
              element.runtimeStyle.left = runtimeStyle;
            }
            return val;
          }
          style = body.currentStyle || body.style;
          top  += parseInt (to_px (body, style.marginTop ), 10) || 0;
          left += parseInt (to_px (body, style.marginleft), 10) || 0;
        }
      }
       return {x: left, y: top};
     }
     }


     return jQuery_offset;
     var ul = document.querySelector('#p-personal .vector-menu-content-list') ||
  })(),
      document.querySelector('#p-personal ul');
    if (!ul) return;


  scroll_offset : function (what)
    var li = document.createElement('li');
  {
     li.id = 'pt-langtoggle';
     var s = 'scroll' + what;
     li.className = 'mw-list-item';
     return (document.documentElement ? document.documentElement[s] : 0)
          || document.body[s] || 0;
  },


  viewport : function (what)
    var group = document.createElement('span');
  {
     group.className = 'gla-lang-toggle';
     var s = 'client' + what;
     group.setAttribute('role', 'group');
     return (document.documentElement ? document.documentElement[s] : 0) || document.body[s] || 0;
    group.setAttribute('aria-label', 'Language');
  },


    UI_LANGS.forEach(function (code) {
      var btn = document.createElement('button');
      btn.type = 'button';
      btn.className = 'gla-lang-flag';
      btn.setAttribute('data-lang', code);
      btn.title = code === 'pt-br' ? 'Português (Brasil)' : 'English';
      btn.setAttribute('aria-label', btn.title);
      var img = document.createElement('img');
      img.src = FLAG_IMG[code] || '';
      img.alt = '';
      img.width = 24;
      img.height = 16;
      btn.appendChild(img);
      group.appendChild(btn);
    });


  calculate_dimension : function ()
    li.appendChild(group);
  {
 
     if (this.popup.style.display != 'none' && this.popup.style.display != null) {
     var anchor = document.getElementById('pt-darkmode');
       return {width : this.popup.offsetWidth, height : this.popup.offsetHeight};
    if (anchor && anchor.parentNode === ul) {
       anchor.insertAdjacentElement('afterend', li);
    } else {
      ul.insertBefore(li, ul.firstChild);
     }
     }
    // Must display it... but position = 'absolute' and visibility = 'hidden' means
  }
    // the user won't notice it.
 
    var view_width = this.viewport ('Width');
  function bindToggle() {
     this.popup.style.top        = "0px";
     if (window.glaLangToggleBound) return;
     this.popup.style.left      = "0px";
     window.glaLangToggleBound = true;
    // Remove previous width as it may change with dynamic tooltips
 
     this.popup.style.width      = "";
     document.addEventListener('click', function (e) {
    this.popup.style.maxWidth  = "";
       var btn = e.target.closest('.gla-lang-flag[data-lang]');
    this.popup.style.overflow  = 'hidden';
      if (!btn) return;
    this.popup.style.visibility = 'hidden';
       e.preventDefault();
    // Remove the close button, otherwise the float will always extend the box to
       applyLang(btn.getAttribute('data-lang') || 'pt-br');
    // the right edge.
    });
    if (this.close_button)
  }
       this.popup.firstChild.removeChild (this.close_button);
 
    this.popup.style.display = "";  // Display it. Now we should have a width
  function boot() {
    var w = this.popup.offsetWidth;
    if (pageHasI18n()) {
    var h = this.popup.offsetHeight;
      document.body.classList.add('gla-i18n-page');
    var limit = Math.round (view_width * this.options.max_width);
    if (this.options.max_pixels > 0 && this.options.max_pixels < limit)
       limit = this.options.max_pixels;
    if (w > limit) {
      w = limit;
       this.popup.style.width    = "" + w + "px";
      this.popup.style.maxWidth = this.popup.style.width;
      if (this.close_button) {
        this.popup.firstChild.insertBefore
          (this.close_button, this.popup.firstChild.firstChild);
      }
    } else {
      this.popup.style.width    = "" + w + "px";
      this.popup.style.maxWidth = this.popup.style.width;
      if (this.close_button) {
        this.popup.firstChild.insertBefore
          (this.close_button, this.popup.firstChild.firstChild);
      }
      if (h != this.popup.offsetHeight) {
        w =  w + this.close_button_width;   
        this.popup.style.width    = "" + w + "px";
        this.popup.style.maxWidth = this.popup.style.width;
      }
     }
     }
     var size = {width : this.popup.offsetWidth, height : this.popup.offsetHeight};
     injectToggle();
     this.popup.style.display = 'none';       // Hide it again
    bindToggle();
    this.popup.style.visibility = "";
    applyLang(getStored(), { silent: true });
     return size;
     try {
      window.dispatchEvent(new CustomEvent('gla:langChanged', {
        detail: { norm: normalizeLang(getStored()), tag: getStored() }
       }));
     } catch (e) { }
   }
   }
   
} // end Tooltip


// </source>
  window.glaLang = {
    STORAGE_KEY: STORAGE_KEY,
    UI_LANGS: UI_LANGS,
    normalizeLang: normalizeLang,
    toLangTag: toLangTag,
    getStored: getStored,
    getNorm: function () {
      return normalizeLang(document.documentElement.lang || getStored());
    },
    getWidgetLang: function () {
      return this.getNorm() === 'en' ? 'en' : 'pt';
    },
    applyLang: applyLang
  };
 
  window.glaLangBoot = boot;
 
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', boot);
  } else {
    boot();
  }
  window.addEventListener('load', boot);
 
  var tries = 0;
  var retryTimer = setInterval(function () {
    if (document.getElementById('pt-langtoggle') || !shouldShowToggle() || tries++ > 40) {
      clearInterval(retryTimer);
      return;
    }
    injectToggle();
  }, 150);
})();

Edição atual tal como às 11h48min de 5 de agosto de 2026

/* Any JavaScript here will be loaded for all users on every page load. */

/* Dark mode: fallback se gla-darkmode-boot.php não estiver no servidor */
(function () {
  try {
    if (localStorage.getItem('gla-darkmode') === '1') {
      var root = document.documentElement;
      root.classList.add('client-darkmode', 'skin-theme-clientpref-night');
      if (document.cookie.indexOf('gla-darkmode=1') === -1) {
        document.cookie = 'gla-darkmode=1;path=/;max-age=31536000;SameSite=Lax';
      }
    }
  } catch (e) { }
})();

(function () {
  'use strict';

  function setupDiscordButton() {
    var a = document.querySelector('#n-Discord a');
    if (!a || a.querySelector('.gla-discord-text')) {
      return;
    }

    var icon = document.createElement('span');
    icon.className = 'gla-discord-icon';
    icon.setAttribute('aria-hidden', 'true');

    var textWrap = document.createElement('span');
    textWrap.className = 'gla-discord-text';
    textWrap.innerHTML = 'Entre no <strong>Discord</strong>';

    a.textContent = '';
    a.appendChild(icon);
    a.appendChild(textWrap);
  }

  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', setupDiscordButton);
  } else {
    setupDiscordButton();
  }
})();

(function () {
  'use strict';

  var LOGO_SRC = 'https://wiki.gla.com.br/images/b/bf/WIKIGLAlogo.png';
  var LOGO_RETRIES = 0;
  var LOGO_MAX_RETRIES = 40;

  function resolveLogoSrc() {
    if (typeof mw !== 'undefined' && mw.config && mw.config.get) {
      var skinLogo = mw.config.get('wgLogo');
      if (skinLogo && skinLogo.indexOf('wiki.png') === -1) {
        return skinLogo;
      }
    }
    return LOGO_SRC;
  }

  function setupLogoImg() {
    var a = document.querySelector('#p-logo a.mw-wiki-logo');
    if (!a) {
      return false;
    }

    if (!a.querySelector('.gla-logo-img')) {
      var img = document.createElement('img');
      img.className = 'gla-logo-img';
      img.src = resolveLogoSrc();
      img.alt = '';
      img.setAttribute('decoding', 'async');
      img.setAttribute('draggable', 'false');
      img.addEventListener('error', function onLogoError() {
        if (img.src !== LOGO_SRC) {
          img.src = LOGO_SRC;
        }
      });
      a.appendChild(img);
    }

    return true;
  }

  function trySetupLogo() {
    if (setupLogoImg()) {
      return;
    }
    LOGO_RETRIES += 1;
    if (LOGO_RETRIES < LOGO_MAX_RETRIES) {
      window.setTimeout(trySetupLogo, 50);
    }
  }

  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', trySetupLogo);
  } else {
    trySetupLogo();
  }
})();

(function () {
  'use strict';

  var STORAGE_KEY = 'gla-darkmode';
  var LINK_CLASS = 'darkmode-link';
  var LABEL_DARK = 'Modo escuro';
  var LABEL_LIGHT = 'Modo padr\u00e3o';

  function isDark() {
    return document.documentElement.classList.contains('client-darkmode');
  }

  function setDarkModeCookie(on) {
    try {
      document.cookie = 'gla-darkmode=' + (on ? '1' : '0') + ';path=/;max-age=' + (on ? 31536000 : 0) + ';SameSite=Lax';
    } catch (e) { }
  }

  function setDark(on) {
    var root = document.documentElement;
    root.classList.toggle('client-darkmode', on);
    root.classList.toggle('skin-theme-clientpref-night', on);
    root.classList.toggle('skin-theme-clientpref-day', !on);
    try {
      localStorage.setItem(STORAGE_KEY, on ? '1' : '0');
    } catch (e) { }
    setDarkModeCookie(on);
    updateLinks(on);
  }

  function updateLinks(on) {
    var links = document.querySelectorAll('.' + LINK_CLASS);
    var label = on ? LABEL_LIGHT : LABEL_DARK;
    for (var i = 0; i < links.length; i++) {
      links[i].textContent = label;
    }
  }

  function findDarkLink(el) {
    while (el && el !== document) {
      if (el.classList && el.classList.contains(LINK_CLASS)) {
        return el;
      }
      el = el.parentNode;
    }
    return null;
  }

  function injectToggle() {
    if (document.getElementById('pt-darkmode')) {
      return;
    }

    var ul = document.querySelector('#p-personal .vector-menu-content-list') ||
      document.querySelector('#p-personal ul');
    if (!ul) {
      return;
    }

    var li = document.createElement('li');
    li.id = 'pt-darkmode';

    var a = document.createElement('a');
    a.href = '#';
    a.className = LINK_CLASS;
    a.textContent = isDark() ? LABEL_LIGHT : LABEL_DARK;
    li.appendChild(a);

    var afterLi = document.getElementById('pt-mytalk') ||
      document.getElementById('pt-anontalk') ||
      document.getElementById('pt-userpage') ||
      document.getElementById('pt-anonuserpage');

    if (afterLi && afterLi.parentNode === ul) {
      afterLi.insertAdjacentElement('afterend', li);
    } else {
      ul.insertBefore(li, ul.firstChild);
    }
  }

  function bindToggle() {
    if (window.glaDarkModeBound) {
      return;
    }
    window.glaDarkModeBound = true;

    document.addEventListener('click', function (e) {
      var link = findDarkLink(e.target);
      if (!link) {
        return;
      }
      e.preventDefault();
      setDark(!isDark());
    });
  }

  function boot() {
    injectToggle();
    bindToggle();
    updateLinks(isDark());
  }

  window.glaDarkModeBoot = boot;
  window.addEventListener('load', boot);

  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', boot);
  } else {
    boot();
  }

  function markThemeReady() {
    document.documentElement.classList.add('gla-theme-ready');
  }

  if (document.readyState === 'complete') {
    requestAnimationFrame(markThemeReady);
  } else {
    window.addEventListener('load', function () {
      requestAnimationFrame(markThemeReady);
    });
  }

  var tries = 0;
  var retryTimer = setInterval(function () {
    if (document.getElementById('pt-darkmode') || tries++ > 40) {
      clearInterval(retryTimer);
      return;
    }
    boot();
  }, 150);
})();



$(document).ready(function () {
  //------- GLOBAL EVENTS TIMER ---------
  (function () {
    var globalEventsTimer = $('#global-event-time'); // Atualizado: ID do Timer dos Global Events
    var globalEventsImage = $('.global-event-image'); // Atualizado: Classe da Imagem dos Global Events
    var globalEventsInterval;

    // Informações dos eventos
    /*
      0 - Domingo
      1 - Segunda-feira
      2 - Terça-feira
      3 - Quarta-feira
      4 - Quinta-feira
      5 - Sexta-feira
      6 - Sábado
    */
    var globalEventsInfo = {
      0: [
        { name: 'Foxy Memory', time: '02:00:00', src: '/images/3/37/Foxy_memory_event.png' },
        { name: 'Foxy race (ship)', time: '09:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
        { name: 'Deathmatch', time: '12:00:00', src: '/images/4/46/Deathmatch_event.png' },
        { name: 'Foxy race', time: '15:00:00', src: '/images/e/e8/Foxy_race_event.png' },
        { name: 'Foxy quiz', time: '19:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
        { name: 'Foxy count', time: '22:00:00', src: '/images/f/f3/Foxy_count_event.png' },
      ],
      1: [
        { name: 'Foxy Memory', time: '02:00:00', src: '/images/3/37/Foxy_memory_event.png' },
        { name: 'Foxy race (ship)', time: '09:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
        { name: 'Deathmatch', time: '12:00:00', src: '/images/4/46/Deathmatch_event.png' },
        { name: 'Foxy race', time: '15:00:00', src: '/images/e/e8/Foxy_race_event.png' },
        { name: 'Foxy quiz', time: '19:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
        { name: 'Foxy count', time: '22:00:00', src: '/images/f/f3/Foxy_count_event.png' },
      ],
      2: [
        { name: 'Foxy race (ship)', time: '02:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
        { name: 'Deathmatch', time: '09:00:00', src: '/images/4/46/Deathmatch_event.png' },
        { name: 'Foxy race', time: '12:00:00', src: '/images/e/e8/Foxy_race_event.png' },
        { name: 'Foxy quiz', time: '15:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
        { name: 'Foxy count', time: '19:00:00', src: '/images/f/f3/Foxy_count_event.png' },
        { name: 'Foxy Memory', time: '22:00:00', src: '/images/3/37/Foxy_memory_event.png' },
      ],
      3: [
        { name: 'Deathmatch', time: '02:00:00', src: '/images/4/46/Deathmatch_event.png' },
        { name: 'Foxy race', time: '09:00:00', src: '/images/e/e8/Foxy_race_event.png' },
        { name: 'Foxy quiz', time: '12:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
        { name: 'Foxy count', time: '15:00:00', src: '/images/f/f3/Foxy_count_event.png' },
        { name: 'Foxy Memory', time: '19:00:00', src: '/images/3/37/Foxy_memory_event.png' },
        { name: 'Foxy race (ship)', time: '22:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
      ],
      4: [
        { name: 'Foxy race', time: '02:00:00', src: '/images/e/e8/Foxy_race_event.png' },
        { name: 'Foxy quiz', time: '09:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
        { name: 'Foxy count', time: '12:00:00', src: '/images/f/f3/Foxy_count_event.png' },
        { name: 'Foxy Memory', time: '15:00:00', src: '/images/3/37/Foxy_memory_event.png' },
        { name: 'Foxy race (ship)', time: '19:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
        { name: 'Deathmatch', time: '22:00:00', src: '/images/4/46/Deathmatch_event.png' },
      ],
      5: [
        { name: 'Foxy quiz', time: '02:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
        { name: 'Foxy count', time: '09:00:00', src: '/images/f/f3/Foxy_count_event.png' },
        { name: 'Foxy Memory', time: '12:00:00', src: '/images/3/37/Foxy_memory_event.png' },
        { name: 'Foxy race (ship)', time: '15:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
        { name: 'Deathmatch', time: '19:00:00', src: '/images/4/46/Deathmatch_event.png' },
        { name: 'Foxy race', time: '22:00:00', src: '/images/e/e8/Foxy_race_event.png' },
      ],
      6: [
        { name: 'Foxy count', time: '02:00:00', src: '/images/f/f3/Foxy_count_event.png' },
        { name: 'Foxy Memory', time: '09:00:00', src: '/images/3/37/Foxy_memory_event.png' },
        { name: 'Foxy race (ship)', time: '12:00:00', src: '/images/2/29/Foxy_race_ship_event.png' },
        { name: 'Deathmatch', time: '15:00:00', src: '/images/4/46/Deathmatch_event.png' },
        { name: 'Foxy race', time: '21:55:00', src: '/images/e/e8/Foxy_race_event.png' },
        { name: 'Foxy quiz', time: '22:00:00', src: '/images/b/b3/Foxy_quiz_event.png' },
      ]
    };

    function pad(value) {
      return value < 10 ? '0' + value : value;
    }

    function getBrazilTime() {
      var now = new Date();
      var utc = now.getTime() + (now.getTimezoneOffset() * 60000); // Converte para UTC
      return new Date(utc - (3 * 3600000)); // Ajusta para UTC-3
    }

    function startGlobalEventCountdown(eventStartTime, eventEndTime) {
      if (globalEventsInterval) clearInterval(globalEventsInterval);

      globalEventsInterval = setInterval(function () {
        var now = getBrazilTime().getTime();

        if (now < eventEndTime) {
          var timeRemaining = Math.ceil((eventEndTime - now) / 1000); // Segundos restantes
          var minutes = Math.floor(timeRemaining / 60);
          var seconds = timeRemaining % 60;
          globalEventsTimer.html('Iniciando: ' + pad(minutes) + ":" + pad(seconds));
        } else {
          clearInterval(globalEventsInterval);
          setGlobalEvent();
        }
      }, 1000);
    }

    function setGlobalEvent() {
      var now = getBrazilTime(); // Usa o horário do Brasil
      var dayEvents = globalEventsInfo[now.getDay()];

      if (!dayEvents || dayEvents.length === 0) {
        globalEventsImage.attr('src', '/images/0/0a/Anyevent.png'); // Imagem padrão
        globalEventsTimer.html('Acabaram os eventos por hoje');
        return;
      }

      for (var i = 0; i < dayEvents.length; i++) {
        var event = dayEvents[i];
        var timeParts = event.time.split(':');
        var eventStartTime = new Date(
          now.getFullYear(),
          now.getMonth(),
          now.getDate(),
          parseInt(timeParts[0], 10),
          parseInt(timeParts[1], 10),
          parseInt(timeParts[2], 10)
        ).getTime();
        var eventEndTime = eventStartTime + 5 * 60 * 1000; // Evento dura 5 minutos para entrada

        if (now >= eventStartTime && now < eventEndTime) {
          // Durante o período de entrada do evento
          globalEventsImage.attr('src', event.src);
          startGlobalEventCountdown(eventStartTime, eventEndTime);
          return;
        }

        if (now < eventStartTime) {
          // Antes do evento, exibe o horário fixo
          globalEventsImage.attr('src', event.src);
          globalEventsTimer.html(
            new Date(eventStartTime).toLocaleTimeString('pt-BR', {
              hour: '2-digit',
              minute: '2-digit',
            })
          );

          // Só inicia a contagem regressiva quando estiver próximo (faltando 5 minutos ou menos)
          if (eventStartTime - now <= 5 * 60 * 1000) {
            startGlobalEventCountdown(eventStartTime, eventEndTime);
          }
          return;
        }
      }

      // Após o último evento do dia
      globalEventsImage.attr('src', '/images/0/0a/Anyevent.png'); // Imagem padrão
      globalEventsTimer.html('Acabaram os eventos por hoje');
    }

    $(document).ready(function () {
      setGlobalEvent();
    });
  })();
  //------- GLOBAL EVENTS TIMER ---------
  //------- TOOLTIP IMAGE---------
  /*
      Tooltip image consiste em uma funcionalidade que insere uma tag IMG 
      quando o usuario passa o mouse por cima de uma imagem com a classe "tooltip-image"
      ao fazer é inserido no body uma tag IMG com a mesma "src" 1.3 vezes maior do que a imagem
      que o usuario está com o mouse em coma, esta tag IMG terá o mesmo X e Y do mouse + um offset 
      para manter um distanciamento.
  */

  //Distanciamento / margem do mouse
  const offset = { x: 20, y: 10 };

  $('.tooltip-image').on('mouseenter',
    function (e) {
      var src = $(this).attr('src');
      var size = $(this).width() * 1.3;

      $('<img src="' + src + '" id="bigImage" />').css('left', e.pageX + offset.x).css('top', e.pageY + offset.y).css('width', size + "px").appendTo('body').hide().fadeIn(500);
    }).on('mouseleave',
      function () {
        $('#bigImage').remove();
      });

  $('.tooltip-image').mousemove(function (e) {
    $('#bigImage').css('left', e.pageX + offset.x).css('top', e.pageY + offset.y);
  });
  //------- TOOLTIP IMAGE---------

  //------- FUNCIONALIDADES PACIENTES KUREHA ---------
  const pacients = {
    "bafo": { image: "/images/c/ce/Bafo_static.png", gif: "/images/e/e0/Bafo.gif" },
    "espirrando": { image: "/images/thumb/5/5b/Espirro_static.png/180px-Espirro_static.png", gif: "/images/thumb/9/90/Espirro.gif/180px-Espirro.gif", audio: "/images/2/2b/Espirrando.ogg" },
    "enjoado": { image: "/images/thumb/5/52/Enjoado_static.png/180px-Enjoado_static.png", gif: "/images/thumb/7/76/Enjoado.gif/180px-Enjoado.gif", audio: "/images/5/5b/Vomito.ogg" },
    "tremendo": { image: "/images/thumb/3/35/Tremendo_static.png/180px-Tremendo_static.png", gif: "/images/thumb/f/f4/Tremendo.gif/180px-Tremendo.gif" },
    "tossindo": { image: "/images/thumb/e/ef/Tosse_static.png/180px-Tosse_static.png", gif: "/images/thumb/a/a4/Tosse.gif/180px-Tosse.gif", audio: "/images/f/f9/Tossindo.ogg" },
    "solucando": { image: "/images/thumb/c/c0/Soluco_static.png/180px-Soluco_static.png", gif: "/images/thumb/6/67/Soluco.gif/180px-Soluco.gif", audio: "/images/e/e2/Solucando.ogg" },
    "funk": { image: "/images/thumb/e/e8/Funkeiro_static.png/180px-Funkeiro_static.png ", gif: "/images/thumb/7/79/Funkeiro.gif/180px-Funkeiro.gif", audio: "/images/d/d2/Funk.ogg" },
    "fedendo": { image: "/images/thumb/1/1e/Fedido_static.png/180px-Fedido_static.png", gif: "/images/thumb/c/c9/Fedido.gif/180px-Fedido.gif" },
    "febre": { image: "/images/thumb/1/14/Febre_static.png/180px-Febre_static.png", gif: "/images/thumb/7/75/Febre.gif/180px-Febre.gif" },
    "endemoniado": { audio: "/images/3/32/Risada_maligna.ogg" },
    "fome": { audio: "/images/3/37/Estomago_roncando.ogg" },
    "cardiaco": { audio: "/images/2/27/Coracao_batendo.ogg" }
  };

  const audioPlayer = document.querySelector("#audio");

  $(".pacient-audio").on("click", function (e) {
    id = $(this).attr('id');

    if (pacients[id]) {
      audioPlayer.src = pacients[id].audio;
      audioPlayer.play();
    }

  });

  $('.interactive-pacient').on('mouseenter', function (e) {
    id = $(this).attr('id');

    if (pacients[id])
      $(this).attr('src', pacients[id].gif);
  }).on('mouseleave', function (e) {
    id = $(this).attr('id');

    if (pacients[id])
      $(this).attr('src', pacients[id].image);
  });

  //------- FUNCIONALIDADES PACIENTES KUREHA ---------
  //------- FUNCIONALIDADES BUZINAS ---------
  const horns = {
    "Buzinadelacucha": { audio: "/images/5/55/Buzinadelacucha-audio.ogg" },
    "Buzinadefumaca": { audio: "/images/3/3a/Buzinadefumaca-audio.ogg" },
    "Buzinadecaminhao": { audio: "/images/e/e4/Buzinadecaminhao-audio.ogg" },
    "Buzinadetrem": { audio: "/images/3/34/Buzinadetrem-audio.ogg" },
    "Buzinadeesporte": { audio: "/images/2/2b/Buzinadeesporte-audio.ogg" },
    "Buzinadear": { audio: "/images/9/95/Buzinadear-audio.ogg" },
    "Buzinadepalhaco": { audio: "/images/a/a4/Buzinadepalhaco-audio.ogg" },
    "Buzinadeinvestida": { audio: "/images/f/ff/Buzinadeinvestida-audio.ogg" },
    "Buzinadebicicleta": { audio: "/images/1/15/Buzinadebicicleta-audio.ogg" },
    "Buzinadeneblina": { audio: "/images/6/64/Buzinadeneblina-audio.ogg" }
  };

  const hornAudioPlayer = document.querySelector("#audio");

  $(".horn-audio").on("click", function (e) {
    const id = $(this).attr('id');
    if (horns[id]) {
      hornAudioPlayer.src = horns[id].audio;
      hornAudioPlayer.play();
    }
  });

  //------- FUNCIONALIDADES BUZINAS ---------
});


/**
* Script JavaScript para o componente de abas MediaWiki
* Adicione este script na sua MediaWiki (Common.js ou página de scripts)
*/

(function () {
  'use strict';

  // Inicializa todos os componentes de abas na página
  function initTabbers() {
    const tabbers = document.querySelectorAll('[data-tabber]');

    tabbers.forEach(function (tabber) {
      const tabs = tabber.querySelectorAll('.mw-tabber-tab');
      const panels = tabber.querySelectorAll('.mw-tabber-panel');

      tabs.forEach(function (tab) {
        tab.addEventListener('click', function () {
          const targetTab = this.getAttribute('data-tab');

          // Remove classe active de todas as abas
          tabs.forEach(function (t) {
            t.classList.remove('active');
          });

          // Remove classe active de todos os painéis
          panels.forEach(function (p) {
            p.classList.remove('active');
          });

          // Adiciona classe active na aba clicada
          this.classList.add('active');

          // Adiciona classe active no painel correspondente
          const targetPanel = tabber.querySelector('[data-panel="' + targetTab + '"]');
          if (targetPanel) {
            targetPanel.classList.add('active');
          }
        });
      });
    });
  }

  // Inicializa quando o DOM estiver pronto
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', initTabbers);
  } else {
    initTabbers();
  }

  // Suporte para MediaWiki (quando o conteúdo é carregado dinamicamente)
  if (typeof mw !== 'undefined' && mw.hook) {
    mw.hook('wikipage.content').add(function () {
      initTabbers();
    });
  }
})();


/* =============================================================================
   GLA pages legacy (provisório) — personagens, wanted, skills, calc XP, abas
   Extraído de antigo_common.js
   ============================================================================= */

$(document).ready(function () {
  //------- PERSONAGENS ---------

  const characters = [
    { name: "Silvers Rayleigh", types: ["slasher", "dps", "diamond", "break_wall"], link: "/Silvers_Rayleigh", img: "/images/f/f1/Rayleigh_Card.png" },
    { name: "Monkey D Garp", types: ["fighter", "dps", "marine", "diamond", "break_wall"], link: "/Monkey_D_Garp", img: "/images/a/a1/GarpCard.png" },
    { name: "Aokiji Dio", types: ["slasher", "especialist", "tank", "marine", "diamond", "break_wall", "bridge"], link: "/Aokiji", img: "/images/6/67/Aokiji_card.png" },
    { name: "Bartolomew Kuma", types: ["especialist", "tank", "diamond", "break_wall"], link: "/Kuma", img: "/images/b/b5/Card-kuma.png" },
    { name: "Boa Hancock", types: ["fighter", "dps", "diamond"], link: "/Boa_Hancock", img: "/images/4/47/Card-hancock.png" },
    { name: "Borsalino Kizaru", types: ["especialist", "shooter", "dps", "diamond", "break_wall"], link: "/Kizaru", img: "/images/3/32/Card-kizaru.png" },
    { name: "Brook (TS)", types: ["slasher", "support", "diamond", "bridge"], link: "/Brook_(Timeskip)", img: "/images/1/1d/Card-brookts.png" },
    { name: "Tony Tony Chopper (TS) Gurren", types: ["fighter", "support", "diamond", "break_wall"], link: "/Chopper_(Timeskip)", img: "/images/5/53/Card-chopperts.png" },
    { name: "Doflamingo", types: ["shooter", "especialist", "dps", "diamond", "break_wall", "bridge"], link: "/Doflamingo", img: "/images/8/8d/Card-doflamingo.png" },
    { name: "Dracule Mihawk", types: ["slasher", "dps", "diamond", "break_wall"], link: "/Mihawk", img: "/images/9/91/Card-mihawk.png" },
    { name: "Emporio Ivankov", types: ["fighter", "support", "diamond", "break_wall"], link: "/Ivankov", img: "/images/c/ca/Card-ivankov.png" },
    { name: "Enel", types: ["shooter", "especialist", "diamond", "dps"], link: "/Enel", img: "/images/8/85/Enel_card.png" },
    { name: "Franky (TS) Sanitaria", types: ["shooter", "tank", "diamond", "break_wall"], link: "/Franky_(Timeskip)", img: "/images/d/d0/Card-frankyts.png" },
    { name: "Jinbe", types: ["fighter", "tank", "diamond", "break_wall"], link: "/Jinbe", img: "/images/2/2e/Card-jinbe.png" },
    { name: "Marshall D. Teach Barba Negra", types: ["especialist", "bruiser", "diamond"], link: "/Marshall_D._Teach", img: "/images/f/ff/Card-kurohige.png" },
    { name: "Marco Abacaxi", types: ["especialist", "fighter", "support", "diamond"], link: "/Marco", img: "/images/2/2b/Marco_card.png" },
    { name: "Monkey D. Luffy (TS) Visno", types: ["fighter", "dps", "diamond", "break_wall"], link: "/Luffy_(Timeskip)", img: "/images/e/ed/Card-luffyts.png" },
    { name: "Nami (TS)", types: ["especialist", "dps", "diamond"], link: "/Nami_(timeskip)", img: "/images/3/35/Card-namits.png" },
    { name: "Portgas D. Ace Duduh", types: ["especialist", "shooter", "dps", "diamond"], link: "/Ace", img: "/images/4/40/Card-ace.png" },
    { name: "Robin (TS)", types: ["especialist", "dps", "diamond", "break_wall", "bridge"], link: "/Robin_(Timeskip)", img: "/images/b/b0/Card-robints.png" },
    { name: "Roronoa Zoro (TS)", types: ["slasher", "dps", "diamond", "break_wall"], link: "/Zoro_(Timeskip)", img: "/images/7/74/Card-zorots.png" },
    { name: "Sabo", types: ["fighter", "especialist", "dps", "diamond", "break_wall"], link: "/Sabo", img: "/images/0/04/Card-sabo.png" },
    { name: "Sakazuki Akainu", types: ["especialist", "fighter", "dps", "diamond", "break_wall"], link: "/Akainu", img: "/images/b/b0/Card_akainu.png" },
    { name: "Shanks", types: ["slasher", "bruiser", "diamond", "break_wall"], link: "/Shanks", img: "/images/a/aa/Card-shanks.png" },
    { name: "Usopp (TS)", types: ["shooter", "dps", "diamond", "break_wall"], link: "/Usopp_(Timeskip)", img: "/images/c/cc/Card-usoppts.png" },
    { name: "Uta", types: ["especialist", "dps", "diamond", "break_wall"], link: "/Uta", img: "/images/2/22/Card_uta.png" },
    { name: "Vinsmoke Sanji (TS)", types: ["fighter", "dps", "diamond", "break_wall"], link: "/Sanji_(Timeskip)", img: "/images/7/7a/Card-sanjits.png" },

    { name: "Kalifa", types: ["support", "gold", "especialist", "break_wall"], link: "/Kalifa", img: "/images/3/39/Kalifa_card.png" },
    { name: "Jabra", types: ["slasher", "dps", "gold", "break_wall"], link: "/Jabra", img: "/images/9/98/Jabra_card.png" },
    { name: "Kaku", types: ["slasher", "shooter", "dps", "gold", "break_wall"], link: "/Kaku", img: "/images/9/98/Kaku_card.png" },
    { name: "Rob Lucci", types: ["fighter", "dps", "gold", "break_wall"], link: "/Rob Lucci", img: "/images/b/b1/Rob_Lucci_card.png" },
    { name: "Blueno", types: ["fighter", "dps", "gold", "break_wall"], link: "/Blueno", img: "/images/5/55/Blueno_card.png" },
    { name: "Marguerite", types: ["shooter", "dps", "gold", "break_wall"], link: "/Marguerite", img: "/images/1/1c/Marguerite_Card.png" },
    { name: "Baby 5", types: ["slasher", "shooter", "gold", "dps"], link: "/Baby_5", img: "/images/5/5e/Baby5_card.png" },
    { name: "Bartolomeo", types: ["especialist", "dps", "gold", "break_wall", "bridge"], link: "/Bartolomeo", img: "/images/a/a9/Card-barto.png" },
    { name: "Basil Hawkins Lost", types: ["especialist", "bruiser", "gold", "bridge"], link: "/Basil_Hawkins", img: "/images/8/89/Card-hawkins.png" },
    { name: "Bastille", types: ["slasher", "tank", "gold", "break_wall"], link: "/Bastille", img: "/images/1/13/Card-bastille.png" },
    { name: "Bellamy", types: ["fighter", "dps", "gold", "break_wall"], link: "/Bellamy", img: "/images/7/7e/Card-bellamy.png" },
    { name: "Bonney Poseidon", types: ["fighter", "support", "gold"], link: "/Bonney", img: "/images/9/91/Card-bonney.png" },
    { name: "Brook", types: ["slasher", "support", "gold"], link: "/brook", img: "/images/7/76/Card-brook.png" },
    { name: "Capone gang bege", types: ["shooter", "dps", "gold", "break_wall"], link: "/Capone_Bege", img: "/images/c/c0/Card-capone.png" },
    { name: "Carrot", types: ["slasher", "especialist", "dps", "gold"], link: "/Carrot", img: "/images/8/8d/Card-carrot.png" },
    { name: "Tony Tony Chopper Gurren", types: ["fighter", "support", "gold", "break_wall"], link: "/Chopper", img: "/images/1/19/Card-chopper.png" },
    { name: "Crocodile", types: ["especialist", "tank", "gold", "break_wall", "bridge"], link: "/Crocodile", img: "/images/5/5d/Card-crocodile.png" },
    { name: "Dalmatian", types: ["slasher", "bruiser", "gold", "break_wall"], link: "/Dalmatian", img: "/images/9/99/Card-dalmatian.png" },
    { name: "Franky Sanitaria", types: ["shooter", "bruiser", "gold", "break_wall"], link: "/Franky", img: "/images/6/61/Card-franky.png" },
    { name: "Gecko Moria Coxinha", types: ["slasher", "support", "gold"], link: "/Gecko_Moria", img: "/images/f/fc/Moria_card.png" },
    { name: "Hina", types: ["fighter", "bruiser", "gold", "break_wall", "bridge"], link: "/Hina", img: "/images/5/57/Card-hina.png" },
    { name: "Jesus Burgess", types: ["fighter", "tank", "gold", "break_wall"], link: "/Jesus_Burgess", img: "/images/2/28/Card-burgess.png" },
    { name: "Eustass Kid Rag", types: ["shooter", "tank", "gold", "break_wall", "bridge"], link: "/Kid", img: "/images/9/9a/Card-kid.png" },
    { name: "Killer", types: ["slasher", "dps", "gold"], link: "/Killer", img: "/images/b/b2/Card-killer.png" },
    { name: "Koala", types: ["fighter", "dps", "gold"], link: "/Koala", img: "/images/f/f3/Card-koala.png" },
    { name: "Leo & Mansherry", types: ["especialist", "support", "gold", "bridge"], link: "/Leo", img: "/images/d/d9/Card-leo.png" },
    { name: "Monkey D. Luffy Visno", types: ["fighter", "bruiser", "gold", "break_wall"], link: "/Luffy", img: "/images/a/af/Card-luffy.png" },
    { name: "Nami", types: ["especialist", "dps", "gold", "break_wall"], link: "/nami", img: "/images/0/08/Card-nami.png" },
    { name: "Perona", types: ["especialist", "support", "gold", "break_wall"], link: "/Perona", img: "/images/6/6d/Card-perona.png" },
    { name: "Rebecca Ghoul Den Berry", types: ["slasher", "tank", "gold"], link: "/Rebecca", img: "/images/9/91/Card-rebecca.png" },
    { name: "Nico Robin", types: ["especialist", "dps", "gold", "break_wall", "bridge"], link: "/Robin", img: "/images/3/3f/Card-robin.png" },
    { name: "Roronoa zoro", types: ["slasher", "bruiser", "gold", "break_wall"], link: "/Roronoa_Zoro", img: "/images/6/6f/Card-zoro.png" },
    { name: "Ryuma", types: ["slasher", "dps", "gold"], link: "/Ryuma", img: "/images/a/ac/Card-ryuma.png" },
    { name: "Scratchmen Apoo", types: ["shooter", "support", "gold"], link: "/Apoo", img: "/images/9/90/Card-apoo.png" },
    { name: "Smoker Piseiro", types: ["fighter", "tank", "gold"], link: "/Smoker", img: "/images/f/fb/Card-smoker.png" },
    { name: "Trafalgar Law", types: ["slasher", "especialist", "dps", "gold", "break_wall"], link: "/Trafalgar_Law", img: "/images/b/b9/Card-law.png" },
    { name: "Urouge", types: ["fighter", "tank", "gold", "break_wall"], link: "/Urouge", img: "/images/9/98/Card-urouge.png" },
    { name: "Usopp", types: ["shooter", "dps", "gold", "break_wall"], link: "/Usopp", img: "/images/a/ac/Card-usopp.png" },
    { name: "Van Augur", types: ["shooter", "dps", "gold", "break_wall"], link: "/Van Augur", img: "/images/c/c7/Card-vanaugur.png" },
    { name: "Vinsmoke Ichiji", types: ["fighter", "bruiser", "gold", "break_wall"], link: "/Ichiji", img: "/images/8/8c/Card-ichiji.png" },
    { name: "Vinsmoke Niji", types: ["shooter", "dps", "gold"], link: "/Niji", img: "/images/6/66/Card-niji.png" },
    { name: "Vinsmoke Reiju Athena", types: ["especialist", "support", "gold"], link: "/Reiju", img: "/images/2/23/Card-reiju.png" },
    { name: "Vinsmoke Sanji", types: ["fighter", "dps", "gold", "break_wall"], link: "/Sanji", img: "/images/0/04/Card-sanji.png" },
    { name: "Vinsmoke Yonji", types: ["fighter", "tank", "gold", "break_wall"], link: "/Yonji", img: "/images/7/73/Card-yonji.png" },
    { name: "X-drake", types: ["fighter", "bruiser", "gold", "break_wall"], link: "/X_Drake", img: "/images/6/69/Card-drake.png" },
    { name: "Satori", types: ["support", "shooter", "especialist", "silver"], link: "/Satori", img: "/images/f/f3/Satori_card.png" },
    { name: "Gedatsu", types: ["fighter", "dps", "silver"], link: "/Gedatsu", img: "/images/f/f6/Gedatsu_card.png" },
    { name: "Ohm", types: ["tank", "slasher", "silver"], link: "/Ohm", img: "/images/1/1e/Ohm_card.png" },
    { name: "Shura", types: ["slasher", "dps", "silver"], link: "/Shura", img: "/images/2/2e/Shura_card.png" },
    { name: "Arlong", types: ["fighter", "bruiser", "silver", "break_wall"], link: "/Arlong", img: "/images/1/1e/Card-arlong.png" },
    { name: "Bepo", types: ["fighter", "dps", "silver"], link: "/Bepo", img: "/images/1/1d/Card-bepo.png" },
    { name: "Mr.2", types: ["fighter", "dps", "silver"], link: "/mr.2", img: "/images/2/27/Card-bonchan.png" },
    { name: "Buggy", types: ["shooter", "dps", "silver", "break_wall"], link: "/buggy", img: "/images/c/ca/Card-buggy.png" },
    { name: "Daddy Masterson", types: ["shooter", "dps", "silver"], link: "/Daddy_Masterson", img: "/images/2/20/Card-daddy.png" },
    { name: "mr.1 Daz Bonez Kolivier", types: ["slasher", "tank", "silver"], link: "/mr.1", img: "/images/6/61/Card-dazbonez.png" },
    { name: "Miss Doublefinger Zala", types: ["slasher", "bruiser", "silver"], link: "/Miss_Doublefinger", img: "/images/5/5f/Card-doublefinger.png" },
    { name: "Don Krieg", types: ["shooter", "dps", "silver"], link: "/don_Krieg", img: "/images/8/8f/Card-krieg.png" },
    { name: "Kuro", types: ["slasher", "dps", "silver"], link: "/kuro", img: "/images/3/3d/Card-kuro.png" },
    { name: "mr.3 Galdino", types: ["especialist", "support", "silver", "bridge"], link: "/mr.3", img: "/images/7/75/Card-mr3.png" },
    { name: "Tashigi", types: ["slasher", "dps", "silver"], link: "/tashigi", img: "/images/b/b8/Card-tashigi.png" },
    { name: "Nefertari Vivi", types: ["slasher", "support", "silver"], link: "/Vivi", img: "/images/9/9c/Card-vivi.png" },
    { name: "Wapol", types: ["shooter", "tank", "silver", "break_wall"], link: "/wapol", img: "/images/b/ba/Card-wapol.png" },
    { name: "Alvida", types: ["fighter", "support", "bronze"], link: "/Alvida", img: "/images/8/83/Card-alvida.png" },
    { name: "Buchi & Sham", types: ["slasher", "bruiser", "bronze"], link: "/Buchi", img: "/images/0/0b/Card-buchi.png" },
    { name: "Cabaji", types: ["slasher", "dps", "bronze"], link: "/Cabaji", img: "/images/9/9d/Card-cabaji.png" },
    { name: "Chew", types: ["shooter", "dps", "bronze", "break_wall"], link: "/Chew", img: "/images/0/0f/Card-chew.png" },
    { name: "Eric", types: ["shooter", "slasher", "dps", "bronze"], link: "/Eric", img: "/images/3/31/Card-eric.png" },
    { name: "Gin", types: ["fighter", "shooter", "dps", "bronze"], link: "/Gin", img: "/images/1/18/Card-gin.png" },
    { name: "Miss Goldenweek", types: ["support", "especialist", "bronze"], link: "/Goldenweek", img: "/images/0/0e/Card-goldenweek.png" },
    { name: "Hatchan", types: ["slasher", "support", "bronze"], link: "/Hatchan", img: "/images/3/31/Card-hatchan.png" },
    { name: "Jango", types: ["shooter", "support", "bronze"], link: "/Jango", img: "/images/4/48/Card-jango.png" },
    { name: "Kuroobi", types: ["fighter", "tank", "bronze", "break_wall"], link: "/Kuroobi", img: "/images/6/6a/Card-kuroobi.png" },
    { name: "Mohji", types: ["especialist", "bruiser", "bronze"], link: "/Mohji", img: "/images/5/58/Card-mohji.png" },
    { name: "Morgan", types: ["slasher", "bruiser", "bronze"], link: "/Morgan", img: "/images/4/43/Card-morgan.png" },
    { name: "Mr.4", types: ["shooter", "bruiser", "bronze"], link: "/Mr.4", img: "/images/9/90/Card-mr4.png" },
    { name: "Mr.5", types: ["shooter", "dps", "bronze"], link: "/Mr.5", img: "/images/4/49/Card-mr5.png" },
    { name: "Pearl", types: ["fighter", "especialist", "tank", "bronze"], link: "/Pearl", img: "/images/d/de/Card-pearl.png" },
  ];

  $(".filter--icon").on("click", function () {
    const id = $(this).attr("id");

    if ($(this).hasClass("all")) {
      $('.filter--icon.active').removeClass('active');
      $(".characters").addClass('show');
      $(".filter--icon.all").addClass('active');
      return false;
    } else {
      $(".filter--icon.all").removeClass('active');
    }

    if ($(this).hasClass("active")) {
      $(this).removeClass('active');
      actives = $('.filter--icon.active');
      query = "";

      $.each(actives, function (key, item) {
        query += "[data-type-" + item.id + "]";
      });

      $(".characters" + query).addClass('show');
    } else {
      if ($(this).hasClass("tier")) {
        $('.filter--icon.tier.active').removeClass('active');
      }

      $(this).addClass('active');
      $(".characters").removeClass('show');
      query = "";
      actives = $('.filter--icon.active');

      $.each(actives, function (key, item) {
        query += "[data-type-" + item.id + "]";
      });

      $(".characters" + query).addClass('show');
    }
  });

  $.each(characters, function (key, item) {
    data = '';
    id = item.name.replace(/\s/g, '_').toLowerCase();

    $.each(item.types, function (key, value) {
      data += "data-type-" + value + " ";
    });

    $("#characters-container").append(
      "<div id=" + id + " class='characters show' " + data + " >" +
      "<a href='https://wiki.gla.com.br/index.php" + item.link + "'>" +
      "<img src='" + item.img + "' alt='imagem de " + item.name + "' />" +
      "</a>" +
      "</div>"
    );
  });

  $(".filter--searchButton").on("click", function () {
    $(".filter--icon.active").removeClass('active');
    $(".characters.show").removeClass('show');
    if ($("#f-input").val().toLowerCase() != '') {
      $(".characters[id*=" + $("#f-input").val().toLowerCase() + "]").addClass('show');
    } else {
      $(".characters").addClass('show');
    }
  });

  $('#f-input').keypress(function (e) {
    const key = e.which;
    if (key == 13)  // the enter key code
    {
      $('.filter--searchButton').click();
      return false;
    }
  });

  //------- PERSONAGENS ---------

  //------- WANTED ---------
  const wanted_slashers = [
    { name: "Baby 5", wanteds: ["nami", "usopp", "mr. 3", "jango"], img: "/images/5/5e/Baby5_card.png" },
    { name: "Ohm", wanteds: ["robin", "nami", "brook", "zoro", "luffy", "sanji", "urouge", "ryuma", "van augur", "law", "niji", "crocodile", "cabaji"], img: "/images/1/1e/Ohm_card.png" },
    { name: "Roronoa Zoro", wanteds: ["robin", "nami", "brook", "chopper", "franky", "luffy", "sanji", "perona", "usopp", "capone", "kid", "van augur", "law", "yonji", "ichiji", "mr. 1", "mr. 2", "mr. 3", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "koala", "buggy", "gin", "mohji", "drake", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/6/6f/Card-zoro.png" },
    { name: "Shanks", wanteds: ["robin", "nami", "brook", "franky", "zoro", "luffy", "sanji", "bonney", "leo", "apoo", "rebecca", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "law", "yonji", "niji", "ichiji", "baby 5", "mr. 1", "mr. 2", "mr. 3", "doublefinger", "goldenweek", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "bellamy"], img: "/images/a/aa/Card-shanks.png" },
    { name: "Dracule Mihawk", wanteds: ["robin", "nami", "chopper", "luffy", "sanji", "bonney", "leo", "apoo", "urouge", "perona", "usopp", "ryuma", "capone", "van augur", "law", "reiju", "yonji", "niji", "ichiji", "baby 5", "mr. 2", "mr. 3", "doublefinger", "goldenweek", "mr. 4", "pearl", "arlong", "hatchan", "chew", "jango", "kuroobi", "buggy", "kuro", "krieg", "mohji", "morgan", "hawkins", "alvida", "crocodile"], img: "/images/9/91/Card-mihawk.png" },
    { name: "Killer", wanteds: ["rebecca", "van augur", "pearl", "jango", "buggy", "alvida"], img: "/images/b/b2/Card-killer.png" },
    { name: "Tashigi", wanteds: ["chopper", "zoro", "luffy", "sanji", "bonney", "urouge", "perona", "ryuma", "killer", "burgess", "kid", "reiju", "yonji", "baby 5", "mr. 1", "mr. 2", "mr. 4", "pearl", "arlong", "hatchan", "buchi", "jango", "kuroobi", "koala", "kuro", "gin", "mohji", "morgan", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/b/b8/Card-tashigi.png" },
    { name: "Roronoa Zoro (TS)", wanteds: ["chopper", "leo", "perona", "usopp", "capone", "mr. 3", "goldenweek", "pearl", "hatchan", "buchi", "jango", "buggy", "alvida"], img: "/images/7/74/Card-zorots.png" },
    { name: "Rebbeca", wanteds: ["franky", "luffy", "sanji", "urouge", "usopp", "ryuma", "killer", "capone", "van augur", "law", "yonji", "niji", "mr. 2", "doublefinger", "mr. 4", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "buggy", "kuro", "gin", "krieg", "morgan", "drake", "alvida"], img: "/images/9/91/Card-rebecca.png" },
    { name: "Carrot", wanteds: ["nami", "chopper", "luffy", "sanji", "leo", "leo", "usopp", "capone", "kid", "van augur", "law", "niji", "ichiji", "mr. 3", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "krieg", "mohji", "drake", "alvida"], img: "/images/8/8d/Card-carrot.png" },
    { name: "Shimotsuki Ryuma", wanteds: ["nami", "brook", "chopper", "franky", "sanji", "leo", "urouge", "perona", "capone", "law", "reiju", "yonji", "niji", "baby 5", "doublefinger", "goldenweek", "mr. 4", "bepo", "pearl", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "gin", "mohji", "morgan", "drake", "alvida", "crocodile"], img: "/images/a/ac/Card-ryuma.png" },
    { name: "Trafalgar Law", wanteds: ["luffy", "sanji", "leo", "apoo", "usopp", "kid", "reiju", "yonji", "niji", "ichiji", "baby 5", "doublefinger", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "buggy", "krieg", "drake", "alvida"], img: "/images/b/b9/Card-law.png" },
    { name: "Mr. 1", wanteds: ["chopper", "perona", "killer", "capone", "law", "niji", "baby 5", "mr. 2", "doublefinger", "mr. 4", "bepo", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "kuro", "krieg", "mohji", "morgan", "alvida", "wapol", "crocodile"], img: "/images/6/61/Card-dazbonez.png" },
    { name: "Bastille", wanteds: ["chopper", "zoro", "law", "doublefinger", "mr. 4", "arlong", "buchi", "kuro", "gin", "alvida", "bellamy"], img: "/images/1/13/Card-bastille.png" },
    { name: "Dalmatian", wanteds: ["capone", "mr. 2", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "mohji", "morgan", "alvida", "crocodile"], img: "/images/9/99/Card-dalmatian.png" },
    { name: "Morgan", wanteds: ["robin", "nami", "leo", "van augur", "baby 5", "goldenweek", "buchi", "chew", "jango", "alvida"], img: "/images/4/43/Card-morgan.png" },
    { name: "Cabaji", wanteds: ["nami", "chopper", "chew", "jango", "alvida"], img: "/images/9/9d/Card-cabaji.png" },
    { name: "Kuro", wanteds: ["nami", "pearl", "hatchan", "buchi", "jango", "koala", "krieg", "mohji", "alvida", "bellamy"], img: "/images/3/3d/Card-kuro.png" },
    { name: "Eric", wanteds: ["nami", "brook", "apoo", "usopp", "reiju", "mr. 3", "goldenweek", "mr. 5", "jango", "buggy", "alvida"], img: "/images/3/31/Card-eric.png" },
    { name: "Miss Doublefinger", wanteds: ["chopper", "luffy", "sanji", "urouge", "rebecca", "perona", "usopp", "burgess", "capone", "kid", "reiju", "yonji", "pearl", "hatchan", "buchi", "jango", "kuroobi", "mohji", "alvida", "wapol"], img: "/images/5/5f/Card-doublefinger.png" },
  ];

  const wanted_shooters = [
    { name: "Baby 5", wanteds: ["nami", "usopp", "mr. 3", "jango"], img: "/images/5/5e/Baby5_card.png" },
    { name: "Daddy Masterson", wanteds: ["robin", "nami", "apoo", "apoo", "usopp", "niji", "mr. 3", "goldenweek", "mr. 5", "chew", "jango", "buggy", "krieg"], img: "/images/2/20/Card-daddy.png" },
    { name: "Enel", wanteds: ["robin", "usopp", "jango", "cabaji"], img: "/images/8/85/Enel_card.png" },
    { name: "Capone Gang Bege", wanteds: ["robin", "nami", "brook", "chopper", "franky", "luffy", "sanji", "leo", "apoo", "rebecca", "usopp", "killer", "burgess", "van augur", "law", "reiju", "yonji", "niji", "ichiji", "baby 5", "mr. 2", "mr. 3", "goldenweek", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "krieg", "mohji", "morgan", "alvida", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/c/c0/Card-capone.png" },
    { name: "Franky", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "leo", "urouge", "usopp", "ryuma", "burgess", "capone", "kid", "van augur", "law", "yonji", "niji", "ichiji", "baby 5", "mr. 1", "mr. 2", "doublefinger", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "mohji", "morgan", "hawkins", "alvida", "crocodile", "cabaji"], img: "/images/6/61/Card-franky.png" },
    { name: "Eustass kid", wanteds: ["chopper", "luffy", "usopp", "kid", "baby 5", "mr. 1", "mr. 2", "doublefinger", "mr. 4", "pearl", "buchi", "gin", "hawkins", "alvida", "crocodile"], img: "/images/9/9a/Card-kid.png" },
    { name: "Van Augur", wanteds: ["robin", "nami", "brook", "chopper", "franky", "luffy", "bonney", "leo", "apoo", "urouge", "usopp", "killer", "capone", "van augur", "law", "reiju", "yonji", "niji", "ichiji", "baby 5", "mr. 2", "mr. 3", "goldenweek", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "krieg", "mohji", "morgan", "drake", "alvida", "wapol", "cabaji"], img: "/images/c/c7/Card-vanaugur.png" },
    { name: "Portgas D. Ace", wanteds: ["nami", "brook", "chopper", "bonney", "leo", "apoo", "perona", "usopp", "kid", "van augur", "niji", "mr. 3", "mr. 5", "bepo", "arlong", "buchi", "chew", "jango", "kuroobi", "buggy", "krieg", "mohji"], img: "/images/4/40/Card-ace.png" },
    { name: "Usopp (TS)", wanteds: ["brook", "chopper", "leo", "apoo", "perona", "usopp", "van augur", "niji", "mr. 3", "goldenweek", "mr. 5", "hatchan", "chew", "jango", "buggy", "krieg", "alvida"], img: "/images/c/cc/Card-usoppts.png" },
    { name: "Donquixote Doflamingo", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "bonney", "leo", "apoo", "urouge", "perona", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "law", "reiju", "yonji", "niji", "ichiji", "mr. 2", "mr. 3", "doublefinger", "goldenweek", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "buchi", "jango", "kuroobi", "koala", "buggy", "gin", "krieg", "mohji", "morgan", "drake", "alvida"], img: "/images/8/8d/Card-doflamingo.png" },
    { name: "Buggy", wanteds: ["nami", "chopper", "bonney", "apoo", "perona", "usopp", "van augur", "baby 5", "mr. 4", "mr. 5", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "krieg", "mohji", "alvida", "cabaji"], img: "/images/c/ca/Card-buggy.png" },
    { name: "Vinsmoke Niji", wanteds: ["nami", "apoo", "van augur", "reiju", "mr. 3", "mr. 5", "buchi", "jango", "buggy", "krieg", "alvida"], img: "/images/6/66/Card-niji.png" },
    { name: "Wapol", wanteds: ["robin", "nami", "brook", "chopper", "zoro", "luffy", "sanji", "urouge", "rebecca", "perona", "ryuma", "killer", "burgess", "kid", "law", "reiju", "yonji", "ichiji", "baby 5", "mr. 1", "doublefinger", "mr. 4", "pearl", "arlong", "buchi", "jango", "kuroobi", "kuro", "mohji", "morgan", "hawkins", "wapol", "crocodile"], img: "/images/b/ba/Card-wapol.png" },
    { name: "Franky (TS)", wanteds: ["chopper", "zoro", "usopp", "capone", "kid", "yonji", "mr. 1", "doublefinger", "mr. 4", "pearl", "arlong", "buchi", "kuro", "alvida"], img: "/images/d/d0/Card-frankyts.png" },
    { name: "Borsalino Kizaru", wanteds: ["capone", "jango", "drake", "alvida"], img: "/images/3/32/Card-kizaru.png" },
    { name: "Don Krieg", wanteds: ["brook", "chopper", "apoo", "capone", "reiju", "goldenweek", "mr. 5", "hatchan", "buchi", "chew", "jango", "buggy", "drake", "alvida"], img: "/images/8/8f/Card-krieg.png" },
    { name: "Eric", wanteds: ["nami", "brook", "apoo", "usopp", "reiju", "mr. 3", "goldenweek", "mr. 5", "jango", "buggy", "alvida"], img: "/images/3/31/Card-eric.png" },
    { name: "Mr. 4", wanteds: ["chopper", "zoro", "bonney", "goldenweek", "buchi", "jango", "morgan"], img: "/images/9/90/Card-mr4.png" },
    { name: "Mr. 5", wanteds: ["brook", "sanji", "bonney", "goldenweek", "jango", "kuroobi"], img: "/images/4/49/Card-mr5.png" },
    { name: "Gin", wanteds: ["chopper", "capone", "van augur", "baby 5", "mr. 3", "goldenweek", "bepo", "buchi", "gin", "krieg", "mohji", "drake", "alvida", "cabaji"], img: "/images/1/18/Card-gin.png" },
    { name: "Chew", wanteds: ["mr. 5"], img: "/images/0/0f/Card-chew.png" },
    { name: "Usopp", wanteds: ["nami", "brook", "chopper", "leo", "apoo", "reiju", "niji", "mr. 3", "mr. 5", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "buggy", "krieg", "alvida", "wapol"], img: "/images/a/ac/Card-usopp.png" },
  ];

  const wanted_fighters = [
    { name: "Sabo", wanteds: ["nami", "niji", "mr. 2", "mr. 3", "goldenweek", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "cabaji"], img: "/images/0/04/Card-sabo.png" },
    { name: "X-Drake", wanteds: ["robin", "brook", "chopper", "franky", "zoro", "sanji", "bonney", "leo", "apoo", "urouge", "rebecca", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "law", "reiju", "yonji", "ichiji", "baby 5", "mr. 1", "mr. 3", "doublefinger", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji", "bellamy"], img: "/images/6/69/Card-drake.png" },
    { name: "Hina", wanteds: ["robin", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "leo", "urouge", "rebecca", "perona", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "reiju", "yonji", "ichiji", "baby 5", "mr. 1", "mr. 3", "doublefinger", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/5/57/Card-hina.png" },
    { name: "Smoker", wanteds: ["robin", "nami", "zoro", "luffy", "urouge", "capone", "van augur", "law", "baby 5", "mr. 1", "mr. 2", "mr. 3", "mr. 5", "krieg", "alvida"], img: "/images/f/fb/Card-smoker.png" },
    { name: "Bellamy", wanteds: ["nami", "brook", "chopper", "zoro", "luffy", "sanji", "apoo", "urouge", "rebecca", "ryuma", "burgess", "van augur", "law", "yonji", "ichiji", "baby 5", "mr. 1", "mr. 2", "doublefinger", "goldenweek", "mr. 4", "bepo", "pearl", "arlong", "buchi", "jango", "kuroobi", "koala", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/7/7e/Card-bellamy.png" },
    { name: "Urouge", wanteds: ["nami", "sanji", "apoo", "usopp", "capone", "chew"], img: "/images/9/98/Card-urouge.png" },
    { name: "Boa Hancock", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "leo", "urouge", "perona", "usopp", "ryuma", "burgess", "capone", "van augur", "law", "reiju", "yonji", "ichiji", "baby 5", "mr. 1", "mr. 3", "mr. 5", "bepo", "arlong", "hatchan", "chew", "jango", "kuroobi", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji", "bellamy"], img: "/images/4/47/Card-hancock.png" },
    { name: "VinsmokeYonji", wanteds: ["mr. 4", "kuro"], img: "/images/7/73/Card-yonji.png" },
    { name: "Vinsmoke Ichiji", wanteds: ["robin", "nami", "brook", "sanji", "apoo", "urouge", "rebecca", "usopp", "capone", "ichiji", "baby 5", "mr. 3", "mr. 5", "bepo", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/8/8c/Card-ichiji.png" },
    { name: "Mr. 2", wanteds: ["bonney", "usopp", "hatchan", "krieg", "alvida"], img: "/images/2/27/Card-bonchan.png" },
    { name: "Vinsmoke Sanji (TS)", wanteds: ["nami", "chopper", "usopp", "law", "mr. 2", "doublefinger", "mr. 4", "mr. 5", "bepo", "pearl", "buchi", "chew", "jango", "koala", "buggy", "krieg", "mohji", "morgan", "alvida", "wapol", "cabaji"], img: "/images/7/7a/Card-sanjits.png" },
    { name: "Monkey D. Luffy (TS)", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "leo", "apoo", "urouge", "rebecca", "perona", "usopp", "ryuma", "killer", "burgess", "kid", "law", "yonji", "niji", "ichiji", "mr. 1", "mr. 2", "doublefinger", "goldenweek", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "buggy", "kuro", "gin", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/e/ed/Card-luffyts.png" },
    { name: "Koala", wanteds: ["robin", "nami", "brook", "franky", "zoro", "luffy", "sanji", "leo", "apoo", "urouge", "usopp", "killer", "burgess", "capone", "van augur", "law", "reiju", "yonji", "mr. 1", "mr. 2", "doublefinger", "mr. 4", "bepo", "pearl", "arlong", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "crocodile", "cabaji", "bellamy"], img: "/images/f/f3/Card-koala.png" },
    { name: "Burgess", wanteds: ["robin", "nami", "brook", "franky", "zoro", "luffy", "sanji", "rebecca", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "law", "yonji", "niji", "ichiji", "mr. 1", "mr. 2", "doublefinger", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "kuroobi", "koala", "buggy", "kuro", "gin", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/2/28/Card-burgess.png" },
    { name: "Monkey D. Luffy", wanteds: ["brook", "chopper", "franky", "sanji", "leo", "usopp", "burgess", "kid", "law", "mr. 1", "mr. 2", "mr. 4", "mr. 5", "pearl", "arlong", "hatchan", "chew", "jango", "kuroobi", "koala", "buggy", "morgan", "alvida", "wapol", "cabaji"], img: "/images/a/af/Card-luffy.png" },
    { name: "Bepo", wanteds: ["zoro", "luffy", "sanji", "pearl", "arlong", "buchi", "kuro", "mohji", "morgan", "drake", "alvida"], img: "/images/1/1d/Card-bepo.png" },
    { name: "Vinsmoke Sanji", wanteds: ["brook", "chopper", "usopp", "kid", "mr. 4", "mr. 5", "pearl", "hatchan", "buchi", "chew", "jango", "kuroobi", "buggy", "gin", "morgan", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/0/04/Card-sanji.png" },
    { name: "Arlong", wanteds: ["mr. 2", "chew", "alvida"], img: "/images/1/1e/Card-arlong.png" },
    { name: "Gin", wanteds: ["chopper", "capone", "van augur", "baby 5", "mr. 3", "goldenweek", "bepo", "buchi", "gin", "krieg", "mohji", "drake", "alvida", "cabaji"], img: "/images/1/18/Card-gin.png" },
  ];

  const wanted_especialists = [
    { name: "Sakazuki Akainu", wanteds: ["capone", "bellamy"], img: "/images/b/b0/Card_akainu.png" },
    { name: "Uta", wanteds: ["nami", "usopp", "jango", "buggy"], img: "/images/2/22/Card_uta.png" },
    { name: "Sabo", wanteds: ["nami", "niji", "mr. 2", "mr. 3", "goldenweek", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "cabaji"], img: "/images/0/04/Card-sabo.png" },
    { name: "Enel", wanteds: ["robin", "usopp", "jango", "cabaji"], img: "/images/8/85/Enel_card.png" },
    { name: "Vinsmoke Reiju", wanteds: ["brook", "bonney", "urouge", "rebecca", "killer", "burgess", "kid", "reiju", "yonji", "baby 5", "mr. 2", "doublefinger", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "koala", "kuro", "gin", "mohji", "morgan", "hawkins", "alvida", "crocodile", "cabaji"], img: "/images/2/23/Card-reiju.png" },
    { name: "Portgas D. Ace", wanteds: ["nami", "brook", "chopper", "bonney", "leo", "apoo", "perona", "usopp", "kid", "van augur", "niji", "mr. 3", "mr. 5", "bepo", "arlong", "buchi", "chew", "jango", "kuroobi", "buggy", "krieg", "mohji"], img: "/images/4/40/Card-ace.png" },
    { name: "Donquixte Doflamingo", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "bonney", "leo", "apoo", "urouge", "perona", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "law", "reiju", "yonji", "niji", "ichiji", "mr. 2", "mr. 3", "doublefinger", "goldenweek", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "buchi", "jango", "kuroobi", "koala", "buggy", "gin", "krieg", "mohji", "morgan", "drake", "alvida"], img: "/images/8/8d/Card-doflamingo.png" },
    { name: "Borsalino Kizaru", wanteds: ["capone", "jango", "drake", "alvida"], img: "/images/3/32/Card-kizaru.png" },
    { name: "Trafalgar Law", wanteds: ["luffy", "sanji", "leo", "apoo", "usopp", "kid", "reiju", "yonji", "niji", "ichiji", "baby 5", "doublefinger", "mr. 4", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "buggy", "krieg", "drake", "alvida"], img: "/images/b/b9/Card-law.png" },
    { name: "Carrot", wanteds: ["nami", "chopper", "luffy", "sanji", "leo", "leo", "usopp", "capone", "kid", "van augur", "law", "niji", "ichiji", "mr. 3", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "krieg", "mohji", "drake", "alvida"], img: "/images/8/8d/Card-carrot.png" },
    { name: "Nami (TS)", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "bonney", "leo", "apoo", "urouge", "rebecca", "usopp", "ryuma", "killer", "kid", "law", "reiju", "yonji", "niji", "ichiji", "baby 5", "mr. 1", "mr. 2", "mr. 3", "doublefinger", "goldenweek", "mr. 4", "mr. 5", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji"], img: "/images/3/35/Card-namits.png" },
    { name: "Nami", wanteds: ["chopper", "bonney", "leo", "apoo", "burgess", "law", "niji", "mr. 3", "doublefinger", "goldenweek", "mr. 5", "pearl", "hatchan", "buchi", "chew", "jango", "buggy", "krieg", "mohji", "alvida"], img: "/images/0/08/Card-nami.png" },
    { name: "Nico Robin", wanteds: ["nami", "chopper", "leo", "apoo", "usopp", "mr. 3", "arlong", "buchi", "chew", "jango", "buggy", "mohji", "alvida"], img: "/images/3/3f/Card-robin.png" },
    { name: "Nico Robin (TS)", wanteds: ["bonney", "leo", "apoo", "perona", "mr. 3", "buchi", "chew", "jango", "alvida"], img: "/images/b/b0/Card-robints.png" },
    { name: "Bartolomeo", wanteds: ["urouge", "reiju", "pearl", "arlong", "jango", "kuroobi", "koala", "morgan", "drake", "alvida"], img: "/images/a/a9/Card-barto.png" },
    { name: "Marshall D. Teach", wanteds: ["bonney", "perona", "killer", "capone", "mr. 2", "goldenweek", "mr. 5", "pearl", "buchi", "chew", "jango", "buggy", "alvida"], img: "/images/f/ff/Card-kurohige.png" },
    { name: "Crocodile", wanteds: ["nami", "yonji", "mr. 1", "alvida"], img: "/images/5/5d/Card-crocodile.png" },
    { name: "Bartolomew Kuma", wanteds: ["robin", "nami", "brook", "chopper", "franky", "zoro", "luffy", "sanji", "urouge", "rebecca", "usopp", "ryuma", "killer", "burgess", "capone", "kid", "van augur", "yonji", "niji", "ichiji", "baby 5", "mr. 1", "mr. 2", "mr. 3", "doublefinger", "mr. 4", "mr. 5", "bepo", "pearl", "arlong", "hatchan", "buchi", "chew", "jango", "kuroobi", "koala", "buggy", "kuro", "gin", "krieg", "mohji", "morgan", "drake", "hawkins", "alvida", "wapol", "crocodile", "cabaji", "bellamy"], img: "/images/b/b5/Card-kuma.png" },
    { name: "Basil Hawkins", wanteds: ["luffy", "urouge", "yonji", "pearl", "kuroobi", "alvida"], img: "/images/8/89/Card-hawkins.png" },
    { name: "Mohji", wanteds: ["alvida", "bonney", "buggy", "pearl", "van augur"], img: "/images/5/58/Card-mohji.png" },
    { name: "Leo & Mansherry", wanteds: ["alvida", "bonney", "mohji"], img: "/images/d/d9/Card-leo.png" },
  ];

  function filterAndAppend(array, value, id) {
    whoDo = array.filter(
      function (v) {
        return v.wanteds.includes(value);
      }
    );

    $.each(whoDo, function (key, item) {
      $(".wantedPortraits#" + id).append(
        "<div class='wantedPortrait' >" +
        "<img src='" + item.img + "' alt='imagem de " + item.name + "' />" +
        "</div>"
      );
    })
  }

  $("#selectbox-wanted").on("input", function () {
    const value = $(this).val();

    if ($(".wantedPortrait"))
      $(".wantedPortrait").remove();

    filterAndAppend(wanted_shooters, value, "wanted-shooter");
    filterAndAppend(wanted_slashers, value, "wanted-slasher");
    filterAndAppend(wanted_fighters, value, "wanted-fighter");
    filterAndAppend(wanted_especialists, value, "wanted-especialist");
  });
  //------- WANTED ---------

  //------- SKILL TAB ---------
  $('.tab-skill').on('click', function () {
    $('.tab-skill.active').removeClass('active');
    $(this).addClass('active');
    const skillId = $(this).data('skill-id');
    if ($(".skillInfo[data-skill-id=" + skillId + "]")) {
      $(".skillInfo.active").removeClass('active');
      $(".skillInfo[data-skill-id=" + skillId + "]").addClass('active');
    }
  });
  //------- SKILL TAB ---------

  //------- CALCULATOR XP ---------
  const maximum_level = 110;
  const tier_values = {
    "diamond": 1,
    "gold": 1,
    "silver": 2,
    "bronze": 3
  };

  $(".calcXp--tierIcon").on("click", function () {
    $(".calcXp--tierIcon.active").removeClass('active');
    $(this).addClass('active');
  });

  $("#calculate-btn").on('click', function () {
    getNeededPotions();
  });

  function calcMissingXpInPotions() {
    const currentPercentOfXp = $("#char-currentPercentOfXp").val() != "" ? $("#char-currentPercentOfXp").val() : 100;
    const currentLevel = $("#char-level").val() != "" ? $("#char-level").val() : 1;
    const levelToUp = $("#char-levelToUp").val() != "" ? $("#char-levelToUp").val() : 110;
    const charTier = $(".calcXp--tierIcon.active").length != 0 ? tier_values[$(".calcXp--tierIcon.active").attr('id')] : tier_values["gold"];

    const percentToUp = 100 - currentPercentOfXp;
    const currentXp = ((50 * (Math.pow((currentLevel - 1), 3)) - 150 * (Math.pow((currentLevel - 1), 2)) + 400 * (currentLevel - 1)) / 3) + ((50 * Math.pow(currentLevel, 2) - 150 * currentLevel + 200) * percentToUp / 100);
    const desiredXp = (50 * (Math.pow((levelToUp - 1), 3)) - 150 * (Math.pow((levelToUp - 1), 2)) + 400 * (levelToUp - 1)) / 3;
    const missingXp = Math.round((desiredXp - currentXp));

    const missingPotions = {
      "small": Math.ceil((missingXp / (1000 * charTier))),
      "medium": (missingXp / (10000 * charTier)).toFixed(1),
      "big": (missingXp / (100000 * charTier)).toFixed(2)
    };

    return missingPotions;
  }

  function calcPotions() {
    const missingPotions = calcMissingXpInPotions();

    var complementaryPotS;
    var complementaryPotM;
    potS = missingPotions['small'];
    potM = missingPotions['medium'];
    potB = missingPotions['big'];

    if (String(potS).slice(-1) == "0") {
      potM = Math.ceil(parseFloat(potM));
    } else {
      potM = Math.floor(potM);
      complementaryPotS = potS - potM * 10;
    }

    if (String(potM).slice(-1) == "0") {
      potM = Math.ceil((parseFloat(potM)));
      potB = Math.floor(potB);
    }
    else {
      potB = Math.floor(potB)
      complementaryPotM = potM - potB * 10
    }

    const potions = {
      "small": complementaryPotS,
      "medium": complementaryPotM,
      "big": potB
    }

    return potions;
  }

  function getNeededPotions() {
    const potions = calcPotions();
    const resultsArea = $("#calc-result");

    resultsArea.html('');

    if (potions["big"]) {
      resultsArea.append(
        "<div class='badge'>" +
        "<img src='/images/a/a5/Bigexppot.png' class='calcXp--xpIcon' />" +
        "<span class='calcXp--numberOfPots'>" + potions['big'] + "</span>" +
        "</div>"
      );
    }


    if (potions["medium"]) {
      resultsArea.append(
        "<div class='badge'>" +
        "<img src='/images/d/df/Medexppot.png' class='calcXp--xpIcon' />" +
        "<span class='calcXp--numberOfPots'>" + potions['medium'] + "</span>" +
        "</div>"
      );
    }


    if (potions["small"]) {
      resultsArea.append(
        "<div class='badge'>" +
        "<img src='/images/5/5a/Smallexppot.png' class='calcXp--xpIcon' />" +
        "<span class='calcXp--numberOfPots'>" + potions['small'] + "</span>" +
        "</div>"
      );
    }
  }
  //------- CALCULATOR XP ---------

  //------- VIDEO SELECTOR ---------
  $(".video-selector").on("click", function () {
    $(".video-selector.active").removeClass("active");
    $(this).addClass("active");

    const value = $(this).data("value");
    const obj = eval('(' + value + ')');
    $("video[data-type-" + obj.select + "].active").removeClass('active');
    const index = obj.showId - 1;
    $("video[data-type-" + obj.select + "]").eq(index).addClass('active');
  });
  //------- VIDEO SELECTOR ---------
  //-------- gurren
  $(document).ready(function () {
    // Alternar entre mostrar e ocultar abas ao clicar
    $('.mostrar-aba').click(function () {
      var aba_id = $(this).attr('data-aba');
      var aba_selecionada = $("#aba-" + aba_id);

      if (aba_selecionada.hasClass('atual')) {
        aba_selecionada.removeClass('atual'); // Oculta a aba se já estiver ativa
        $(this).removeClass('ativa'); // Remove a classe ativa do botão
      } else {
        $('.aba').removeClass('atual'); // Oculta todas as abas
        aba_selecionada.addClass('atual'); // Exibe a aba correspondente
        $('.mostrar-aba').removeClass('ativa'); // Remove a classe ativa de outros botões
        $(this).addClass('ativa'); // Adiciona a classe ativa ao botão clicado
      }
    });

    // Exibir aba correspondente ao hash da URL
    var url = location.href;
    var hash = url.split('#')[1];
    if (hash != null && hash.length > 0) {
      $("#aba-" + hash).addClass('atual'); // Exibe a aba do hash
      $('*[data-aba="' + hash + '"]').addClass('ativa'); // Ativa o botão correspondente
    }
  });
});


//------- 2222222222222222222222222222222222222222222222222222222222222222222222 ---------
/*
(function () {
    'use strict';

    var STORAGE_KEY = 'gla-wiki-theme';
    var DARK_CLASS = 'gla-dark-mode';
    var BUTTON_ID = 'gla-darkmode-toggle';

    function getSavedTheme() {
        try {
            return localStorage.getItem(STORAGE_KEY);
        } catch (e) {
            return null;
        }
    }

    function saveTheme(theme) {
        try {
            localStorage.setItem(STORAGE_KEY, theme);
        } catch (e) {
            // Ignora caso o navegador bloqueie localStorage
        }
    }

    function isDarkMode() {
        return document.documentElement.classList.contains(DARK_CLASS);
    }

    function applyTheme(theme) {
        var dark = theme === 'dark';

        document.documentElement.classList.toggle(DARK_CLASS, dark);

        if (document.body) {
            document.body.classList.toggle(DARK_CLASS, dark);
        }

        updateButton();
    }

    function updateButton() {
        var button = document.getElementById(BUTTON_ID);

        if (!button) {
            return;
        }

        var dark = isDarkMode();

        button.setAttribute('aria-pressed', dark ? 'true' : 'false');
        button.setAttribute('title', dark ? 'Alternar para modo claro' : 'Alternar para modo escuro');

        button.innerHTML = dark
            ? '<span class="gla-darkmode-icon">☀</span><span class="gla-darkmode-text">Modo claro</span>'
            : '<span class="gla-darkmode-icon">☾</span><span class="gla-darkmode-text">Modo escuro</span>';
    }

    function createButton() {
        if (document.getElementById(BUTTON_ID)) {
            return;
        }

        var button = document.createElement('button');

        button.id = BUTTON_ID;
        button.type = 'button';
        button.className = 'gla-darkmode-button';
        button.setAttribute('aria-label', 'Alternar modo escuro');
        button.setAttribute('aria-pressed', isDarkMode() ? 'true' : 'false');

        button.addEventListener('click', function () {
            var nextTheme = isDarkMode() ? 'light' : 'dark';

            saveTheme(nextTheme);
            applyTheme(nextTheme);
        });

        document.body.appendChild(button);
        updateButton();
    }

    function ready(fn) {
        if (document.readyState === 'loading') {
            document.addEventListener('DOMContentLoaded', fn);
        } else {
            fn();
        }
    }

    var savedTheme = getSavedTheme();

    if (savedTheme === 'dark') {
        document.documentElement.classList.add(DARK_CLASS);
    }

    ready(function () {
        if (savedTheme === 'dark') {
            document.body.classList.add(DARK_CLASS);
        }

        createButton();
        updateButton();
    });
})();
*/
/**
* Script JavaScript para o componente de abas MediaWiki
* Adicione este script na sua MediaWiki (Common.js ou página de scripts)
*/

(function () {
  'use strict';

  // Inicializa todos os componentes de abas na página
  function initTabbers() {
    const tabbers = document.querySelectorAll('[data-tabber]');

    tabbers.forEach(function (tabber) {
      const tabs = tabber.querySelectorAll('.mw-tabber-tab');
      const panels = tabber.querySelectorAll('.mw-tabber-panel');

      tabs.forEach(function (tab) {
        tab.addEventListener('click', function () {
          const targetTab = this.getAttribute('data-tab');

          // Remove classe active de todas as abas
          tabs.forEach(function (t) {
            t.classList.remove('active');
          });

          // Remove classe active de todos os painéis
          panels.forEach(function (p) {
            p.classList.remove('active');
          });

          // Adiciona classe active na aba clicada
          this.classList.add('active');

          // Adiciona classe active no painel correspondente
          const targetPanel = tabber.querySelector('[data-panel="' + targetTab + '"]');
          if (targetPanel) {
            targetPanel.classList.add('active');
          }
        });
      });
    });
  }

  // Inicializa quando o DOM estiver pronto
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', initTabbers);
  } else {
    initTabbers();
  }

});

/* =============================================================================
   GLA language switch (glaLang) - global toggle + page panes + gla:langChanged
   Contrato: localStorage "glaLang" (pt-br | en), evento window "gla:langChanged"
   ============================================================================= */
(function () {
  'use strict';

  var STORAGE_KEY = 'glaLang';
  var UI_LANGS = ['pt-br', 'en'];
  var FLAG_IMG = {
    'pt-br': 'https://wiki.gla.com.br/images/8/8c/Brazil.png',
    'en': 'https://wiki.gla.com.br/images/0/0a/Usa.png'
  };

  function normalizeLang(s) {
    s = (s || '').toLowerCase();
    if (s === 'pt-br' || s === 'pt_br' || s === 'ptbr' || s === 'pt') return 'pt';
    return (s.split('-')[0] || 'pt');
  }

  function toLangTag(langFull) {
    var tag = (langFull || 'pt-br').toLowerCase();
    if (tag === 'pt') return 'pt-br';
    return UI_LANGS.indexOf(tag) >= 0 ? tag : 'pt-br';
  }

  function paneMatches(paneLang, langTag) {
    var pane = (paneLang || '').toLowerCase();
    var tag = (langTag || 'pt-br').toLowerCase();
    if (pane === tag) return true;
    if ((pane === 'pt' || pane === 'pt-br') && (tag === 'pt' || tag === 'pt-br')) return true;
    return pane.split('-')[0] === tag.split('-')[0];
  }

  function getStored() {
    try {
      var saved = (localStorage.getItem(STORAGE_KEY) || '').toLowerCase();
      if (saved && UI_LANGS.indexOf(saved) >= 0) return saved;
    } catch (e) { }
    return 'pt-br';
  }

  function markFlags(langTag) {
    document.querySelectorAll('.gla-lang-flag[data-lang]').forEach(function (btn) {
      btn.classList.toggle('active', paneMatches(btn.getAttribute('data-lang'), langTag));
    });
  }

  function updatePanes(langTag) {
    document.querySelectorAll('.gla-i18n').forEach(function (wrap) {
      var mode = (wrap.getAttribute('data-gla-i18n-mode') || 'panes').toLowerCase();
      if (mode === 'client') return;
      var panes = wrap.querySelectorAll(':scope > .gla-i18n-pane');
      if (!panes.length) return;
      panes.forEach(function (pane) {
        var show = paneMatches(pane.getAttribute('data-lang'), langTag);
        pane.hidden = !show;
        pane.style.display = show ? '' : 'none';
      });
    });
  }

  function applyLang(langFull, opts) {
    opts = opts || {};
    var langTag = toLangTag(langFull);
    var norm = normalizeLang(langTag);

    document.documentElement.lang = langTag;
    document.documentElement.setAttribute('data-gla-lang', norm);
    try {
      localStorage.setItem(STORAGE_KEY, langTag);
    } catch (e) { }

    markFlags(langTag);
    updatePanes(langTag);

    if (opts.silent !== true) {
      try {
        window.dispatchEvent(new CustomEvent('gla:langChanged', { detail: { norm: norm, tag: langTag } }));
      } catch (e2) { }
    }

    return norm;
  }

  function pageHasI18n() {
    return !!document.querySelector(
      '[data-gla-i18n], .gla-i18n, .item-wrapper, .item-tooltip-enc, ' +
      '.gla-item-chip, .gla-quest-item-chip, [data-gla-item-chip], .character-box'
    );
  }

  function shouldShowToggle() {
    return pageHasI18n();
  }

  function injectToggle() {
    if (!shouldShowToggle() || document.getElementById('pt-langtoggle')) {
      return;
    }

    var ul = document.querySelector('#p-personal .vector-menu-content-list') ||
      document.querySelector('#p-personal ul');
    if (!ul) return;

    var li = document.createElement('li');
    li.id = 'pt-langtoggle';
    li.className = 'mw-list-item';

    var group = document.createElement('span');
    group.className = 'gla-lang-toggle';
    group.setAttribute('role', 'group');
    group.setAttribute('aria-label', 'Language');

    UI_LANGS.forEach(function (code) {
      var btn = document.createElement('button');
      btn.type = 'button';
      btn.className = 'gla-lang-flag';
      btn.setAttribute('data-lang', code);
      btn.title = code === 'pt-br' ? 'Português (Brasil)' : 'English';
      btn.setAttribute('aria-label', btn.title);
      var img = document.createElement('img');
      img.src = FLAG_IMG[code] || '';
      img.alt = '';
      img.width = 24;
      img.height = 16;
      btn.appendChild(img);
      group.appendChild(btn);
    });

    li.appendChild(group);

    var anchor = document.getElementById('pt-darkmode');
    if (anchor && anchor.parentNode === ul) {
      anchor.insertAdjacentElement('afterend', li);
    } else {
      ul.insertBefore(li, ul.firstChild);
    }
  }

  function bindToggle() {
    if (window.glaLangToggleBound) return;
    window.glaLangToggleBound = true;

    document.addEventListener('click', function (e) {
      var btn = e.target.closest('.gla-lang-flag[data-lang]');
      if (!btn) return;
      e.preventDefault();
      applyLang(btn.getAttribute('data-lang') || 'pt-br');
    });
  }

  function boot() {
    if (pageHasI18n()) {
      document.body.classList.add('gla-i18n-page');
    }
    injectToggle();
    bindToggle();
    applyLang(getStored(), { silent: true });
    try {
      window.dispatchEvent(new CustomEvent('gla:langChanged', {
        detail: { norm: normalizeLang(getStored()), tag: getStored() }
      }));
    } catch (e) { }
  }

  window.glaLang = {
    STORAGE_KEY: STORAGE_KEY,
    UI_LANGS: UI_LANGS,
    normalizeLang: normalizeLang,
    toLangTag: toLangTag,
    getStored: getStored,
    getNorm: function () {
      return normalizeLang(document.documentElement.lang || getStored());
    },
    getWidgetLang: function () {
      return this.getNorm() === 'en' ? 'en' : 'pt';
    },
    applyLang: applyLang
  };

  window.glaLangBoot = boot;

  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', boot);
  } else {
    boot();
  }
  window.addEventListener('load', boot);

  var tries = 0;
  var retryTimer = setInterval(function () {
    if (document.getElementById('pt-langtoggle') || !shouldShowToggle() || tries++ > 40) {
      clearInterval(retryTimer);
      return;
    }
    injectToggle();
  }, 150);
})();