[third] Store the XHR produced by filedrop in the calling object's .data.

(imported from commit 92d165d66e09cb8fe02652b32000850665e675e5)
This commit is contained in:
Luke Faraone 2013-03-27 10:42:17 -07:00
parent 0f10d1c6d4
commit 932e98f456
1 changed files with 8 additions and 2 deletions

View File

@ -68,7 +68,10 @@
$.fn.filedrop = function(options) {
var opts = $.extend({}, default_opts, options),
global_progress = [];
global_progress = []
// Humbug modification: keep a pointer to the object that the function
// was invoked on.
caller = this;
this.on('drop', drop).on('dragstart', opts.dragStart).on('dragenter', dragEnter).on('dragover', dragOver).on('dragleave', dragLeave);
$(document).on('drop', docDrop).on('dragenter', docEnter).on('dragover', docOver).on('dragleave', docLeave);
@ -325,6 +328,9 @@
builder,
newName = rename(file.name),
mime = file.type;
// Humbug modification: Shunt the XHR into the parent object so we
// can interrupt it later.
caller.data("filedrop_xhr", xhr);
if (opts.withCredentials) {
xhr.withCredentials = opts.withCredentials;
@ -504,4 +510,4 @@
};
} catch (e) {}
})(jQuery);
})(jQuery);