JSFiddle - React, Tailwind, and code Playground
by lollero
CSS
body {
font-family: Monospace;
}
ul { border: 1px solid red; }
JavaScript
var needed_items = [
"Loaf of Bread",
"Stick of Butter",
"Bag of Flour",
"Glass of Buttermilk",
"Onion",
"Slab of Red Meat",
"Slab of Poultry",
"Pile of Salt and Pepper",
"Bag of Sugar",
"Jug of Water",
"Mushrooms",
"Packet of Salt",
"Jar of Vegetable Oil",
"Ball of Dough",
"Pile of Cinnamon and Sugar",
"Apple",
"Packet of Baking Powder",
"Carrots",
"Parsley Leaf",
"Slice of Buttered Toast",
"Onion Rings",
"Hamburger",
"Grilled Steak",
"Grilled Poultry",
"Grilled Mushroom",
"Cinnamon Pinwheel",
"Cinnamon Apple",
"Buttermilk Biscuit",
"Bowl of Sauteed Carrots",
"Bowl of Apple Sauce",
];
$.getJSON( "https://api.guildwars2.com/v2/items", function( data ) {
var items1 = [];
$.each( data, function( key, val ) {
items1.push( val );
});
for ( var i=0; i < 84814; i++ ) {
$.getJSON( "https://api.guildwars2.com/v2/items/" + items1[i], function( data ) {
var items2 = [];
var itemFound = false;
$.each( data, function( key, val ) {
for ( var i=0; i < needed_items.length; i++ ) {
if( data.name.indexOf( needed_items[i] ) > -1 ) {
itemFound = true;
key === "name" && items2.push( "<li id='" + key + "'>" + val + "</li>" );
items2.push( "<li id='api-id'>" + i + "</li>" );
}
}
});
if ( itemFound ) {
$( "<ul/>", {
"class": "list",
html: items2.join( "" )
}).appendTo( "body" );
}
});
}
})