Widget:Test: mudanças entre as edições

De PokeXGames
Ir para navegação Ir para pesquisar
Sem resumo de edição
Etiqueta: Revertido
Sem resumo de edição
 
(183 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 1: Linha 1:
<script>
<!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;
        }


const optionsImageBibliotecaChosenOne = [
        .variation-item {
            width: 30%;
            box-sizing: border-box;
            margin: 10px;
            text-align: center;
            border: 1px solid #ccc;
            padding: 10px;
        }


     {
        .variation-item img {
         label: " ʺEp. Ariados, Amigosʺ, ʺEp. Wake Up Snorlax!ʺ",
            width: 100px;
         image: "https://wiki.pokexgames.com/images/7/77/3538%2C_5020%2C_9.png",
            height: 100px;
        obs: "<center><b>(3538, 5020, 9)</b></center>"
            display: block;
    },
            margin: 0 auto 10px;
    {  
        }
        label: " ʺEp. A Way Off Day Offʺ, ʺEp. The Misty Mermaidʺ",
     </style>
        image: "https://wiki.pokexgames.com/images/c/c5/3547%2C_5036%2C_9.png",
</head>
         obs: "<center><b>(3547, 5036, 9)</b></center>"
<body>
    <form id="imageForm">
         <div class="input-group">
            <input type="text" id="imageSearch" placeholder="Digite o nome da imagem" autocomplete="off">
            <div id="dropdown" class="dropdown"></div>
        </div>
 
         <div id="imageContainer" class="image-container hidden">
            <!-- As imagens e suas informações serão exibidas aqui -->
        </div>
    </form>
 
    <script>
        const imageList = {
            'Charmander': {
                imageUrl: 'https://wiki.pokexgames.com/images/6/65/004-Charmander.png',  
                variations: [
                    {
                        imageUrl: 'https://wiki.pokexgames.com/images/3/3b/Clefable_Lovely-_Accessory.png',
                        description: 'Charmander XXX',
                        obtain: {
                            url: 'https://wiki.pokexgames.com/index.php/Craft_Profissões_-_Estilista#Rank_E',
                            text: 'Estilista'
                        }
                    },
                    { 
                        imageUrl: 'https://wiki.pokexgames.com/images/3/3b/Clefable_Lovely-_Accessory.png',
                        description: 'Charmander brabo.',
                        obtain: {
                            url: 'https://wiki.pokexgames.com/index.php/Craft_Profissões_-_Estilista#Rank_E',
                            text: 'Estilista'
                        }
                    }
                ]
            },
         };
 
        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 = `
        <div class="image-item">
            <img src="${imageInfo.imageUrl}" alt="${imageName}">
        </div>
    `;
 
    if (imageInfo.variations) {
        imagesHtml += '<div class="variations-container">';
        imageInfo.variations.forEach(variation => {
            imagesHtml += `
                <div class="variation-item">
                    <img src="${variation.imageUrl}" alt="Variation Image">
                    <div class="image-info">
                        <b>Nome do Addon</b>: ${variation.description}
                        <b>Como Obter</b>: <a href="${variation.obtain.url}" target="_blank">${variation.obtain.text}</a>
                    </div>
                </div>
            `;
        });
        imagesHtml += '</div>';
     }
     }
]
 
</script>
    imageContainer.innerHTML = imagesHtml;
    imageContainer.classList.remove('hidden');
}
 
    </script>
</body>
</html>

Edição atual tal como às 20h28min de 13 de setembro 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: 30%;
           box-sizing: border-box;
           margin: 10px;
           text-align: center;
           border: 1px solid #ccc;
           padding: 10px;
       }
       .variation-item img {
           width: 100px;
           height: 100px;
           display: block;
           margin: 0 auto 10px;
       }
   </style>

</head> <body>

   <form id="imageForm">
           <input type="text" id="imageSearch" placeholder="Digite o nome da imagem" autocomplete="off">
   </form>
   <script>
       const imageList = {
           'Charmander': { 
               imageUrl: 'https://wiki.pokexgames.com/images/6/65/004-Charmander.png', 
               variations: [
                   { 
                       imageUrl: 'https://wiki.pokexgames.com/images/3/3b/Clefable_Lovely-_Accessory.png',
                       description: 'Charmander XXX',
                       obtain: {
                           url: 'https://wiki.pokexgames.com/index.php/Craft_Profissões_-_Estilista#Rank_E',
                           text: 'Estilista'
                       } 
                   },
                   {  
                       imageUrl: 'https://wiki.pokexgames.com/images/3/3b/Clefable_Lovely-_Accessory.png',
                       description: 'Charmander brabo.',
                       obtain: {
                           url: 'https://wiki.pokexgames.com/index.php/Craft_Profissões_-_Estilista#Rank_E',
                           text: 'Estilista'
                       } 
                   }
               ]
           },
       };
       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}">
   `;
   if (imageInfo.variations) {

imagesHtml += '

';
       imageInfo.variations.forEach(variation => {
           imagesHtml += `
                   <img src="${variation.imageUrl}" alt="Variation Image">
                       Nome do Addon: ${variation.description} 
                       Como Obter: <a href="${variation.obtain.url}" target="_blank">${variation.obtain.text}</a>
           `;
       });
imagesHtml += '

';

   }
   imageContainer.innerHTML = imagesHtml;
   imageContainer.classList.remove('hidden');

}

   </script>

</body> </html>