Widget:Test
Ir para navegação
Ir para pesquisar
<!DOCTYPE html> <html lang="pt-BR"> <head>
<meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Item Search</title> <style> .suggest-icon { max-width: 20px; max-height: 20px; }
#suggest { max-height: 300px; max-width: 300px; overflow-y: scroll; overflow-x: hidden; }
.item-name { display: flex; align-items: center; }
.item-name-icon { max-width: 30px; margin-right: 8px; }
.craft p { margin: 0; }
.materials { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.item-from-craft { display: flex; align-items: center; padding: 8px 12px; border: 1px solid #ccc; border-radius: 8px; }
.material-icon-container { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; }
.who-drops { display: flex; flex-wrap: wrap; gap: 8px; }
.who-drops-item { display: flex; align-items: center; padding: 8px; border: 1px solid #ccc; border-radius: 8px; } </style>
</head> <body>
<input type="text" id="search" placeholder="Busque um item..." />
<script> // Base de dados local const allData = [ { "id": 18, "name": "Bag of Pollen", "icon": "https://wiki.pokexgames.com/images/b/bc/BagOfPollem.png", "link": "https://wiki.pokexgames.com/index.php/Bag_Of_Pollem", "isNightmare": false, } ] }, { "id": 1884, "name": "Anya Outfit (female)", "icon": "https://wiki.pokexgames.com/images/8/8a/Anya_Outfit_Designer.png", "link": null, "isNightmare": false, "craft": { "quantity": 1, "skill": "100", "cooldownText": "5 dias", "rank": "S", "profession": "Stylist", "materials": [ { "name": "Lovely Topknot", "icon": "https://wiki.pokexgames.com/images/e/e9/Lovely_Topknot.png", "isNightmare": true, "quantity": 10, "id": 532 }, // outros materiais omitidos para simplicidade... ] } }, { "id": 1912, "name": "Catcher Token", "icon": "https://wiki.pokexgames.com/images/f/fd/Catcher_Token.png", "link": "https://wiki.pokexgames.com/index.php/Tokens", "isNightmare": false } ];
const search = document.getElementById("search"); const suggest = document.getElementById("suggest"); const content = document.getElementById("content");
const clearSuggestions = () => { suggest.innerHTML = ""; };
const setItem = (id) => { const data = allData.find((data) => data.id == id); if (!data) return; clearSuggestions();
if (data.name === "Bag of Pollen") { content.innerHTML = `
![BagOfPollem.png](/images/b/bc/BagOfPollem.png)
Bag Of Pollen
Informações Importantes | |
---|---|
Como obter | ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Preço NPC | 40 dólares |
Onde vender | NPC Mark (Itens) |
Utilidade | É um item muito usado em craft de profissões, principalmente por Professores. Pode ser vendido em NPC, ou por um preço um pouco maior no Market para outros jogadores. |
![]() |
Veja mais: NPC Mark (Itens) - Profissões - Quests - Market |
`;
} else { content.innerHTML = `
<img class="item-name-icon" src="${data.icon}" />
${data.name}
`;
if (data.craft) { content.innerHTML += `
Craft
Quantidade: ${data.craft.quantity}
Skill: ${data.craft.skill} - Rank ${data.craft.rank}
Tempo de Craft: ${data.craft.cooldownText}
Profissão: ${data.craft.profession}
Materiais:
${data.craft.materials.map((material) => `
${material.quantity}x ${material.name}
`;
}
if (data.whoDrops) { content.innerHTML += `
Quem Droppa
${data.whoDrops.map((drop) => `
<a href="${drop.link}" target="_blank" rel="noopener noreferrer"> <img class="item-name-icon" src="${drop.icon}" /> ${drop.name} </a>
`;
}
const materialTo = allData.filter((item) => { if (!item.craft?.materials) return false; return item.craft.materials.some((m) => m.id == id); });
if (materialTo.length) { content.innerHTML += `
Usado para craftar
${materialTo.map((material) => `
${material.name}
`;
} } };
document.addEventListener("click", (e) => { if (e.target.classList.contains("suggest-item")) { e.preventDefault(); setItem(e.target.dataset.itemId); } });
search.addEventListener("input", () => { const value = search.value?.toLowerCase(); suggest.innerHTML = ""; allData.forEach((data) => { if (data.name.toLowerCase().includes(value)) { const div = document.createElement("div"); div.innerHTML = ` <img src="${data.icon}" class="suggest-icon" lazy /> <a class="suggest-item" href="#" data-item-id="${data.id}">${data.name}</a>`; suggest.appendChild(div); } }); }); </script>
</body> </html>