From 440675fbee70074258a54a275c9c5a4fc0555c77 Mon Sep 17 00:00:00 2001 From: ferferga Date: Fri, 28 Feb 2020 13:51:41 +0100 Subject: [PATCH] Apply suggestions --- src/components/input/keyboardnavigation.js | 23 ++++------------------ src/scripts/site.js | 2 ++ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/components/input/keyboardnavigation.js b/src/components/input/keyboardnavigation.js index b3c68e604f..0359ee7430 100644 --- a/src/components/input/keyboardnavigation.js +++ b/src/components/input/keyboardnavigation.js @@ -145,28 +145,13 @@ define(["inputManager", "layoutManager"], function (inputManager, layoutManager) } }); } - // For hiding the mouse while playbackç - require(["components/input/mouseManager"]); - // Gamepad initialization. No script is required if no gamepads are at boot time, saving a bit of resources._10k + // Gamepad initialisation. No script is required if no gamepads are present at init time, saving a bit of resources. // Whenever the gamepad is connected, we hand all the control of the gamepad to gamepadtokey.js by removing the event handler - function isGamepadConnected() { - var gamepads = navigator.getGamepads(); - for (var i = 0, len = gamepads.length; i < len; i++) { - var gamepad = gamepads[i]; - if (gamepad) { - return true; - } - } - return false; - } - function attachGamepadScript(e) { - if (isGamepadConnected()) { - console.log("Gamepad connected! Attaching gamepadtokey.js script"); - window.removeEventListener("gamepadconnected", attachGamepadScript); - require(["components/input/gamepadtokey"]); - } + console.log("Gamepad connected! Attaching gamepadtokey.js script"); + window.removeEventListener("gamepadconnected", attachGamepadScript); + require(["components/input/gamepadtokey"]); } // No need to check for gamepads manually at load time, the eventhandler will be fired for that diff --git a/src/scripts/site.js b/src/scripts/site.js index 280addc2f9..fc18ae9504 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -492,6 +492,7 @@ var AppInfo = {}; require(["keyboardnavigation"], function(keyboardnavigation) { keyboardnavigation.enable(); }); + require(["mouseManager"]); require(["focusPreventScroll"]); require(["autoFocuser"], function(autoFocuser) { autoFocuser.enable(); @@ -907,6 +908,7 @@ var AppInfo = {}; define("serverNotifications", [componentsPath + "/serverNotifications"], returnFirstDependency); define("skinManager", [componentsPath + "/skinManager"], returnFirstDependency); define("keyboardnavigation", [componentsPath + "/input/keyboardnavigation"], returnFirstDependency); + define("mouseManager", [componentsPath + "/input/mouseManager"], returnFirstDependency); define("scrollManager", [componentsPath + "/scrollManager"], returnFirstDependency); define("autoFocuser", [componentsPath + "/autoFocuser"], returnFirstDependency); define("connectionManager", [], function () {