Widget:Test4: mudanças entre as edições

Ir para navegação Ir para pesquisar
sem sumário de edição
Sem resumo de edição
Etiqueta: Revertido
Sem resumo de edição
Etiqueta: Revertido
Linha 209: Linha 209:
         </div>
         </div>


        <div id="clanFilter" class="input-group">
<div id="clanFilter" class="input-group">
            <label><b>Filtro de clãs do jogador:</b></label>
    <label><b>Filtro de clãs do jogador:</b></label>
            <div id="tagButtons"></div>
    <div id="tagCheckboxes"></div>
        </div>
</div>


        <div id="typeFilter" class="input-group hidden">
<div id="typeFilter" class="input-group hidden">
            <label><b>Filtro de dano causado pelo Pokémon selvagem:</b></label>
    <label><b>Filtro de dano causado pelo Pokémon selvagem:</b></label>
            <div id="typeButtons"></div>
    <div id="typeCheckboxes"></div>
        </div>
</div>


         <div id="imageContainer" class="image-container"></div>
         <div id="imageContainer" class="image-container"></div>
Linha 320: Linha 321:
             });
             });


            function clearFilters() {
function clearFilters() {
                document.querySelectorAll("#tagButtons .tag-button.selected").forEach(button => {
    tagCheckboxesContainer.querySelectorAll("input[type='checkbox']").forEach(cb => cb.checked = false);
                    button.classList.remove("selected");
    typeCheckboxesContainer.querySelectorAll("input[type='checkbox']").forEach(cb => cb.checked = false);
                });
    selectedTags = [];
 
    selectedTypes = [];
                document.querySelectorAll("#typeButtons .tag-button.selected").forEach(button => {
    filterHunts();
                    button.classList.remove("selected");
}
                });
                selectedTags = [];
                selectedTypes = [];


                filterHunts();
            }


             switchClans.addEventListener("click", () => {
             switchClans.addEventListener("click", () => {
Linha 354: Linha 350:
             });
             });


            function filterHunts() {
function getSelectedValues(container) {
                const selectedDifficulty = difficultySelect.value;
    return Array.from(container.querySelectorAll("input[type='checkbox']:checked"))
                 const searchTerm = searchInput.value.toLowerCase();
                 .map(input => input.value);
                imageContainer.innerHTML = "";
}


                // Se nenhuma dificuldade for selecionada, não exibe nada
function filterHunts() {
                if (!selectedDifficulty) {
    const selectedDifficulty = difficultySelect.value;
                    return;
    const searchTerm = searchInput.value.toLowerCase();
                }
    selectedTags = getSelectedValues(tagCheckboxesContainer);
    selectedTypes = getSelectedValues(typeCheckboxesContainer);
   
    imageContainer.innerHTML = "";


                const huntList = hunts["NW"]; // Assume que a database é sempre "NW"
    if (!selectedDifficulty) return;
                huntList.forEach(hunt => {
                    const hasAllClasses = hunt.classes.includes("Todos");
                    const hasAllTypes = hunt.huntTypes.includes("Todos");


                    const matchesTags = hasAllClasses || selectedTags.length === 0 || selectedTags.some(tag => hunt.classes.includes(tag));
    const huntList = hunts["NW"];
    huntList.forEach(hunt => {
        const hasAllClasses = hunt.classes.includes("Todos");
        const hasAllTypes = hunt.huntTypes.includes("Todos");


                    const matchesTypes = hasAllTypes || selectedTypes.length === 0 || selectedTypes.some(type => hunt.huntTypes.includes(type));
        const matchesTags = hasAllClasses || selectedTags.length === 0 || selectedTags.some(tag => hunt.classes.includes(tag));
        const matchesTypes = hasAllTypes || selectedTypes.length === 0 || selectedTypes.some(type => hunt.huntTypes.includes(type));
        const matchesDifficulty = hunt.difficulty === selectedDifficulty;
        const isNeutro = hunt.huntTipo === "Neutro";
        const matchesSearch = hunt.name.toLowerCase().includes(searchTerm) || (hunt.altName && hunt.altName.toLowerCase().includes(searchTerm));


                    const matchesDifficulty = hunt.difficulty === selectedDifficulty;
        if (matchesTags && matchesTypes && matchesDifficulty && (!isNeutro || (isNeutro && showNeutro)) && matchesSearch) {
 
            const imageItem = document.createElement("div");
                    const isNeutro = hunt.huntTipo === "Neutro";
            imageItem.className = "image-item";
 
            imageItem.innerHTML = `
                    const matchesSearch = hunt.name.toLowerCase().includes(searchTerm) || (hunt.altName && hunt.altName.toLowerCase().includes(searchTerm));
                <div class="image-content">
 
                    <a href="${hunt.link}" target="_blank">
                    if (matchesTags && matchesTypes && matchesDifficulty && (!isNeutro || (isNeutro && showNeutro)) && matchesSearch) {
                        <img src="${hunt.imageUrl}" alt="${hunt.name}" title="Clique para mais informações">
                        const imageItem = document.createElement("div");
                    </a>
                        imageItem.className = "image-item";
                    <div class="image-info">
                        imageItem.innerHTML = `
                        <p><b>Resistência: </b> ${Array.isArray(hunt.local) ? hunt.local.join(", ") : hunt.local}</p>
                            <div class="image-content">
                        <p><b>Dificuldade: </b> ${hunt.difficulty}</p>
                                <a href="${hunt.link}" target="_blank">
                        <p><b>Dano: </b> ${hunt.huntTypes.join(", ")}</p>
                                    <img src="${hunt.imageUrl}" alt="${hunt.name}" title="Clique para mais informações">
                        <p><b>Clãs: </b> ${hunt.classes.join(", ")}</p>
                                </a>
                    </div>
<div class="image-info">
                </div>
    <p><b>Resistência: </b> ${Array.isArray(hunt.local) ? hunt.local.join(", ") : hunt.local}</p>
            `;
    <p><b>Dificuldade: </b> ${hunt.difficulty}</p>
            imageContainer.appendChild(imageItem);
    <p><b>Dano: </b> ${hunt.huntTypes.includes("Todos") ? "Todos" : hunt.huntTypes.map(type => `<img src="${typeIcons[type]}" alt="${type}" title="${type}" class="class-icon">`).join(" ")}</p>
        }
    <div class="class-container">
    });
        <p><b>Clãs: </b></p>
}
        <div class="class-icons">
            ${hunt.classes.includes("Todos") ? "Todos" : hunt.classes.map(cls => `<img src="${classIcons[cls]}" alt="${cls}" title="${cls}" class="class-icon">`).join("")}
        </div>
    </div>
</div>
                        `;
                        imageContainer.appendChild(imageItem);
                    }
                });
            }


             difficultySelect.addEventListener("change", filterHunts);
             difficultySelect.addEventListener("change", filterHunts);
7 894

edições

Menu de navegação