From 1aa35e3a0070e3d0a7c31ba0b1130b1dc90f4783 Mon Sep 17 00:00:00 2001
From: bitpredator <67551273+bitpredator@users.noreply.github.com>
Date: Sat, 27 Jul 2024 17:58:43 +0200
Subject: [PATCH] refactor: Improved code style respecting ESLint rules

---
 .../[phone]/esx-radio/html/js/script.js       | 131 +++++++++---------
 1 file changed, 67 insertions(+), 64 deletions(-)

diff --git a/server-data/resources/[phone]/esx-radio/html/js/script.js b/server-data/resources/[phone]/esx-radio/html/js/script.js
index 25c295e0c..d9e758108 100644
--- a/server-data/resources/[phone]/esx-radio/html/js/script.js
+++ b/server-data/resources/[phone]/esx-radio/html/js/script.js
@@ -1,89 +1,92 @@
-$(function () {
-    window.addEventListener('message', function (event) {
-        if (event.data.type == "open") {
-            ESXRadio.SlideUp()
-        }
-
-        if (event.data.type == "close") {
-            ESXRadio.SlideDown()
-        }
-    });
-
-    document.onkeyup = function (data) {
-        if (data.which == 27) { // Escape key
-            $.post('https://esx-radio/escape', JSON.stringify({}));
-            ESXRadio.SlideDown()
-        } else if (data.which == 13) { // Enter key
-            $.post('https://esx-radio/joinRadio', JSON.stringify({
-                channel: $("#channel").val()
-            }));
-        }
-    };
+$(function() {
+	window.addEventListener('message', function(event) {
+		if (event.data.type == 'open') {
+			ESXRadio.SlideUp();
+		}
+
+		if (event.data.type == 'close') {
+			ESXRadio.SlideDown();
+		}
+	});
+
+	document.onkeyup = function(data) {
+		// eslint-disable-next-line no-inline-comments
+		if (data.which == 27) { // Escape key
+			$.post('https://esx-radio/escape', JSON.stringify({}));
+			ESXRadio.SlideDown();
+		}
+		// eslint-disable-next-line no-inline-comments
+		else if (data.which == 13) { // Enter key
+			$.post('https://esx-radio/joinRadio', JSON.stringify({
+				channel: $('#channel').val(),
+			}));
+		}
+	};
 });
 
-ESXRadio = {}
+ESXRadio = {};
 
-$(document).on('click', '#submit', function (e) {
-    e.preventDefault();
+$(document).on('click', '#submit', function(e) {
+	e.preventDefault();
 
-    $.post('https://esx-radio/joinRadio', JSON.stringify({
-        channel: $("#channel").val()
-    }));
+	$.post('https://esx-radio/joinRadio', JSON.stringify({
+		channel: $('#channel').val(),
+	}));
 });
 
-$(document).on('click', '#disconnect', function (e) {
-    e.preventDefault();
+$(document).on('click', '#disconnect', function(e) {
+	e.preventDefault();
 
-    $.post('https://esx-radio/leaveRadio');
+	$.post('https://esx-radio/leaveRadio');
 });
 
-$(document).on('click', '#volumeUp', function (e) {
-    e.preventDefault();
+$(document).on('click', '#volumeUp', function(e) {
+	e.preventDefault();
 
-    $.post('https://esx-radio/volumeUp', JSON.stringify({
-        channel: $("#channel").val()
-    }));
+	$.post('https://esx-radio/volumeUp', JSON.stringify({
+		channel: $('#channel').val(),
+	}));
 });
 
-$(document).on('click', '#volumeDown', function (e) {
-    e.preventDefault();
+$(document).on('click', '#volumeDown', function(e) {
+	e.preventDefault();
 
-    $.post('https://esx-radio/volumeDown', JSON.stringify({
-        channel: $("#channel").val()
-    }));
+	$.post('https://esx-radio/volumeDown', JSON.stringify({
+		channel: $('#channel').val(),
+	}));
 });
 
-$(document).on('click', '#decreaseradiochannel', function (e) {
-    e.preventDefault();
+$(document).on('click', '#decreaseradiochannel', function(e) {
+	e.preventDefault();
 
-    $.post('https://esx-radio/decreaseradiochannel', JSON.stringify({
-        channel: $("#channel").val()
-    }));
+	$.post('https://esx-radio/decreaseradiochannel', JSON.stringify({
+		channel: $('#channel').val(),
+	}));
 });
 
-$(document).on('click', '#increaseradiochannel', function (e) {
-    e.preventDefault();
+$(document).on('click', '#increaseradiochannel', function(e) {
+	e.preventDefault();
 
-    $.post('https://esx-radio/increaseradiochannel', JSON.stringify({
-        channel: $("#channel").val()
-    }));
+	$.post('https://esx-radio/increaseradiochannel', JSON.stringify({
+		channel: $('#channel').val(),
+	}));
 });
 
-$(document).on('click', '#poweredOff', function (e) {
-    e.preventDefault();
+$(document).on('click', '#poweredOff', function(e) {
+	e.preventDefault();
 
-    $.post('https://esx-radio/poweredOff', JSON.stringify({
-        channel: $("#channel").val()
-    }));
+	$.post('https://esx-radio/poweredOff', JSON.stringify({
+		channel: $('#channel').val(),
+	}));
 });
 
-ESXRadio.SlideUp = function () {
-    $(".container").css("display", "block");
-    $(".radio-container").animate({ bottom: "6vh", }, 250);
-}
+ESXRadio.SlideUp = function() {
+	$('.container').css('display', 'block');
+	$('.radio-container').animate({ bottom: '6vh' }, 250);
+};
 
-ESXRadio.SlideDown = function () {
-    $(".radio-container").animate({ bottom: "-110vh", }, 400, function () {
-        $(".container").css("display", "none");
-    });
-}
+ESXRadio.SlideDown = function() {
+	$('.radio-container').animate({ bottom: '-110vh' }, 400, function() {
+		$('.container').css('display', 'none');
+	});
+};