From 5f789c54f9f1206d435cbfb33f32edd9185b1520 Mon Sep 17 00:00:00 2001 From: Kakarot <57848836+GhzGarage@users.noreply.github.com> Date: Sat, 10 Feb 2024 17:16:21 -0600 Subject: [PATCH] Updates/improvements --- html/js/app.js | 66 +++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/html/js/app.js b/html/js/app.js index 27584a5..9ea0df3 100644 --- a/html/js/app.js +++ b/html/js/app.js @@ -6,86 +6,98 @@ document.addEventListener("DOMContentLoaded", function () { }; const targetEye = document.getElementById("target-eye"); - let targetLabel = document.getElementById("target-label"); - let TargetEyeStyleObject = targetEye.style; + const targetLabel = document.getElementById("target-label"); + const TargetEyeStyleObject = targetEye.style; function OpenTarget() { - targetLabel.innerHTML = ""; + targetLabel.textContent = ""; targetEye.style.display = "block"; targetEye.className = config.StandardEyeIcon; TargetEyeStyleObject.color = config.StandardColor; } function CloseTarget() { - targetLabel.innerHTML = ""; + targetLabel.textContent = ""; targetEye.style.display = "none"; } + function createTargetOption(index, itemData) { + if (itemData !== null) { + index = Number(index) + 1; + const targetOption = document.createElement("div"); + targetOption.id = `target-option-${index}`; + targetOption.style.marginBottom = "0.2vh"; + targetOption.style.borderRadius = "0.15rem"; + targetOption.style.padding = "0.45rem"; + targetOption.style.background = "rgba(23, 23, 23, 40%)"; + targetOption.style.color = config.StandardColor; + const targetIcon = document.createElement("span"); + targetIcon.id = `target-icon-${index}`; + const icon = document.createElement("i"); + icon.className = itemData.icon; + targetIcon.appendChild(icon); + targetIcon.appendChild(document.createTextNode(" ")); + targetOption.appendChild(targetIcon); + targetOption.appendChild(document.createTextNode(itemData.label)); + targetLabel.appendChild(targetOption); + } + } + function FoundTarget(item) { if (item.data) { targetEye.className = item.data; } TargetEyeStyleObject.color = config.SuccessColor; - targetLabel.innerHTML = ""; + targetLabel.textContent = ""; for (let [index, itemData] of Object.entries(item.options)) { - if (itemData !== null) { - index = Number(index) + 1; - targetLabel.innerHTML += `