From 54e8481ec23b943438a2c5ab89c89601d63b69cc Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Tue, 24 Dec 2024 10:33:55 +0100 Subject: [PATCH] chore: carried out code formatting and stability work --- .../[esx_addons]/ps-dispatch/ui/app.js | 62 ++++++++++++------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/server-data/resources/[esx_addons]/ps-dispatch/ui/app.js b/server-data/resources/[esx_addons]/ps-dispatch/ui/app.js index 4ac104cf..ddb05f8f 100644 --- a/server-data/resources/[esx_addons]/ps-dispatch/ui/app.js +++ b/server-data/resources/[esx_addons]/ps-dispatch/ui/app.js @@ -1,7 +1,8 @@ +/* eslint-disable no-unused-vars */ $(document).ready(() => { - window.addEventListener('message', function (event) { - let data = event.data; - if (data.update == 'newCall') { + window.addEventListener('message', function(event) { + const data = event.data; + if (data.update === 'newCall') { addNewCall(data.callID, data.timer, data.data, data.isPolice); } }); @@ -50,7 +51,7 @@ function timeAgo(dateParam) { } const date = - typeof dateParam === 'object' ? dateParam : new Date(dateParam); + typeof dateParam === 'object' ? dateParam : new Date(dateParam); const DAY_IN_MS = 86400000; const today = new Date(); const yesterday = new Date(today - DAY_IN_MS); @@ -62,17 +63,23 @@ function timeAgo(dateParam) { if (seconds < 5) { return 'Just Now'; - } else if (seconds < 60) { + } + else if (seconds < 60) { return `${seconds} Seconds ago`; - } else if (seconds < 90) { + } + else if (seconds < 90) { return 'About a minute ago'; - } else if (minutes < 60) { + } + else if (minutes < 60) { return `${minutes} Minutes ago`; - } else if (isToday) { + } + else if (isToday) { return getFormattedDate(date, 'Today'); - } else if (isYesterday) { + } + else if (isYesterday) { return getFormattedDate(date, 'Yesterday'); - } else if (isThisYear) { + } + else if (isThisYear) { return getFormattedDate(date, false, true); } @@ -84,7 +91,8 @@ function addNewCall(callID, timer, info, isPolice) { let DispatchItem; if (info['isDead']) { DispatchItem = `