Skip to content

Commit

Permalink
refactor: Improved code style respecting ESLint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Jul 31, 2024
1 parent e917ef3 commit b495543
Show file tree
Hide file tree
Showing 4 changed files with 427 additions and 406 deletions.
64 changes: 33 additions & 31 deletions server-data/resources/[esx]/es_extended/html/js/app.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
(() => {
ESX = {};
ESX = {};

ESX.inventoryNotification = function (add, label, count) {
let notif = "";
ESX.inventoryNotification = function(add, label, count) {
let notif = '';

if (add) {
notif += "+";
} else {
notif += "-";
}
if (add) {
notif += '+';
}
else {
notif += '-';
}

if (count) {
notif += count + " " + label;
} else {
notif += " " + label;
}
if (count) {
notif += count + ' ' + label;
}
else {
notif += ' ' + label;
}

let elem = $("<div>" + notif + "</div>");
$("#inventory_notifications").append(elem);
const elem = $('<div>' + notif + '</div>');
$('#inventory_notifications').append(elem);

$(elem)
.delay(3000)
.fadeOut(1000, function () {
elem.remove();
});
};
$(elem)
.delay(3000)
.fadeOut(1000, function() {
elem.remove();
});
};

window.onData = (data) => {
if (data.action === "inventoryNotification") {
ESX.inventoryNotification(data.add, data.item, data.count);
}
};
window.onData = (data) => {
if (data.action === 'inventoryNotification') {
ESX.inventoryNotification(data.add, data.item, data.count);
}
};

window.onload = function (e) {
window.addEventListener("message", (event) => {
onData(event.data);
});
};
window.onload = function() {
window.addEventListener('message', (event) => {
onData(event.data);
});
};
})();
Loading

0 comments on commit b495543

Please sign in to comment.