From 46eac6914f80dd7ffca49c25d2c737ec2ea749ee Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 10 Jan 2020 09:12:20 +0000 Subject: [PATCH] Cleaned up JS setLight, organisation --- nui/radar.js | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/nui/radar.js b/nui/radar.js index 3913e66..f884677 100644 --- a/nui/radar.js +++ b/nui/radar.js @@ -176,9 +176,9 @@ function setLight( ant, cat, item, state ) let obj = elements.antennas[ant][cat][item]; if ( state ) { - cat == "dirs" ? obj.addClass( "active_arrow" ) : obj.addClass( "active" ); + obj.addClass( cat == "dirs" ? "active_arrow" : "active" ); } else { - cat == "dirs" ? obj.removeClass( "active_arrow" ) : obj.removeClass( "active" ); + obj.removeClass( cat == "dirs" ? "active_arrow" : "active" ); } } @@ -334,10 +334,9 @@ function playLockAudio( ant, dir, vol ) } - - - - +/*------------------------------------------------------------------------------------ + Radar updating +------------------------------------------------------------------------------------*/ function updateDisplays( ps, ants ) { elements.patrolSpeed.html( ps ); @@ -355,16 +354,6 @@ function updateDisplays( ps, ants ) } } -function menu( optionText, option ) -{ - clearEverything(); - - elements.antennas.front.targetSpeed.html( optionText[0] ); - elements.antennas.front.fastSpeed.html( optionText[1] ); - - elements.patrolSpeed.html( option ); -} - function settingUpdate( ants ) { for ( let ant in ants ) @@ -376,6 +365,20 @@ function settingUpdate( ants ) } } + +/*------------------------------------------------------------------------------------ + Misc +------------------------------------------------------------------------------------*/ +function menu( optionText, option ) +{ + clearEverything(); + + elements.antennas.front.targetSpeed.html( optionText[0] ); + elements.antennas.front.fastSpeed.html( optionText[1] ); + + elements.patrolSpeed.html( option ); +} + function displayKeyLock( state ) { elements.keyLock.stateLabel.html( state ? "enabled" : "disabled" ); @@ -387,8 +390,6 @@ function displayKeyLock( state ) }, 2000 ); } - - // This function is used to send data back through to the LUA side function sendData( name, data ) { $.post( "http://" + resourceName + "/" + name, JSON.stringify( data ), function( datab ) {