begin display cleanup

This commit is contained in:
hppeng 2022-07-17 23:46:23 -07:00
parent 8c050437fc
commit 70df30d335

View file

@ -181,8 +181,7 @@ function displayExpandedItem(item, parent_id){
elemental_format = !elemental_format; elemental_format = !elemental_format;
} }
else if (command === "!spacer") { else if (command === "!spacer") {
let spacer = document.createElement('div'); let spacer = make_elem('div', ["row", "my-2"], {});
spacer.classList.add("row", "my-2");
parent_div.appendChild(spacer); parent_div.appendChild(spacer);
continue; continue;
} }
@ -191,49 +190,44 @@ function displayExpandedItem(item, parent_id){
let id = command; let id = command;
if(nonRolledIDs.includes(id)){//nonRolledID & non-0/non-null/non-und ID if(nonRolledIDs.includes(id)){//nonRolledID & non-0/non-null/non-und ID
if (!item.get(id)) { if (!item.get(id)) {
if (! (item.get("crafted") && skp_order.includes(id) && if (!(item.get("crafted") && skp_order.includes(id) &&
(item.get("maxRolls").get(id) || item.get("minRolls").get(id)))) { (item.get("maxRolls").get(id) || item.get("minRolls").get(id)))) {
continue; continue;
} }
} }
if (id === "slots") { if (id === "slots") {
let p_elem = document.createElement("div"); let p_elem = make_elem("div", ["col"]);
p_elem.classList.add("col");
// PROPER POWDER DISPLAYING // PROPER POWDER DISPLAYING
let numerals = new Map([[1, "I"], [2, "II"], [3, "III"], [4, "IV"], [5, "V"], [6, "VI"]]); let numerals = new Map([[1, "I"], [2, "II"], [3, "III"], [4, "IV"], [5, "V"], [6, "VI"]]);
let powderPrefix = document.createElement("b"); let powderPrefix = make_elem("b", [], {
powderPrefix.textContent = "Powder Slots: " + item.get(id) + " ["; textContent: "Powder Slots: " + item.get(id) + " ["
});
p_elem.appendChild(powderPrefix); p_elem.appendChild(powderPrefix);
let powders = item.get("powders"); let powders = item.get("powders");
for (let i = 0; i < powders.length; i++) { for (let i = 0; i < powders.length; i++) {
let powder = document.createElement("b"); let powder = make_elem("b", [damageClasses[Math.floor(powders[i]/6)+1]+"_powder"],
powder.textContent = numerals.get((powders[i]%6)+1)+" "; { textContent: numerals.get((powders[i]%6)+1)+" " });
powder.classList.add(damageClasses[Math.floor(powders[i]/6)+1]+"_powder");
p_elem.appendChild(powder); p_elem.appendChild(powder);
} }
let powderSuffix = document.createElement("b"); let powderSuffix = make_elem("b", { textContent: "]" });
powderSuffix.textContent = "]";
p_elem.appendChild(powderSuffix); p_elem.appendChild(powderSuffix);
parent_div.appendChild(p_elem); parent_div.appendChild(p_elem);
} else if (id === "set") { } else if (id === "set") {
if (item.get("hideSet")) { continue; } if (item.get("hideSet")) { continue; }
let p_elem = document.createElement("div"); let p_elem = make_elem("div", ["col"], { textContent: "Set: " + item.get(id).toString() });
p_elem.classList.add("col");
p_elem.textContent = "Set: " + item.get(id).toString();
parent_div.appendChild(p_elem); parent_div.appendChild(p_elem);
} else if (id === "majorIds") { } else if (id === "majorIds") {
//console.log(item.get(id)); //console.log(item.get(id));
for (let majorID of item.get(id)) { for (let majorID of item.get(id)) {
let p_elem = document.createElement("div"); let p_elem = make_elem("div", ['col']);
p_elem.classList.add("col");
let title_elem = document.createElement("b"); let title_elem = make_elem("b", []);
let b_elem = document.createElement("b"); let b_elem = make_elem("b", []);
if (majorID.includes(":")) { if (majorID.includes(":")) {
let name = majorID.substring(0, majorID.indexOf(":")+1); let name = majorID.substring(0, majorID.indexOf(":")+1);
let mid = majorID.substring(majorID.indexOf(":")+1); let mid = majorID.substring(majorID.indexOf(":")+1);