diff --git a/nui/radar.css b/nui/radar.css index 71cd123..d51186a 100644 --- a/nui/radar.css +++ b/nui/radar.css @@ -159,6 +159,14 @@ button:focus { outline: none; } color: rgb(255, 255, 0); } +.green { + color: rgb( 0, 255, 0 ); +} + +.red { + color: rgb( 255, 0, 0 ); +} + .arrow { width: 11px; height: 15.4px; diff --git a/nui/radar.html b/nui/radar.html index 2e8b232..48d10f9 100644 --- a/nui/radar.html +++ b/nui/radar.html @@ -300,7 +300,7 @@ -

Radar key lock

+

Radar key binds

diff --git a/nui/radar.js b/nui/radar.js index 9914771..39d6072 100644 --- a/nui/radar.js +++ b/nui/radar.js @@ -605,17 +605,27 @@ function menu( optionText, option ) elements.patrolSpeed.html( option ); } +var keyLockTimeout; + // Makes the key lock label fade in then fade out after 2 seconds function displayKeyLock( state ) { + let sl = elements.keyLock.stateLabel; + // Set the state label text to enabled or disabled - elements.keyLock.stateLabel.html( state ? "enabled" : "disabled" ); + sl.html( state ? "blocked" : "enabled" ); + + // Change the colour of the altered text + state ? sl.addClass( "red" ).removeClass( "green" ) : sl.addClass( "green" ).removeClass( "red" ); // Fade in the label elements.keyLock.label.fadeIn(); + // Clear the timeout if it already exists + clearTimeout( keyLockTimeout ); + // Make the label fade out after 2 seconds - setTimeout( function() { + keyLockTimeout = setTimeout( function() { elements.keyLock.label.fadeOut(); }, 2000 ); }