Widget:Test
Ir para navegação
Ir para pesquisar
<!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; }
.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; }
.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; } </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>
<label for="searchIds" class="mapsCalc__label">Filtrar por Nº do Mapa:</label> <input type="text" id="searchIds" placeholder="Digite os números separados por vírgula" class="mapsCalc__select">
<label for="searchTag" class="mapsCalc__label">Filtrar por Tag:</label> <input type="text" id="searchTag" placeholder="Digite a tag para filtrar" class="mapsCalc__select">
<input type="checkbox" id="enableFilter"> <label class="filter-label" for="enableFilter">Ativar Filtro</label>
</form>
<script> const specificOptions = { 1: { // Mapa Vermelho 'Areia': [ { id: '101', local: 'Green Island', coordinates: '3780, 3326, 7', imageUrl: 'https://wiki.pokexgames.com/images/d/db/3780%2C_3326%2C_7.png' }, ], }, 2: { // Mapa Verde 'Areia': [ { id: '1001', local: 'Outland Water', coordinates: '2847, 2827, 6', tag: 'Agua', imageUrl: 'https://wiki.pokexgames.com/images/b/b9/Mapa_Verde_ADV_-_2847%2C_2827%2C_6.webp' }, { id: '1002', local: 'Outland Water', coordinates: '2863, 2850, 6', imageUrl: 'https://wiki.pokexgames.com/images/c/c9/Mapa_Verde_ADV_-_2863%2C_2850%2C_6.webp' }, ], }, 3: { // Mapa Roxo // Adicionar dados para o Mapa Roxo aqui } };
document.getElementById('enableFilter').addEventListener('change', function () { const filterSection = document.getElementById('filterSection'); filterSection.classList.toggle('hidden', !this.checked); });
document.getElementById('mapType').addEventListener('change', function () { const selectedMapType = this.value; const specificOptionSelect = document.getElementById('specificOption');
if (selectedMapType) { specificOptionSelect.innerHTML = '<option value="">Selecione uma opção</option>'; const options = Object.keys(specificOptions[selectedMapType]); options.forEach(option => { specificOptionSelect.innerHTML += `<option value="${option}">${option}</option>`; }); document.getElementById('specificOptions').classList.remove('hidden'); } else { document.getElementById('specificOptions').classList.add('hidden'); } filterImages(); // Atualiza a visualização após a seleção do mapa });
document.getElementById('specificOption').addEventListener('change', function () { filterImages(); });
document.getElementById('searchIds').addEventListener('input', function () { filterImages(); });
document.getElementById('searchTag').addEventListener('input', function () { filterImages(); });
function filterImages() { const searchIds = document.getElementById('searchIds').value.split(',').map(id => id.trim()); const searchTag = document.getElementById('searchTag').value.trim().toLowerCase(); const selectedMapType = document.getElementById('mapType').value; const selectedOption = document.getElementById('specificOption').value; const imageContainer = document.getElementById('imageContainer');
let imagesHtml = ; let allImages = [];
if (selectedMapType && selectedOption) { const images = specificOptions[selectedMapType][selectedOption] || []; allImages = images.filter(image => { const idMatch = searchIds.length === 0 || searchIds.includes(image.id); const tagMatch = !searchTag || (image.tag && image.tag.toLowerCase().includes(searchTag)); return idMatch && tagMatch; });
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: ${image.tag || 'N/A'}
`; }); }
imageContainer.innerHTML = imagesHtml || 'Nenhuma imagem encontrada com os critérios fornecidos.'; imageContainer.classList.toggle('hidden', allImages.length === 0); } </script>
</body> </html>