Fixed interaction with modal dialogs to prevent browser race conditions when touchscreen events are involved

This commit is contained in:
Fabio Manganiello 2019-01-13 23:45:03 +01:00
parent 740063c23b
commit f38b2db273
4 changed files with 18 additions and 6 deletions

View file

@ -4,6 +4,7 @@ $(document).ready(function() {
openedWebsocket,
dateTimeInterval,
websocketTimeoutId,
modalFadingInTimeoutId,
websocketReconnectMsecs = 30000,
eventListeners = [];
@ -155,6 +156,10 @@ $(document).ready(function() {
var top = 40 + $(window).scrollTop();
$container.css('margin-top', top + 'px');
modalFadingInTimeoutId = setTimeout(function() {
modalFadingInTimeoutId = undefined;
}, 100);
$modal.fadeIn();
});
};
@ -171,8 +176,10 @@ $(document).ready(function() {
if (!$source.parents('.modal').length
&& !$source.data('modal')
&& !$source.data('dismiss-modal')) {
if (!modalFadingInTimeoutId) {
$('.modal').filter(':visible').fadeOut();
}
}
});
};

View file

@ -1,5 +1,6 @@
$(document).ready(function() {
var seekInterval,
longPressTimeout,
curPath = [],
curTrackUpdateHandler,
curTrackElapsed = {
@ -225,8 +226,10 @@ $(document).ready(function() {
});
}
if (longPressTimeout) {
clearTimeout(longPressTimeout);
longPressTimeout = undefined;
}
};
var updatePlaylist = function(tracks) {

View file

@ -308,7 +308,7 @@ $(document).ready(function() {
});
});
$container.on('click touch', '.snapcast-host-settings', function(evt) {
$container.on('mousedown touchstart', '.snapcast-host-settings', function(evt) {
var host = $(this).parents('.snapcast-host-container').data('host');
var hostName = $(this).parents('.snapcast-host-container').data('name');
var $modal = $($(this).data('modal'));
@ -324,7 +324,7 @@ $(document).ready(function() {
}
});
$container.on('click touch', '.snapcast-group-settings', function(evt) {
$container.on('mousedown touchstart', '.snapcast-group-settings', function(evt) {
var host = $(this).parents('.snapcast-host-container').data('host');
var groupId = $(this).parents('.snapcast-group-container').data('id');
var groupName = $(this).parents('.snapcast-group-container').data('name');
@ -375,7 +375,7 @@ $(document).ready(function() {
.find('select[name=stream]').html($streams.html());
});
$container.on('click touch', '.snapcast-client-settings', function(evt) {
$container.on('mousedown touchstart', '.snapcast-client-settings', function(evt) {
var host = $(this).parents('.snapcast-host-container').data('host');
var clientId = $(this).parents('.snapcast-client-container').data('id');
var clientName = $(this).parents('.snapcast-client-container').data('name');

View file

@ -18,7 +18,9 @@ class UtilsPlugin(Plugin):
_interval_hndl_idx = 0
_interval_hndl_idx_lock = threading.RLock()
_pending_timeouts = {}
_pending_intervals = {}
_pending_timemouts_lock = threading.RLock()
_pending_intervals_lock = threading.RLock()
@action