Skip to content

Commit 7dcef02

Browse files
committed
1.9 Changes
1 parent d99117f commit 7dcef02

File tree

2 files changed

+74
-86
lines changed

2 files changed

+74
-86
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
.bundle
33
Gemfile.lock
44
pkg/*
5+
.idea
6+
.idea/
7+
.idea/*

vendor/assets/javascripts/jquery-fileupload/jquery.fileupload.js

Lines changed: 71 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload Plugin 5.21
2+
* jQuery File Upload Plugin 5.21.3
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -33,21 +33,6 @@
3333
$.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader);
3434
$.support.xhrFormDataFileUpload = !!window.FormData;
3535

36-
// The form.elements propHook is added to filter serialized elements
37-
// to not include file inputs in jQuery 1.9.0.
38-
// This hooks directly into jQuery.fn.serializeArray.
39-
// For more info, see http://bugs.jquery.com/ticket/13306
40-
$.propHooks.elements = {
41-
get: function (form) {
42-
if ($.nodeName(form, 'form')) {
43-
return $.grep(form.elements, function (elem) {
44-
return !$.nodeName(elem, 'input') || elem.type !== 'file';
45-
});
46-
}
47-
return null;
48-
}
49-
};
50-
5136
// The fileupload widget listens for change events on file input fields defined
5237
// via fileInput setting and paste or drop events of the given dropZone.
5338
// In addition to the default jQuery Widget methods, the fileupload widget
@@ -241,7 +226,7 @@
241226
_isXHRUpload: function (options) {
242227
return !options.forceIframeTransport &&
243228
((!options.multipart && $.support.xhrFileUpload) ||
244-
$.support.xhrFormDataFileUpload);
229+
$.support.xhrFormDataFileUpload);
245230
},
246231

247232
_getFormData: function (options) {
@@ -276,8 +261,8 @@
276261
total,
277262
loaded;
278263
if (data._time && data.progressInterval &&
279-
(now - data._time < data.progressInterval) &&
280-
e.loaded !== e.total) {
264+
(now - data._time < data.progressInterval) &&
265+
e.loaded !== e.total) {
281266
return;
282267
}
283268
data._time = now;
@@ -337,7 +322,7 @@
337322
_initXHRData: function (options) {
338323
var formData,
339324
file = options.files[0],
340-
// Ignore non-multipart setting if not supported:
325+
// Ignore non-multipart setting if not supported:
341326
multipart = options.multipart || !$.support.xhrFileUpload,
342327
paramName = options.paramName[0];
343328
options.headers = options.headers || {};
@@ -389,7 +374,7 @@
389374
// This check allows the tests to run with
390375
// dummy objects:
391376
if ((window.Blob && file instanceof Blob) ||
392-
(window.File && file instanceof File)) {
377+
(window.File && file instanceof File)) {
393378
formData.append(
394379
options.paramName[index] || paramName,
395380
file,
@@ -412,7 +397,7 @@
412397
options.formData = this._getFormData(options);
413398
// Add redirect url to form data on cross-domain uploads:
414399
if (options.redirect && $('<a></a>').prop('href', options.url)
415-
.prop('host') !== location.host) {
400+
.prop('host') !== location.host) {
416401
options.formData.push({
417402
name: options.redirectParamName || 'redirect',
418403
value: options.redirect
@@ -480,7 +465,7 @@
480465
options.type = (options.type || options.form.prop('method') || '')
481466
.toUpperCase();
482467
if (options.type !== 'POST' && options.type !== 'PUT' &&
483-
options.type !== 'PATCH') {
468+
options.type !== 'PATCH') {
484469
options.type = 'POST';
485470
}
486471
if (!options.formAcceptCharset) {
@@ -546,7 +531,7 @@
546531
jqXHR,
547532
upload;
548533
if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
549-
options.data) {
534+
options.data) {
550535
return false;
551536
}
552537
if (testOnly) {
@@ -561,7 +546,7 @@
561546
);
562547
}
563548
// The chunk upload method:
564-
upload = function (i) {
549+
upload = function () {
565550
// Clone the options object for each chunk upload:
566551
var o = $.extend({}, options);
567552
o.blob = slice.call(
@@ -581,7 +566,7 @@
581566
// Add progress listeners for this chunk upload:
582567
that._initProgressListener(o);
583568
jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) ||
584-
that._getXHRPromise(false, o.context))
569+
that._getXHRPromise(false, o.context))
585570
.done(function (result, textStatus, jqXHR) {
586571
ub = that._getUploadedBytes(jqXHR) ||
587572
(ub + o.chunkSize);
@@ -648,8 +633,8 @@
648633
},
649634

650635
_onDone: function (result, textStatus, jqXHR, options) {
651-
if (!this._isXHRUpload(options) || !options.loaded ||
652-
options.loaded < options.total) {
636+
if (!options.uploadedBytes && (!this._isXHRUpload(options) ||
637+
!options.loaded || options.loaded < options.total)) {
653638
var total = this._getTotal(options.files) || 1;
654639
// Create a progress event for each iframe load,
655640
// or if there has been no progress event with
@@ -707,45 +692,45 @@
707692
options._bitrateTimer = new that._BitrateTimer();
708693
jqXHR = jqXHR || (
709694
((aborted || that._trigger('send', e, options) === false) &&
710-
that._getXHRPromise(false, options.context, aborted)) ||
711-
that._chunkedUpload(options) || $.ajax(options)
712-
).done(function (result, textStatus, jqXHR) {
713-
that._onDone(result, textStatus, jqXHR, options);
714-
}).fail(function (jqXHR, textStatus, errorThrown) {
715-
that._onFail(jqXHR, textStatus, errorThrown, options);
716-
}).always(function (jqXHRorResult, textStatus, jqXHRorError) {
717-
that._sending -= 1;
718-
that._onAlways(
719-
jqXHRorResult,
720-
textStatus,
721-
jqXHRorError,
722-
options
723-
);
724-
if (options.limitConcurrentUploads &&
695+
that._getXHRPromise(false, options.context, aborted)) ||
696+
that._chunkedUpload(options) || $.ajax(options)
697+
).done(function (result, textStatus, jqXHR) {
698+
that._onDone(result, textStatus, jqXHR, options);
699+
}).fail(function (jqXHR, textStatus, errorThrown) {
700+
that._onFail(jqXHR, textStatus, errorThrown, options);
701+
}).always(function (jqXHRorResult, textStatus, jqXHRorError) {
702+
that._sending -= 1;
703+
that._onAlways(
704+
jqXHRorResult,
705+
textStatus,
706+
jqXHRorError,
707+
options
708+
);
709+
if (options.limitConcurrentUploads &&
725710
options.limitConcurrentUploads > that._sending) {
726-
// Start the next queued upload,
727-
// that has not been aborted:
728-
var nextSlot = that._slots.shift(),
729-
isPending;
730-
while (nextSlot) {
731-
// jQuery 1.6 doesn't provide .state(),
732-
// while jQuery 1.8+ removed .isRejected():
733-
isPending = nextSlot.state ?
711+
// Start the next queued upload,
712+
// that has not been aborted:
713+
var nextSlot = that._slots.shift(),
714+
isPending;
715+
while (nextSlot) {
716+
// jQuery 1.6 doesn't provide .state(),
717+
// while jQuery 1.8+ removed .isRejected():
718+
isPending = nextSlot.state ?
734719
nextSlot.state() === 'pending' :
735720
!nextSlot.isRejected();
736-
if (isPending) {
737-
nextSlot.resolve();
738-
break;
721+
if (isPending) {
722+
nextSlot.resolve();
723+
break;
724+
}
725+
nextSlot = that._slots.shift();
739726
}
740-
nextSlot = that._slots.shift();
741727
}
742-
}
743-
});
728+
});
744729
return jqXHR;
745730
};
746731
this._beforeSend(e, options);
747732
if (this.options.sequentialUploads ||
748-
(this.options.limitConcurrentUploads &&
733+
(this.options.limitConcurrentUploads &&
749734
this.options.limitConcurrentUploads <= this._sending)) {
750735
if (this.options.limitConcurrentUploads > 1) {
751736
slot = $.Deferred();
@@ -783,7 +768,7 @@
783768
fileSet,
784769
i;
785770
if (!(options.singleFileUploads || limit) ||
786-
!this._isXHRUpload(options)) {
771+
!this._isXHRUpload(options)) {
787772
fileSet = [data.files];
788773
paramNameSet = [paramName];
789774
} else if (!options.singleFileUploads && limit) {
@@ -808,7 +793,7 @@
808793
newData.submit = function () {
809794
newData.jqXHR = this.jqXHR =
810795
(that._trigger('submit', e, this) !== false) &&
811-
that._onSend(e, this);
796+
that._onSend(e, this);
812797
return this.jqXHR;
813798
};
814799
result = that._trigger('add', e, newData);
@@ -871,11 +856,11 @@
871856
dirReader = entry.createReader();
872857
dirReader.readEntries(function (entries) {
873858
that._handleFileTreeEntries(
874-
entries,
875-
path + entry.name + '/'
876-
).done(function (files) {
877-
dfd.resolve(files);
878-
}).fail(errorHandler);
859+
entries,
860+
path + entry.name + '/'
861+
).done(function (files) {
862+
dfd.resolve(files);
863+
}).fail(errorHandler);
879864
}, errorHandler);
880865
} else {
881866
// Return an empy list for file system items
@@ -888,23 +873,23 @@
888873
_handleFileTreeEntries: function (entries, path) {
889874
var that = this;
890875
return $.when.apply(
891-
$,
892-
$.map(entries, function (entry) {
893-
return that._handleFileTreeEntry(entry, path);
894-
})
895-
).pipe(function () {
896-
return Array.prototype.concat.apply(
897-
[],
898-
arguments
899-
);
900-
});
876+
$,
877+
$.map(entries, function (entry) {
878+
return that._handleFileTreeEntry(entry, path);
879+
})
880+
).pipe(function () {
881+
return Array.prototype.concat.apply(
882+
[],
883+
arguments
884+
);
885+
});
901886
},
902887

903888
_getDroppedFiles: function (dataTransfer) {
904889
dataTransfer = dataTransfer || {};
905890
var items = dataTransfer.items;
906891
if (items && items.length && (items[0].webkitGetAsEntry ||
907-
items[0].getAsEntry)) {
892+
items[0].getAsEntry)) {
908893
return this._handleFileTreeEntries(
909894
$.map(items, function (item) {
910895
var entry;
@@ -959,14 +944,14 @@
959944
return this._getSingleFileInputFiles(fileInput);
960945
}
961946
return $.when.apply(
962-
$,
963-
$.map(fileInput, this._getSingleFileInputFiles)
964-
).pipe(function () {
965-
return Array.prototype.concat.apply(
966-
[],
967-
arguments
968-
);
969-
});
947+
$,
948+
$.map(fileInput, this._getSingleFileInputFiles)
949+
).pipe(function () {
950+
return Array.prototype.concat.apply(
951+
[],
952+
arguments
953+
);
954+
});
970955
},
971956

972957
_onChange: function (e) {
@@ -997,7 +982,7 @@
997982
}
998983
});
999984
if (this._trigger('paste', e, data) === false ||
1000-
this._onAdd(e, data) === false) {
985+
this._onAdd(e, data) === false) {
1001986
return false;
1002987
}
1003988
},
@@ -1065,7 +1050,7 @@
10651050
var options = this.options;
10661051
if (options.fileInput === undefined) {
10671052
options.fileInput = this.element.is('input[type="file"]') ?
1068-
this.element : this.element.find('input[type="file"]');
1053+
this.element : this.element.find('input[type="file"]');
10691054
} else if (!(options.fileInput instanceof $)) {
10701055
options.fileInput = $(options.fileInput);
10711056
}

0 commit comments

Comments
 (0)