abort preview thumbnail ajax request when leaving the zone (#4731)

This commit is contained in:
Frédéric Péters 2014-06-06 15:06:32 +02:00
parent 993fe872f8
commit 852aebb677
1 changed files with 5 additions and 1 deletions

View File

@ -269,10 +269,13 @@
};
$.querywidget.updatePreviewLinks = function () {
var xhr_preview = null;
$('.ResultsTasksTable tr a, .ResultsTable tr a').hover(function() {
$('#preview-doc').remove();
$.getJSON($(this).attr('href') + '/@@preview',
if (xhr_preview !== null) xhr_preview.abort();
xhr_preview = $.getJSON($(this).attr('href') + '/@@preview',
function (data) {
xhr_preview = null;
$('#preview-doc').remove();
if (data.thumbnail_url) {
$('body').append('<div id="preview-doc">');
@ -280,6 +283,7 @@
}
});
}, function() {
if (xhr_preview !== null) xhr_preview.abort();
$('#preview-doc').remove();
});
};