Widget:Test: mudanças entre as edições
Ir para navegação
Ir para pesquisar
Sem resumo de edição Etiqueta: Revertido |
Sem resumo de edição Etiqueta: Revertido |
||
Linha 13: | Linha 13: | ||
flex-direction: column; | flex-direction: column; | ||
margin-top: -15px; | margin-top: -15px; | ||
} | } | ||
Linha 33: | Linha 32: | ||
} | } | ||
.image-container img { | .image-container img { | ||
object-fit: cover; | |||
margin-bottom: 5px; | |||
} | } | ||
.image-info { | .image-info { | ||
Linha 51: | Linha 50: | ||
#searchButton { | #searchButton { | ||
background: none; | background: none; | ||
border: none; | border: none; | ||
padding: 0; | padding: 0; | ||
cursor: pointer; | cursor: pointer; | ||
margin-top: 5px; | margin-top: 5px; | ||
} | } | ||
Linha 66: | Linha 60: | ||
border-radius: 12px; | border-radius: 12px; | ||
width: auto; | width: auto; | ||
height: auto; | height: auto; | ||
} | } | ||
.input-group { | .input-group { | ||
position: relative; | position: relative; | ||
margin: 20px 0; | margin: 20px 0; | ||
} | } | ||
Linha 94: | Linha 71: | ||
position: absolute; | position: absolute; | ||
top: -18px; | top: -18px; | ||
background: none; | background: none; | ||
padding: 0 5px; | padding: 0 5px; | ||
Linha 104: | Linha 80: | ||
.maps__select { | .maps__select { | ||
width: 100%; | width: 100%; | ||
padding: 10px; | padding: 10px; | ||
font-size: 16px; | font-size: 16px; | ||
Linha 111: | Linha 86: | ||
appearance: none; | appearance: none; | ||
background-color: #fff; | background-color: #fff; | ||
box-sizing: border-box; | box-sizing: border-box; | ||
} | } | ||
.input-group input[type="text"] { | .input-group input[type="text"] { | ||
width: 100%; | width: 100%; | ||
padding: 10px; | padding: 10px; | ||
font-size: 16px; | font-size: 16px; | ||
Linha 125: | Linha 96: | ||
border: 1px solid #ccc; | border: 1px solid #ccc; | ||
box-sizing: border-box; | box-sizing: border-box; | ||
} | } | ||
Linha 131: | Linha 101: | ||
position: absolute; | position: absolute; | ||
top: -18px; | top: -18px; | ||
background: none; | background: none; | ||
padding: 0 5px; | padding: 0 5px; | ||
font-size: 14px; | font-size: 14px; | ||
font-weight: bold; | font-weight: bold; | ||
color: #0d0d0d; | color: #0d0d0d; | ||
} | } | ||
Linha 148: | Linha 111: | ||
display: flex; | display: flex; | ||
align-items: center; | align-items: center; | ||
} | } | ||
Linha 155: | Linha 117: | ||
padding: 0; | padding: 0; | ||
width: auto; | width: auto; | ||
height: auto; | height: auto; | ||
vertical-align: middle; | vertical-align: middle; | ||
} | } | ||
Linha 164: | Linha 123: | ||
.filter-label { | .filter-label { | ||
margin-left: 10px; | margin-left: 10px; | ||
font-size: 14px; | font-size: 14px; | ||
font-weight: bold; | font-weight: bold; | ||
color: #0d0d0d; | color: #0d0d0d; | ||
line-height: 1.5; | line-height: 1.5; | ||
} | } | ||
</style> | </style> | ||
</head> | </head> | ||
<body> | <body> | ||
<form id="mapForm"> | <form id="mapForm"> | ||
Linha 241: | Linha 199: | ||
document.getElementById('enableFilter').addEventListener('change', function () { | document.getElementById('enableFilter').addEventListener('change', function () { | ||
const filterSection = document.getElementById('filterSection'); | const filterSection = document.getElementById('filterSection'); | ||
filterSection.classList.toggle('hidden', !this.checked); | |||
}); | }); | ||
Linha 262: | Linha 216: | ||
document.getElementById('specificOptions').classList.add('hidden'); | document.getElementById('specificOptions').classList.add('hidden'); | ||
} | } | ||
filterImages(); // Atualiza a visualização após a seleção do mapa | |||
}); | }); | ||
Linha 287: | Linha 242: | ||
if (selectedMapType && selectedOption) { | if (selectedMapType && selectedOption) { | ||
const images = specificOptions[selectedMapType][selectedOption]; | const images = specificOptions[selectedMapType][selectedOption] || []; | ||
allImages = images.filter(image => { | allImages = images.filter(image => { | ||
const idMatch = searchIds.length === 0 || searchIds.includes(image.id); | const idMatch = searchIds.length === 0 || searchIds.includes(image.id); |
Edição das 02h55min de 27 de agosto 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; }
.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>