mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update alerts
This commit is contained in:
parent
d74e699177
commit
3e161d7edb
11 changed files with 143 additions and 79 deletions
81
dashboard-ui/bower_components/emby-webcomponents/alert/alert.js
vendored
Normal file
81
dashboard-ui/bower_components/emby-webcomponents/alert/alert.js
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
define(['paperdialoghelper', 'layoutManager', 'dialogText', 'html!./../prompt/icons.html', 'css!./../prompt/style.css', 'paper-button', 'paper-input'], function (paperdialoghelper, layoutManager, dialogText) {
|
||||
|
||||
return function (options) {
|
||||
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
title: '',
|
||||
text: options
|
||||
};
|
||||
}
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true
|
||||
};
|
||||
|
||||
var backButton = false;
|
||||
var raisedButtons = false;
|
||||
|
||||
if (layoutManager.tv) {
|
||||
dialogOptions.size = 'fullscreen';
|
||||
backButton = true;
|
||||
raisedButtons = true;
|
||||
} else {
|
||||
|
||||
dialogOptions.modal = false;
|
||||
dialogOptions.entryAnimationDuration = 160;
|
||||
dialogOptions.exitAnimationDuration = 200;
|
||||
}
|
||||
|
||||
var dlg = paperdialoghelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('promptDialog');
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<div class="promptDialogContent">';
|
||||
if (backButton) {
|
||||
html += '<paper-icon-button tabindex="-1" icon="dialog:arrow-back" class="btnPromptExit"></paper-icon-button>';
|
||||
}
|
||||
|
||||
if (options.title) {
|
||||
html += '<h2>';
|
||||
html += options.title;
|
||||
html += '</h2>';
|
||||
}
|
||||
|
||||
if (options.text) {
|
||||
|
||||
if (options.title) {
|
||||
html += '<p style="margin-top:2em;">';
|
||||
} else {
|
||||
html += '<p>';
|
||||
}
|
||||
|
||||
html += options.text;
|
||||
html += '</p>';
|
||||
}
|
||||
|
||||
var buttonText = options.type == 'error' ? 'Ok' : 'GotIt';
|
||||
if (raisedButtons) {
|
||||
html += '<paper-button raised class="btnSubmit"><iron-icon icon="dialog:check"></iron-icon><span>' + dialogText.get(buttonText) + '</span></paper-button>';
|
||||
} else {
|
||||
html += '<div style="text-align:right;">';
|
||||
html += '<paper-button class="btnSubmit">' + dialogText.get(buttonText) + '</paper-button>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
document.body.appendChild(dlg);
|
||||
|
||||
dlg.querySelector('.btnSubmit').addEventListener('click', function (e) {
|
||||
|
||||
paperdialoghelper.close(dlg);
|
||||
});
|
||||
|
||||
return paperdialoghelper.open(dlg);
|
||||
};
|
||||
});
|
22
dashboard-ui/bower_components/emby-webcomponents/alert/nativealert.js
vendored
Normal file
22
dashboard-ui/bower_components/emby-webcomponents/alert/nativealert.js
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
define([], function () {
|
||||
|
||||
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();
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue