|
1 | 1 | /*
|
2 |
| - * jQuery File Upload Processing Plugin 1.1 |
| 2 | + * jQuery File Upload Processing Plugin 1.3.0 |
3 | 3 | * https://github.com/blueimp/jQuery-File-Upload
|
4 | 4 | *
|
5 | 5 | * Copyright 2012, Sebastian Tschan
|
|
9 | 9 | * http://www.opensource.org/licenses/MIT
|
10 | 10 | */
|
11 | 11 |
|
12 |
| -/*jslint nomen: true, unparam: true */ |
13 |
| -/*global define, window */ |
| 12 | +/* jshint nomen:false */ |
| 13 | +/* global define, window */ |
14 | 14 |
|
15 | 15 | (function (factory) {
|
16 | 16 | 'use strict';
|
|
64 | 64 | */
|
65 | 65 | },
|
66 | 66 |
|
67 |
| - _processFile: function (data) { |
| 67 | + _processFile: function (data, originalData) { |
68 | 68 | var that = this,
|
69 | 69 | dfd = $.Deferred().resolveWith(that, [data]),
|
70 | 70 | chain = dfd.promise();
|
71 | 71 | this._trigger('process', null, data);
|
72 | 72 | $.each(data.processQueue, function (i, settings) {
|
73 | 73 | var func = function (data) {
|
| 74 | + if (originalData.errorThrown) { |
| 75 | + return $.Deferred() |
| 76 | + .rejectWith(that, [originalData]).promise(); |
| 77 | + } |
74 | 78 | return that.processActions[settings.action].call(
|
75 | 79 | that,
|
76 | 80 | data,
|
|
98 | 102 | _transformProcessQueue: function (options) {
|
99 | 103 | var processQueue = [];
|
100 | 104 | $.each(options.processQueue, function () {
|
101 |
| - var settings = {}; |
| 105 | + var settings = {}, |
| 106 | + action = this.action, |
| 107 | + prefix = this.prefix === true ? action : this.prefix; |
102 | 108 | $.each(this, function (key, value) {
|
103 | 109 | if ($.type(value) === 'string' &&
|
104 | 110 | value.charAt(0) === '@') {
|
105 |
| - settings[key] = options[value.slice(1)]; |
| 111 | + settings[key] = options[ |
| 112 | + value.slice(1) || (prefix ? prefix + |
| 113 | + key.charAt(0).toUpperCase() + key.slice(1) : key) |
| 114 | + ]; |
106 | 115 | } else {
|
107 | 116 | settings[key] = value;
|
108 | 117 | }
|
| 118 | + |
109 | 119 | });
|
110 | 120 | processQueue.push(settings);
|
111 | 121 | });
|
|
127 | 137 | if (this._processing === 0) {
|
128 | 138 | this._trigger('processstart');
|
129 | 139 | }
|
130 |
| - $.each(data.files, function (index, file) { |
| 140 | + $.each(data.files, function (index) { |
131 | 141 | var opts = index ? $.extend({}, options) : options,
|
132 | 142 | func = function () {
|
133 |
| - return that._processFile(opts); |
| 143 | + if (data.errorThrown) { |
| 144 | + return $.Deferred() |
| 145 | + .rejectWith(that, [data]).promise(); |
| 146 | + } |
| 147 | + return that._processFile(opts, data); |
134 | 148 | };
|
135 | 149 | opts.index = index;
|
136 | 150 | that._processing += 1;
|
|
0 commit comments