mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update paper dialog helper api
This commit is contained in:
parent
eb59fad11f
commit
d22c5b9c01
1 changed files with 35 additions and 14 deletions
|
@ -1,6 +1,6 @@
|
||||||
define(['paper-dialog', 'scale-up-animation', 'fade-out-animation'], function () {
|
define(['paper-dialog', 'scale-up-animation', 'fade-out-animation', 'fade-in-animation'], function () {
|
||||||
|
|
||||||
function paperDialogHashHandler(dlg, hash, lockDocumentScroll) {
|
function paperDialogHashHandler(dlg, hash, resolve, lockDocumentScroll) {
|
||||||
|
|
||||||
function onHashChange(e) {
|
function onHashChange(e) {
|
||||||
|
|
||||||
|
@ -59,24 +59,26 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function openWithHash(dlg, hash, lockDocumentScroll) {
|
function open(dlg) {
|
||||||
|
|
||||||
new paperDialogHashHandler(dlg, hash, lockDocumentScroll);
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
|
new paperDialogHashHandler(dlg, 'dlg' + new Date().getTime(), resolve);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function close(dlg) {
|
function close(dlg) {
|
||||||
|
|
||||||
if (enableHashChange()) {
|
if (dlg.opened) {
|
||||||
|
history.back();
|
||||||
if (dlg.opened) {
|
|
||||||
history.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
dlg.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onDialogOpened(e) {
|
||||||
|
|
||||||
|
//Emby.FocusManager.autoFocus(e.target, true);
|
||||||
|
}
|
||||||
|
|
||||||
function createDialog(options) {
|
function createDialog(options) {
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
@ -101,8 +103,23 @@
|
||||||
|
|
||||||
// These don't seem to perform well on mobile
|
// These don't seem to perform well on mobile
|
||||||
if (!browserInfo.mobile) {
|
if (!browserInfo.mobile) {
|
||||||
dlg.entryAnimation = 'scale-up-animation';
|
dlg.entryAnimation = options.entryAnimation || 'scale-up-animation';
|
||||||
dlg.exitAnimation = 'fade-out-animation';
|
dlg.exitAnimation = 'fade-out-animation';
|
||||||
|
|
||||||
|
dlg.animationConfig = {
|
||||||
|
// scale up
|
||||||
|
'entry': {
|
||||||
|
name: options.entryAnimation || 'scale-up-animation',
|
||||||
|
node: dlg,
|
||||||
|
timing: { duration: options.entryAnimationDuration || 300, easing: 'ease-out' }
|
||||||
|
},
|
||||||
|
// fade out
|
||||||
|
'exit': {
|
||||||
|
name: 'fade-out-animation',
|
||||||
|
node: dlg,
|
||||||
|
timing: { duration: options.exitAnimationDuration || 400, easing: 'ease-in' }
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
dlg.classList.add('popupEditor');
|
dlg.classList.add('popupEditor');
|
||||||
|
@ -122,6 +139,10 @@
|
||||||
dlg.classList.add('background-theme-' + theme);
|
dlg.classList.add('background-theme-' + theme);
|
||||||
dlg.classList.add('smoothScrollY');
|
dlg.classList.add('smoothScrollY');
|
||||||
|
|
||||||
|
if (options.removeOnClose) {
|
||||||
|
dlg.setAttribute('data-removeonclose', 'true');
|
||||||
|
}
|
||||||
|
|
||||||
return dlg;
|
return dlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +186,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
window.PaperDialogHelper = {
|
window.PaperDialogHelper = {
|
||||||
open: openWithHash,
|
open: open,
|
||||||
close: close,
|
close: close,
|
||||||
createDialog: createDialog,
|
createDialog: createDialog,
|
||||||
positionTo: positionTo
|
positionTo: positionTo
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue