Widget:Test2
<!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; /* Ajuste este valor conforme necessário para subir o botão */ }
.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; /* Mantém a proporção da imagem, cortando se necessário */ margin-bottom: 5px;
}
.image-info { margin-top: 5px; }
select, input[type="text"], button { margin: 5px; }
#filterButton, #searchButton { background: none; /* Remove o fundo do botão */ border: none; /* Remove a borda do botão */ padding: 0; /* Remove o padding do botão */ cursor: pointer; /* Mostra o cursor de ponteiro ao passar sobre o botão */ margin-top: 5px; /* Ajuste a margem superior para subir o botão */ }
#filterButton img, #searchButton img { border-radius: 12px; width: auto; /* Garante que a largura se ajuste ao tamanho original da imagem */ height: auto; /* Garante que a altura se ajuste ao tamanho original da imagem */ }
.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; /* Ajuste a margem para mover o campo para cima */ }
.input-group label { position: absolute; top: -18px; /* Eleva o texto para cima */ background: none; padding: 0 5px; font-size: 14px; font-weight: bold; color: #0d0d0d; }
.maps__select { width: 100%; /* Mantém a largura total disponível */ padding: 10px; font-size: 16px; border-radius: 5px; border: 1px solid #ccc; appearance: none; background-color: #fff; /* Adiciona um fundo branco */ box-sizing: border-box; /* Inclui o padding e a borda na largura total */ }
.input-group input[type="text"] { width: 100%; /* Mantém a largura total disponível */ padding: 10px; font-size: 16px; border-radius: 5px; border: 1px solid #ccc; box-sizing: border-box; /* Inclui o padding e a borda na largura total */ }
.maps__label { position: absolute; top: -18px; /* Eleva o texto um pouco mais para cima */ background: none; padding: 0 5px; font-size: 14px; font-weight: bold; /* Deixa o texto em negrito */ color: #0d0d0d; }
.hover-minimize:hover { transform: scale(0.95); /* Adiciona um efeito de minimizar ao passar o mouse */ }
.filter-container { display: flex; align-items: center;
}
.filter-container input[type="checkbox"] { margin: 0; padding: 0; width: auto; /* Ajusta o tamanho da checkbox conforme necessário */ height: auto; /* Ajusta o tamanho da checkbox conforme necessário */ /* Alinha verticalmente a checkbox com o texto */ vertical-align: middle; }
.filter-label { margin-left: 10px; /* Espaço entre a checkbox e o texto */ font-size: 14px; font-weight: bold; color: #0d0d0d; line-height: 1.5; /* Ajusta a altura da linha para um alinhamento adequado */ } </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>
<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="mapsCalc__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>
const specificOptions = {
1: { // Mapa Vermelho 'Areia': [ { id: '101', tags: ['Areia', 'Praia'], local: 'Green Island', coordinates: '3780, 3326, 7', imageUrl: 'https://wiki.pokexgames.com/images/d/db/3780%2C_3326%2C_7.png'}, ], // Outras opções do Mapa Vermelho }, 2: { 'Areia': [ { id: '1001', local: ' Outland Water', coordinates: '2847, 2827, 6', tags: ['Areia', 'Água', 'Pedra'], 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', tags: ['Areia', 'Grama', 'Pedra', 'Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/c/c9/Mapa_Verde_ADV_-_2863%2C_2850%2C_6.webp' }, { id: '1003', local: ' Respawn de Baltoy', coordinates: '5575, 5658, 5', tags: ['Areia', 'Terra'], imageUrl: 'https://wiki.pokexgames.com/images/3/3f/Mapa_Verde_ADV_-_5575%2C_5658%2C_5.webp' }, { id: '1004', local: ' Respawn de Vibrava', coordinates: '5616, 5729, 7', tags: ['Areia', 'Pedra'], imageUrl: 'https://wiki.pokexgames.com/images/6/67/Mapa_Verde_ADV_-_5616%2C_5729%2C_7.webp' }, { id: '1005', local: ' Respawn de Flygon', coordinates: '5730, 5708, 7', tags: ['Areia'], imageUrl: 'https://wiki.pokexgames.com/images/6/6b/Mapa_Verde_ADV_-_5730%2C_5708%2C_7.webp' }, { id: '1006', local: ' Respawn de Pelipper', coordinates: '5814, 6111, 7', tags: ['Areia', 'Grama', 'Pedra', 'Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/0/06/Mapa_Verde_ADV_-_5814%2C_6111%2C_7.webp' }, { id: '1007', local: ' Outland Psychic', coordinates: '2603, 2860, 7', tags: ['Areia', 'Construção'], imageUrl: 'https://wiki.pokexgames.com/images/1/15/Mapa_Verde_ADV_-_2603%2C_2860%2C_7.webp' }, { id: '1008', local: ' Respawn de Tropius', coordinates: '5345, 5808, 7', tags: ['Areia', 'Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/8/86/Mapa_Verde_ADV_-_5345%2C_5808%2C_7.webp' },
], }, 3: { 'Areia': [ { id: '10001', local: ' Respawn de Grumpig', coordinates: '30815, 20315, 6',tags:['Areia','Terra'], imageUrl: 'https://wiki.pokexgames.com/images/4/4b/Mapas_de_ADV_ROXO_-_30815%2C_20315%2C_6.webp' }, ], 'Gelo': [ { id: '20001', local: ' Respawn de Dragonite e Garchomp', coordinates: '30802, 20395, 2',tags:['Gelo','Árvore','Pedra'], imageUrl: 'https://wiki.pokexgames.com/images/c/c4/Mapas_de_ADV_ROXO_-_30802%2C_20395%2C_2.webp' },
{ id: '20002', local: ' Respawn de Altaria', coordinates: '30816, 20323, 3',tags:['Gelo'], imageUrl: 'https://wiki.pokexgames.com/images/8/8e/Mapas_de_ADV_ROXO_-_30816%2C_20323%2C_3.webp' }, { id: '20003', local: ' Respawn de Dratini e Dragonair', coordinates: '30851, 20351, 5',tags:['Gelo','Pedra'], imageUrl: 'https://wiki.pokexgames.com/images/b/b3/Mapas_de_ADV_ROXO_-_30851%2C_20351%2C_5.webp' }, { id: '20004', local: ' Respawn de Dragonite e Garchomp', coordinates: '30860, 20398, 2',tags:['Gelo','Pedra','Árvore','Água'], imageUrl: 'https://wiki.pokexgames.com/images/e/ea/Mapas_de_ADV_ROXO_-_30860%2C_20398%2C_2.webp' }, { id: '20005', local: ' Respawn de Snorunt', coordinates: '30890, 20277, 5',tags:['Gelo','Pedra','Árvore','Água'], imageUrl: 'https://wiki.pokexgames.com/images/5/58/Mapas_de_ADV_ROXO_-_30890%2C_20277%2C_5.webp' },
], 'Grama': [ { id: '30001', local: ' Respawn de Darkrai', coordinates: '30792, 20621, 5',tags:['Grama','Árvore','Pedra'], imageUrl: 'https://wiki.pokexgames.com/images/2/23/Mapas_de_ADV_ROXO_-_30792%2C_20621%2C_5.webp' },
{ id: '30002', local: ' Respawn de Darkrai', coordinates: '30823, 20758, 5',tags:['Grama','Árvore'], imageUrl: 'https://wiki.pokexgames.com/images/e/ee/Mapas_de_ADV_ROXO_-_30823%2C_20758%2C_5.webp' },
], 'Pedra': [ { id: '40001', local: ' Respawn de Cranidos', coordinates: '30800, 20697, 5',tags:['Pedra','Água'], imageUrl: 'https://wiki.pokexgames.com/images/f/f1/Mapas_de_ADV_ROXO_-_30800%2C_20697%2C_5.webp' },
{ id: '40002', local: ' Respawn de Cranidos', coordinates: '30838, 20548, 5',tags:['Pedra','Água','Construção'], imageUrl: 'https://wiki.pokexgames.com/images/7/74/Mapas_de_ADV_ROXO_-_30838%2C_20548%2C_5.webp' }, { id: '40003', local: ' Respawn de Bagon', coordinates: '30846, 20350, 4',tags:['Pedra','Gelo'], imageUrl: 'https://wiki.pokexgames.com/images/2/27/Mapas_de_ADV_ROXO_-_30846%2C_20350%2C_4.webp' }, { id: '40004', local: ' Respawn de Tyranitar', coordinates: '30875, 20550, 4',tags:['Pedra'], imageUrl: 'https://wiki.pokexgames.com/images/6/68/Mapas_de_ADV_ROXO_-_30875%2C_20550%2C_4.webp' }, { id: '40005', local: ' Respawn de Gible e Gabite', coordinates: '30896, 20314, 4',tags:['Pedra', 'Gelo'], imageUrl: 'https://wiki.pokexgames.com/images/1/18/Mapas_de_ADV_ROXO_-_30896%2C_20314%2C_4.webp' },
], 'Subaquáticos': [ { id: '50001', local: ' test', coordinates: '3780, 3326, 7',tags:['teste','testes'], imageUrl: 'https://wiki.pokexgames.com/images/d/db/3780%2C_3326%2C_7.png' }, ], 'Terra': [ { id: '60001', local: ' Respawn Sudowoodo e Rampardos', coordinates: '30841, 20620, 5',tags:['Terra','Grama'], imageUrl: 'https://wiki.pokexgames.com/images/c/c2/Mapas_de_ADV_ROXO_-_30841%2C_20620%2C_5.webp' },
], 'Pisos':[ { id: '70001', local: ' Respawn de Infernape', coordinates: '30793, 20532, 3', tags:['Piso','Construção', 'Fogo'], imageUrl: 'https://wiki.pokexgames.com/images/6/6f/Mapas_de_ADV_ROXO_-_30793%2C_20532%2C_3.webp' },
{ id: '70002', local: ' Respawn de Steelix', coordinates: '30805, 20398, 7', tags:['Piso','Construção','Pedra','Terra'], imageUrl: 'https://wiki.pokexgames.com/images/0/06/Mapas_de_ADV_ROXO_-_30805%2C_20398%2C_7.webp' }, { id: '70003', local: ' Respawn de Espurr', coordinates: '30807, 20231, 5', tags:['Piso','Construção','Areia', 'Água', 'Fogo'], imageUrl: 'https://wiki.pokexgames.com/images/e/e7/Mapas_de_ADV_ROXO_-_30807%2C_20231%2C_5.webp' }, { id: '70004', local: ' Respawn de Starmie', coordinates: '30828, 20254, 7', tags:['Piso','Construção','Água','Fogo'], imageUrl: 'https://wiki.pokexgames.com/images/5/5c/Mapas_de_ADV_ROXO_-_30828%2C_20254%2C_7.webp' }, { id: '70005', local: ' Respawn de Starmie', coordinates: '30845, 20256, 7', tags:['Piso','Construção','Água','Fogo'], imageUrl: 'https://wiki.pokexgames.com/images/6/62/Mapas_de_ADV_ROXO_-_30845%2C_20256%2C_7.webp' }, { id: '70006', local: ' Saída norte de Lavender', coordinates: '30881, 20394, 7', tags:['Piso','Construção','Fogo'], imageUrl: 'https://wiki.pokexgames.com/images/5/5e/Mapas_de_ADV_ROXO_-_30881%2C_20394%2C_7.webp' },
] },
};
document.getElementById('enableFilter').addEventListener('change', function () { const filterSection = document.getElementById('filterSection'); if (this.checked) { filterSection.classList.remove('hidden'); } else { filterSection.classList.add('hidden'); } });
document.getElementById('searchIds').addEventListener('keypress', function (event) { if (event.key === 'Enter') { event.preventDefault(); document.getElementById('filterButton').click(); } });
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'); } });
document.getElementById('specificOption').addEventListener('change', function () { const selectedMapType = document.getElementById('mapType').value; const selectedOption = this.value; const imageContainer = document.getElementById('imageContainer');
if (selectedMapType && selectedOption) { const images = specificOptions[selectedMapType][selectedOption]; let imagesHtml = ;
if (Array.isArray(images)) { images.forEach(image => { imagesHtml += `
<img src="${image.imageUrl}" alt="${selectedOption}">
Número do Mapa: ${image.id}
Local: ${image.local}
Coordenada: ${image.coordinates}
Tag(s): ${image.tags.join(', ') || 'Nenhuma'}
`; }); }
imageContainer.innerHTML = imagesHtml; imageContainer.classList.remove('hidden'); } else { imageContainer.classList.add('hidden'); } });
document.getElementById('filterButton').addEventListener('click', function () {
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 === 'tag') { if (selectedMapType) { const mapOptions = specificOptions[selectedMapType]; if (selectedSpecificOption) { const images = mapOptions[selectedSpecificOption].filter(image => searchIds.some(tag => image.tags.map(t => t.toLowerCase()).includes(tag)) ); allImages = allImages.concat(images); } else { Object.keys(mapOptions).forEach(option => { const images = mapOptions[option].filter(image => searchIds.some(tag => image.tags.map(t => t.toLowerCase()).includes(tag)) ); allImages = allImages.concat(images); }); } } } else if (filterOption === 'number') { if (searchIds.length > 0) { Object.keys(specificOptions).forEach(mapType => { const mapOptions = specificOptions[mapType]; Object.keys(mapOptions).forEach(option => { const images = mapOptions[option].filter(image => searchIds.includes(image.id)); 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>