mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16:27 +02:00
Converted JavaScript remote closing to use jQuery
This commit is contained in:
17
nui/radar.js
17
nui/radar.js
@@ -382,22 +382,23 @@ elements.remote.find( "button" ).each( function( i, obj ) {
|
||||
} );
|
||||
|
||||
// Close the remote when the user presses the 'Escape' key or the right mouse button
|
||||
document.onkeyup = function( event )
|
||||
{
|
||||
if ( event.keyCode == 27 )
|
||||
function closeRemote()
|
||||
{
|
||||
sendData( "closeRemote", null );
|
||||
setRemoteVisible( false );
|
||||
setUISettingsVisible( false, false );
|
||||
}
|
||||
}
|
||||
|
||||
window.oncontextmenu = function()
|
||||
$( document ).keyup( function( event ) {
|
||||
if ( event.keyCode == 27 )
|
||||
{
|
||||
sendData( "closeRemote", null );
|
||||
setRemoteVisible( false );
|
||||
setUISettingsVisible( false, false );
|
||||
closeRemote();
|
||||
}
|
||||
} );
|
||||
|
||||
$( document ).contextmenu( function() {
|
||||
closeRemote();
|
||||
} );
|
||||
|
||||
// The main event listener, this is what the NUI messages sent by the LUA side arrive at, they are
|
||||
// then handled properly via a switch/case that runs the relevant code
|
||||
|
||||
Reference in New Issue
Block a user