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

update dialogs

This commit is contained in:
Luke Pulverenti 2016-05-22 12:47:14 -04:00
parent 6a539b8f3a
commit e73b3a1603
4 changed files with 24 additions and 26 deletions

View file

@ -193,32 +193,30 @@
// Seeing an issue in some non-chrome browsers where this is requiring a double click
//var eventName = browser.firefox ? 'mousedown' : 'click';
var eventName = 'click';
var selectedId;
dlg.addEventListener('click', function (e) {
var actionSheetMenuItem = parentWithClass(e.target, 'actionSheetMenuItem');
if (actionSheetMenuItem) {
selectedId = actionSheetMenuItem.getAttribute('data-id');
dialogHelper.close(dlg);
}
});
return new Promise(function (resolve, reject) {
dlg.addEventListener(eventName, function (e) {
dlg.addEventListener('close', function () {
var actionSheetMenuItem = parentWithClass(e.target, 'actionSheetMenuItem');
if (selectedId) {
if (options.callback) {
options.callback(selectedId);
}
if (actionSheetMenuItem) {
var selectedId = actionSheetMenuItem.getAttribute('data-id');
dialogHelper.close(dlg);
// Add a delay here to allow the click animation to finish, for nice effect
setTimeout(function () {
if (options.callback) {
options.callback(selectedId);
}
resolve(selectedId);
}, 100);
resolve(selectedId);
}
});
dialogHelper.open(dlg);