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

De PokeXGames
Ir para navegação Ir para pesquisar
Sem resumo de edição
Sem resumo de edição
Etiqueta: Revertido
Linha 4: Linha 4:
     <meta charset="UTF-8">
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>Seleção de Mapas</title>
     <title>Seleção e Exibição de Imagens</title>
     <style>
     <style>
        .d-flex {
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            margin-top: -15px;
        }
         .hidden {
         .hidden {
             display: none;
             display: none;
        }
        .image-container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 10px;
            margin-top: 5px;
        }
        .image-container .image-item {
            flex: 1 0 30%;
            text-align: center;
        }
        .image-container img {
            object-fit: cover;
            margin-bottom: 5px;
        }
        .image-info {
            margin-top: 5px;
        }
        select,
        input[type="text"],
        button {
            margin: 5px;
        }
        #filterButton,
        #searchButton {
            background: none;
            border: none;
            padding: 0;
            cursor: pointer;
            margin-top: 5px;
        }
        #filterButton img,
        #searchButton img {
            border-radius: 12px;
            width: auto;
            height: auto;
        }
        .mw-body-content {
            display: flex;
        }
        .mw-parser-output {
            display: inline-block;
            padding: .5rem 2rem;
            margin: 0 auto;
            border: 30px solid transparent;
            border-image: url(https://wiki.pokexgames.com/images/3/37/Calculadora-de-Boost.png) 38;
            min-width: 410px;
            min-height: 320px;
         }
         }


         .input-group {
         .input-group {
            position: relative;
             margin: 20px 0;
             margin: 20px 0;
         }
         }


         .maps__select,
        .input-group label {
         .input-group input[type="text"],
            position: absolute;
        .input-group button {
            top: -18px;
            background: none;
            padding: 0 5px;
            font-size: 14px;
            font-weight: bold;
            color: #0d0d0d;
        }
 
         .maps__select {
            width: 100%;
            padding: 10px;
            font-size: 16px;
            border-radius: 5px;
            border: 1px solid #ccc;
            appearance: none;
            background-color: #fff;
            box-sizing: border-box;
        }
 
         .input-group input[type="text"] {
             width: 100%;
             width: 100%;
             padding: 10px;
             padding: 10px;
            margin-top: 5px;
             font-size: 16px;
             font-size: 16px;
             border-radius: 5px;
             border-radius: 5px;
             border: 1px solid #ccc;
             border: 1px solid #ccc;
            box-sizing: border-box;
        }
        .maps__label {
            position: absolute;
            top: -18px;
            background: none;
            padding: 0 5px;
            font-size: 14px;
            font-weight: bold;
            color: #0d0d0d;
         }
         }


         .image-container {
         .hover-minimize:hover {
             display: flex;
             transform: scale(0.95);
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 20px;
         }
         }


         .image-item {
         .filter-container {
             flex: 1 0 30%;
             display: flex;
             text-align: center;
             align-items: center;
         }
         }


         .image-item img {
         .filter-container input[type="checkbox"] {
             max-width: 100%;
             margin: 0;
            padding: 0;
            width: auto;
             height: auto;
             height: auto;
            vertical-align: middle;
         }
         }


         .image-info {
         .filter-label {
             margin-top: 5px;
             margin-left: 10px;
            font-size: 14px;
            font-weight: bold;
            color: #0d0d0d;
            line-height: 1.5;
         }
         }


Linha 60: Linha 160:
         .tag-button.selected {
         .tag-button.selected {
             background-color: #15864e;
             background-color: #15864e;
             color: #fff;
             color: rgb(159, 5, 219);
        }
 
        .filter-container {
            display: flex;
            align-items: center;
            margin-bottom: 20px;
        }
 
        .filter-container input[type="checkbox"] {
            margin-right: 10px;
        }
 
        .filter-container label {
            font-size: 16px;
         }
         }


Linha 97: Linha 183:
</head>
</head>
<body>
<body>
     <div class="input-group">
     <form id="mapForm">
        <label for="mapType">Tipo de Mapa</label>
        <div id="mapTypeSelection" class="input-group">
         <select id="mapType" class="maps__select">
            <select id="mapType" class="maps__select">
            <option value="">Selecione um mapa</option>
                <option value="">Selecione um mapa</option>
             <option value="1">Mapa Vermelho</option>
                <option value="1">Mapa Vermelho</option>
            <option value="2">Mapa Verde</option>
                <option value="2">Mapa Verde</option>
            <option value="3">Mapa Roxo</option>
                <option value="3">Mapa Roxo</option>
        </select>
            </select>
    </div>
            <label class="maps__label" for="mapType">Tipo de Mapa</label>
         </div>
 
        <div id="specificOptions" class="input-group">
            <select id="specificOption" class="maps__select">
                <option value="">Selecione uma opção</option>
                <option value="Areia">Areia</option>
                <option value="Gelo">Gelo</option>
                <option value="Grama">Grama</option>
                <option value="Pedra">Pedra</option>
                <option value="Subaquático">Subaquático</option>
                <option value="Terra">Terra</option>
                <option value="Pisos">Pisos</option>
             </select>
            <label class="maps__label" for="specificOption">Local do X</label>
        </div>
       
        <div class="filter-container">
            <input type="checkbox" id="enableFilter">
            <label for="enableFilter" class="filter-label">Ativar filtro</label>
        </div>
       
        <div id="filterSection" class="hidden">
            <div id="filterById" class="input-group">
                <label for="filterOption" class="maps__label">Filtrar Por</label>
                <select id="filterOption" class="maps__select">
                    <option value="">Escolha uma Opção</option>
                    <option value="number">Filtrar por Número</option>
                    <option value="tag">Filtrar por Tag</option>
                </select>
                <input type="text" id="searchIds" placeholder="Digite os números ou tags separados por vírgula" class="maps__select">
            </div>


    <div class="input-group">
            <div class="d-flex justify-center align-center flex-column">
        <label for="specificOption">Local do X</label>
                <button type="button" id="filterButton" class="hover-minimize">
        <select id="specificOption" class="maps__select">
                    <img src="https://wiki.pokexgames.com/images/8/82/Botao_Filtrar_Mapas_Adv.png" alt="Imagem botão filtrar">
            <option value="">Selecione uma opção</option>
                </button>
            <option value="Areia">Areia</option>
             </div>
            <option value="Gelo">Gelo</option>
         </div>
            <option value="Grama">Grama</option>
            <option value="Pedra">Pedra</option>
            <option value="Subaquático">Subaquático</option>
            <option value="Terra">Terra</option>
             <option value="Pisos">Pisos</option>
         </select>
    </div>


    <div class="filter-container">
        <div id="imageContainer" class="image-container hidden">
        <input type="checkbox" id="enableFilter">
            <!-- As imagens e suas informações serão exibidas aqui -->
         <label for="enableFilter">Ativar filtro</label>
         </div>
     </div>
    </form>
<script>
const specificOptions = {
    1: {
        'Areia': [
            { id: '101', local: 'Green Island', coordinates: '3780, 3326, 7', tags: ['Areia', 'Água', 'Grama', 'Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/4/4c/Mapas_de_ADV_VERMELHO_-_3780%2C_3326%2C_7.webp' },
            { id: '102', local: 'Wildwind Island', coordinates: '3969, 3300, 7', tags: ['Areia', 'Terra', 'Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/5/58/Mapas_de_ADV_VERMELHO_-_3969%2C_3300%2C_7.webp' },
            { id: '103', local: 'Wildwind Island', coordinates: '4002, 3320, 7', tags: ['Areia', 'Árvore', 'Pedra'], imageUrl: 'https://wiki.pokexgames.com/images/0/07/Mapas_de_ADV_VERMELHO_-_4002%2C_3320%2C_7.webp' },
            { id: '104', local: 'Saffron', coordinates: '4009, 3601, 7', tags: ['Areia', 'Árvore', 'Terra', 'Água'], imageUrl: 'https://wiki.pokexgames.com/images/f/f5/Mapas_de_ADV_VERMELHO_-_4009%2C_3601%2C_7.webp' },
            { id: '105', local: 'Hurricane Island', coordinates: '4166, 3302, 7', tags: ['Areia', 'Pedra', 'Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/a/ab/Mapas_de_ADV_VERMELHO_-_4166%2C_3302%2C_7.webp' },
        ],
        'Gelo': [
            { id: '201', local: 'Frost Peak', coordinates: '4600, 3000, 7', tags: ['Gelo', 'Árvore', 'Pedra'], imageUrl: 'https://wiki.pokexgames.com/images/3/3e/Mapas_de_ADV_VERDE_-_4600%2C_3000%2C_7.webp' },
            { id: '202', local: 'Ice Fields', coordinates: '4700, 3100, 7', tags: ['Gelo', 'Pedra', 'Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/1/1e/Mapas_de_ADV_VERDE_-_4700%2C_3100%2C_7.webp' },
        ],
        'Grama': [
            { id: '301', local: 'Green Meadow', coordinates: '5000, 3400, 7', tags: ['Grama', 'Árvore', 'Pedra'], imageUrl: 'https://wiki.pokexgames.com/images/7/76/Mapas_de_ADV_VERDE_-_5000%2C_3400%2C_7.webp' },
            { id: '302', local: 'Forest Glade', coordinates: '5100, 3500, 7', tags: ['Grama', 'Árvore', 'Água'], imageUrl: 'https://wiki.pokexgames.com/images/8/89/Mapas_de_ADV_VERDE_-_5100%2C_3500%2C_7.webp' },
        ],
        // Adicione mais locais e mapas conforme necessário
     },
    2: {
        // Dados para Mapas Verdes
    },
    3: {
        // Dados para Mapas Roxos
    },
};


    <div id="filterOptions" class="input-group hidden">
document.getElementById('mapType').addEventListener('change', updateSpecificOptions);
        <label for="filterType">Filtrar Por</label>
document.getElementById('filterOption').addEventListener('change', toggleSearchInput);
        <select id="filterType" class="maps__select">
document.getElementById('enableFilter').addEventListener('change', toggleFilterSection);
            <option value="">Escolha uma Opção</option>
document.getElementById('filterButton').addEventListener('click', filterImages);
            <option value="number">Filtrar por Número</option>
        </select>
        <input type="text" id="searchIds" placeholder="Digite os números ou tags separados por vírgula">
        <button id="filterButton" class="maps__select">Filtrar</button>
    </div>


     <div id="tagButtons" class="hidden">
function updateSpecificOptions() {
        <!-- Botões de tag serão exibidos aqui -->
     const mapType = document.getElementById('mapType').value;
     </div>
     const specificOption = document.getElementById('specificOption');


     <div id="imageContainer" class="image-container">
     specificOption.innerHTML = '<option value="">Selecione uma opção</option>';
         <!-- As imagens e suas informações serão exibidas aqui -->
 
     </div>
    if (mapType) {
        const options = Object.keys(specificOptions[mapType] || {});
        options.forEach(option => {
            specificOption.innerHTML += `<option value="${option}">${option}</option>`;
         });
     }
}


     <script>
function toggleSearchInput() {
        const specificOptions = {
     const filterOption = document.getElementById('filterOption').value;
            1: { // Mapa Vermelho
    const searchInput = document.getElementById('searchIds');
                'Areia': [
    searchInput.placeholder = filterOption === 'number' ? 'Digite os números separados por vírgula' : 'Digite as tags separadas por vírgula';
                    { id: '101', local: 'Green Island', coordinates: '3780, 3326, 7', tags: ['Areia', 'Água', 'Grama', 'Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/4/4c/Mapas_de_ADV_VERMELHO_-_3780%2C_3326%2C_7.webp' },
}
                    { id: '102', local: 'Desert', coordinates: '4500, 5300, 5', tags: ['Areia'], imageUrl: 'https://wiki.pokexgames.com/images/5/55/Mapa_Vermelho_ADV_-_4500%2C_5300%2C_5.webp' }
                ],
                'Grama': [
                    { id: '103', local: 'Grassland', coordinates: '5600, 4700, 8', tags: ['Grama'], imageUrl: 'https://wiki.pokexgames.com/images/6/67/Mapa_Vermelho_ADV_-_5600%2C_4700%2C_8.webp' }
                ]
            },
            2: { // Mapa Verde
                'Gelo': [
                    { id: '201', local: 'Snowy Peak', coordinates: '2050, 4850, 10', tags: ['Gelo'], imageUrl: 'https://wiki.pokexgames.com/images/5/56/Mapa_Verde_ADV_-_2050%2C_4850%2C_10.webp' }
                ]
            }
        };


        const imageContainer = document.getElementById('imageContainer');
function toggleFilterSection() {
        const tagButtons = document.getElementById('tagButtons');
    const filterSection = document.getElementById('filterSection');
        const filterOptions = document.getElementById('filterOptions');
    filterSection.classList.toggle('hidden', !document.getElementById('enableFilter').checked);
        const mapTypeSelect = document.getElementById('mapType');
}
        const specificOptionSelect = document.getElementById('specificOption');
        const enableFilter = document.getElementById('enableFilter');
        const searchIdsInput = document.getElementById('searchIds');
        const filterButton = document.getElementById('filterButton');


        function updateTags() {
function filterImages() {
            const selectedMapType = mapTypeSelect.value;
    const searchIds = document.getElementById('searchIds').value.split(',').map(id => id.trim().toLowerCase());
            const selectedOption = specificOptionSelect.value;
    const filterOption = document.getElementById('filterOption').value;
    const selectedMapType = document.getElementById('mapType').value;
    const selectedSpecificOption = document.getElementById('specificOption').value;
    const imageContainer = document.getElementById('imageContainer');
    let imagesHtml = '';
    let allImages = [];


             let tags = [];
    if (filterOption === 'number') {
            if (selectedMapType && selectedOption) {
        if (searchIds.length > 0) {
                const options = specificOptions[selectedMapType];
             Object.keys(specificOptions).forEach(mapType => {
                if (options && options[selectedOption]) {
                if (selectedMapType === '' || selectedMapType === mapType) {
                    options[selectedOption].forEach(item => {
                    const mapOptions = specificOptions[mapType];
                         tags = [...new Set([...tags, ...item.tags])];
                    Object.keys(mapOptions).forEach(option => {
                         const images = mapOptions[option].filter(image => searchIds.includes(image.id));
                        allImages = allImages.concat(images);
                     });
                     });
                 }
                 }
            }
            tagButtons.innerHTML = '';
            tags.forEach(tag => {
                const button = document.createElement('button');
                button.textContent = tag;
                button.classList.add('tag-button');
                button.addEventListener('click', () => {
                    button.classList.toggle('selected');
                    filterImages();
                });
                tagButtons.appendChild(button);
             });
             });
            tagButtons.classList.toggle('hidden', tags.length === 0);
         }
         }
 
    } else if (filterOption === 'tag' && selectedSpecificOption) {
        function filterImages() {
        Object.keys(specificOptions).forEach(mapType => {
            const selectedTags = Array.from(document.querySelectorAll('.tag-button.selected')).map(btn => btn.textContent);
            if (selectedMapType === '' || selectedMapType === mapType) {
            const selectedMapType = mapTypeSelect.value;
                const mapOptions = specificOptions[mapType];
            const selectedOption = specificOptionSelect.value;
                Object.keys(mapOptions).forEach(option => {
            const filterById = searchIdsInput.value.trim();
                    const images = mapOptions[option].filter(image => image.tags.includes(selectedSpecificOption));
 
                    allImages = allImages.concat(images);
            imageContainer.innerHTML = '';
                });
            if (selectedMapType && selectedOption) {
                const options = specificOptions[selectedMapType];
                if (options && options[selectedOption]) {
                    const filteredItems = options[selectedOption].filter(item => {
                        const matchesTag = selectedTags.length === 0 || selectedTags.some(tag => item.tags.includes(tag));
                        const matchesId = filterById === '' || filterById.split(',').map(id => id.trim()).includes(item.id);
                        return matchesTag && matchesId;
                    });
 
                    filteredItems.forEach(item => {
                        const itemDiv = document.createElement('div');
                        itemDiv.classList.add('image-item');
 
                        const img = document.createElement('img');
                        img.src = item.imageUrl;
                        img.alt = `Mapa ${item.id}`;
                        itemDiv.appendChild(img);
 
                        const infoDiv = document.createElement('div');
                        infoDiv.classList.add('image-info');
                        infoDiv.innerHTML = `
                            <strong>Número do Mapa:</strong> ${item.id}<br>
                            <strong>Local:</strong> ${item.local}<br>
                            <strong>Coordenada:</strong> ${item.coordinates}<br>
                            <strong>Tag(s):</strong> ${item.tags.join(', ')}
                        `;
                        itemDiv.appendChild(infoDiv);
 
                        imageContainer.appendChild(itemDiv);
                    });
 
                    if (filteredItems.length === 0) {
                        imageContainer.innerHTML = '<p>Nenhuma imagem encontrada para os critérios selecionados.</p>';
                    }
                }
             }
             }
        }
        mapTypeSelect.addEventListener('change', () => {
            updateTags();
            filterImages();
         });
         });
    }


         specificOptionSelect.addEventListener('change', () => {
    if (allImages.length > 0) {
            updateTags();
         allImages.sort((a, b) => a.local.localeCompare(b.local));
            filterImages();
        });


         filterButton.addEventListener('click', () => {
         allImages.forEach(image => {
             filterImages();
             imagesHtml += `
                <div class="image-item">
                    <img src="${image.imageUrl}" alt="Imagem ID ${image.id}">
                    <div class="image-info">
                        <b>Número do Mapa</b>: ${image.id} <br>
                        <b>Local</b>: ${image.local} <br>
                        <b>Coordenada</b>: ${image.coordinates}<br>
                        <b>Tag(s)</b>: ${image.tags.join(', ') || 'Nenhuma'}
                    </div>
                </div>
            `;
         });
         });
    } else {
        imagesHtml = 'Nenhuma imagem encontrada com os critérios fornecidos.';
    }


        searchIdsInput.addEventListener('input', () => {
    imageContainer.innerHTML = imagesHtml;
            filterImages();
    imageContainer.classList.toggle('hidden', allImages.length === 0);
        });
}
 
</script>
        enableFilter.addEventListener('change', () => {
            filterOptions.classList.toggle('hidden', !enableFilter.checked);
            if (!enableFilter.checked) {
                filterImages();
            }
        });
 
        function initializePage() {
            specificOptionSelect.classList.remove('hidden');
            filterOptions.classList.add('hidden');
            tagButtons.classList.add('hidden');
            updateTags();
        }
 
        initializePage();
    </script>
</body>
</body>
</html>
</html>

Edição das 23h28min de 3 de setembro de 2024

<!DOCTYPE html> <html lang="pt-BR"> <head>

   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>Seleção e Exibição de Imagens</title>
   <style>
       .d-flex {
           display: flex;
           justify-content: center;
           align-items: center;
           flex-direction: column;
           margin-top: -15px;
       }
       .hidden {
           display: none;
       }
       .image-container {
           display: flex;
           flex-wrap: wrap;
           justify-content: center;
           gap: 10px;
           margin-top: 5px;
       }
       .image-container .image-item {
           flex: 1 0 30%;
           text-align: center;
       }
       .image-container img {
           object-fit: cover;
           margin-bottom: 5px;
       }
       .image-info {
           margin-top: 5px;
       }
       select,
       input[type="text"],
       button {
           margin: 5px;
       }
       #filterButton,
       #searchButton {
           background: none;
           border: none;
           padding: 0;
           cursor: pointer;
           margin-top: 5px;
       }
       #filterButton img,
       #searchButton img {
           border-radius: 12px;
           width: auto;
           height: auto;
       }
       .mw-body-content {
           display: flex;
       }
       .mw-parser-output {
           display: inline-block;
           padding: .5rem 2rem;
           margin: 0 auto;
           border: 30px solid transparent;
           border-image: url(https://wiki.pokexgames.com/images/3/37/Calculadora-de-Boost.png) 38;
           min-width: 410px;
           min-height: 320px;
       }
       .input-group {
           position: relative;
           margin: 20px 0;
       }
       .input-group label {
           position: absolute;
           top: -18px;
           background: none;
           padding: 0 5px;
           font-size: 14px;
           font-weight: bold;
           color: #0d0d0d;
       }
       .maps__select {
           width: 100%;
           padding: 10px;
           font-size: 16px;
           border-radius: 5px;
           border: 1px solid #ccc;
           appearance: none;
           background-color: #fff;
           box-sizing: border-box;
       }
       .input-group input[type="text"] {
           width: 100%;
           padding: 10px;
           font-size: 16px;
           border-radius: 5px;
           border: 1px solid #ccc;
           box-sizing: border-box;
       }
       .maps__label {
           position: absolute;
           top: -18px;
           background: none;
           padding: 0 5px;
           font-size: 14px;
           font-weight: bold;
           color: #0d0d0d;
       }
       .hover-minimize:hover {
           transform: scale(0.95);
       }
       .filter-container {
           display: flex;
           align-items: center;
       }
       .filter-container input[type="checkbox"] {
           margin: 0;
           padding: 0;
           width: auto;
           height: auto;
           vertical-align: middle;
       }
       .filter-label {
           margin-left: 10px;
           font-size: 14px;
           font-weight: bold;
           color: #0d0d0d;
           line-height: 1.5;
       }
       .tag-button {
           display: inline-block;
           background-color: #f1f1f1;
           color: #333;
           padding: 10px 20px;
           margin: 5px;
           border: 1px solid #ccc;
           border-radius: 20px;
           cursor: pointer;
           font-size: 16px;
       }
       .tag-button.selected {
           background-color: #15864e;
           color: rgb(159, 5, 219);
       }
       .selected-tags {
           margin: 20px;
           padding: 10px;
           background-color: #f9f9f9;
           border: 1px solid #ccc;
           border-radius: 5px;
       }
       .tag-item {
           display: inline-block;
           background-color: #007BFF;
           color: white;
           padding: 5px 10px;
           margin-right: 5px;
           border-radius: 3px;
           font-size: 14px;
       }
   </style>

</head> <body>

   <form id="mapForm">
           <select id="mapType" class="maps__select">
               <option value="">Selecione um mapa</option>
               <option value="1">Mapa Vermelho</option>
               <option value="2">Mapa Verde</option>
               <option value="3">Mapa Roxo</option>
           </select>
           <label class="maps__label" for="mapType">Tipo de Mapa</label>
           <select id="specificOption" class="maps__select">
               <option value="">Selecione uma opção</option>
               <option value="Areia">Areia</option>
               <option value="Gelo">Gelo</option>
               <option value="Grama">Grama</option>
               <option value="Pedra">Pedra</option>
               <option value="Subaquático">Subaquático</option>
               <option value="Terra">Terra</option>
               <option value="Pisos">Pisos</option>
           </select>
           <label class="maps__label" for="specificOption">Local do X</label>
           <input type="checkbox" id="enableFilter">
           <label for="enableFilter" class="filter-label">Ativar filtro</label>
   </form>
<script>

const specificOptions = {

   1: {
       'Areia': [
           { id: '101', local: 'Green Island', coordinates: '3780, 3326, 7', tags: ['Areia', 'Água', 'Grama', 'Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/4/4c/Mapas_de_ADV_VERMELHO_-_3780%2C_3326%2C_7.webp' },
           { id: '102', local: 'Wildwind Island', coordinates: '3969, 3300, 7', tags: ['Areia', 'Terra', 'Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/5/58/Mapas_de_ADV_VERMELHO_-_3969%2C_3300%2C_7.webp' },
           { id: '103', local: 'Wildwind Island', coordinates: '4002, 3320, 7', tags: ['Areia', 'Árvore', 'Pedra'], imageUrl: 'https://wiki.pokexgames.com/images/0/07/Mapas_de_ADV_VERMELHO_-_4002%2C_3320%2C_7.webp' },
           { id: '104', local: 'Saffron', coordinates: '4009, 3601, 7', tags: ['Areia', 'Árvore', 'Terra', 'Água'], imageUrl: 'https://wiki.pokexgames.com/images/f/f5/Mapas_de_ADV_VERMELHO_-_4009%2C_3601%2C_7.webp' },
           { id: '105', local: 'Hurricane Island', coordinates: '4166, 3302, 7', tags: ['Areia', 'Pedra', 'Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/a/ab/Mapas_de_ADV_VERMELHO_-_4166%2C_3302%2C_7.webp' },
       ],
       'Gelo': [
           { id: '201', local: 'Frost Peak', coordinates: '4600, 3000, 7', tags: ['Gelo', 'Árvore', 'Pedra'], imageUrl: 'https://wiki.pokexgames.com/images/3/3e/Mapas_de_ADV_VERDE_-_4600%2C_3000%2C_7.webp' },
           { id: '202', local: 'Ice Fields', coordinates: '4700, 3100, 7', tags: ['Gelo', 'Pedra', 'Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/1/1e/Mapas_de_ADV_VERDE_-_4700%2C_3100%2C_7.webp' },
       ],
       'Grama': [
           { id: '301', local: 'Green Meadow', coordinates: '5000, 3400, 7', tags: ['Grama', 'Árvore', 'Pedra'], imageUrl: 'https://wiki.pokexgames.com/images/7/76/Mapas_de_ADV_VERDE_-_5000%2C_3400%2C_7.webp' },
           { id: '302', local: 'Forest Glade', coordinates: '5100, 3500, 7', tags: ['Grama', 'Árvore', 'Água'], imageUrl: 'https://wiki.pokexgames.com/images/8/89/Mapas_de_ADV_VERDE_-_5100%2C_3500%2C_7.webp' },
       ],
       // Adicione mais locais e mapas conforme necessário
   },
   2: {
       // Dados para Mapas Verdes
   },
   3: {
       // Dados para Mapas Roxos
   },

};

document.getElementById('mapType').addEventListener('change', updateSpecificOptions); document.getElementById('filterOption').addEventListener('change', toggleSearchInput); document.getElementById('enableFilter').addEventListener('change', toggleFilterSection); document.getElementById('filterButton').addEventListener('click', filterImages);

function updateSpecificOptions() {

   const mapType = document.getElementById('mapType').value;
   const specificOption = document.getElementById('specificOption');
   specificOption.innerHTML = '<option value="">Selecione uma opção</option>';
   if (mapType) {
       const options = Object.keys(specificOptions[mapType] || {});
       options.forEach(option => {
           specificOption.innerHTML += `<option value="${option}">${option}</option>`;
       });
   }

}

function toggleSearchInput() {

   const filterOption = document.getElementById('filterOption').value;
   const searchInput = document.getElementById('searchIds');
   searchInput.placeholder = filterOption === 'number' ? 'Digite os números separados por vírgula' : 'Digite as tags separadas por vírgula';

}

function toggleFilterSection() {

   const filterSection = document.getElementById('filterSection');
   filterSection.classList.toggle('hidden', !document.getElementById('enableFilter').checked);

}

function filterImages() {

   const searchIds = document.getElementById('searchIds').value.split(',').map(id => id.trim().toLowerCase());
   const filterOption = document.getElementById('filterOption').value;
   const selectedMapType = document.getElementById('mapType').value;
   const selectedSpecificOption = document.getElementById('specificOption').value;
   const imageContainer = document.getElementById('imageContainer');
   let imagesHtml = ;
   let allImages = [];
   if (filterOption === 'number') {
       if (searchIds.length > 0) {
           Object.keys(specificOptions).forEach(mapType => {
               if (selectedMapType ===  || selectedMapType === mapType) {
                   const mapOptions = specificOptions[mapType];
                   Object.keys(mapOptions).forEach(option => {
                       const images = mapOptions[option].filter(image => searchIds.includes(image.id));
                       allImages = allImages.concat(images);
                   });
               }
           });
       }
   } else if (filterOption === 'tag' && selectedSpecificOption) {
       Object.keys(specificOptions).forEach(mapType => {
           if (selectedMapType ===  || selectedMapType === mapType) {
               const mapOptions = specificOptions[mapType];
               Object.keys(mapOptions).forEach(option => {
                   const images = mapOptions[option].filter(image => image.tags.includes(selectedSpecificOption));
                   allImages = allImages.concat(images);
               });
           }
       });
   }
   if (allImages.length > 0) {
       allImages.sort((a, b) => a.local.localeCompare(b.local));
       allImages.forEach(image => {
           imagesHtml += `
                   <img src="${image.imageUrl}" alt="Imagem ID ${image.id}">
                       Número do Mapa: ${image.id} 
Local: ${image.local}
Coordenada: ${image.coordinates}
Tag(s): ${image.tags.join(', ') || 'Nenhuma'}
           `;
       });
   } else {
       imagesHtml = 'Nenhuma imagem encontrada com os critérios fornecidos.';
   }
   imageContainer.innerHTML = imagesHtml;
   imageContainer.classList.toggle('hidden', allImages.length === 0);

} </script> </body> </html>