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
 
(206 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 1: Linha 1:
<script>
<!DOCTYPE html>
var optionsValuesAgatha = [
<html lang="pt-BR">
    {
<head>
        group: "Beholder Eye",
    <meta charset="UTF-8">
        phrases: [
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
            "The most common colors are brown, blue, green and black",
    <title>Busca de Imagens por Nome</title>
            "Our guide",
     <style>
            "Human Eye",
         .input-group { margin-bottom: 1em; position: relative; }
            "It can distinguish about 10 million colors"
         .dropdown {
        ],
            border: 1px solid #ccc;
        img: "/images/3/33/Beholder_Eye.png",
             display: none;
        obs: ""
             position: absolute;
     },
             background-color: #fff;
    {
            z-index: 1000;
         group: "Big Cask",
            max-height: 150px;
         phrases: [
            overflow-y: auto;
             "158,987295 liters",
            width: 100%;
             "You can find wine inside",
         }
             "You can store oil inside",
         .dropdown-item {
         ],
            padding: 8px;
         img: "/images/d/de/Big_Cask.png",
            cursor: pointer;
        obs: "Ele também pode aparecer como um recipiente. O nome será Big Cask."
            display: flex;
    },
            align-items: center;
    {
         }
        group: "Bug Venom",
        .dropdown-item img {
         phrases: [
             margin-right: 10px;
            "It has a powerful poison",
        }
             "Used to eat leaves",
        .dropdown-item:hover {
             "Insect's weapon",
             background-color: #f0f0f0;
         ],
         }
         img: "/images/8/88/Agatha_Bug_Venom.png",
         .image-container {
        obs: ""
            display: flex;
    },
            flex-direction: column;
    {
            align-items: center;
        group: "Bowl",
            justify-content: center;
        phrases: [
         }
            "Take a Bowl",          
         .image-item {
         ],
            margin-bottom: 1em;
        img: "/images/0/0c/Agatha_Bowl.png",
            text-align: center;
        obs: "Ele também pode aparecer como um recipiente. O nome será Bowl"
        }
    },
        .image-item img {
    {
            display: block;
        group: "Bear Paw",
            margin: 0 auto;
         phrases: [
        }
             "Hands",
 
             "Weapons and legs of a giant",
         .variations-container {
             "Brown Claws",          
            display: flex;
         ],
             flex-wrap: wrap;
        img: "/images/b/b2/Agatha_Bear_Paw.png",
             justify-content: center;
        obs: ""
             margin-top: 1em;
    },
         }
    {
 
        group: "Bat Wing",
         .variation-item {
         phrases: [
            width: 35%;
            "Bloodsucker wing",
            box-sizing: border-box;
             "Bat Wing",
            margin: 5px;
             "Witches like to use",
            text-align: center;
            "Used in witch potions",          
            border: 1px solid ;
        ],
            padding: 10px;
         img: "/images/3/3d/Agatha_Bat_Wing.png",
         }
        obs: ""
 
    },
        .variation-item img {
    {
             display: block;
        group: "Behemoth Fang",
             margin: 0 auto 10px;
        phrases: [
         }
             "Ancient tooth",
 
             "It does not have teeth problems",
         .swap-button {
            "Elder Fang",
            margin-top: 10px;
            "Can kill you in one bite",       
            cursor: pointer;
        ],
            width: 15px;
        img: "/images/b/bc/Behemoth_Fang.png",
             height: 15px;
        obs: ""
             background: url('https://wiki.pokexgames.com/images/f/fb/SwapButtonAddons.png') no-repeat center;
    },
            background-size: contain;
    {
            display: block;
         group: "Dracolaˈs Eye",
            margin: 0 auto;
         phrases: [
         }
            "Darkness eye",
    </style>
             "Shadow eye",
</head>
             "Eye of blood"
<body>
         ],
    <form id="imageForm">
        img: "/images/b/b1/Dracola%27s_Eye.png",
         <div class="input-group">
         obs: ""
             <input type="text" id="imageSearch" placeholder="Digite o nome da imagem" autocomplete="off">
     },
             <div id="dropdown" class="dropdown"></div>
     {
         </div>
         group: "Dark Bat Wing",
 
        phrases: [
         <div id="imageContainer" class="image-container hidden">
            "Rare wing",
            <!-- As imagens e suas informações serão exibidas aqui -->
            "Dark Bloodsucker wings",
        </div>
            "Dark piece of a flyer", 
     </form>
        ],
 
        img: "/images/b/b8/Dark_Bat_Wing.png",
     <script>
        obs: ""
         const imageList = {
    },
            'Squirtle': {
    {
                imageUrl: 'https://wiki.pokexgames.com/images/7/7a/007-Squirtle.png',  
        group: "Dragon Claw",
                variations: [
        phrases: [
                    {  
            "A giant lizard weapon",
                        description: 'Squirtle Purple Ninja Pack',
            "Weapon of the monster with wings",
                        descriptionIMG: 'https://wiki.pokexgames.com/images/c/c1/Purple_Stripe.png',
            "It can rip you", 
                        obtain: {
        ],
                            url: 'https://wiki.pokexgames.com/index.php/Craft_Profissões_-_Estilista#Rank_E',
        img: "/images/5/50/Agatha_Dragon_Claw.png",
                            text: 'Estilista'
        obs: ""
                        },
    },
                        additionalImages: [
    {
                            { url: 'https://wiki.pokexgames.com/images/d/dd/Squirtle_Purple_Ninja_Pack_Frente.png'}, // Frente
        group: "Frozen Human",
                            { url: 'https://wiki.pokexgames.com/images/5/50/Squirtle_Purple_Ninja_Pack_Esquerda.png'}, // Lado Esquerdo
        phrases: [
                            { url: 'https://wiki.pokexgames.com/images/a/af/Squirtle_Purple_Ninja_Pack_Direita.png'}, // Costas
            "It's cold here, im freezing...",
                            { url: 'https://wiki.pokexgames.com/images/5/5d/Squirtle_Purple_Ninja_Pack_Costas.png'}  // Lado Direito
            "Frozenhead",
                        ]
            "I can't move...frozen...", 
                    },
        ],
                    {
        img: "/images/thumb/1/1f/Frozen_Human.png/490px-Frozen_Human.png",
                        description: 'Squirtle Red Ninja Pack',
        obs: ""
                        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',
        group: "Flowers",
                            text: 'Estilista'
        phrases: [
                        },
            "The best essence in nature",
                        additionalImages: [
            "Piece of spring",
                            { url: 'https://wiki.pokexgames.com/images/1/13/Squirtle_Red_Ninja_Pack_Frente.png'}, // Frente
            "A bouquet of", 
                            { 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
        img: "/images/2/24/Agatha_Flowers.png",
                            { url: 'https://wiki.pokexgames.com/images/f/fd/Squirtle_Red_Ninja_Pack_Direita.png'}  // Lado Direito
        obs: ""
                        ]
    },
                    }
    {
                ]
        group: "Fish Fin",
            },
        phrases: [
         };
            "It can strach you under water",
 
            "Sharp piece of fish",
        const imageSearch = document.getElementById('imageSearch');
            "Piece of Fish", 
        const dropdown = document.getElementById('dropdown');
        ],
         const imageContainer = document.getElementById('imageContainer');
        img: "/images/3/34/Agatha_Fish_Fin.png",
 
        obs: ""
         imageSearch.addEventListener('input', function() {
    },
            const searchValue = this.value.trim().toLowerCase();
    {
             dropdown.innerHTML = '';
        group: "Gyarados Tail",
 
        phrases: [
             if (searchValue) {
            "Piece of a sea giant",
                Object.keys(imageList).forEach(imageName => {
            "Whip of lord of the sea",
                    if (imageName.toLowerCase().includes(searchValue)) {
            "A tail of a furious", 
                        const dropdownItem = document.createElement('div');
        ],
                        dropdownItem.classList.add('dropdown-item');
        img: "/images/2/20/Agatha_Gyarados_Tail.png",
                       
        obs: ""
                        const imgElement = document.createElement('img');
    },
                        imgElement.src = imageList[imageName].imageUrl;
    {
                        imgElement.alt = imageName;
        group: "Hook",
                       
        phrases: [
                        dropdownItem.appendChild(imgElement);
            "Used by captains",
                        dropdownItem.appendChild(document.createTextNode(imageName));
            "If you lose a hand you can use instead",
                       
            "Pirates like it", 
                        dropdownItem.addEventListener('click', function() {
        ],
                            showImageInfo(imageName);
        img: "/images/b/b7/Agatha_Hook.png",
                            dropdown.style.display = 'none';
        obs: ""
                        });
    },
                        dropdown.appendChild(dropdownItem);
    {
                    }
        group: "Honey Comb",
                });
        phrases: [
 
            "Sweet taste",
                dropdown.style.display = dropdown.childNodes.length ? 'block' : 'none';
            "Egyptians used to use",
            } else {
            "House of a insect", 
                dropdown.style.display = 'none';
        ],
            }
        img: "/images/f/fa/Honey_Comb.png",
         });
        obs: "Ele também pode aparecer como um recipiente. O nome será Honey Comb"
 
    },
         document.addEventListener('click', function(event) {
{
             if (!imageSearch.contains(event.target) && !dropdown.contains(event.target)) {
        group: "Leaves (sala das estantes)",
                dropdown.style.display = 'none';
         phrases: [
             }
            "Used to synthesis of light",
         });
            "Hair of trees",
 
            "Green sharps", 
function showImageInfo(imageName) {
            "Leaves", 
    const imageInfo = imageList[imageName];
         ],
    let imagesHtml = `
         img: "/images/5/54/Leaves_2.png",
         <div class="image-item">
        obs: ""
            <img src="${imageInfo.imageUrl}" alt="${imageName}">
    },
        </div>
{
         <div class="variations-container">
        group: "Leaves (sala de poções)",
    `;
        phrases: [
 
             "Small Leaves",
    imageInfo.variations.forEach((variation, index) => {
            "Head of a small plant",
        imagesHtml += `
             "Small green piece of nature", 
             <div class="variation-item">
            "Small pieces of spring", 
                <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>
        img: "/images/f/fb/Agatha_Leaves.png",
                <div class="image-info">
        obs: ""
                    <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>
        group: "Map",
                </div>
        phrases: [
            </div>
            "Traveler best friend",
         `;
            "It does have continents",
     });
            "You can see the shape of the earth", 
 
        ],
     imagesHtml += '</div>';
        img: "/images/a/af/Agatha_Map.png",
 
        obs: ""
    imageContainer.innerHTML = imagesHtml;
    },
    imageContainer.classList.remove('hidden');
{
 
        group: "Onix Tail",
    // Alternar imagens ao clicar no botão de troca
        phrases: [
    const swapButtons = document.querySelectorAll('.swap-button');
            "Rocks",
 
            "Hard tail",
    swapButtons.forEach(button => {
            "Whip of rocks", 
         const index = button.getAttribute('data-variation-index');
            "Whip of stones"
         const variation = imageInfo.variations[index];
        ],
        let currentImageIndex = 0;
        img: "/images/f/f8/Agatha_Onix_Tail.png",
 
        obs: ""
         button.addEventListener('click', () => {
    },
             currentImageIndex = (currentImageIndex + 1) % variation.additionalImages.length;
{
             const variationImage = button.previousElementSibling; // Atualiza a imagem da variação
         group: "Poké Ball",
             variationImage.src = variation.additionalImages[currentImageIndex].url;
         phrases: [
            variationImage.style.width = `${variation.additionalImages[currentImageIndex].width}px`;
            "People dream using this in a journey",
         });
             "Critical for trainers",
     });
             "The Trainers Weapon"
}
         ],
 
         img: "/images/8/87/Pok%C3%A9_Ball.png",
    </script>
        obs: "É a pokéball sozinha com o pokémon dentro."
</body>
    },
</html>
    {
         group: "Plasmother Remains",
        phrases: [
            "Green remains",
            "Green and disgusting",
             "Monster's plasma"
        ],
        img: "/images/e/e3/Plasmother_Remains.png",
        obs: ""
    },
    {
        group: "Piano",
        phrases: [
            "Maurizio pollini",
            "Used to create symphony",
            "Played by keys"
        ],
        img: "/images/8/83/Agatha_Piano.png",
        obs: ""
    },
    {
        group: "Pinsir Horn",
        phrases: [
            "It's Hard",
            "The most powerful weapon of a insect",
            "It's piece of an insect",
            "It's pick of in insect"
        ],
        img: "/images/e/e2/Agatha_Pinsir_Horn.png",
         obs: ""
     },
     {
        group: "Rat Tail",
        phrases: [
            "Future piece of raticate",
            "Rat Whip",
            "Small Whip",
        ],
         img: "/images/4/46/Agatha_Rat_Tail.png",
         obs: ""
    },
    {
         group: "Squirtle Hull",
        phrases: [
             "Squirtle´s house",
             "Turtle's shell",
             "Tortoises protection",
        ],
        img: "/images/2/29/Agatha_Squirtle_Hull.png",
         obs: ""
     },
    {
        group: "Soul Orb",
        phrases: [
            "Essence incorporeal",
            "Sphere of human essence",
            "Concentration of human energy",
        ],
        img: "/images/b/bb/Soul_Orb.png",
        obs: ""
    },
    {
        group: "Sandbag",
        phrases: [
            "It comes from rock",
            "Found in the desert",
            "Granular material",
        ],
        img: "/images/7/78/Agatha_Sandbag.png",
        obs: ""
    },
    {
        group: "Tube",
        phrases: [
            "Take an Erlenmeyer",
        ],
        img: "/images/3/39/Agatha_Tube.png",
        obs: "Ele também pode aparecer como um recipiente. O nome será Tube"
    },
    {
        group: "Tube 2",
        phrases: [
            "Take a Kitasatos",
        ],
        img: "/images/6/68/Tube_2.png",
        obs: "Ele também pode aparecer como um recipiente. O nome será Tube 2"
    },
    {
        group: "Trap",
        phrases: [
            "The most popular is used in bears",
            "Insect can step but a giant can die",
            "Do not step it"
        ],
        img: "/images/a/a6/Agatha_Trap.png",
        obs: ""
    },
    {
        group: "Voodoo Doll",
        phrases: [
            "It makes you a puppet",
            "Used in dark magic",
            "Has arm and legs do not move and feel pain"
        ],
        img: "/images/f/fd/Voodoo_Doll.png",
        obs: ""
    },
    {
        group: "Wood",
        phrases: [
            "Termite Food",
            "Plank",
            "Plant armor"
        ],
        img: "/images/f/f1/Agatha_Wood.png",
        obs: ""
    },
    {
        group: "Water Pipe",
        phrases: [
            "Take a Water Pipe",
        ],
        img: "/images/c/cf/Water_Pipe.png",
        obs: "Ele também pode aparecer como um recipiente. O nome será Water Pipe"
    },
];
</script>

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>