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 27, 2024
1 parent a4d76bc commit 1aa35e3
Showing 1 changed file with 67 additions and 64 deletions.
131 changes: 67 additions & 64 deletions server-data/resources/[phone]/esx-radio/html/js/script.js
Original file line number Diff line number Diff line change
@@ -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');
});
};

0 comments on commit 1aa35e3

Please sign in to comment.