1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

define apiInput as a module for webpack

This commit is contained in:
vitorsemeano 2019-02-23 19:34:34 +00:00
parent 2665923bb0
commit 3dba261ae7
5 changed files with 23 additions and 22 deletions

View file

@ -234,6 +234,19 @@ define(['connectionManager', 'playbackManager', 'events', 'inputManager', 'focus
events.on(apiClient, "message", onMessageReceived); events.on(apiClient, "message", onMessageReceived);
} }
function enableNativeGamepadKeyMapping() {
if (!(!window.navigator || "string" != typeof window.navigator.gamepadInputEmulation)) {
window.navigator.gamepadInputEmulation = "keyboard";
return true;
}
return false;
}
function isGamepadSupported() {
return "ongamepadconnected" in window || navigator.getGamepads || navigator.webkitGetGamepads;
}
connectionManager.getApiClients().forEach(bindEvents); connectionManager.getApiClients().forEach(bindEvents);
events.on(connectionManager, 'apiclientcreated', function (e, newApiClient) { events.on(connectionManager, 'apiclientcreated', function (e, newApiClient) {
@ -241,5 +254,11 @@ define(['connectionManager', 'playbackManager', 'events', 'inputManager', 'focus
bindEvents(newApiClient); bindEvents(newApiClient);
}); });
if (!enableNativeGamepadKeyMapping() && isGamepadSupported()) {
require(["components/apiInput/gamepadtokey"]);
}
require(["components/apiInput/mouseManager"]);
return serverNotifications; return serverNotifications;
}); });

View file

@ -0,0 +1,3 @@
{
"main": "apiInput.js"
}

View file

@ -1198,19 +1198,6 @@ var AppInfo = {};
}); });
} }
function enableNativeGamepadKeyMapping() {
if (!(!window.navigator || "string" != typeof window.navigator.gamepadInputEmulation)) {
window.navigator.gamepadInputEmulation = "keyboard";
return true;
}
return false;
}
function isGamepadSupported() {
return "ongamepadconnected" in window || navigator.getGamepads || navigator.webkitGetGamepads;
}
function onAppReady(browser) { function onAppReady(browser) {
console.log("Begin onAppReady"); console.log("Begin onAppReady");
@ -1238,10 +1225,6 @@ var AppInfo = {};
hashbang: true hashbang: true
}); });
if (!enableNativeGamepadKeyMapping() && isGamepadSupported()) {
require(["components/input/gamepadtokey"]);
}
require(["components/thememediaplayer", "scripts/autobackdrops"]); require(["components/thememediaplayer", "scripts/autobackdrops"]);
if (!("cordova" !== self.appMode && "android" !== self.appMode)) { if (!("cordova" !== self.appMode && "android" !== self.appMode)) {
@ -1268,8 +1251,6 @@ var AppInfo = {};
require(["mediaSession"]); require(["mediaSession"]);
} }
require(["apiInput", "mouseManager"]);
if (!(browser.tv || browser.xboxOne)) { if (!(browser.tv || browser.xboxOne)) {
require(["components/playback/playbackorientation"]); require(["components/playback/playbackorientation"]);
registerServiceWorker(); registerServiceWorker();
@ -1471,7 +1452,6 @@ var AppInfo = {};
define("cardBuilder", [embyWebComponentsBowerPath + "/cardbuilder/cardbuilder"], returnFirstDependency); define("cardBuilder", [embyWebComponentsBowerPath + "/cardbuilder/cardbuilder"], returnFirstDependency);
define("peoplecardbuilder", [embyWebComponentsBowerPath + "/cardbuilder/peoplecardbuilder"], returnFirstDependency); define("peoplecardbuilder", [embyWebComponentsBowerPath + "/cardbuilder/peoplecardbuilder"], returnFirstDependency);
define("chaptercardbuilder", [embyWebComponentsBowerPath + "/cardbuilder/chaptercardbuilder"], returnFirstDependency); define("chaptercardbuilder", [embyWebComponentsBowerPath + "/cardbuilder/chaptercardbuilder"], returnFirstDependency);
define("mouseManager", [embyWebComponentsBowerPath + "/input/mouse"], returnFirstDependency);
define("flexStyles", ["css!" + embyWebComponentsBowerPath + "/flexstyles"], returnFirstDependency); define("flexStyles", ["css!" + embyWebComponentsBowerPath + "/flexstyles"], returnFirstDependency);
define("deleteHelper", [embyWebComponentsBowerPath + "/deletehelper"], returnFirstDependency); define("deleteHelper", [embyWebComponentsBowerPath + "/deletehelper"], returnFirstDependency);
define("tvguide", [embyWebComponentsBowerPath + "/guide/guide"], returnFirstDependency); define("tvguide", [embyWebComponentsBowerPath + "/guide/guide"], returnFirstDependency);
@ -1570,8 +1550,7 @@ var AppInfo = {};
define("fnchecked", ["legacy/fnchecked"], returnFirstDependency); define("fnchecked", ["legacy/fnchecked"], returnFirstDependency);
define("dialogHelper", [embyWebComponentsBowerPath + "/dialoghelper/dialoghelper"], returnFirstDependency); define("dialogHelper", [embyWebComponentsBowerPath + "/dialoghelper/dialoghelper"], returnFirstDependency);
define("inputmanager", ["inputManager"], returnFirstDependency); define("inputmanager", ["inputManager"], returnFirstDependency);
define("apiInput", [embyWebComponentsBowerPath + "/input/api"], returnFirstDependency); define("serverNotifications", [embyWebComponentsBowerPath + "/apiInput/apiInput"], returnFirstDependency);
define("serverNotifications", ["apiInput"], returnFirstDependency);
define("headroom-window", ["headroom"], createWindowHeadroom); define("headroom-window", ["headroom"], createWindowHeadroom);
define("appFooter-shared", ["appFooter"], createSharedAppFooter); define("appFooter-shared", ["appFooter"], createSharedAppFooter);
define("skinManager", [embyWebComponentsBowerPath + "/skinmanager"], function (skinManager) { define("skinManager", [embyWebComponentsBowerPath + "/skinmanager"], function (skinManager) {