mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
merged alert and nativeAlert for webpack
This commit is contained in:
parent
8e1c56adf5
commit
2665923bb0
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();
|
||||
};
|
||||
});
|
@ -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();
|
||||
};
|
||||
});
|
@ -465,8 +465,6 @@ var AppInfo = {};
|
||||
define("apiclient", ["bower_components/emby-apiclient/apiclient"], returnFirstDependency);
|
||||
}
|
||||
|
||||
define("actionsheet", ["webActionSheet"], returnFirstDependency);
|
||||
|
||||
if ("registerElement" in document) {
|
||||
define("registerElement", []);
|
||||
} else {
|
||||
@ -491,11 +489,7 @@ var AppInfo = {};
|
||||
|
||||
var preferNativeAlerts = browser.tv;
|
||||
|
||||
if (preferNativeAlerts && window.alert) {
|
||||
define("alert", [embyWebComponentsBowerPath + "/alert/nativealert"], returnFirstDependency);
|
||||
} else {
|
||||
define("alert", [embyWebComponentsBowerPath + "/alert/alert"], returnFirstDependency);
|
||||
}
|
||||
define("alert", [embyWebComponentsBowerPath + "/alert"], returnFirstDependency);
|
||||
|
||||
defineResizeObserver();
|
||||
define("dialog", [embyWebComponentsBowerPath + "/dialog/dialog"], returnFirstDependency);
|
||||
@ -1400,7 +1394,7 @@ var AppInfo = {};
|
||||
paths.shaka = embyWebComponentsBowerPath + "/shaka/shaka-player.compiled";
|
||||
define("chromecastHelper", [embyWebComponentsBowerPath + "/chromecast/chromecasthelpers"], returnFirstDependency);
|
||||
define("mediaSession", [embyWebComponentsBowerPath + "/playback/mediasession"], returnFirstDependency);
|
||||
define("webActionSheet", [embyWebComponentsBowerPath + "/actionsheet/actionsheet"], returnFirstDependency);
|
||||
define("actionsheet", [embyWebComponentsBowerPath + "/actionsheet/actionsheet"], returnFirstDependency);
|
||||
define("libjass", [bowerPath + "/libjass/libjass.min", "css!" + bowerPath + "/libjass/libjass"], returnFirstDependency);
|
||||
define("tunerPicker", ["components/tunerpicker"], returnFirstDependency);
|
||||
define("mainTabsManager", [embyWebComponentsBowerPath + "/maintabsmanager"], returnFirstDependency);
|
||||
|
Loading…
Reference in New Issue
Block a user