Skip to content

Commit

Permalink
Merge pull request #928 from bitpredator/dev
Browse files Browse the repository at this point in the history
chore:  improve formatting + code cleanup
  • Loading branch information
bitpredator authored Dec 22, 2024
2 parents 9091091 + 59169bf commit 4abd463
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions server-data/resources/[ox]/ox_target/web/js/createOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export function createOptions(type, data, id, zoneId) {

const option = document.createElement('div');
const iconElement = `<i class="fa-fw ${data.icon} option-icon" ${
data.iconColor ? `style = color:${data.iconColor} !important` : null
}"></i>`;
data.iconColor ? `style="color:${data.iconColor} !important"` : ''
}></i>`;

option.innerHTML = `${iconElement}<p class="option-label">${data.label}</p>`;
option.className = 'option-container';
Expand Down
62 changes: 31 additions & 31 deletions server-data/resources/[ox]/ox_target/web/js/main.js
Original file line number Diff line number Diff line change
@@ -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);
});
}
}
}
}
});

0 comments on commit 4abd463

Please sign in to comment.