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-03-24 21:08:05 -04:00
parent b8dfc23ae5
commit ef206ec9a5

View file

@ -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);
}