aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/blueimp/jquery-file-upload/js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/blueimp/jquery-file-upload/js')
-rw-r--r--vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js35
-rw-r--r--vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js19
-rw-r--r--vendor/blueimp/jquery-file-upload/js/jquery.fileupload-ui.js6
-rw-r--r--vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js29
4 files changed, 45 insertions, 44 deletions
diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js
index 859846103..c2056b954 100644
--- a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js
+++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js
@@ -52,7 +52,6 @@
disableImageHead: '@',
disableMetaDataParsers: '@',
disableExif: '@',
- disableExifThumbnail: '@',
disableExifOffsets: '@',
includeExifTags: '@',
excludeExifTags: '@',
@@ -216,31 +215,23 @@
},
thumbnail,
thumbnailBlob;
- if (data.exif) {
- if (options.orientation === true) {
+ if (data.exif && options.thumbnail) {
+ thumbnail = data.exif.get('Thumbnail');
+ thumbnailBlob = thumbnail && thumbnail.get('Blob');
+ if (thumbnailBlob) {
options.orientation = data.exif.get('Orientation');
+ loadImage(thumbnailBlob, resolve, options);
+ return dfd.promise();
}
- if (options.thumbnail) {
- thumbnail = data.exif.get('Thumbnail');
- thumbnailBlob = thumbnail && thumbnail.get('Blob');
- if (thumbnailBlob) {
- loadImage(thumbnailBlob, resolve, options);
- return dfd.promise();
- }
- }
- // Prevent orienting browser oriented images:
- if (loadImage.orientation) {
- data.orientation = data.orientation || options.orientation;
- }
+ }
+ if (data.orientation) {
// Prevent orienting the same image twice:
- if (data.orientation) {
- delete options.orientation;
- } else {
- data.orientation = options.orientation;
- }
+ delete options.orientation;
+ } else {
+ data.orientation = options.orientation || loadImage.orientation;
}
if (img) {
- resolve(loadImage.scale(img, options));
+ resolve(loadImage.scale(img, options, data));
return dfd.promise();
}
return data;
@@ -320,7 +311,7 @@
file = data.files[data.index],
// eslint-disable-next-line new-cap
dfd = $.Deferred();
- if (data.orientation && data.exifOffsets) {
+ if (data.orientation === true && data.exifOffsets) {
// Reset Exif Orientation data:
loadImage.writeExifData(data.imageHead, data, 'Orientation', 1);
}
diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js
index 29de8309a..130778e7f 100644
--- a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js
+++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js
@@ -78,7 +78,7 @@
settings
);
};
- chain = chain.then(func, settings.always && func);
+ chain = chain[that._promisePipe](func, settings.always && func);
});
chain
.done(function () {
@@ -146,14 +146,15 @@
};
opts.index = index;
that._processing += 1;
- that._processingQueue = that._processingQueue
- .then(func, func)
- .always(function () {
- that._processing -= 1;
- if (that._processing === 0) {
- that._trigger('processstop');
- }
- });
+ that._processingQueue = that._processingQueue[that._promisePipe](
+ func,
+ func
+ ).always(function () {
+ that._processing -= 1;
+ if (that._processing === 0) {
+ that._trigger('processstop');
+ }
+ });
});
}
return this._processingQueue;
diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-ui.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-ui.js
index c42b18cc2..9cc3d3fd0 100644
--- a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-ui.js
+++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-ui.js
@@ -626,13 +626,13 @@
this._on(fileUploadButtonBar.find('.start'), {
click: function (e) {
e.preventDefault();
- filesList.find('.start').click();
+ filesList.find('.start').trigger('click');
}
});
this._on(fileUploadButtonBar.find('.cancel'), {
click: function (e) {
e.preventDefault();
- filesList.find('.cancel').click();
+ filesList.find('.cancel').trigger('click');
}
});
this._on(fileUploadButtonBar.find('.delete'), {
@@ -642,7 +642,7 @@
.find('.toggle:checked')
.closest('.template-download')
.find('.delete')
- .click();
+ .trigger('click');
fileUploadButtonBar.find('.toggle').prop('checked', false);
}
});
diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js
index f75cf2b10..184d34721 100644
--- a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js
+++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js
@@ -301,6 +301,16 @@
timeout: 0
},
+ // jQuery versions before 1.8 require promise.pipe if the return value is
+ // used, as promise.then in older versions has a different behavior, see:
+ // https://blog.jquery.com/2012/08/09/jquery-1-8-released/
+ // https://bugs.jquery.com/ticket/11010
+ // https://github.com/blueimp/jQuery-File-Upload/pull/3435
+ _promisePipe: (function () {
+ var parts = $.fn.jquery.split('.');
+ return Number(parts[0]) > 1 || Number(parts[1]) > 7 ? 'then' : 'pipe';
+ })(),
+
// A list of options that require reinitializing event listeners and/or
// special initialization code:
_specialOptions: [
@@ -732,16 +742,15 @@
};
data.process = function (resolveFunc, rejectFunc) {
if (resolveFunc || rejectFunc) {
- data._processQueue = this._processQueue = (
- this._processQueue || getPromise([this])
- )
- .then(function () {
+ data._processQueue = this._processQueue = (this._processQueue ||
+ getPromise([this]))
+ [that._promisePipe](function () {
if (data.errorThrown) {
return $.Deferred().rejectWith(that, [data]).promise();
}
return getPromise(arguments);
})
- .then(resolveFunc, rejectFunc);
+ [that._promisePipe](resolveFunc, rejectFunc);
}
return this._processQueue || getPromise([this]);
};
@@ -1052,9 +1061,9 @@
if (this.options.limitConcurrentUploads > 1) {
slot = $.Deferred();
this._slots.push(slot);
- pipe = slot.then(send);
+ pipe = slot[that._promisePipe](send);
} else {
- this._sequence = this._sequence.then(send, send);
+ this._sequence = this._sequence[that._promisePipe](send, send);
pipe = this._sequence;
}
// Return the piped Promise object, enhanced with an abort method,
@@ -1168,7 +1177,7 @@
// If the fileInput had focus before it was detached,
// restore focus to the inputClone.
if (restoreFocus) {
- inputClone.focus();
+ inputClone.trigger('focus');
}
// Avoid memory leaks with the detached file input:
$.cleanData(input.off('remove'));
@@ -1254,7 +1263,7 @@
return that._handleFileTreeEntry(entry, path);
})
)
- .then(function () {
+ [this._promisePipe](function () {
return Array.prototype.concat.apply([], arguments);
});
},
@@ -1322,7 +1331,7 @@
}
return $.when
.apply($, $.map(fileInput, this._getSingleFileInputFiles))
- .then(function () {
+ [this._promisePipe](function () {
return Array.prototype.concat.apply([], arguments);
});
},