aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-12-04 10:25:11 +0000
committerMario <mario@mariovavti.com>2019-12-04 10:25:11 +0000
commitbde429cff649237984903a252ba1a718e6d74f53 (patch)
treeb2b2570159cfb37689e6ce3b96c3b1b988d676cc /vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js
parentcc9f41df5f83bcab435d6fb941b5a8f5b1457037 (diff)
parent4c8d33d1eb2a804aa70a7bc677d6c73d0d94816b (diff)
downloadvolse-hubzilla-bde429cff649237984903a252ba1a718e6d74f53.tar.gz
volse-hubzilla-bde429cff649237984903a252ba1a718e6d74f53.tar.bz2
volse-hubzilla-bde429cff649237984903a252ba1a718e6d74f53.zip
Merge branch '4.6RC'4.6
Diffstat (limited to 'vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js')
-rw-r--r--vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js188
1 files changed, 91 insertions, 97 deletions
diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js
index eebeb3733..37b380a00 100644
--- a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js
+++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js
@@ -9,53 +9,42 @@
* https://opensource.org/licenses/MIT
*/
-/* global define, require, window */
+/* global define, require */
-;(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define([
- 'jquery',
- './jquery.fileupload-process'
- ], factory);
- } else if (typeof exports === 'object') {
- // Node/CommonJS:
- factory(
- require('jquery'),
- require('./jquery.fileupload-process')
- );
- } else {
- // Browser globals:
- factory(
- window.jQuery
- );
- }
-}(function ($) {
- 'use strict';
-
- // Append to the default processQueue:
- $.blueimp.fileupload.prototype.options.processQueue.push(
- {
- action: 'validate',
- // Always trigger this action,
- // even if the previous action was rejected:
- always: true,
- // Options taken from the global options map:
- acceptFileTypes: '@',
- maxFileSize: '@',
- minFileSize: '@',
- maxNumberOfFiles: '@',
- disabled: '@disableValidation'
- }
- );
+(function(factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define(['jquery', './jquery.fileupload-process'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(require('jquery'), require('./jquery.fileupload-process'));
+ } else {
+ // Browser globals:
+ factory(window.jQuery);
+ }
+})(function($) {
+ 'use strict';
- // The File Upload Validation plugin extends the fileupload widget
- // with file validation functionality:
- $.widget('blueimp.fileupload', $.blueimp.fileupload, {
+ // Append to the default processQueue:
+ $.blueimp.fileupload.prototype.options.processQueue.push({
+ action: 'validate',
+ // Always trigger this action,
+ // even if the previous action was rejected:
+ always: true,
+ // Options taken from the global options map:
+ acceptFileTypes: '@',
+ maxFileSize: '@',
+ minFileSize: '@',
+ maxNumberOfFiles: '@',
+ disabled: '@disableValidation'
+ });
- options: {
- /*
+ // The File Upload Validation plugin extends the fileupload widget
+ // with file validation functionality:
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
+ options: {
+ /*
// The regular expression for allowed file types, matches
// against either file type or file name:
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
@@ -67,59 +56,64 @@
maxNumberOfFiles: 10,
*/
- // Function returning the current number of files,
- // has to be overriden for maxNumberOfFiles validation:
- getNumberOfFiles: $.noop,
+ // Function returning the current number of files,
+ // has to be overriden for maxNumberOfFiles validation:
+ getNumberOfFiles: $.noop,
- // Error and info messages:
- messages: {
- maxNumberOfFiles: 'Maximum number of files exceeded',
- acceptFileTypes: 'File type not allowed',
- maxFileSize: 'File is too large',
- minFileSize: 'File is too small'
- }
- },
-
- processActions: {
-
- validate: function (data, options) {
- if (options.disabled) {
- return data;
- }
- var dfd = $.Deferred(),
- settings = this.options,
- file = data.files[data.index],
- fileSize;
- if (options.minFileSize || options.maxFileSize) {
- fileSize = file.size;
- }
- if ($.type(options.maxNumberOfFiles) === 'number' &&
- (settings.getNumberOfFiles() || 0) + data.files.length >
- options.maxNumberOfFiles) {
- file.error = settings.i18n('maxNumberOfFiles');
- } else if (options.acceptFileTypes &&
- !(options.acceptFileTypes.test(file.type) ||
- options.acceptFileTypes.test(file.name))) {
- file.error = settings.i18n('acceptFileTypes');
- } else if (fileSize > options.maxFileSize) {
- file.error = settings.i18n('maxFileSize');
- } else if ($.type(fileSize) === 'number' &&
- fileSize < options.minFileSize) {
- file.error = settings.i18n('minFileSize');
- } else {
- delete file.error;
- }
- if (file.error || data.files.error) {
- data.files.error = true;
- dfd.rejectWith(this, [data]);
- } else {
- dfd.resolveWith(this, [data]);
- }
- return dfd.promise();
- }
+ // Error and info messages:
+ messages: {
+ maxNumberOfFiles: 'Maximum number of files exceeded',
+ acceptFileTypes: 'File type not allowed',
+ maxFileSize: 'File is too large',
+ minFileSize: 'File is too small'
+ }
+ },
+ processActions: {
+ validate: function(data, options) {
+ if (options.disabled) {
+ return data;
}
-
- });
-
-}));
+ // eslint-disable-next-line new-cap
+ var dfd = $.Deferred(),
+ settings = this.options,
+ file = data.files[data.index],
+ fileSize;
+ if (options.minFileSize || options.maxFileSize) {
+ fileSize = file.size;
+ }
+ if (
+ $.type(options.maxNumberOfFiles) === 'number' &&
+ (settings.getNumberOfFiles() || 0) + data.files.length >
+ options.maxNumberOfFiles
+ ) {
+ file.error = settings.i18n('maxNumberOfFiles');
+ } else if (
+ options.acceptFileTypes &&
+ !(
+ options.acceptFileTypes.test(file.type) ||
+ options.acceptFileTypes.test(file.name)
+ )
+ ) {
+ file.error = settings.i18n('acceptFileTypes');
+ } else if (fileSize > options.maxFileSize) {
+ file.error = settings.i18n('maxFileSize');
+ } else if (
+ $.type(fileSize) === 'number' &&
+ fileSize < options.minFileSize
+ ) {
+ file.error = settings.i18n('minFileSize');
+ } else {
+ delete file.error;
+ }
+ if (file.error || data.files.error) {
+ data.files.error = true;
+ dfd.rejectWith(this, [data]);
+ } else {
+ dfd.resolveWith(this, [data]);
+ }
+ return dfd.promise();
+ }
+ }
+ });
+});