From 156541ed89737722e30ab3611f0aa5d56c1894b9 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 5 Sep 2016 02:17:15 -0400 Subject: [PATCH] emscripten: Disable default browser keys This will attempt to disable the default action of some of the browser hotkeys. --- pkg/emscripten/webplayer.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/emscripten/webplayer.js b/pkg/emscripten/webplayer.js index dec03abbfd..08885d1a42 100644 --- a/pkg/emscripten/webplayer.js +++ b/pkg/emscripten/webplayer.js @@ -230,5 +230,15 @@ $(function() { $.getScript(core + '_libretro.js', function () { // Activate the Start RetroArch button. $('#btnStart').removeClass('disabled'); + + /** + * Attempt to disable some default browser keys. + */ + window.addEventListener('keydown', function(e) { + // Space key, arrows, and F1. + if([32, 37, 38, 39, 40, 112].indexOf(e.keyCode) > -1) { + e.preventDefault(); + } + }, false); }); });