diff --git a/css/main.css b/css/main.css index 89e6299..2b81b43 100644 --- a/css/main.css +++ b/css/main.css @@ -14,7 +14,7 @@ body { } .no-gamepad { position: absolute; - bottom: 0; + top: 20px; display: none; width: 100vw; line-height: 2em; diff --git a/index.html b/index.html index c52a899..4611812 100644 --- a/index.html +++ b/index.html @@ -8,12 +8,12 @@ - - + +
Debug
-
No active gamepad. Press H to see how it works.
+
No active gamepad detected. Press H to read instructions.

Help

@@ -63,6 +63,6 @@
- + diff --git a/js/gamepad.js b/js/gamepad.js index f03db4b..49a83b1 100644 --- a/js/gamepad.js +++ b/js/gamepad.js @@ -1,4 +1,4 @@ -// (function(window, document, undefined) { +(function(window, document, undefined) { $.urlParam = function(name) { var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); if (results === null) { @@ -10,6 +10,7 @@ var haveEvents = 'ongamepadconnected' in window; var debug = false; + var scanGamepadsDelay = 1000; var gamepads = {}; var $gamepad = $('.gamepad'); var $nogamepad = $('.no-gamepad'); @@ -17,20 +18,20 @@ var $help = $('.help'); var gamepadIdentifiers = { 'debug': { - 'id': /xinput|XInput/, + 'id': /debug/, 'colors': [] }, 'ds4': { 'id': /054c.*?05c4/, 'colors': ['black', 'white', 'red', 'blue'] }, - // 'xbox-one': { - // 'id': /xinput|XInput/, - // 'colors': ['black', 'white'] - // } + 'xbox-one': { + 'id': /xinput|XInput/, + 'colors': ['black', 'white'] + } }; var gamepadHelpTimeout = null; - var gamepadHelpDelay = 10000; + var gamepadHelpDelay = 5000; var activeGamepadIndex = null; var activeGamepadType = null; var activeGamepadIdentifier = null; @@ -113,7 +114,7 @@ displayGamepadHelp(); } - setInterval(scanGamepads, 500); + setInterval(scanGamepads, scanGamepadsDelay); function scanGamepads() { if (null !== activeGamepadIndex) { return; @@ -319,4 +320,4 @@ $debug[debug ? 'fadeIn' : 'fadeOut'](); } -// })(window, document); +})(window, document);