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'; 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); + }); + } + } + } + } });