From f5b51d81c0c13f206667ef31b77766044d2657ae Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Sun, 22 Dec 2024 14:21:02 +0100 Subject: [PATCH 1/2] chore: improve formatting + code cleanup - Improved the formatting of the .js code and performed a small cleanup --- server-data/resources/[ox]/ox_target/web/js/createOptions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server-data/resources/[ox]/ox_target/web/js/createOptions.js b/server-data/resources/[ox]/ox_target/web/js/createOptions.js index 3717a35d..921c0b2b 100644 --- a/server-data/resources/[ox]/ox_target/web/js/createOptions.js +++ b/server-data/resources/[ox]/ox_target/web/js/createOptions.js @@ -16,8 +16,8 @@ export function createOptions(type, data, id, zoneId) { const option = document.createElement('div'); const iconElement = ``; + data.iconColor ? `style="color:${data.iconColor} !important"` : '' + }>`; option.innerHTML = `${iconElement}

${data.label}

`; option.className = 'option-container'; From 59169bfe1aaadc90ff8ad26b427fe72c8ce46348 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Sun, 22 Dec 2024 14:26:21 +0100 Subject: [PATCH 2/2] chore: code formatting --- .../resources/[ox]/ox_target/web/js/main.js | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/server-data/resources/[ox]/ox_target/web/js/main.js b/server-data/resources/[ox]/ox_target/web/js/main.js index 31a9d4df..92e617d3 100644 --- a/server-data/resources/[ox]/ox_target/web/js/main.js +++ b/server-data/resources/[ox]/ox_target/web/js/main.js @@ -1,40 +1,40 @@ -import { createOptions } from "./createOptions.js"; +import { createOptions } from './createOptions.js'; -const optionsWrapper = document.getElementById("options-wrapper"); +const optionsWrapper = document.getElementById('options-wrapper'); const body = document.body; -const eye = document.getElementById("eyeSvg"); +const eye = document.getElementById('eyeSvg'); -window.addEventListener("message", (event) => { - optionsWrapper.innerHTML = ""; +window.addEventListener('message', (event) => { + optionsWrapper.innerHTML = ''; - switch (event.data.event) { - case "visible": { - body.style.visibility = event.data.state ? "visible" : "hidden"; - return eye.classList.remove("eye-hover"); - } + switch (event.data.event) { + case 'visible': { + body.style.visibility = event.data.state ? 'visible' : 'hidden'; + return eye.classList.remove('eye-hover'); + } - case "leftTarget": { - return eye.classList.remove("eye-hover"); - } + case 'leftTarget': { + return eye.classList.remove('eye-hover'); + } - case "setTarget": { - eye.classList.add("eye-hover"); + case 'setTarget': { + eye.classList.add('eye-hover'); - if (event.data.options) { - for (const type in event.data.options) { - event.data.options[type].forEach((data, id) => { - createOptions(type, data, id + 1); - }); - } - } + if (event.data.options) { + for (const type in event.data.options) { + event.data.options[type].forEach((data, id) => { + createOptions(type, data, id + 1); + }); + } + } - if (event.data.zones) { - for (let i = 0; i < event.data.zones.length; i++) { - event.data.zones[i].forEach((data, id) => { - createOptions("zones", data, id + 1, i + 1); - }); - } - } - } - } + if (event.data.zones) { + for (let i = 0; i < event.data.zones.length; i++) { + event.data.zones[i].forEach((data, id) => { + createOptions('zones', data, id + 1, i + 1); + }); + } + } + } + } });