diff --git a/static/main.js b/static/main.js index b62bb953..50db8daf 100644 --- a/static/main.js +++ b/static/main.js @@ -61,6 +61,10 @@ Date.prototype.yyyymmdd = function(time) { // http://stackoverflow.com/questions return this.getFullYear()+""+mm+""+dd+ ""; // padding }; var date = new Date(); +String.prototype.replaceAll = function(search, replacement) { + var target = this; + return target.split(search).join(replacement); +}; // image data // key is the name of the item in the database, value is the name of the image on wiki.factorio.com/images/* diff --git a/static/storage.js b/static/storage.js index d2dd1040..8b9c7dbd 100644 --- a/static/storage.js +++ b/static/storage.js @@ -9,7 +9,7 @@ function drawcontents(data) { } else if(imagelinks[data[i].name]) { img = imagelinks[data[i].name]; } else { - img = "https://wiki.factorio.com/images/" + capitalizeFirstLetter(data[i].name.replace('-','_')) + ".png"; + img = "https://wiki.factorio.com/images/" + capitalizeFirstLetter(data[i].name.replaceAll('-','_')) + ".png"; } var searchField = document.querySelector("#search"); if(!searchField.value || data[i].name.includes(searchField.value)) {