From 68c27b52249b56fb9b8533682a38da339a058f67 Mon Sep 17 00:00:00 2001 From: hppeng Date: Wed, 3 Aug 2022 01:00:39 -0700 Subject: [PATCH] Bring up to date using `make_elem` --- js/items.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/js/items.js b/js/items.js index 317f6d1..8c15450 100644 --- a/js/items.js +++ b/js/items.js @@ -121,15 +121,11 @@ function displayItems(items_copy) { for (let i in items_copy) { if (i > 200) {break;} let item = items_copy[i].itemExp; - let box = document.createElement("div"); - box.classList.add("col-lg-3", "col-sm-6", "p-2"); - box.id = "item"+i; + let box = make_elem('div', ['col-lg-3', 'col-sm-6', 'p-2'], {id: 'item'+i}); //box.addEventListener("dblclick", function() {set_item(item);}); TODO: ?? - let bckgrdbox = document.createElement("div"); - bckgrdbox.classList.add("dark-7", "rounded", "px-2", "col-auto"); - box.appendChild(bckgrdbox); - bckgrdbox.id = "item"+i+"b"; + let bckgrdbox = make_elem("div", ["dark-7", "rounded", "px-2", "col-auto"], {id: 'item'+i+'b'}); + box.append(bckgrdbox); items_parent.appendChild(box); item.set("powders", []); if (item.get("category") == "weapon") { @@ -263,9 +259,7 @@ function init_items() { list.style.maxHeight = position.height * 4 +"px"; if (!data.results.length) { - message = document.createElement('li'); - message.classList.add('scaled-font'); - message.textContent = "No results found!"; + const message = make_elem('li', ['scaled-font'], {textContent: "No results found!"}); list.prepend(message); }; },