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

merged alert and nativeAlert for webpack

This commit is contained in:
vitorsemeano 2019-02-23 19:14:56 +00:00
parent 8e1c56adf5
commit 2665923bb0
4 changed files with 42 additions and 65 deletions

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();
};
});