diff --git a/src/components/alert.js b/src/components/alert.js new file mode 100644 index 0000000000..0e8c16501f --- /dev/null +++ b/src/components/alert.js @@ -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 || '', '
', '\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(); + }; +}); \ No newline at end of file diff --git a/src/components/alert/alert.js b/src/components/alert/alert.js deleted file mode 100644 index ce434bac8a..0000000000 --- a/src/components/alert/alert.js +++ /dev/null @@ -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(); - }); - }; -}); \ No newline at end of file diff --git a/src/components/alert/nativealert.js b/src/components/alert/nativealert.js deleted file mode 100644 index f565e802c7..0000000000 --- a/src/components/alert/nativealert.js +++ /dev/null @@ -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 || '', '
', '\n'); - - alert(text); - - return Promise.resolve(); - }; -}); \ No newline at end of file diff --git a/src/scripts/site.js b/src/scripts/site.js index 984c01800e..c42acb6325 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -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);