7 894
edições
Sem resumo de edição |
Sem resumo de edição |
||
Linha 125: | Linha 125: | ||
</div> | </div> | ||
<div id="imageContainer" class="image-container"></div> | <div id="imageContainer" class="image-container"></div> | ||
<script> | <script> | ||
const hunts = { | const hunts = { | ||
"NW": [ | "NW": [ | ||
{ name: "Grimer", difficulty: "Baixa", local: "Cinnabar", classes: ["Orebound", "Psycraft"], imageUrl: "https://wiki.pokexgames.com/images/e/ee/Banner_Hunts_-_NW_Grimer.png", hasType: true, huntTypes: ["Poison"], huntTipo: "Elemental", link: "https://wiki.pokexgames.com/index.php/Cosmic_Quest_-_Boss_Solrock" }, | |||
{ name: "Petilil", difficulty: "Baixa", local: "Fuchsia", classes: ["Volcanic", "Naturia", "Malefic", "Seavell", "Wingeon"], imageUrl: "https://wiki.pokexgames.com/images/7/70/Nightmare_Hunt_Petilil.png", hasType: true, huntTypes: ["Grass"], huntTipo: "Elemental", link: "https://exemplo.com/hunt2" } | |||
{ name: "Grimer", difficulty: "Baixa", local: "Cinnabar", classes: ["Orebound", "Psycraft"], imageUrl: "https://wiki.pokexgames.com/images/e/ee/Banner_Hunts_-_NW_Grimer.png", hasType: true, huntTypes: ["Poison"], huntTipo:"Elemental", link: "https://wiki.pokexgames.com/index.php/Cosmic_Quest_-_Boss_Solrock" }, | ], | ||
{ name: "Petilil", difficulty: "Baixa", local: "Fuchsia", classes: ["Volcanic", "Naturia","Malefic","Seavell","Wingeon"], imageUrl: "https://wiki.pokexgames.com/images/7/70/Nightmare_Hunt_Petilil.png", | |||
], | |||
}; | }; | ||
Linha 149: | Linha 147: | ||
}; | }; | ||
document.addEventListener("DOMContentLoaded", function() { | document.addEventListener("DOMContentLoaded", function () { | ||
const mapTypeSelect = document.getElementById("mapType"); | const mapTypeSelect = document.getElementById("mapType"); | ||
const huntTipoSelect = document.getElementById("huntTipo"); | const huntTipoSelect = document.getElementById("huntTipo"); | ||
const tagButtons = document.querySelectorAll(".tag-button"); | const tagButtons = document.querySelectorAll(".tag-button"); | ||
const imageContainer = document.getElementById("imageContainer"); | const imageContainer = document.getElementById("imageContainer"); | ||
Linha 191: | Linha 189: | ||
huntList.forEach(hunt => { | huntList.forEach(hunt => { | ||
const matchesTags = selectedTags.length === 0 || selectedTags.some(tag => hunt.classes.includes(tag)); | const matchesTags = selectedTags.length === 0 || selectedTags.some(tag => hunt.classes.includes(tag)); | ||
const matchesHuntType = ! | const matchesHuntType = !selectedHuntType || hunt.huntTipo === selectedHuntType; | ||
if (matchesTags && matchesHuntType) { | if (matchesTags && matchesHuntType) { | ||
Linha 219: | Linha 217: | ||
// Event listeners | // Event listeners | ||
mapTypeSelect.addEventListener("change", function() { | mapTypeSelect.addEventListener("change", function () { | ||
updateHuntTypeDropdown(this.value); | updateHuntTypeDropdown(this.value); | ||
filterHunts(); // Filtra as hunts ao mudar o local | |||
}); | }); | ||
Linha 230: | Linha 225: | ||
tagButtons.forEach(button => { | tagButtons.forEach(button => { | ||
button.addEventListener("click", function() { | button.addEventListener("click", function () { | ||
button.classList.toggle("selected"); | button.classList.toggle("selected"); | ||
const tag = button.querySelector("img").alt; | const tag = button.querySelector("img").alt; |