Merge pull request #177 from vitorsemeano/webpack_part22

Conversion to webpack - part2 - emby-webcomponents into components and module naming resolution
This commit is contained in:
Joshua M. Boniface 2019-03-16 10:59:36 -04:00 committed by GitHub
commit e6e38adebe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
278 changed files with 246 additions and 266 deletions

View File

@ -1,34 +0,0 @@
define(['dialog', 'globalize'], function (dialog, globalize) {
'use strict';
return function (text, title) {
var options;
if (typeof text === 'string') {
options = {
title: title,
text: text
};
} else {
options = text;
}
var items = [];
items.push({
name: globalize.translate('ButtonGotIt'),
id: 'ok',
type: 'submit'
});
options.buttons = items;
return dialog(options).then(function (result) {
if (result === 'ok') {
return Promise.resolve();
}
return Promise.reject();
});
};
});

View File

@ -1,23 +0,0 @@
define([], function () {
'use strict';
function replaceAll(str, find, replace) {
return str.split(find).join(replace);
}
return function (options) {
if (typeof options === 'string') {
options = {
text: options
};
}
var text = replaceAll(options.text || '', '<br/>', '\n');
alert(text);
return Promise.resolve();
};
});

View File

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

40
src/components/alert.js Normal file
View File

@ -0,0 +1,40 @@
define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize) {
'use strict';
return function (text, title) {
var options;
if (typeof text === 'string') {
options = {
title: title,
text: text
};
} else {
options = text;
}
if (browser.tv && window.alert) {
alert(replaceAll(options.text || '', '<br/>', '\n'));
} else {
var items = [];
items.push({
name: globalize.translate('ButtonGotIt'),
id: 'ok',
type: 'submit'
});
options.buttons = items;
return dialog(options).then(function (result) {
if (result === 'ok') {
return Promise.resolve();
}
return Promise.reject();
});
}
return Promise.resolve();
};
});

View File

@ -234,6 +234,19 @@ define(['connectionManager', 'playbackManager', 'events', 'inputManager', 'focus
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);
events.on(connectionManager, 'apiclientcreated', function (e, newApiClient) {
@ -241,5 +254,11 @@ define(['connectionManager', 'playbackManager', 'events', 'inputManager', 'focus
bindEvents(newApiClient);
});
if (!enableNativeGamepadKeyMapping() && isGamepadSupported()) {
require(["components/apiInput/gamepadtokey"]);
}
require(["components/apiInput/mouseManager"]);
return serverNotifications;
});

View File

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

Some files were not shown because too many files have changed in this diff Show More