change clickable arrow to a function

This commit is contained in:
reschan 2022-06-22 09:34:06 +07:00
parent adcf1ee362
commit 564e4709cd

View file

@ -827,12 +827,7 @@ function displaysq2MeleeDamage(parent_elem, overallparent_elem, meleeStats){
parent_elem.append(critStats);
//up and down arrow - done ugly
let arrow = document.createElement("img");
arrow.id = "arrow_" + overallparent_elem.id;
arrow.style.maxWidth = document.body.clientWidth > 900 ? "3rem" : "10rem";
arrow.src = "../media/icons/" + (newIcons ? "new" : "old") + "/toggle_down.png";
overallparent_elem.appendChild(arrow);
addClickableArrow(overallparent_elem);
}
function displaysq2ArmorStats(build) {
@ -1401,12 +1396,7 @@ function displaysq2SpellDamage(parent_elem, overallparent_elem, build, spell, sp
}
}
//up and down arrow - done ugly
let arrow = document.createElement("img");
arrow.id = "arrow_" + overallparent_elem.id;
arrow.style.maxWidth = document.body.clientWidth > 900 ? "3rem" : "10rem";
arrow.src = "../media/icons/" + (newIcons ? "new" : "old") + "/toggle_down.png";
overallparent_elem.appendChild(arrow);
addClickableArrow(overallparent_elem);
}
function displaysq2EquipOrder(parent_elem, buildOrder){
@ -2390,3 +2380,12 @@ function sq2StringCDF(id,val,base,amp) {
document.getElementById(id + "-cdf").appendChild(div2);
document.getElementById(id + "-cdf").appendChild(div3);
}
function addClickableArrow(elem) {
//up and down arrow - done ugly
let arrow = document.createElement("img");
arrow.id = "arrow_" + elem.id;
arrow.style.maxWidth = document.body.clientWidth > 900 ? "3rem" : "10rem";
arrow.src = "../media/icons/" + (newIcons ? "new" : "old") + "/toggle_down.png";
elem.appendChild(arrow);
}