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

De Wiki Gla
Ir para navegação Ir para pesquisar
m
 
(656 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 */
$(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;


// Countdown timer that is accurate to the second and accounts for Daylight Savings Time (DST) unless
        // Informações dos eventos
// otherwise specified.
        /*
// Example: a countdown of loopTime=30 seconds and a delayTime=10 seconds will have a delay timer start a
          0 - Domingo
// count down from 9 to 0 seconds and the actual timer start a count down from 19 to 0 seconds.
          1 - Segunda-feira
// Reference: https://www.w3schools.com/howto/howto_js_countdown.asp
          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' },
            ]
        };


// All of these CSS classes must be present on page in order for countdown timer to function
        function pad(value) {
const COUNTDOWN_CLASSES = ["seedDate", "bText", "bDelayText", "timer",
            return value < 10 ? '0' + value : value;
        "aText", "aDelayText", "loopTime", "loopLimit", "endText",  
        }
        "delayTime", "delayDisplay", "dst", "dateFormat", "dateLabels"];
 
Object.freeze(COUNTDOWN_CLASSES);
        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',
                        })
                    );


const BARO_COUNTDOWN_CLASSES = {
                    // Só inicia a contagem regressiva quando estiver próximo (faltando 5 minutos ou menos)
    PC: "pcPlanet",  
                    if (eventStartTime - now <= 5 * 60 * 1000) {
    PS4: "ps4Planet",
                        startGlobalEventCountdown(eventStartTime, eventEndTime);
    XB1: "xb1Planet",
                    }
    NSW: "nswPlanet"
                    return;
};
                }
Object.freeze(BARO_COUNTDOWN_CLASSES);
            }


// All dictionaries related to time use the abbreviated time units as keys
            // Após o último evento do dia
const TIME_UNIT_ABBR = {
            globalEventsImage.attr('src', '/images/0/0a/Anyevent.png'); // Imagem padrão
    Year: "Y",
            globalEventsTimer.html('Acabaram os eventos por hoje');
    Month: "M",
        }
    Day: "D",
    Hour: "h",
    Minute: "m",
    Second: "s"
};
Object.freeze(TIME_UNIT_ABBR);


const TIME_IN_MILLISECONDS = {
        $(document).ready(function () {
     Y: 31536000000,  // assuming leap years are irrelevant (milliseconds in a day * 365)
            setGlobalEvent();
     M: 2628000000,  // average milliseconds per month (milliseconds in a year / 12)
        });
     D: 86400000,
     })();
    h: 3600000,
     //------- GLOBAL EVENTS TIMER ---------
    m: 60000,
    //------- TOOLTIP IMAGE---------
    s: 1000
     /*
};
        Tooltip image consiste em uma funcionalidade que insere uma tag IMG
Object.freeze(TIME_IN_MILLISECONDS);
        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.
    */


// Mapping relay names to their respective planet
    //Distanciamento / margem do mouse
var relayDict = {
    const offset = { x: 20, y: 10 };
    Mercury: "Larunda",
    Venus: "Vesper",
    Earth: "Strata",
    Saturn: "Kronia",
    Pluto: "Orcus",
    Europa: "Leonov",
    Eris: "Kuiper"
};


// Planets are in order of Baro Ki'Teer's rotation
    $('.tooltip-image').on('mouseenter',
var platformRelayDict = {
        function (e) {
    PC: ["Earth", "Pluto", "Saturn", "Mercury"],
            var src = $(this).attr('src');
    PS4: ["Earth", "Eris", "Mercury", "Saturn"],
            var size = $(this).width() * 1.3;
    XB1: ["Venus", "Pluto", "Europa", "Earth"],
    NSW: ["Europa", "Eris", "Mercury", "Venus"]
};


var countdownTimers;
            $('<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();
            });


// Assume that this code is only invoked by Template:Countdown
    $('.tooltip-image').mousemove(function (e) {
if (document.getElementsByClassName("customcountdown").length > 0) {
        $('#bigImage').css('left', e.pageX + offset.x).css('top', e.pageY + offset.y);
     countdownInit();
     });
}
    //------- TOOLTIP IMAGE---------


/**
    //------- FUNCIONALIDADES PACIENTES KUREHA ---------
* Initializes countdown timers.
    const pacients = {
*/
        "bafo": { image: "/images/c/ce/Bafo_static.png", gif: "/images/e/e0/Bafo.gif" },
function countdownInit() {
        "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" },
    // Stores the innerHTML of elements with the CSS class associated with the key;
        "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" },
    // each element contains an object representing all the countdown elements
        "tremendo": { image: "/images/thumb/3/35/Tremendo_static.png/180px-Tremendo_static.png", gif: "/images/thumb/f/f4/Tremendo.gif/180px-Tremendo.gif" },
    // for a particular timer.
        "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" },
    countdownTimers = getTimersElements();
        "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" },
    console.log("Countdown timer elements recognized.");
        "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" }
    };


     updateTimers();
     const audioPlayer = document.querySelector("#audio");
    console.log("Countdown timers started.");


     // Update timers every second
     $(".pacient-audio").on("click", function (e) {
    setInterval(function() {
         id = $(this).attr('id');
         updateTimers();
    }, 1000);
}


function updateTimers() {
        if (pacients[id]) {
    // Create countdown timer for each element with .customcountdown class
            audioPlayer.src = pacients[id].audio;
    for (var i = 0; i < countdownTimers.length; i++) {
            audioPlayer.play();
        updateTimer(countdownTimers[i], i);
        }
    }
}


/**
    });
* Calculate time difference and update timer each second.
* @param {*} timerParams - dictionary that contains parameters for countdown timer
* @param {*} num - countdown timer instance
*/
function updateTimer(timerParams, num) {
    var now = new Date();


     // Parameters are stored in innerHTML
     $('.interactive-pacient').on('mouseenter', function (e) {
    var seedDate = new Date((timerParams.seedDate === "") ? "December 3, 2015 00:00:00 UTC"
         id = $(this).attr('id');
         : timerParams.seedDate);


    if (isNaN(seedDate.getTime())) {
        if (pacients[id])
         throw "ERROR: seedDate is not in a valid date format (e.g. \"December 3, 2015 00:00:00 UTC\").";
            $(this).attr('src', pacients[id].gif);
    }
    }).on('mouseleave', function (e) {
         id = $(this).attr('id');


    // Time between loop iterations (i.e. duration of a loop)
        if (pacients[id])
    var loopTime = convertTimeToMilliseconds(timerParams.loopTime);
            $(this).attr('src', pacients[id].image);
    // Maximum number of loop iterations; it loopLimit is less than 0, then effectively
    });
    // treat it as infinite number of loops
    var loopLimit = (isNaN(timerParams.loopLimit)) ? 0 :
        (timerParams.loopLimit < 0) ? Number.MAX_SAFE_INTEGER
        : Number(timerParams.loopLimit);


     // Splits total loopTime into two time periods, one that is the delayed countdown (i.e.
     //------- FUNCIONALIDADES PACIENTES KUREHA ---------
    // a countdown of the countdown) and the other is the actual countdown; timers switch
    //------- FUNCIONALIDADES BUZINAS ---------
    // after the other timer reaches zero
    const horns = {
    // (e.g. if delayTime == 20s and loopTime = 60s, the first 20s will be a 20s countdown
        "Buzinadelacucha": { audio: "/images/5/55/Buzinadelacucha-audio.ogg" },
    // with delay text while the next 40s will be the actual countdown)
        "Buzinadefumaca": { audio: "/images/3/3a/Buzinadefumaca-audio.ogg" },
     var delayTime = convertTimeToMilliseconds(timerParams.delayTime);
        "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" }
     };


     // Show delayed countdown if true
     const hornAudioPlayer = document.querySelector("#audio");
    var delayDisplay = timerParams.delayDisplay === "";


     // delayTime should always be less than total loopTime
     $(".horn-audio").on("click", function (e) {
    if (delayTime >= loopTime) {
        const id = $(this).attr('id');
        throw "ERROR: Cannot have a delayTime that is larger than total loopTime.";
        if (horns[id]) {
     }
            hornAudioPlayer.src = horns[id].audio;
            hornAudioPlayer.play();
        }
     });


     var numLoops = calculateNumLoops(now, seedDate, 0, loopTime, loopLimit);
     //------- FUNCIONALIDADES BUZINAS ---------
    var numLoopsDelay = calculateNumLoops(now, seedDate, delayTime, loopTime, loopLimit);


     var endDate = findEndDate(seedDate, 0, numLoops, loopTime);
     //------- PERSONAGENS ---------
    var endDateDelay = findEndDate(seedDate, delayTime, numLoopsDelay, loopTime);


     // Accounts for Daylight Saving Time (DST) between now and target date
     const characters = [
    // by default unless otherwise specified
        { name: "Aokiji Dio", types: ["slasher", "especialist", "tank", "marine", "diamond", "break_wall", "bridge"], link: "/Aokiji", img: "/images/6/67/Aokiji_card.png" },
    var dstOffset = (timerParams.dst === "") ?
        { name: "Bartolomew Kuma", types: ["especialist", "tank", "diamond", "break_wall"], link: "/Kuma", img: "/images/b/b5/Card-kuma.png" },
         (now.getTimezoneOffset() - endDate.getTimezoneOffset()) * 60 * 1000 : 0;
        { name: "Boa Hancock", types: ["fighter", "dps", "diamond"], link: "/Boa_Hancock", img: "/images/4/47/Card-hancock.png" },
    var dstOffsetDelay = (timerParams.dst === "") ?
        { name: "Borsalino Kizaru", types: ["especialist", "shooter", "dps", "diamond", "break_wall"], link: "/Kizaru", img: "/images/3/32/Card-kizaru.png" },
         (now.getTimezoneOffset() - endDateDelay.getTimezoneOffset()) * 60 * 1000 : 0;
         { 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" },
    // Total time between now and target date in milliseconds converted
        { name: "Doflamingo", types: ["shooter", "especialist", "dps", "diamond", "break_wall", "bridge"], link: "/Doflamingo", img: "/images/8/8d/Card-doflamingo.png" },
    // to certain time period
        { name: "Dracule Mihawk", types: ["slasher", "dps", "diamond", "break_wall"], link: "/Mihawk", img: "/images/9/91/Card-mihawk.png" },
    // (i.e. for 120 minutes: years = 0; months = 0; days = 0;
        { name: "Emporio Ivankov", types: ["fighter", "support", "diamond", "break_wall"], link: "/Ivankov", img: "/images/c/ca/Card-ivankov.png" },
    // hours = 2; minutes = 120; seconds = 7200)
         { name: "Enel", types: ["shooter", "especialist", "diamond", "dps"], link: "/Enel", img: "/images/8/85/Enel_card.png" },
    // time string will result in "00021207200" thus far
        { name: "Franky (TS) Sanitaria", types: ["shooter", "tank", "diamond", "break_wall"], link: "/Franky_(Timeskip)", img: "/images/d/d0/Card-frankyts.png" },
    var timeDiff = calculateTimeDiff(now, endDate, dstOffset)// in milliseconds, rounded to the nearest thousandths place
        { name: "Jinbe", types: ["fighter", "tank", "diamond", "break_wall"], link: "/Jinbe", img: "/images/2/2e/Card-jinbe.png" },
    var timeDiffDelay = calculateTimeDiff(now, endDateDelay, dstOffsetDelay);
        { name: "Marshall D. Teach Barba Negra", types: ["especialist", "bruiser", "diamond"], link: "/Marshall_D._Teach", img: "/images/f/ff/Card-kurohige.png" },
    // console.log("Loop time: " + loopTime +
        { name: "Marco Abacaxi", types: ["especialist", "fighter", "support", "diamond"], link: "/Marco", img: "/images/2/2b/Marco_card.png" },
    //     " | Time diff: " + timeDiff +
        { name: "Monkey D. Luffy (TS) Visno", types: ["fighter", "dps", "diamond", "break_wall"], link: "/Luffy_(Timeskip)", img: "/images/e/ed/Card-luffyts.png" },
    //     " | Delay time diff: " + timeDiffDelay +
        { name: "Nami (TS)", types: ["especialist", "dps", "diamond"], link: "/Nami_(Timeskip)", img: "/images/3/35/Card-namits.png" },
    //     " | Loop time - time diff " + (loopTime - timeDiff)
        { 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" },


    var dateFormat = (timerParams.dateFormat === "") ? "YY MM DD hh mm ss"  
        { name: "Kalifa", types: ["support", "gold", "especialist", "break_wall"], link: "/Kalifa", img: "/images/3/39/Kalifa_card.png" },
         : timerParams.dateFormat;
        { 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" },


    // Based on the specified time periods' desired units, gives each time
        { name: "Baby 5", types: ["slasher", "shooter", "gold", "dps"], link: "/Baby_5", img: "/images/5/5e/Baby5_card.png" },
    // period in the string certain units
        { name: "Bartolomeo", types: ["especialist", "dps", "gold", "break_wall", "bridge"], link: "/Bartolomeo", img: "/images/a/a9/Card-barto.png" },
    // (i.e. for 120 minutes & "hh mm ss" & "single": years = 0Y; months = 0M;
        { name: "Basil Hawkins Lost", types: ["especialist", "bruiser", "gold", "bridge"], link: "/Basil_Hawkins", img: "/images/8/89/Card-hawkins.png" },
    // days = 0D; hours = 02h; minutes = 00m; seconds = 00s)
        { name: "Bastille", types: ["slasher", "tank", "gold", "break_wall"], link: "/Bastille", img: "/images/1/13/Card-bastille.png" },
    // time string will result in "0Y0M0D02h00m00s" thus far
        { name: "Bellamy", types: ["fighter", "dps", "gold", "break_wall"], link: "/Bellamy", img: "/images/7/7e/Card-bellamy.png" },
     var timeUnits = getDisplayUnits(timerParams.dateLabels);
        { 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: "/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" },
     ];


     // When loop iterations reaches loop limit, hide normal text, hide delay
     $(".filter--icon").on("click", function () {
    // text, hide normal/delay time periods, and only show end of loop text
         const id = $(this).attr("id");
    if ((numLoops === loopLimit) && (endDate.getTime() <= now.getTime())) {
        document.getElementById("endText_" + num).setAttribute("style", "display:visible");
        document.getElementById("bText_" + num).setAttribute("style", "display:none");
        document.getElementById("aText_" + num).setAttribute("style", "display:none");
        document.getElementById("bDelayText_" + num).setAttribute("style", "display:none");
        document.getElementById("aDelayText_" + num).setAttribute("style", "display:none");
         $("#timer_" + num).html("");


    // While delay time has yet to reach inputted delay time show normal text,
        if ($(this).hasClass("all")) {
    // hide delay text, and only show normal time periods specified by date
            $('.filter--icon.active').removeClass('active');
    // format
            $(".characters").addClass('show');
    // (i.e. for 120 minutes & "hh mm ss" & "single" & " " or "&nbsp;":
            $(".filter--icon.all").addClass('active');
    // years = ; months = ; days = ; hours = 02h ;
             return false;
    // minutes = 00m ; seconds = 00s)
    // Time string will result in "02h 00m 00s" thus far
    } else if (Math.min(timeDiff, timeDiffDelay) === timeDiffDelay) {
        document.getElementById("endText_" + num).setAttribute("style", "display:none");
        document.getElementById("bText_" + num).setAttribute("style", "display:visible");
        document.getElementById("aText_" + num).setAttribute("style", "display:visible");
        document.getElementById("aDelayText_" + num).setAttribute("style", "display:none");
        document.getElementById("bDelayText_" + num).setAttribute("style", "display:none");
        // Adding the time values onto the page for "true" countdown
        $("#timer_" + num).html(formatTimerNumbers(dateFormat, timeDiffDelay, timeUnits));
   
    // When delay time reaches inputted delay time show delay text, hide normal
    // text, and only show delay time periods specified by date format
    } else {
        document.getElementById("endText_" + num).setAttribute("style", "display:none");
        document.getElementById("bText_" + num).setAttribute("style", "display:none");
        document.getElementById("aText_" + num).setAttribute("style", "display:none");
        document.getElementById("bDelayText_" + num).setAttribute("style", "display:visible");
        document.getElementById("aDelayText_" + num).setAttribute("style", "display:visible");
        // Adding the time values onto the page for delayed time period
        if (delayDisplay) {
             $("#timer_" + num).html(formatTimerNumbers(dateFormat, timeDiff, timeUnits));
         } else {
         } else {
             $("#timer_" + num).html("");
             $(".filter--icon.all").removeClass('active');
         }
         }
    }
    updateBaroTimers(num, numLoops);
}


/**
        if ($(this).hasClass("active")) {
* Maps countdown timers elements from DOM to individual timers.
            $(this).removeClass('active');
* Assuming that when an element with .customcountdown class is present
            actives = $('.filter--icon.active');
* all the required elements for timer will be nested under it
            query = "";
*/
 
function getTimersElements() {
            $.each(actives, function (key, item) {
    var count = document.getElementsByClassName("customcountdown");
                query += "[data-type-" + item.id + "]";
    countdownTimers = [];
            });


    for (var i = 0; i < count.length; i++) {
            $(".characters" + query).addClass('show');
        // Adding new objects to dictionary; each representing an individual timer
         } else {
         countdownTimers[i] = {};
            if ($(this).hasClass("tier")) {
        for (var index in COUNTDOWN_CLASSES) {
                 $('.filter--icon.tier.active').removeClass('active');
            var className = COUNTDOWN_CLASSES[index];
            var element = document.getElementsByClassName(className)[i];
            if (element === null) {
                 throw "ERROR: " + className + " CSS class is missing for countdown timer instance #" + i + ".";
             }
             }
             // Gives each instance of repeating elements of same class unique ids
 
             // (e.g. #seedDate_1)
            $(this).addClass('active');
             element.id = className + "_" + i;
             $(".characters").removeClass('show');
             countdownTimers[i][className] = element.innerHTML;
            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>"
            );
        })
     }
     }
 
     // Other optional classes related to countdown
     $("#selectbox-wanted").on("input", function () {
    for (var platform in BARO_COUNTDOWN_CLASSES) {
         const value = $(this).val();
         var className = BARO_COUNTDOWN_CLASSES[platform];
 
         if ($("." + className).length > 0) {
         if ($(".wantedPortrait"))
            var elements = document.getElementsByClassName(className);
            $(".wantedPortrait").remove();
            for (var i = 0; i < elements.length; i++) {
 
                elements[i].id = className + "_" + i;
        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": 0.5,
        "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;
     }
     }
    return countdownTimers;
}


/**
    function calcPotions() {
* Converts time to milliseconds. Ignores sign and decimals. Default unit is seconds ("s") and
        const missingPotions = calcMissingXpInPotions();
* default number is zero.
 
* @param {*} time = a string with a number and a time unit associated (e.g. "50s" is 50 seconds)  
        var complementaryPotS;
* @returns time in milliseconds
        var complementaryPotM;
*/
        potS = missingPotions['small'];
function convertTimeToMilliseconds(time) {
        potM = missingPotions['medium'];
    var number = parseFloat(time);
        potB = missingPotions['big'];
    var unit = time.match(/[A-Za-z]+/);
 
    if (unit === null) {
        if (String(potS).slice(-1) == "0") {
        unit = "s";
            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;
     }
     }
    if (isNaN(number)) {
        number = 0;
    }
    if (TIME_IN_MILLISECONDS[unit] !== undefined) {
        return number * TIME_IN_MILLISECONDS[unit];
    }
    throw "ERROR: Invalid time unit (" + unit + ") in a .loopTime and/or .delayTime CSS class. " +
            "Valid units: \"Y\", \"M\", \"D\", \"h\", \"m\", \"s\"";
}


/**
    function getNeededPotions() {
* Calculating number of loops between current and initial datetime.
        const potions = calcPotions();
* @param {*} now - Date object representing current datetime
        const resultsArea = $("#calc-result");
* @param {*} seedDate - Date object that is before now
 
* @param {*} delayTime - delay in milliseconds
        resultsArea.html('');
* @param {*} loopTime - loop duration in milliseconds
 
* @param {*} loopLimit - maximum number of loops countdown timer can run
        if (potions["big"]) {
* @returns the number of loops that countdown timer will run
            resultsArea.append(
*/
                "<div class='badge'>" +
function calculateNumLoops(now, seedDate, delayTime, loopTime, loopLimit) {
                "<img src='/images/a/a5/Bigexppot.png' class='calcXp--xpIcon' />" +
    // Math.ceil() is needed to account for the fact that timer can reach 0
                "<span class='calcXp--numberOfPots'>" + potions['big'] + "</span>" +
    // during an unfinished loop
                "</div>"
    var numLoops = Math.ceil((now.getTime() - seedDate.getTime() + delayTime) / loopTime);
            );
    if (numLoops > loopLimit) {
        }
         return loopLimit;
 
 
        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>"
            );
         }
     }
     }
     return numLoops;
     //------- CALCULATOR XP ---------
}


/**
    //------- VIDEO SELECTOR ---------
* Determining the end datetime based on initial datetime,
    $(".video-selector").on("click", function () {
* loop duration, and the number of loops that the timer will cycle through.
        $(".video-selector.active").removeClass("active");
* @param {*} seedDate - Date object
        $(this).addClass("active");
* @param {*} delayTime - delay in milliseconds
* @param {*} numLoops - number of countdown loops
* @param {*} loopTime - loop duration in milliseconds
* @returns a Date object representing end date of countdown
*/
function findEndDate(seedDate, delayTime, numLoops, loopTime) {
    return new Date(seedDate.getTime() - delayTime + (numLoops * loopTime));
}


/**
        const value = $(this).data("value");
* Total time between now and target date in milliseconds converted
        const obj = eval('(' + value + ')');
* to certain time period.
        $("video[data-type-" + obj.select + "].active").removeClass('active');
* @param {*} now - Date object
        const index = obj.showId - 1;
* @param {*} endDate - Date object
        $("video[data-type-" + obj.select + "]").eq(index).addClass('active');
* @param {*} dstOffset - DST offset in milliseconds
    });
* @returns time difference in milliseconds, rounded to the nearest thousands
     //------- VIDEO SELECTOR ---------
*/
     //-------- gurren
function calculateTimeDiff(now, endDate, dstOffset) {
     $(document).ready(function () {
     // Note that skipping seconds can rarely happen
        // Alternar entre mostrar e ocultar abas ao clicar
     // especially when counting down to zero
        $('.mostrar-aba').click(function () {
     // since function calls are not instantaneous and take time to run
            var aba_id = $(this).attr('data-aba');
    // (example case: 7041 milliseconds => 5999 milliseconds)
            var aba_selecionada = $("#aba-" + aba_id);
    var timeDiff = (endDate.getTime() - now.getTime()) + dstOffset;
    return timeDiff;
}


/**
            if (aba_selecionada.hasClass('atual')) {
* Get display units for each time unit.
                aba_selecionada.removeClass('atual'); // Oculta a aba se já estiver ativa
* @param {*} dateLabels - a string
                $(this).removeClass('ativa'); // Remove a classe ativa do botão
* @returns a dictionary that contains display strings per time unit
            } else {
*/
                $('.aba').removeClass('atual'); // Oculta todas as abas
function getDisplayUnits(dateLabels) {
                aba_selecionada.addClass('atual'); // Exibe a aba correspondente
    var timeUnits = {};
                $('.mostrar-aba').removeClass('ativa'); // Remove a classe ativa de outros botões
    var unitAbbr;
                 $(this).addClass('ativa'); // Adiciona a classe ativa ao botão clicado
    switch(dateLabels) {
        case "full":
            for (var unit in TIME_UNIT_ABBR) {
                unitAbbr = TIME_UNIT_ABBR[unit];
                 timeUnits[unitAbbr] = " " + unit + "s";
             }
             }
            break;
        });
         case "single":
 
            for (var unit in TIME_UNIT_ABBR) {
         // Exibir aba correspondente ao hash da URL
                unitAbbr = TIME_UNIT_ABBR[unit];
        var url = location.href;
                timeUnits[unitAbbr] = TIME_UNIT_ABBR[unit];
        var hash = url.split('#')[1];
            }
         if (hash != null && hash.length > 0) {
            break;
             $("#aba-" + hash).addClass('atual'); // Exibe a aba do hash
         default:
            $('*[data-aba="' + hash + '"]').addClass('ativa'); // Ativa o botão correspondente
             for (var unit in TIME_UNIT_ABBR) {
        }
                unitAbbr = TIME_UNIT_ABBR[unit];
    });
                timeUnits[unitAbbr] = "";
});
            }
 
            break;
 
    }
//------- 2222222222222222222222222222222222222222222222222222222222222222222222 ---------
    return timeUnits;
}


/**
/**
* Formats the numbers of the countdown timer text.
* Script JavaScript para o componente de abas MediaWiki
* @param {*} dateFormat - string that represents date format; each unit is separated by a non-alphabetical
* Adicione este script na sua MediaWiki (Common.js ou página de scripts)
* character (e.g. "YY-MM-DD hh:mm:ss")
*/
* @param {*} timeDiff - dictionary that contains time differences per time unit
 
* @param {*} timeUnits - dictionary of display text per time unit
(function () {
* @returns a string of the formatted text
    'use strict';
*/
 
function formatTimerNumbers(dateFormat, timeDiff, timeUnits) {
    // Inicializa todos os componentes de abas na página
    var timerText = dateFormat;
    function initTabbers() {
    var formatArr = dateFormat.split(/[^A-Za-z]/); // e.g. ["YYYY", "MM", "DD"]
        const tabbers = document.querySelectorAll('[data-tabber]');
    for (var index in formatArr) {
 
        var elem = formatArr[index];
        tabbers.forEach(function (tabber) {
        var unitAbbr = elem.charAt(0);
            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');
                    });


        // calculating how many of a time unit can fit in this time frame
                    // Adiciona classe active na aba clicada
        var timeInMilliseconds = TIME_IN_MILLISECONDS[unitAbbr];
                    this.classList.add('active');
        var numTimeUnits = Math.floor(timeDiff / timeInMilliseconds);
        timeDiff -= numTimeUnits * timeInMilliseconds;


        // building display
                    // Adiciona classe active no painel correspondente
        var text = numTimeUnits + "";
                    const targetPanel = tabber.querySelector('[data-panel="' + targetTab + '"]');
        text = text.padStart(elem.length, "0");  // padding zeroes for uniformity
                    if (targetPanel) {
        text += timeUnits[elem.charAt(0)]; // adding unit display (e.g. "5 Years")
                        targetPanel.classList.add('active');
        var regex = new RegExp(elem);
                    }
         timerText = timerText.replace(regex, text);
                });
            });
         });
     }
     }
    return timerText;
}


/**
    // Inicializa quando o DOM estiver pronto
* Update Baro Ki'Teer timers.
     if (document.readyState === 'loading') {
* @param {*} num - countdown timer instance
        document.addEventListener('DOMContentLoaded', initTabbers);
* @param {*} numLoops - number of countdown timer loops that have passed
    } else {
*/
         initTabbers();
function updateBaroTimers(num, numLoops) {
     for (var platform in BARO_COUNTDOWN_CLASSES) {
        var className = BARO_COUNTDOWN_CLASSES[platform];
        if ($("." + className).length > 0) {
            $("." + className + "_" + num).html(baroRelayTracker(numLoops, platform));
         }
     }
     }
}


/**
    // Suporte para MediaWiki (quando o conteúdo é carregado dinamicamente)
* Tracks what relay Baro is currently on.
    if (typeof mw !== 'undefined' && mw.hook) {
* @param {*} count
        mw.hook('wikipage.content').add(function () {
* @param {*} platform - "PC", "PS4", "XB1", or "NSW"
            initTabbers();
*/
        });
function baroRelayTracker(count, platform) {
     }
    var rotationNum = count % 4;
})();
    var planet = platformRelayDict[platform][rotationNum];
     return relayDict[planet] + " Relay, <a href=\"https://warframe.fandom.com/wiki/" +
            planet + "\">" + planet + "</a> (" + platform + ")<br/>";
}

Edição atual tal como às 18h09min de 3 de dezembro de 2025

$(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 ---------

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

    const characters = [
        { 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: "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: "/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": 0.5,
        "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 ---------

/**
* 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();
        });
    }
})();