mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update dialogs
This commit is contained in:
parent
b8dfc23ae5
commit
ef206ec9a5
1 changed files with 20 additions and 0 deletions
|
@ -116,12 +116,32 @@
|
|||
}
|
||||
}
|
||||
|
||||
function parentWithTag(elem, tagName) {
|
||||
|
||||
while (elem.tagName != tagName) {
|
||||
elem = elem.parentNode;
|
||||
|
||||
if (!elem) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
function closeOnBackdropClick(dlg) {
|
||||
|
||||
dlg.addEventListener('click', function (event) {
|
||||
var rect = dlg.getBoundingClientRect();
|
||||
var isInDialog = (rect.top <= event.clientY && event.clientY <= rect.top + rect.height
|
||||
&& rect.left <= event.clientX && event.clientX <= rect.left + rect.width);
|
||||
|
||||
if (!isInDialog) {
|
||||
if (parentWithTag(event.target, 'SELECT')) {
|
||||
isInDialog = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isInDialog) {
|
||||
close(dlg);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue