Widget:Test
<!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: 340px; min-height: 270px; }
.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; } </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> </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>
<label for="filterMode" class="maps__label">Modo de Filtro:</label> <select id="filterMode" class="maps__select"> <option value="number">Filtrar por Número</option> <option value="tag">Filtrar por Tag</option> </select>
<label for="searchIds" class="maps__label">Buscar por Nº do Mapa:</label> <input type="text" id="searchIds" placeholder="Digite os números separados por vírgula" class="maps__select">
<button type="button" id="filterButton" class="hover-minimize"> <img src="https://wiki.pokexgames.com/images/8/82/Botao_Filtrar_Mapas_Adv.png" alt="Imagem botão filtrar"> </button>
</form>
<script> // Dados de exemplo para filtros const specificOptions = { 1: { 'Areia': [ { id: '101', local: 'Local Verde 1', coordinates: '3780, 3326, 7', imageUrl: 'https://wiki.pokexgames.com/images/d/db/3780%2C_3326%2C_7.png' } ] }, 2: { 'Areia': [ { id: '1001', local: 'Outland Water', tag: 'agua', coordinates: '2847, 2827, 6', 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: { // Adicionar dados para o Mapa Roxo aqui } };
document.getElementById('enableFilter').addEventListener('change', function () { const filterSection = document.getElementById('filterSection'); const filterOptions = document.getElementById('filterOptions'); if (this.checked) { filterSection.classList.remove('hidden'); filterOptions.classList.remove('hidden'); } else { filterSection.classList.add('hidden'); filterOptions.classList.add('hidden'); } });
document.getElementById('filterMode').addEventListener('change', function () { const filterMode = this.value; const searchIds = document.getElementById('searchIds'); if (filterMode === 'number') { searchIds.placeholder = "Digite os números separados por vírgula"; } else if (filterMode === 'tag') { searchIds.placeholder = "Digite as tags separadas por vírgula"; } });
document.getElementById('mapType').addEventListener('change', function () { const selectedMapType = this.value; const specificOptionSelect = document.getElementById('specificOption');
specificOptionSelect.innerHTML = '<option value="">Selecione uma opção</option>'; if (selectedMapType) { 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'); } });
document.getElementById('filterButton').addEventListener('click', function () { const selectedMapType = document.getElementById('mapType').value; const selectedOption = document.getElementById('specificOption').value; const filterMode = document.getElementById('filterMode').value; const searchIds = document.getElementById('searchIds').value.split(',').map(id => id.trim().toLowerCase()); const imageContainer = document.getElementById('imageContainer');
if (!selectedMapType || !selectedOption) { alert("Selecione pelo menos um tipo de mapa"); return; }
let imagesHtml = ; let allImages = []; const mapOptions = specificOptions[selectedMapType] || {}; const images = mapOptions[selectedOption] || [];
if (filterMode === 'number') { allImages = images.filter(image => searchIds.includes(image.id.toLowerCase())); } else if (filterMode === 'tag') { allImages = images.filter(image => searchIds.includes(image.tag.toLowerCase())); }
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ão disponível'}
`; });
imageContainer.innerHTML = imagesHtml || 'Nenhuma imagem encontrada com os parâmetros fornecidos.'; imageContainer.classList.remove('hidden'); }); </script>
</body>
</html>