/inventory/ now has a search field

This commit is contained in:
Danielv123 committed 2017-05-26 09:25:07 +02:00
1 parent b520d9611b
commit bafc8dfc44
3 files changed
+11 -3

No files matched your search

+4 -1
View File
@@ -11,7 +11,10 @@ function drawcontents(data) {
} else {
img = "https://wiki.factorio.com/images/" + capitalizeFirstLetter(data[i].name) + ".png";
}
result = result + "<tr><td><image src='" + img + "' onerror='hideThis(this);'></td><td>" + data[i].name + "</td><td>" + data[i].count + "</td></tr>";
var searchField = document.querySelector("#search");
if(!searchField.value || data[i].name.includes(searchField.value)) {
result = result + "<tr><td><image src='" + img + "' onerror='hideThis(this);'></td><td>" + data[i].name + "</td><td>" + data[i].count + "</td></tr>";
}
}
result = result + "</table>"
document.getElementById("contents").innerHTML = result;