mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
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:
commit
e6e38adebe
278 changed files with 246 additions and 266 deletions
|
@ -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();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
});
|
|
|
@ -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();
|
|
||||||
};
|
|
||||||
});
|
|
3
src/components/actionsheet/package.json
Normal file
3
src/components/actionsheet/package.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"main": "actionsheet.js"
|
||||||
|
}
|
40
src/components/alert.js
Normal file
40
src/components/alert.js
Normal 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();
|
||||||
|
};
|
||||||
|
});
|
|
@ -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;
|
||||||
});
|
});
|
3
src/components/apiInput/package.json
Normal file
3
src/components/apiInput/package.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"main": "apiInput.js"
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue