From bafc8dfc44019bb316708dced48e51674283c16c Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Fri, 26 May 2017 09:25:07 +0200 Subject: [PATCH] /inventory/ now has a search field --- static/index.ejs | 1 + static/storage.js | 5 ++++- static/style.css | 8 ++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/static/index.ejs b/static/index.ejs index f8f0ebb9..03a05b22 100644 --- a/static/index.ejs +++ b/static/index.ejs @@ -9,6 +9,7 @@

Storage

+
diff --git a/static/storage.js b/static/storage.js index 83e5930f..97d184b7 100644 --- a/static/storage.js +++ b/static/storage.js @@ -11,7 +11,10 @@ function drawcontents(data) { } else { img = "https://wiki.factorio.com/images/" + capitalizeFirstLetter(data[i].name) + ".png"; } - result = result + "" + data[i].name + "" + data[i].count + ""; + var searchField = document.querySelector("#search"); + if(!searchField.value || data[i].name.includes(searchField.value)) { + result = result + "" + data[i].name + "" + data[i].count + ""; + } } result = result + "" document.getElementById("contents").innerHTML = result; diff --git a/static/style.css b/static/style.css index 73492c90..7fdd5b44 100644 --- a/static/style.css +++ b/static/style.css @@ -17,8 +17,12 @@ button { http://www.lua-api.factorio.com */ background-color: #262626; color: #C8C8C8; -} - +} +/* search field */ +#storage > input { + background-color:black; + width:300px; +} #sidenav { position:fixed; left:0px;