-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Improved code style respecting ESLint rules
- Loading branch information
1 parent
a4d76bc
commit 1aa35e3
Showing
1 changed file
with
67 additions
and
64 deletions.
There are no files selected for viewing
131 changes: 67 additions & 64 deletions
131
server-data/resources/[phone]/esx-radio/html/js/script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}; |