Revert "#2284 jQuery Fileupload 업데이트"

This reverts commit d9a7b89a74.
This commit is contained in:
Kijin Sung 2018-10-11 14:27:19 +09:00
parent fa4fb72b27
commit 7a97084df9
19 changed files with 654 additions and 924 deletions

View file

@ -1,18 +1,18 @@
/*
* jQuery File Upload Plugin Angular JS Example
* jQuery File Upload Plugin Angular JS Example 1.2.1
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*/
/* jshint nomen:false */
/* global window, angular */
;(function () {
(function () {
'use strict';
var isOnGitHub = window.location.hostname === 'blueimp.github.io',

View file

@ -1,17 +1,17 @@
/*
* jQuery postMessage Transport Plugin
* jQuery postMessage Transport Plugin 1.1.2
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*/
/* global define, require, window, document */
;(function (factory) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
@ -64,12 +64,6 @@
loc = $('<a>').prop('href', options.postMessage)[0],
target = loc.protocol + '//' + loc.host,
xhrUpload = options.xhr().upload;
// IE always includes the port for the host property of a link
// element, but not in the location.host or origin property for the
// default http port 80 and https port 443, so we strip it:
if (/^(http:\/\/.+:80)|(https:\/\/.+:443)$/.test(target)) {
target = target.replace(/:(80|443)$/, '');
}
return {
send: function (_, completeCallback) {
counter += 1;

View file

@ -1,12 +1,12 @@
/*
* jQuery XDomainRequest Transport Plugin
* jQuery XDomainRequest Transport Plugin 1.1.4
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*
* Based on Julian Aubourg's ajaxHooks xdr.js:
* https://github.com/jaubourg/ajaxHooks/
@ -14,7 +14,7 @@
/* global define, require, window, XDomainRequest */
;(function (factory) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:

View file

@ -1,18 +1,18 @@
/*
* jQuery File Upload AngularJS Plugin
* jQuery File Upload AngularJS Plugin 2.2.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*/
/* jshint nomen:false */
/* global define, angular, require */
/* global define, angular */
;(function (factory) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
@ -24,16 +24,6 @@
'./jquery.fileupload-video',
'./jquery.fileupload-validate'
], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS:
factory(
require('jquery'),
require('angular'),
require('./jquery.fileupload-image'),
require('./jquery.fileupload-audio'),
require('./jquery.fileupload-video'),
require('./jquery.fileupload-validate')
);
} else {
factory();
}
@ -101,7 +91,7 @@
angular.forEach(data.files, function (file) {
filesCopy.push(file);
});
scope.$parent.$applyAsync(function () {
scope.$apply(function () {
addFileMethods(scope, data);
var method = scope.option('prependFiles') ?
'unshift' : 'push';
@ -110,7 +100,7 @@
data.process(function () {
return scope.process(data);
}).always(function () {
scope.$parent.$applyAsync(function () {
scope.$apply(function () {
addFileMethods(scope, data);
scope.replace(filesCopy, data.files);
});
@ -122,6 +112,12 @@
}
});
},
progress: function (e, data) {
if (e.isDefaultPrevented()) {
return false;
}
data.scope.$apply();
},
done: function (e, data) {
if (e.isDefaultPrevented()) {
return false;
@ -201,8 +197,8 @@
// The FileUploadController initializes the fileupload widget and
// provides scope methods to control the File Upload functionality:
.controller('FileUploadController', [
'$scope', '$element', '$attrs', '$window', 'fileUpload','$q',
function ($scope, $element, $attrs, $window, fileUpload, $q) {
'$scope', '$element', '$attrs', '$window', 'fileUpload',
function ($scope, $element, $attrs, $window, fileUpload) {
var uploadMethods = {
progress: function () {
return $element.fileupload('progress');
@ -264,21 +260,19 @@
$scope.applyOnQueue = function (method) {
var list = this.queue.slice(0),
i,
file,
promises = [];
file;
for (i = 0; i < list.length; i += 1) {
file = list[i];
if (file[method]) {
promises.push(file[method]());
file[method]();
}
}
return $q.all(promises);
};
$scope.submit = function () {
return this.applyOnQueue('$submit');
this.applyOnQueue('$submit');
};
$scope.cancel = function () {
return this.applyOnQueue('$cancel');
this.applyOnQueue('$cancel');
};
// Add upload methods to the scope:
angular.extend($scope, uploadMethods);
@ -326,11 +320,9 @@
'fileuploadprocessalways',
'fileuploadprocessstop'
].join(' '), function (e, data) {
$scope.$parent.$applyAsync(function () {
if ($scope.$emit(e.type, data).defaultPrevented) {
e.preventDefault();
}
});
if ($scope.$emit(e.type, data).defaultPrevented) {
e.preventDefault();
}
}).on('remove', function () {
// Remove upload methods from the scope,
// when the widget is removed:

View file

@ -1,18 +1,18 @@
/*
* jQuery File Upload Audio Preview Plugin
* jQuery File Upload Audio Preview Plugin 1.0.4
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*/
/* jshint nomen:false */
/* global define, require, window, document */
;(function (factory) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
@ -25,8 +25,7 @@
// Node/CommonJS:
factory(
require('jquery'),
require('blueimp-load-image/js/load-image'),
require('./jquery.fileupload-process')
require('load-image')
);
} else {
// Browser globals:

View file

@ -1,18 +1,18 @@
/*
* jQuery File Upload Image Preview & Resize Plugin
* jQuery File Upload Image Preview & Resize Plugin 1.7.3
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*/
/* jshint nomen:false */
/* global define, require, window, Blob */
;(function (factory) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
@ -20,8 +20,8 @@
'jquery',
'load-image',
'load-image-meta',
'load-image-scale',
'load-image-exif',
'load-image-ios',
'canvas-to-blob',
'./jquery.fileupload-process'
], factory);
@ -29,12 +29,7 @@
// Node/CommonJS:
factory(
require('jquery'),
require('blueimp-load-image/js/load-image'),
require('blueimp-load-image/js/load-image-meta'),
require('blueimp-load-image/js/load-image-scale'),
require('blueimp-load-image/js/load-image-exif'),
require('blueimp-canvas-to-blob'),
require('./jquery.fileupload-process')
require('load-image')
);
} else {
// Browser globals:

View file

@ -1,31 +1,25 @@
/*
* jQuery File Upload jQuery UI Plugin
* jQuery File Upload jQuery UI Plugin 8.7.2
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*/
/* jshint nomen:false */
/* global define, require, window */
;(function (factory) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define([
'jquery',
'./jquery.fileupload-ui'
], factory);
define(['jquery', './jquery.fileupload-ui'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS:
factory(
require('jquery'),
require('./jquery.fileupload-ui')
);
factory(require('jquery'));
} else {
// Browser globals:
factory(window.jQuery);

View file

@ -1,18 +1,18 @@
/*
* jQuery File Upload Processing Plugin
* jQuery File Upload Processing Plugin 1.3.1
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2012, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*/
/* jshint nomen:false */
/* global define, require, window */
;(function (factory) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
@ -22,10 +22,7 @@
], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS:
factory(
require('jquery'),
require('./jquery.fileupload')
);
factory(require('jquery'));
} else {
// Browser globals:
factory(
@ -87,7 +84,7 @@
settings
);
};
chain = chain.then(func, settings.always && func);
chain = chain.pipe(func, settings.always && func);
});
chain
.done(function () {
@ -154,7 +151,7 @@
};
opts.index = index;
that._processing += 1;
that._processingQueue = that._processingQueue.then(func, func)
that._processingQueue = that._processingQueue.pipe(func, func)
.always(function () {
that._processing -= 1;
if (that._processing === 0) {

View file

@ -1,24 +1,24 @@
/*
* jQuery File Upload User Interface Plugin
* jQuery File Upload User Interface Plugin 9.6.1
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*/
/* jshint nomen:false */
/* global define, require, window */
;(function (factory) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define([
'jquery',
'blueimp-tmpl',
'tmpl',
'./jquery.fileupload-image',
'./jquery.fileupload-audio',
'./jquery.fileupload-video',
@ -28,11 +28,7 @@
// Node/CommonJS:
factory(
require('jquery'),
require('blueimp-tmpl'),
require('./jquery.fileupload-image'),
require('./jquery.fileupload-audio'),
require('./jquery.fileupload-video'),
require('./jquery.fileupload-validate')
require('tmpl')
);
} else {
// Browser globals:
@ -72,10 +68,10 @@
// The expected data type of the upload response, sets the dataType
// option of the $.ajax upload requests:
dataType: 'json',
// Error and info messages:
messages: {
unknownError: 'Unknown error'
unknownError: 'Unknown error'
},
// Function returning the current number of files,

View file

@ -1,17 +1,17 @@
/*
* jQuery File Upload Validation Plugin
* jQuery File Upload Validation Plugin 1.1.3
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*/
/* global define, require, window */
;(function (factory) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
@ -21,10 +21,7 @@
], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS:
factory(
require('jquery'),
require('./jquery.fileupload-process')
);
factory(require('jquery'));
} else {
// Browser globals:
factory(
@ -39,7 +36,7 @@
{
action: 'validate',
// Always trigger this action,
// even if the previous action was rejected:
// even if the previous action was rejected:
always: true,
// Options taken from the global options map:
acceptFileTypes: '@',

View file

@ -1,18 +1,18 @@
/*
* jQuery File Upload Video Preview Plugin
* jQuery File Upload Video Preview Plugin 1.0.4
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*/
/* jshint nomen:false */
/* global define, require, window, document */
;(function (factory) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
@ -25,8 +25,7 @@
// Node/CommonJS:
factory(
require('jquery'),
require('blueimp-load-image/js/load-image'),
require('./jquery.fileupload-process')
require('load-image')
);
} else {
// Browser globals:

View file

@ -1,24 +1,24 @@
/*
* jQuery File Upload Plugin
* jQuery File Upload Plugin 5.42.3
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*/
/* jshint nomen:false */
/* global define, require, window, document, location, Blob, FormData */
;(function (factory) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define([
'jquery',
'jquery-ui/ui/widget'
'jquery.ui.widget'
], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS:
@ -43,7 +43,7 @@
'|(Kindle/(1\\.0|2\\.[05]|3\\.0))'
).test(window.navigator.userAgent) ||
// Feature detection for all other devices:
$('<input type="file"/>').prop('disabled'));
$('<input type="file">').prop('disabled'));
// The FileReader API is not actually used, but works as feature detection,
// as some Safari versions (5?) support XHR file uploads via the FormData API,
@ -453,7 +453,7 @@
}
if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
options.headers['Content-Disposition'] = 'attachment; filename="' +
encodeURI(file.uploadName || file.name) + '"';
encodeURI(file.name) + '"';
}
if (!multipart) {
options.contentType = file.type || 'application/octet-stream';
@ -489,11 +489,7 @@
});
}
if (options.blob) {
formData.append(
paramName,
options.blob,
file.uploadName || file.name
);
formData.append(paramName, options.blob, file.name);
} else {
$.each(options.files, function (index, file) {
// This check allows the tests to run with
@ -656,7 +652,7 @@
data.process = function (resolveFunc, rejectFunc) {
if (resolveFunc || rejectFunc) {
data._processQueue = this._processQueue =
(this._processQueue || getPromise([this])).then(
(this._processQueue || getPromise([this])).pipe(
function () {
if (data.errorThrown) {
return $.Deferred()
@ -664,7 +660,7 @@
}
return getPromise(arguments);
}
).then(resolveFunc, rejectFunc);
).pipe(resolveFunc, rejectFunc);
}
return this._processQueue || getPromise([this]);
};
@ -734,7 +730,7 @@
promise = dfd.promise(),
jqXHR,
upload;
if (!(this._isXHRUpload(options) && slice && (ub || ($.type(mcs) === 'function' ? mcs(options) : mcs) < fs)) ||
if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
options.data) {
return false;
}
@ -757,7 +753,7 @@
o.blob = slice.call(
file,
ub,
ub + ($.type(mcs) === 'function' ? mcs(o) : mcs),
ub + mcs,
file.type
);
// Store the current chunk size, as the blob itself
@ -949,9 +945,9 @@
if (this.options.limitConcurrentUploads > 1) {
slot = $.Deferred();
this._slots.push(slot);
pipe = slot.then(send);
pipe = slot.pipe(send);
} else {
this._sequence = this._sequence.then(send, send);
this._sequence = this._sequence.pipe(send, send);
pipe = this._sequence;
}
// Return the piped Promise object, enhanced with an abort method,
@ -1050,19 +1046,13 @@
_replaceFileInput: function (data) {
var input = data.fileInput,
inputClone = input.clone(true),
restoreFocus = input.is(document.activeElement);
inputClone = input.clone(true);
// Add a reference for the new cloned file input to the data argument:
data.fileInputClone = inputClone;
$('<form></form>').append(inputClone)[0].reset();
// Detaching allows to insert the fileInput on another form
// without loosing the file input value:
input.after(inputClone).detach();
// If the fileInput had focus before it was detached,
// restore focus to the inputClone.
if (restoreFocus) {
inputClone.focus();
}
// Avoid memory leaks with the detached file input:
$.cleanData(input.unbind('remove'));
// Replace the original file input element in the fileInput
@ -1084,8 +1074,6 @@
_handleFileTreeEntry: function (entry, path) {
var that = this,
dfd = $.Deferred(),
entries = [],
dirReader,
errorHandler = function (e) {
if (e && !e.entry) {
e.entry = entry;
@ -1113,7 +1101,8 @@
readEntries();
}
}, errorHandler);
};
},
dirReader, entries = [];
path = path || '';
if (entry.isFile) {
if (entry._file) {
@ -1130,7 +1119,7 @@
dirReader = entry.createReader();
readEntries();
} else {
// Return an empty list for file system items
// Return an empy list for file system items
// other than files or directories:
dfd.resolve([]);
}
@ -1144,7 +1133,7 @@
$.map(entries, function (entry) {
return that._handleFileTreeEntry(entry, path);
})
).then(function () {
).pipe(function () {
return Array.prototype.concat.apply(
[],
arguments
@ -1213,7 +1202,7 @@
return $.when.apply(
$,
$.map(fileInput, this._getSingleFileInputFiles)
).then(function () {
).pipe(function () {
return Array.prototype.concat.apply(
[],
arguments
@ -1316,10 +1305,6 @@
this._off(this.options.fileInput, 'change');
},
_destroy: function () {
this._destroyEventHandlers();
},
_setOption: function (key, value) {
var reinit = $.inArray(key, this._specialOptions) !== -1;
if (reinit) {

View file

@ -1,17 +1,17 @@
/*
* jQuery Iframe Transport Plugin
* jQuery Iframe Transport Plugin 1.8.3
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
* http://www.opensource.org/licenses/MIT
*/
/* global define, require, window, document, JSON */
/* global define, require, window, document */
;(function (factory) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
@ -27,14 +27,7 @@
'use strict';
// Helper variable to create unique names for the transport iframes:
var counter = 0,
jsonAPI = $,
jsonParse = 'parseJSON';
if ('JSON' in window && 'parse' in JSON) {
jsonAPI = JSON;
jsonParse = 'parse';
}
var counter = 0;
// The iframe transport accepts four additional options:
// options.fileInput: a jQuery collection of file input fields
@ -204,7 +197,7 @@
return iframe && $(iframe[0].body).text();
},
'iframe json': function (iframe) {
return iframe && jsonAPI[jsonParse]($(iframe[0].body).text());
return iframe && $.parseJSON($(iframe[0].body).text());
},
'iframe html': function (iframe) {
return iframe && $(iframe[0].body).html();

File diff suppressed because it is too large Load diff