Widget:Test: 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
 
(59 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
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 e Exibição de Imagens</title>
     <title>Busca de Imagens por Nome</title>
     <style>
     <style>
         /* Estilos conforme fornecidos */
         .input-group { margin-bottom: 1em; position: relative; }
         .d-flex {
        .dropdown {
            border: 1px solid #ccc;
            display: none;
            position: absolute;
            background-color: #fff;
            z-index: 1000;
            max-height: 150px;
            overflow-y: auto;
            width: 100%;
        }
         .dropdown-item {
            padding: 8px;
            cursor: pointer;
             display: flex;
             display: flex;
            justify-content: center;
             align-items: center;
             align-items: center;
            flex-direction: column;
            margin-top: -15px;
            /* Ajuste este valor conforme necessário para subir o botão */
         }
         }
 
        .dropdown-item img {
         .hidden {
            margin-right: 10px;
             display: none;
        }
         .dropdown-item:hover {
             background-color: #f0f0f0;
         }
         }
         .image-container {
         .image-container {
             display: flex;
             display: flex;
             flex-wrap: wrap;
             flex-direction: column;
            align-items: center;
             justify-content: center;
             justify-content: center;
            gap: 10px;
            margin-top: 5px;
         }
         }
 
         .image-item {  
         .image-container .image-item {
             margin-bottom: 1em;  
             flex: 1 0 30%;
             text-align: center;
             text-align: center;
         }
         }
 
         .image-item img {
         .image-container img {
             display: block;
             object-fit: cover; /* Mantém a proporção da imagem, cortando se necessário */
             margin: 0 auto;
             margin-bottom: 5px;
         }
         }


         .image-info {
         .variations-container {
            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;
             display: flex;
            flex-wrap: wrap;
            justify-content: center;
            margin-top: 1em;
         }
         }


         .mw-parser-output {
         .variation-item {
             display: inline-block;
             width: 35%;
            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;
             box-sizing: border-box;
             /* Inclui o padding e a borda na largura total */
             margin: 5px;
        }
            text-align: center;
 
             border: 1px solid ;
        .input-group input[type="text"] {
             width: 100%;
            /* Mantém a largura total disponível */
             padding: 10px;
             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 {
         .variation-item img {
             position: absolute;
             display: block;
            top: -18px;
             margin: 0 auto 10px;
            /* 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 {
         .swap-button {  
            transform: scale(0.95);
             margin-top: 10px;
            /* Adiciona um efeito de minimizar ao passar o mouse */
             cursor: pointer;
        }
             width: 15px;
 
             height: 15px;
        .filter-container {
             background: url('https://wiki.pokexgames.com/images/f/fb/SwapButtonAddons.png') no-repeat center;
            display: flex;
             background-size: contain;
            align-items: center;
             display: block;
             margin-bottom: 10px; /* Adiciona espaço abaixo do container */
             margin: 0 auto;
        }
 
        .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>
     </style>
</head>
</head>
<body>
<body>
     <div class="d-flex">
     <form id="imageForm">
        <!-- Filtros -->
         <div class="input-group">
         <div class="input-group">
             <label for="mapType" class="maps__label">Tipo de Mapa</label>
             <input type="text" id="imageSearch" placeholder="Digite o nome da imagem" autocomplete="off">
            <select id="mapType" class="maps__select">
            <div id="dropdown" class="dropdown"></div>
                <option value="">Selecione o Tipo de Mapa</option>
                <option value="1">Mapa Vermelho</option>
                <option value="2">Mapa Verde</option>
                <option value="3">Mapa Roxo</option>
            </select>
         </div>
         </div>


         <div class="input-group">
         <div id="imageContainer" class="image-container hidden">
            <label for="location" class="maps__label">Local do X</label>
             <!-- As imagens e suas informações serão exibidas aqui -->
            <select id="location" class="maps__select">
                <option value="">Selecione o Local do X</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>
        </div>
 
        <div class="filter-container">
             <input type="checkbox" id="filterCheckbox">
            <label for="filterCheckbox" class="filter-label">Ativar Filtro</label>
        </div>
 
        <div id="filterOptions" class="hidden">
            <div 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>
            </div>
            <div class="input-group">
                <input type="text" id="filterValue" placeholder="Digite o valor para filtrar">
                <button id="filterButton">
                    <img src="https://wiki.pokexgames.com/images/8/82/Botao_Filtrar_Mapas_Adv.png" alt="Filtrar">
                </button>
            </div>
         </div>
         </div>
     </div>
     </form>
 
    <div id="mapContainer" class="image-container"></div>


     <script>
     <script>
         const specificOptions = {
         const imageList = {
             1: { // Mapa Vermelho
             'Squirtle': {  
                 Areia: [
                 imageUrl: 'https://wiki.pokexgames.com/images/7/7a/007-Squirtle.png',  
                    { id: '7007', local: 'Pirâmide nos Cacturne', coordinates: '5631, 5589, 7', tag: 'Areia', imageUrl: 'https://wiki.pokexgames.com/images/9/93/Mapa_Verde_ADV_-_5631%2C_5589%2C_7.webp' }
                 variations: [
                    // Adicione mais mapas conforme necessário
                    {  
                ],
                        description: 'Squirtle Purple Ninja Pack',
                 Gelo: [],
                        descriptionIMG: 'https://wiki.pokexgames.com/images/c/c1/Purple_Stripe.png',
                Grama: [],
                        obtain: {
                Pedra: [],
                            url: 'https://wiki.pokexgames.com/index.php/Craft_Profissões_-_Estilista#Rank_E',
                Subaquático: [],
                            text: 'Estilista'
                Terra: [],
                        },
                Pisos: []
                        additionalImages: [
            },
                            { url: 'https://wiki.pokexgames.com/images/d/dd/Squirtle_Purple_Ninja_Pack_Frente.png'}, // Frente
              2: {  
                            { url: 'https://wiki.pokexgames.com/images/5/50/Squirtle_Purple_Ninja_Pack_Esquerda.png'}, // Lado Esquerdo
                'Areia': [
                            { url: 'https://wiki.pokexgames.com/images/a/af/Squirtle_Purple_Ninja_Pack_Direita.png'}, // Costas
                { id: '1001', local: ' Outland Water', coordinates: '2847, 2827, 6', imageUrl: 'https://wiki.pokexgames.com/images/b/b9/Mapa_Verde_ADV_-_2847%2C_2827%2C_6.webp' },
                            { url: 'https://wiki.pokexgames.com/images/5/5d/Squirtle_Purple_Ninja_Pack_Costas.png'} // Lado Direito
{ 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' },
                        ]
{ id: '1003', local: ' Respawn de Baltoy', coordinates: '5575, 5658, 5', 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', 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', imageUrl: 'https://wiki.pokexgames.com/images/6/6b/Mapa_Verde_ADV_-_5730%2C_5708%2C_7.webp' },
                        description: 'Squirtle Red Ninja Pack',
{ id: '1006', local: ' Respawn de Pelipper', coordinates: '5814, 6111, 7', imageUrl: 'https://wiki.pokexgames.com/images/0/06/Mapa_Verde_ADV_-_5814%2C_6111%2C_7.webp' },
                        descriptionIMG: 'https://wiki.pokexgames.com/images/c/c1/Purple_Stripe.png',
                ],
                        obtain: {
                'Gelo': [
                            url: 'https://wiki.pokexgames.com/index.php/Craft_Profissões_-_Estilista#Rank_E',
                { id: '2001', local: ' Outland Ice', coordinates: '2562, 3244, 6', imageUrl: 'https://wiki.pokexgames.com/images/4/40/Mapa_Verde_ADV_-_2562%2C_3244%2C_6.webp' },
                            text: 'Estilista'
{ id: '2002', local: ' Outland Ice', coordinates: '2670, 3318, 8', imageUrl: 'https://wiki.pokexgames.com/images/7/71/Mapa_Verde_ADV_-_2670%2C_3318%2C_8.webp' },
                        },
{ id: '2003', local: ' Outland Ice', coordinates: '2695, 3286, 7', imageUrl: 'https://wiki.pokexgames.com/images/e/e5/Mapa_Verde_ADV_-_2695%2C_3286%2C_7.webp' },
                        additionalImages: [
{ id: '2004', local: ' Outland Dragon', coordinates: '2710, 3287, 4', imageUrl: 'https://wiki.pokexgames.com/images/9/94/Mapa_Verde_ADV_-_2710%2C_3287%2C_4.webp' },
                            { url: 'https://wiki.pokexgames.com/images/1/13/Squirtle_Red_Ninja_Pack_Frente.png'}, // Frente
{ id: '2005', local: ' Respawn de Swellow', coordinates: '5047, 5744, 5', imageUrl: 'https://wiki.pokexgames.com/images/7/7c/Mapa_Verde_ADV_-_5047%2C_5744%2C_5.webp' },
                            { url: 'https://wiki.pokexgames.com/images/1/1e/Squirtle_Red_Ninja_Pack_Esquerda.png'}, // Lado Esquerdo
{ id: '2006', local: ' Respawn de Walrein', coordinates: '5845, 5800, 7', imageUrl: 'https://wiki.pokexgames.com/images/9/93/Mapa_Verde_ADV_-_5845%2C_5800%2C_7.webp' },
                            { url: 'https://wiki.pokexgames.com/images/0/01/Squirtle_Red_Ninja_Pack_Costas.png'}, // Costas
                ],
                            { url: 'https://wiki.pokexgames.com/images/f/fd/Squirtle_Red_Ninja_Pack_Direita.png'} // Lado Direito
                'Grama': [
                        ]
                { id: '3001', local: ' Outland Bug', coordinates: '2633, 3039, 7', imageUrl: 'https://wiki.pokexgames.com/images/4/40/Mapa_Verde_ADV_-_2633%2C_3039%2C_7.webp' },
                    }
{ id: '3002', local: ' Outland Water', coordinates: '2654, 2810, 7', imageUrl: 'https://wiki.pokexgames.com/images/2/26/Mapa_Verde_ADV_-_2654%2C_2810%2C_7.webp' },
{ id: '3003', local: ' Outland Grass', coordinates: '2863, 2879, 7', imageUrl: 'https://wiki.pokexgames.com/images/8/8d/Mapa_Verde_ADV_-_2863%2C_2879%2C_7.webp' },
{ id: '3004', local: ' Respawn de Nuzleaf', coordinates: '5355, 5962, 7', imageUrl: 'https://wiki.pokexgames.com/images/d/d8/Mapa_Verde_ADV_-_5355%2C_5962%2C_7.webp' },
{ id: '3005', local: ' Respawn de Grovyle', coordinates: '5383, 5892, 6', imageUrl: 'https://wiki.pokexgames.com/images/9/9c/Mapa_Verde_ADV_-_5383%2C_5892%2C_6.webp' },
{ id: '3006', local: ' Respawn de Sceptile', coordinates: '5395, 5795, 6', imageUrl: 'https://wiki.pokexgames.com/images/d/de/Mapa_Verde_ADV_-_5395%2C_5795%2C_6.webp' },
{ id: '3007', local: ' Respawn de Zangoose', coordinates: '5417, 5757, 7', imageUrl: 'https://wiki.pokexgames.com/images/4/49/Mapa_Verde_ADV_-_5417%2C_5757%2C_7.webp' },
{ id: '3008', local: ' Respawn de Exploud', coordinates: '5437, 5561, 5', imageUrl: 'https://wiki.pokexgames.com/images/6/6c/Mapa_Verde_ADV_-_5437%2C_5561%2C_5.webp' },
{ id: '3009', local: ' Respawn de Ludicolo', coordinates: '5463, 5838, 7', imageUrl: 'https://wiki.pokexgames.com/images/c/c3/Mapa_Verde_ADV_-_5463%2C_5838%2C_7.webp' },
{ id: '3010', local: ' Respawn de Wingull', coordinates: '5726, 6160, 7', imageUrl: 'https://wiki.pokexgames.com/images/3/37/Mapa_Verde_ADV_-_5729%2C_6160%2C_7.webp' },
{ id: '3011', local: ' Artificial Safari', coordinates: '5797, 5661, 7', imageUrl: 'https://wiki.pokexgames.com/images/3/3e/Mapa_Verde_ADV_-_5797%2C_5661%2C_7.webp' },
{ id: '3012', local: ' Artificial Safari', coordinates: '5871, 5532, 7', imageUrl: 'https://wiki.pokexgames.com/images/b/b7/Mapa_Verde_ADV_-_5871%2C_5532%2C_7.webp' },
                ],
                'Pedra': [
                { id: '4001', local: ' Outland Fire', coordinates: '2793, 3029, 7', imageUrl: 'https://wiki.pokexgames.com/images/f/fc/Mapa_Verde_ADV_-_2793%2C_3029%2C_7.webp' },
{ id: '4002', local: ' Outland Water', coordinates: '2808, 2864, 7', imageUrl: 'https://wiki.pokexgames.com/images/0/0a/Mapa_Verde_ADV_-_2808%2C_2864%2C_7.webp' },
{ id: '4003', local: ' Respawn de Hariyama', coordinates: '5368, 5779, 5', imageUrl: 'https://wiki.pokexgames.com/images/4/45/Mapa_Verde_ADV_-_5368%2C_5779%2C_5.webp' },
{ id: '4004', local: ' Respawn de Blaziken', coordinates: '5613, 5910, 4', imageUrl: 'https://wiki.pokexgames.com/images/a/ab/Mapa_Verde_ADV_-_5613%2C_5910%2C_4.webp' },
{ id: '4005', local: ' Respawn de Camerupt', coordinates: '5617, 5925, 5', imageUrl: 'https://wiki.pokexgames.com/images/a/a1/Mapa_Verde_ADV_-_5617%2C_5925%2C_5.webp' },
{ id: '4006', local: ' Respawn de Claydol', coordinates: '5621, 5667, 5', imageUrl: 'https://wiki.pokexgames.com/images/7/72/Mapa_Verde_ADV_-_5621%2C_5667%2C_5.webp' },
{ id: '4007', local: ' Respawn de Torkoal', coordinates: '5650, 5914, 6', imageUrl: 'https://wiki.pokexgames.com/images/c/c9/Mapa_Verde_ADV_-_5650%2C_5914%2C_6.webp' },
                ],
                'Subaquáticos': [
                { id: '5001', local: ' Caminho da Outland North', coordinates: '4204, 4404, 12', imageUrl: 'https://wiki.pokexgames.com/images/4/4b/Mapa_Verde_ADV_-_4204%2C_4404%2C_12.webp' },
{ id: '5002', local: ' Área subaquática próximo aos Zangoose', coordinates: '5425, 5747, 8', imageUrl: 'https://wiki.pokexgames.com/images/6/63/Mapa_Verde_ADV_-_5425%2C_5747%2C_8.webp' },
   
                ],
                'Terra': [
                { id: '6001', local: ' Outland Ground', coordinates: '2551, 3105, 7', imageUrl: 'https://wiki.pokexgames.com/images/8/8d/Mapa_Verde_ADV_-_2551%2C_3105%2C_7.webp' },
{ id: '6002', local: ' Outland Bug', coordinates: '2720, 3039, 7', imageUrl: 'https://wiki.pokexgames.com/images/e/e7/Mapa_Verde_ADV_-_2720%2C_3039%2C_7.webp' },
{ id: '6003', local: ' Outland Fire', coordinates: '2842, 3073, 6', imageUrl: 'https://wiki.pokexgames.com/images/f/f1/Mapa_Verde_ADV_-_2842%2C_3073%2C_6.webp' },
{ id: '6004', local: ' Outland Grass', coordinates: '2922, 2913, 6', imageUrl: 'https://wiki.pokexgames.com/images/3/3f/Mapa_Verde_ADV_-_2922%2C_2913%2C_6.webp' },
{ id: '6005', local: ' Respawn de Toxicroak', coordinates: '5309, 5805, 6', imageUrl: 'https://wiki.pokexgames.com/images/4/40/Mapa_Verde_ADV_-_5309%2C_5805%2C_6.webp' },
{ id: '6006', local: ' Respawn de Seviper', coordinates: '5317, 5787, 7', imageUrl: 'https://wiki.pokexgames.com/images/6/67/Mapa_Verde_ADV_-_5317%2C_5787%2C_7.webp' },
{ id: '6007', local: ' Respawn de Shiftry', coordinates: '5400, 6039, 6', imageUrl: 'https://wiki.pokexgames.com/images/d/d7/Mapa_Verde_ADV_-_5400%2C_6039%2C_6.webp' },
{ id: '6008', local: ' Respawn de Poochyena', coordinates: '5414, 6019, 8', imageUrl: 'https://wiki.pokexgames.com/images/3/31/Mapa_Verde_ADV_-_5414%2C_6019%2C_8.webp' },
{ id: '6009', local: ' Respawn de Vigoroth', coordinates: '5569, 5883, 5', imageUrl: 'https://wiki.pokexgames.com/images/b/b2/Mapa_Verde_ADV_-_5569%2C_5883%2C_5.webp' },
{ id: '6010', local: ' Respawn de Medicham', coordinates: '5606, 5682, 6', imageUrl: 'https://wiki.pokexgames.com/images/b/b3/Mapa_Verde_ADV_-_5606%2C_5682%2C_6.webp' },
{ id: '6011', local: ' Entrada dos Castform de Phenac', coordinates: '5612, 5638, 7', imageUrl: 'https://wiki.pokexgames.com/images/a/a5/Mapa_Verde_ADV_-_5612%2C_5638%2C_7.webp' },
{ id: '6012', local: ' Respawn de Swampert', coordinates: '5694, 5804, 7', imageUrl: 'https://wiki.pokexgames.com/images/8/82/Mapa_Verde_ADV_-_5694%2C_5804%2C_7.webp' },
 
                ],
                'Pisos':[
                { id: '7001', local: ' Outland Electric', coordinates: '2505, 3105, 10', imageUrl: 'https://wiki.pokexgames.com/images/b/b8/Mapa_Verde_ADV_-_2505%2C_3105%2C_10.webp' },
                { id: '7002', local: ' Outland Psychic', coordinates: '2586, 2968, 7', imageUrl: 'https://wiki.pokexgames.com/images/8/84/Mapa_Verde_ADV_-_2586%2C_2968%2C_7.webp' },
                { id: '7003', local: ' Outland Psychic', coordinates: '2607, 2958, 6', imageUrl: 'https://wiki.pokexgames.com/images/f/f3/Mapa_Verde_ADV_-_2607%2C_2958%2C_6.webp' },
{ id: '7004', local: ' Respawn de Lairon', coordinates: '5361, 5682, 7', imageUrl: 'https://wiki.pokexgames.com/images/e/eb/Mapa_Verde_ADV_-_5361%2C_5682%2C_7.webp' },
{ id: '7005', local: ' Respawn de Metang', coordinates: '5437, 5561, 6', imageUrl: 'https://wiki.pokexgames.com/images/b/b0/Mapa_Verde_ADV_-_5437%2C_5561%2C_6.webp' },
{ id: '7006', local: ' Respawn de Mightyena', coordinates: '5485, 5987, 8', imageUrl: 'https://wiki.pokexgames.com/images/0/06/Mapa_Verde_ADV_-_5485%2C_5987%2C_8.webp' },
{ id: '7007', local: ' Pirâmide nos Cacturne', coordinates: '5631, 5589, 7', imageUrl: 'https://wiki.pokexgames.com/images/9/93/Mapa_Verde_ADV_-_5631%2C_5589%2C_7.webp' },
                 ]
                 ]
             },
             },
        };


            3: { // Mapa Roxo
         const imageSearch = document.getElementById('imageSearch');
                Areia: [],
        const dropdown = document.getElementById('dropdown');
                Gelo: [],
        const imageContainer = document.getElementById('imageContainer');
                Grama: [],
                Pedra: [],
                Subaquático: [],
                Terra: [],
                Pisos: []
            }
         };
     
        function filterMaps() {
            const mapType = document.getElementById('mapType').value;
            const location = document.getElementById('location').value;
            const filterCheckbox = document.getElementById('filterCheckbox').checked;
            const filterOption = document.getElementById('filterOption').value;
            const filterValue = document.getElementById('filterValue').value.toLowerCase();
            const mapContainer = document.getElementById('mapContainer');
            mapContainer.innerHTML = '';


            if (mapType && location) {
        imageSearch.addEventListener('input', function() {
                const maps = specificOptions[mapType][location];
            const searchValue = this.value.trim().toLowerCase();
                let filteredMaps = maps;
            dropdown.innerHTML = '';


                if (filterCheckbox) {
            if (searchValue) {
                     if (filterOption === 'number') {
                Object.keys(imageList).forEach(imageName => {
                         filteredMaps = maps.filter(map => map.id.includes(filterValue));
                     if (imageName.toLowerCase().includes(searchValue)) {
                    } else if (filterOption === 'tag') {
                         const dropdownItem = document.createElement('div');
                         filteredMaps = maps.filter(map => map.tag.toLowerCase().includes(filterValue));
                        dropdownItem.classList.add('dropdown-item');
                    } else {
                       
                         filteredMaps = maps;
                        const imgElement = document.createElement('img');
                        imgElement.src = imageList[imageName].imageUrl;
                         imgElement.alt = imageName;
                       
                        dropdownItem.appendChild(imgElement);
                        dropdownItem.appendChild(document.createTextNode(imageName));
                       
                        dropdownItem.addEventListener('click', function() {
                            showImageInfo(imageName);
                            dropdown.style.display = 'none';
                        });
                         dropdown.appendChild(dropdownItem);
                     }
                     }
                }
                filteredMaps.forEach(map => {
                    const imageItem = document.createElement('div');
                    imageItem.className = 'image-item';
                    imageItem.innerHTML = `
                        <img src="${map.imageUrl}" alt="Imagem do Mapa">
                        <div class="image-info">
                            <p><strong>ID:</strong> ${map.id}</p>
                            <p><strong>Local:</strong> ${map.local}</p>
                            <p><strong>Coordenadas:</strong> ${map.coordinates}</p>
                            <p><strong>Tag:</strong> ${map.tag}</p>
                        </div>
                    `;
                    mapContainer.appendChild(imageItem);
                 });
                 });
            } else if (!mapType || !location) {
                const imageItem = document.createElement('div');
                imageItem.className = 'image-item';
                imageItem.innerHTML = `
                    <p><strong>Selecione um Tipo de Mapa e Local do X para ver os resultados.</strong></p>
                `;
                mapContainer.appendChild(imageItem);
            }
        }


        document.getElementById('filterCheckbox').addEventListener('change', function() {
                dropdown.style.display = dropdown.childNodes.length ? 'block' : 'none';
            const filterOptions = document.getElementById('filterOptions');
            if (this.checked) {
                filterOptions.classList.remove('hidden');
             } else {
             } else {
                 filterOptions.classList.add('hidden');
                 dropdown.style.display = 'none';
                document.getElementById('filterOption').value = '';
                document.getElementById('filterValue').value = '';
                filterMaps();
             }
             }
         });
         });


         document.getElementById('filterButton').addEventListener('click', function() {
         document.addEventListener('click', function(event) {
             filterMaps();
             if (!imageSearch.contains(event.target) && !dropdown.contains(event.target)) {
                dropdown.style.display = 'none';
            }
         });
         });


         document.getElementById('filterValue').addEventListener('keypress', function(event) {
function showImageInfo(imageName) {
             if (event.key === 'Enter') {
    const imageInfo = imageList[imageName];
                event.preventDefault();
    let imagesHtml = `
                document.getElementById('filterButton').click();
        <div class="image-item">
             }
            <img src="${imageInfo.imageUrl}" alt="${imageName}">
        </div>
         <div class="variations-container">
    `;
 
    imageInfo.variations.forEach((variation, index) => {
        imagesHtml += `
             <div class="variation-item">
                <img src="${variation.additionalImages[0].url}" alt="Variation Image" class="variation-image" data-variation-index="${index}" style="width: ${variation.additionalImages[0].width}px;">
                <div class="swap-button" data-variation-index="${index}"></div><br>
                <div class="image-info">
                    <img src="${variation.descriptionIMG}" alt="Description Image" style="margin-right: 5px; display: inline-block;"> <!-- Exibe a imagem antes da descrição -->
                    <br> ${variation.description} <br> <!-- Descrição após a imagem -->
                    <b>Como Obter</b>: <a href="${variation.obtain.url}" target="_blank">${variation.obtain.text}</a>
                </div>
            </div>
        `;
    });
 
    imagesHtml += '</div>';
 
    imageContainer.innerHTML = imagesHtml;
    imageContainer.classList.remove('hidden');
 
    // Alternar imagens ao clicar no botão de troca
    const swapButtons = document.querySelectorAll('.swap-button');
 
    swapButtons.forEach(button => {
        const index = button.getAttribute('data-variation-index');
        const variation = imageInfo.variations[index];
        let currentImageIndex = 0;
 
        button.addEventListener('click', () => {
            currentImageIndex = (currentImageIndex + 1) % variation.additionalImages.length;
            const variationImage = button.previousElementSibling; // Atualiza a imagem da variação
            variationImage.src = variation.additionalImages[currentImageIndex].url;
             variationImage.style.width = `${variation.additionalImages[currentImageIndex].width}px`;
         });
         });
    });
}
     </script>
     </script>
</body>
</body>
</html>
</html>

Edição atual tal como às 23h45min de 16 de outubro 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>Busca de Imagens por Nome</title>
   <style>
       .input-group { margin-bottom: 1em; position: relative; }
       .dropdown {
           border: 1px solid #ccc;
           display: none;
           position: absolute;
           background-color: #fff;
           z-index: 1000;
           max-height: 150px;
           overflow-y: auto;
           width: 100%;
       }
       .dropdown-item {
           padding: 8px;
           cursor: pointer;
           display: flex;
           align-items: center;
       }
       .dropdown-item img {
           margin-right: 10px;
       }
       .dropdown-item:hover {
           background-color: #f0f0f0;
       }
       .image-container {
           display: flex;
           flex-direction: column;
           align-items: center;
           justify-content: center;
       }
       .image-item { 
           margin-bottom: 1em; 
           text-align: center;
       }
       .image-item img {
           display: block;
           margin: 0 auto;
       }
       .variations-container {
           display: flex;
           flex-wrap: wrap;
           justify-content: center;
           margin-top: 1em;
       }
       .variation-item {
           width: 35%;
           box-sizing: border-box;
           margin: 5px;
           text-align: center;
           border: 1px solid ;
           padding: 10px;
       }
       .variation-item img {
           display: block;
           margin: 0 auto 10px;
       }
       .swap-button { 
           margin-top: 10px;
           cursor: pointer;
           width: 15px;
           height: 15px;
           background: url('https://wiki.pokexgames.com/images/f/fb/SwapButtonAddons.png') no-repeat center;
           background-size: contain;
           display: block;
           margin: 0 auto;
       }
   </style>

</head> <body>

   <form id="imageForm">
           <input type="text" id="imageSearch" placeholder="Digite o nome da imagem" autocomplete="off">
   </form>
   <script>
       const imageList = {
           'Squirtle': { 
               imageUrl: 'https://wiki.pokexgames.com/images/7/7a/007-Squirtle.png', 
               variations: [
                   { 
                       description: 'Squirtle Purple Ninja Pack',
                       descriptionIMG: 'https://wiki.pokexgames.com/images/c/c1/Purple_Stripe.png',
                       obtain: {
                           url: 'https://wiki.pokexgames.com/index.php/Craft_Profissões_-_Estilista#Rank_E',
                           text: 'Estilista'
                       },
                       additionalImages: [
                           { url: 'https://wiki.pokexgames.com/images/d/dd/Squirtle_Purple_Ninja_Pack_Frente.png'}, // Frente
                           { url: 'https://wiki.pokexgames.com/images/5/50/Squirtle_Purple_Ninja_Pack_Esquerda.png'}, // Lado Esquerdo
                           { url: 'https://wiki.pokexgames.com/images/a/af/Squirtle_Purple_Ninja_Pack_Direita.png'}, // Costas
                           { url: 'https://wiki.pokexgames.com/images/5/5d/Squirtle_Purple_Ninja_Pack_Costas.png'}  // Lado Direito
                       ]
                   },
                   {  
                       description: 'Squirtle Red Ninja Pack',
                       descriptionIMG: 'https://wiki.pokexgames.com/images/c/c1/Purple_Stripe.png',
                       obtain: {
                           url: 'https://wiki.pokexgames.com/index.php/Craft_Profissões_-_Estilista#Rank_E',
                           text: 'Estilista'
                       },
                       additionalImages: [
                           { url: 'https://wiki.pokexgames.com/images/1/13/Squirtle_Red_Ninja_Pack_Frente.png'}, // Frente
                           { url: 'https://wiki.pokexgames.com/images/1/1e/Squirtle_Red_Ninja_Pack_Esquerda.png'}, // Lado Esquerdo
                           { url: 'https://wiki.pokexgames.com/images/0/01/Squirtle_Red_Ninja_Pack_Costas.png'}, // Costas
                           { url: 'https://wiki.pokexgames.com/images/f/fd/Squirtle_Red_Ninja_Pack_Direita.png'}  // Lado Direito
                       ]
                   }
               ]
           },
       };
       const imageSearch = document.getElementById('imageSearch');
       const dropdown = document.getElementById('dropdown');
       const imageContainer = document.getElementById('imageContainer');
       imageSearch.addEventListener('input', function() {
           const searchValue = this.value.trim().toLowerCase();
           dropdown.innerHTML = ;
           if (searchValue) {
               Object.keys(imageList).forEach(imageName => {
                   if (imageName.toLowerCase().includes(searchValue)) {
                       const dropdownItem = document.createElement('div');
                       dropdownItem.classList.add('dropdown-item');
                       
                       const imgElement = document.createElement('img');
                       imgElement.src = imageList[imageName].imageUrl;
                       imgElement.alt = imageName;
                       
                       dropdownItem.appendChild(imgElement);
                       dropdownItem.appendChild(document.createTextNode(imageName));
                       
                       dropdownItem.addEventListener('click', function() {
                           showImageInfo(imageName);
                           dropdown.style.display = 'none';
                       });
                       dropdown.appendChild(dropdownItem);
                   }
               });
               dropdown.style.display = dropdown.childNodes.length ? 'block' : 'none';
           } else {
               dropdown.style.display = 'none';
           }
       });
       document.addEventListener('click', function(event) {
           if (!imageSearch.contains(event.target) && !dropdown.contains(event.target)) {
               dropdown.style.display = 'none';
           }
       });

function showImageInfo(imageName) {

   const imageInfo = imageList[imageName];
   let imagesHtml = `
           <img src="${imageInfo.imageUrl}" alt="${imageName}">
   `;
   imageInfo.variations.forEach((variation, index) => {
       imagesHtml += `
                <img src="${variation.additionalImages[0].url}" alt="Variation Image" class="variation-image" data-variation-index="${index}" style="width: ${variation.additionalImages[0].width}px;">

                   <img src="${variation.descriptionIMG}" alt="Description Image" style="margin-right: 5px; display: inline-block;"> 
                   
${variation.description}
Como Obter: <a href="${variation.obtain.url}" target="_blank">${variation.obtain.text}</a>
       `;
   });
imagesHtml += '

';

   imageContainer.innerHTML = imagesHtml;
   imageContainer.classList.remove('hidden');
   // Alternar imagens ao clicar no botão de troca
   const swapButtons = document.querySelectorAll('.swap-button');
   swapButtons.forEach(button => {
       const index = button.getAttribute('data-variation-index');
       const variation = imageInfo.variations[index];
       let currentImageIndex = 0;
       button.addEventListener('click', () => {
           currentImageIndex = (currentImageIndex + 1) % variation.additionalImages.length;
           const variationImage = button.previousElementSibling; // Atualiza a imagem da variação
           variationImage.src = variation.additionalImages[currentImageIndex].url;
           variationImage.style.width = `${variation.additionalImages[currentImageIndex].width}px`;
       });
   });

}

   </script>

</body> </html>