avatars_for_rails 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{lib/generators/avatars_for_rails/templates/public → app/assets}/images/Jcrop.gif +0 -0
- data/{lib/generators/avatars_for_rails/templates/public → app/assets}/images/cancel.png +0 -0
- data/avatars_for_rails.gemspec +1 -1
- data/vendor/assets/javascripts/jquery.fileupload-ui.js +333 -63
- data/vendor/assets/javascripts/jquery.fileupload.js +654 -173
- data/vendor/assets/stylesheets/jquery.fileupload-ui.css +91 -21
- metadata +27 -46
- data/lib/generators/avatars_for_rails/templates/public/images/pbar-ani.gif +0 -0
- data/lib/generators/avatars_for_rails/templates/public/images/rails.png +0 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/application.js +0 -2
- data/lib/generators/avatars_for_rails/templates/public/javascripts/avatars.js +0 -8
- data/lib/generators/avatars_for_rails/templates/public/javascripts/controls.js +0 -965
- data/lib/generators/avatars_for_rails/templates/public/javascripts/dragdrop.js +0 -974
- data/lib/generators/avatars_for_rails/templates/public/javascripts/effects.js +0 -1123
- data/lib/generators/avatars_for_rails/templates/public/javascripts/jquery-ui.min.js +0 -401
- data/lib/generators/avatars_for_rails/templates/public/javascripts/jquery.Jcrop.min.js +0 -163
- data/lib/generators/avatars_for_rails/templates/public/javascripts/jquery.fileupload-ui.js +0 -529
- data/lib/generators/avatars_for_rails/templates/public/javascripts/jquery.fileupload.js +0 -956
- data/lib/generators/avatars_for_rails/templates/public/javascripts/jquery.form.js +0 -815
- data/lib/generators/avatars_for_rails/templates/public/javascripts/jquery.js +0 -7179
- data/lib/generators/avatars_for_rails/templates/public/javascripts/prototype.js +0 -6001
- data/lib/generators/avatars_for_rails/templates/public/javascripts/rails.js +0 -158
- data/lib/generators/avatars_for_rails/templates/public/stylesheets/.gitkeep +0 -0
- data/lib/generators/avatars_for_rails/templates/public/stylesheets/avatars.css +0 -115
- data/lib/generators/avatars_for_rails/templates/public/stylesheets/jquery.Jcrop.css +0 -35
- data/lib/generators/avatars_for_rails/templates/public/stylesheets/jquery.fileupload-ui.css +0 -140
File without changes
|
File without changes
|
data/avatars_for_rails.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# project in your rails apps through git.
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "avatars_for_rails"
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.3"
|
6
6
|
s.authors = ["Jaime Castro Montero", "GING"]
|
7
7
|
s.summary = "Avatar manager for rails apps."
|
8
8
|
s.description = "A Rails engine that allows any model to act as avatarable, permitting it to have a complete avatar manager with a few options. Adapted to rails 3"
|
@@ -1,51 +1,142 @@
|
|
1
1
|
/*
|
2
|
-
* jQuery File Upload User Interface Plugin
|
2
|
+
* jQuery File Upload User Interface Plugin 4.4
|
3
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
4
|
+
*
|
5
|
+
* Copyright 2010, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
3
7
|
*
|
4
|
-
* Copyright 2010, Sebastian Tschan, AQUANTUM
|
5
8
|
* Licensed under the MIT license:
|
6
9
|
* http://creativecommons.org/licenses/MIT/
|
7
|
-
*
|
8
|
-
* https://blueimp.net
|
9
|
-
* http://www.aquantum.de
|
10
10
|
*/
|
11
11
|
|
12
12
|
/*jslint browser: true */
|
13
|
-
/*global jQuery */
|
13
|
+
/*global jQuery, FileReader, URL, webkitURL */
|
14
14
|
|
15
15
|
(function ($) {
|
16
|
+
'use strict';
|
16
17
|
|
17
|
-
var
|
18
|
-
|
18
|
+
var undef = 'undefined',
|
19
|
+
func = 'function',
|
20
|
+
UploadHandler,
|
21
|
+
methods,
|
22
|
+
|
23
|
+
MultiLoader = function (callBack) {
|
24
|
+
var loaded = 0,
|
25
|
+
list = [];
|
26
|
+
this.complete = function () {
|
27
|
+
loaded += 1;
|
28
|
+
if (loaded === list.length + 1) {
|
29
|
+
// list.length * onComplete + 1 * onLoadAll
|
30
|
+
callBack(list);
|
31
|
+
loaded = 0;
|
32
|
+
list = [];
|
33
|
+
}
|
34
|
+
};
|
35
|
+
this.push = function (item) {
|
36
|
+
list.push(item);
|
37
|
+
};
|
38
|
+
this.getList = function () {
|
39
|
+
return list;
|
40
|
+
};
|
41
|
+
};
|
19
42
|
|
20
43
|
UploadHandler = function (container, options) {
|
21
44
|
var uploadHandler = this,
|
22
|
-
undef = 'undefined',
|
23
|
-
func = 'function',
|
24
45
|
dragOverTimeout,
|
25
|
-
isDropZoneEnlarged
|
46
|
+
isDropZoneEnlarged,
|
47
|
+
multiLoader = new MultiLoader(function (list) {
|
48
|
+
uploadHandler.hideProgressBarAll(function () {
|
49
|
+
uploadHandler.resetProgressBarAll();
|
50
|
+
if (typeof uploadHandler.onCompleteAll === func) {
|
51
|
+
uploadHandler.onCompleteAll(list);
|
52
|
+
}
|
53
|
+
});
|
54
|
+
}),
|
55
|
+
getUploadTable = function (handler) {
|
56
|
+
return typeof handler.uploadTable === func ?
|
57
|
+
handler.uploadTable(handler) : handler.uploadTable;
|
58
|
+
},
|
59
|
+
getDownloadTable = function (handler) {
|
60
|
+
return typeof handler.downloadTable === func ?
|
61
|
+
handler.downloadTable(handler) : handler.downloadTable;
|
62
|
+
};
|
26
63
|
|
64
|
+
this.requestHeaders = {'Accept': 'application/json, text/javascript, */*; q=0.01'};
|
27
65
|
this.dropZone = container;
|
66
|
+
this.imageTypes = /^image\/(gif|jpeg|png)$/;
|
67
|
+
this.previewMaxWidth = this.previewMaxHeight = 80;
|
68
|
+
this.previewLoadDelay = 100;
|
69
|
+
this.previewAsCanvas = true;
|
70
|
+
this.previewSelector = '.file_upload_preview';
|
28
71
|
this.progressSelector = '.file_upload_progress div';
|
29
|
-
this.cancelSelector = '.file_upload_cancel
|
72
|
+
this.cancelSelector = '.file_upload_cancel button';
|
30
73
|
this.cssClassSmall = 'file_upload_small';
|
31
74
|
this.cssClassLarge = 'file_upload_large';
|
32
75
|
this.cssClassHighlight = 'file_upload_highlight';
|
33
76
|
this.dropEffect = 'highlight';
|
34
|
-
this.uploadTable = this.downloadTable =
|
35
|
-
|
36
|
-
this.
|
37
|
-
|
77
|
+
this.uploadTable = this.downloadTable = null;
|
78
|
+
this.buildUploadRow = this.buildDownloadRow = null;
|
79
|
+
this.progressAllNode = null;
|
80
|
+
|
81
|
+
this.loadImage = function (file, callBack, maxWidth, maxHeight, imageTypes, noCanvas) {
|
82
|
+
var img,
|
83
|
+
scaleImage,
|
84
|
+
urlAPI,
|
85
|
+
fileReader;
|
86
|
+
if (imageTypes && !imageTypes.test(file.type)) {
|
87
|
+
return null;
|
88
|
+
}
|
89
|
+
scaleImage = function (img) {
|
90
|
+
var canvas = document.createElement('canvas'),
|
91
|
+
scale = Math.min(
|
92
|
+
(maxWidth || img.width) / img.width,
|
93
|
+
(maxHeight || img.height) / img.height
|
94
|
+
);
|
95
|
+
if (scale > 1) {
|
96
|
+
scale = 1;
|
97
|
+
}
|
98
|
+
img.width = parseInt(img.width * scale, 10);
|
99
|
+
img.height = parseInt(img.height * scale, 10);
|
100
|
+
if (noCanvas || typeof canvas.getContext !== func) {
|
101
|
+
return img;
|
102
|
+
}
|
103
|
+
canvas.width = img.width;
|
104
|
+
canvas.height = img.height;
|
105
|
+
canvas.getContext('2d').drawImage(img, 0, 0, img.width, img.height);
|
106
|
+
return canvas;
|
107
|
+
};
|
108
|
+
img = document.createElement('img');
|
109
|
+
urlAPI = typeof URL !== undef ? URL : typeof webkitURL !== undef ? webkitURL : null;
|
110
|
+
if (urlAPI && typeof urlAPI.createObjectURL === func) {
|
111
|
+
img.onload = function () {
|
112
|
+
urlAPI.revokeObjectURL(this.src);
|
113
|
+
callBack(scaleImage(img));
|
114
|
+
};
|
115
|
+
img.src = urlAPI.createObjectURL(file);
|
116
|
+
} else if (typeof FileReader !== undef &&
|
117
|
+
typeof FileReader.prototype.readAsDataURL === func) {
|
118
|
+
img.onload = function () {
|
119
|
+
callBack(scaleImage(img));
|
120
|
+
};
|
121
|
+
fileReader = new FileReader();
|
122
|
+
fileReader.onload = function (e) {
|
123
|
+
img.src = e.target.result;
|
124
|
+
};
|
125
|
+
fileReader.readAsDataURL(file);
|
126
|
+
} else {
|
127
|
+
callBack(null);
|
128
|
+
}
|
38
129
|
};
|
39
130
|
|
40
131
|
this.addNode = function (parentNode, node, callBack) {
|
41
|
-
if (node) {
|
132
|
+
if (parentNode && parentNode.length && node && node.length) {
|
42
133
|
node.css('display', 'none').appendTo(parentNode).fadeIn(function () {
|
43
134
|
if (typeof callBack === func) {
|
44
135
|
try {
|
45
136
|
callBack();
|
46
137
|
} catch (e) {
|
47
138
|
// Fix endless exception loop:
|
48
|
-
|
139
|
+
node.stop();
|
49
140
|
throw e;
|
50
141
|
}
|
51
142
|
}
|
@@ -56,15 +147,15 @@
|
|
56
147
|
};
|
57
148
|
|
58
149
|
this.removeNode = function (node, callBack) {
|
59
|
-
if (node) {
|
150
|
+
if (node && node.length) {
|
60
151
|
node.fadeOut(function () {
|
61
|
-
|
152
|
+
node.remove();
|
62
153
|
if (typeof callBack === func) {
|
63
154
|
try {
|
64
155
|
callBack();
|
65
156
|
} catch (e) {
|
66
157
|
// Fix endless exception loop:
|
67
|
-
|
158
|
+
node.stop();
|
68
159
|
throw e;
|
69
160
|
}
|
70
161
|
}
|
@@ -73,68 +164,204 @@
|
|
73
164
|
callBack();
|
74
165
|
}
|
75
166
|
};
|
167
|
+
|
168
|
+
this.replaceNode = function (oldNode, newNode, callBack) {
|
169
|
+
if (oldNode && newNode) {
|
170
|
+
oldNode.fadeOut(function () {
|
171
|
+
newNode.css('display', 'none');
|
172
|
+
oldNode.replaceWith(newNode);
|
173
|
+
newNode.fadeIn(function () {
|
174
|
+
if (typeof callBack === func) {
|
175
|
+
try {
|
176
|
+
callBack();
|
177
|
+
} catch (e) {
|
178
|
+
// Fix endless exception loop:
|
179
|
+
oldNode.stop();
|
180
|
+
newNode.stop();
|
181
|
+
throw e;
|
182
|
+
}
|
183
|
+
}
|
184
|
+
});
|
185
|
+
});
|
186
|
+
} else if (typeof callBack === func) {
|
187
|
+
callBack();
|
188
|
+
}
|
189
|
+
};
|
190
|
+
|
191
|
+
this.resetProgressBarAll = function () {
|
192
|
+
if (uploadHandler.progressbarAll) {
|
193
|
+
uploadHandler.progressbarAll.progressbar(
|
194
|
+
'value',
|
195
|
+
0
|
196
|
+
);
|
197
|
+
}
|
198
|
+
};
|
199
|
+
|
200
|
+
this.hideProgressBarAll = function (callBack) {
|
201
|
+
if (uploadHandler.progressbarAll && !$(getUploadTable(uploadHandler))
|
202
|
+
.find(uploadHandler.progressSelector + ':visible:first').length) {
|
203
|
+
uploadHandler.progressbarAll.fadeOut(callBack);
|
204
|
+
} else if (typeof callBack === func) {
|
205
|
+
callBack();
|
206
|
+
}
|
207
|
+
};
|
76
208
|
|
77
209
|
this.onAbort = function (event, files, index, xhr, handler) {
|
78
|
-
|
210
|
+
handler.removeNode(handler.uploadRow, handler.hideProgressBarAll);
|
79
211
|
};
|
80
212
|
|
81
213
|
this.cancelUpload = function (event, files, index, xhr, handler) {
|
82
214
|
var readyState = xhr.readyState;
|
83
215
|
xhr.abort();
|
84
216
|
// If readyState is below 2, abort() has no effect:
|
85
|
-
if (
|
217
|
+
if (typeof readyState !== 'number' || readyState < 2) {
|
86
218
|
handler.onAbort(event, files, index, xhr, handler);
|
87
219
|
}
|
88
220
|
};
|
89
221
|
|
90
222
|
this.initProgressBar = function (node, value) {
|
223
|
+
if (!node || !node.length) {
|
224
|
+
return null;
|
225
|
+
}
|
91
226
|
if (typeof node.progressbar === func) {
|
92
227
|
return node.progressbar({
|
93
228
|
value: value
|
94
229
|
});
|
95
230
|
} else {
|
96
|
-
|
97
|
-
|
98
|
-
progressbar
|
99
|
-
|
100
|
-
|
231
|
+
node.addClass('progressbar')
|
232
|
+
.append($('<div/>').css('width', value + '%'))
|
233
|
+
.progressbar = function (key, value) {
|
234
|
+
return this.each(function () {
|
235
|
+
if (key === 'destroy') {
|
236
|
+
$(this).removeClass('progressbar').empty();
|
237
|
+
} else {
|
238
|
+
$(this).children().css('width', value + '%');
|
239
|
+
}
|
240
|
+
});
|
241
|
+
};
|
242
|
+
return node;
|
101
243
|
}
|
102
244
|
};
|
103
245
|
|
104
|
-
this.
|
105
|
-
|
106
|
-
|
107
|
-
handler.progressbar = uploadHandler.initProgressBar(
|
108
|
-
uploadRow.find(uploadHandler.progressSelector),
|
109
|
-
(xhr.upload ? 0 : 100)
|
110
|
-
);
|
111
|
-
uploadRow.find(uploadHandler.cancelSelector).click(function (e) {
|
112
|
-
uploadHandler.cancelUpload(e, files, index, xhr, handler);
|
113
|
-
});
|
246
|
+
this.destroyProgressBar = function (node) {
|
247
|
+
if (!node || !node.length) {
|
248
|
+
return null;
|
114
249
|
}
|
115
|
-
|
250
|
+
return node.progressbar('destroy');
|
116
251
|
};
|
117
252
|
|
118
|
-
this.
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
});
|
253
|
+
this.initUploadProgress = function (xhr, handler) {
|
254
|
+
if (!xhr.upload && handler.progressbar) {
|
255
|
+
handler.progressbar.progressbar(
|
256
|
+
'value',
|
257
|
+
100 // indeterminate progress displayed by a full animated progress bar
|
258
|
+
);
|
259
|
+
}
|
126
260
|
};
|
127
|
-
|
261
|
+
|
262
|
+
this.initUploadProgressAll = function () {
|
263
|
+
if (uploadHandler.progressbarAll && uploadHandler.progressbarAll.is(':hidden')) {
|
264
|
+
uploadHandler.progressbarAll.fadeIn();
|
265
|
+
}
|
266
|
+
};
|
267
|
+
|
268
|
+
this.onSend = function (event, files, index, xhr, handler) {
|
269
|
+
handler.initUploadProgress(xhr, handler);
|
270
|
+
};
|
271
|
+
|
128
272
|
this.onProgress = function (event, files, index, xhr, handler) {
|
129
|
-
if (handler.progressbar) {
|
273
|
+
if (handler.progressbar && event.lengthComputable) {
|
130
274
|
handler.progressbar.progressbar(
|
131
275
|
'value',
|
132
276
|
parseInt(event.loaded / event.total * 100, 10)
|
133
277
|
);
|
134
278
|
}
|
135
279
|
};
|
280
|
+
|
281
|
+
this.onProgressAll = function (event, list) {
|
282
|
+
if (uploadHandler.progressbarAll && event.lengthComputable) {
|
283
|
+
uploadHandler.progressbarAll.progressbar(
|
284
|
+
'value',
|
285
|
+
parseInt(event.loaded / event.total * 100, 10)
|
286
|
+
);
|
287
|
+
}
|
288
|
+
};
|
289
|
+
|
290
|
+
this.onLoadAll = function (list) {
|
291
|
+
multiLoader.complete();
|
292
|
+
};
|
293
|
+
|
294
|
+
this.initProgressBarAll = function () {
|
295
|
+
if (!uploadHandler.progressbarAll) {
|
296
|
+
uploadHandler.progressbarAll = uploadHandler.initProgressBar(
|
297
|
+
(typeof uploadHandler.progressAllNode === func ?
|
298
|
+
uploadHandler.progressAllNode(uploadHandler) : uploadHandler.progressAllNode),
|
299
|
+
0
|
300
|
+
);
|
301
|
+
}
|
302
|
+
};
|
303
|
+
|
304
|
+
this.destroyProgressBarAll = function () {
|
305
|
+
uploadHandler.destroyProgressBar(uploadHandler.progressbarAll);
|
306
|
+
};
|
307
|
+
|
308
|
+
this.loadPreviewImage = function (files, index, handler) {
|
309
|
+
index = index || 0;
|
310
|
+
handler.uploadRow.find(handler.previewSelector).each(function () {
|
311
|
+
var previewNode = $(this),
|
312
|
+
file = files[index];
|
313
|
+
setTimeout(function () {
|
314
|
+
handler.loadImage(
|
315
|
+
file,
|
316
|
+
function (img) {
|
317
|
+
handler.addNode(
|
318
|
+
previewNode,
|
319
|
+
$(img)
|
320
|
+
);
|
321
|
+
},
|
322
|
+
handler.previewMaxWidth,
|
323
|
+
handler.previewMaxHeight,
|
324
|
+
handler.imageTypes,
|
325
|
+
!handler.previewAsCanvas
|
326
|
+
);
|
327
|
+
}, handler.previewLoadDelay);
|
328
|
+
index += 1;
|
329
|
+
});
|
330
|
+
};
|
331
|
+
|
332
|
+
this.initUploadRow = function (event, files, index, xhr, handler) {
|
333
|
+
var uploadRow = handler.uploadRow = (typeof handler.buildUploadRow === func ?
|
334
|
+
handler.buildUploadRow(files, index, handler) : null);
|
335
|
+
if (uploadRow) {
|
336
|
+
handler.progressbar = handler.initProgressBar(
|
337
|
+
uploadRow.find(handler.progressSelector),
|
338
|
+
0
|
339
|
+
);
|
340
|
+
uploadRow.find(handler.cancelSelector).click(function (e) {
|
341
|
+
handler.cancelUpload(e, files, index, xhr, handler);
|
342
|
+
e.preventDefault();
|
343
|
+
});
|
344
|
+
handler.loadPreviewImage(files, index, handler);
|
345
|
+
}
|
346
|
+
};
|
136
347
|
|
137
|
-
this.
|
348
|
+
this.initUpload = function (event, files, index, xhr, handler, callBack) {
|
349
|
+
handler.initUploadRow(event, files, index, xhr, handler);
|
350
|
+
handler.addNode(
|
351
|
+
getUploadTable(handler),
|
352
|
+
handler.uploadRow,
|
353
|
+
function () {
|
354
|
+
if (typeof handler.beforeSend === func) {
|
355
|
+
handler.beforeSend(event, files, index, xhr, handler, callBack);
|
356
|
+
} else {
|
357
|
+
callBack();
|
358
|
+
}
|
359
|
+
}
|
360
|
+
);
|
361
|
+
handler.initUploadProgressAll();
|
362
|
+
};
|
363
|
+
|
364
|
+
this.parseResponse = function (xhr, handler) {
|
138
365
|
if (typeof xhr.responseText !== undef) {
|
139
366
|
return $.parseJSON(xhr.responseText);
|
140
367
|
} else {
|
@@ -143,30 +370,44 @@
|
|
143
370
|
}
|
144
371
|
};
|
145
372
|
|
146
|
-
this.initDownloadRow = function (event, files, index, xhr, handler
|
373
|
+
this.initDownloadRow = function (event, files, index, xhr, handler) {
|
147
374
|
var json, downloadRow;
|
148
375
|
try {
|
149
|
-
json = handler.response =
|
150
|
-
downloadRow = handler.downloadRow = uploadHandler.buildDownloadRow(json);
|
151
|
-
uploadHandler.addNode(uploadHandler.downloadTable, downloadRow, callBack);
|
376
|
+
json = handler.response = handler.parseResponse(xhr, handler);
|
152
377
|
} catch (e) {
|
153
|
-
if (typeof
|
378
|
+
if (typeof handler.onError === func) {
|
154
379
|
handler.originalEvent = event;
|
155
|
-
|
380
|
+
handler.onError(e, files, index, xhr, handler);
|
156
381
|
} else {
|
157
382
|
throw e;
|
158
383
|
}
|
159
384
|
}
|
385
|
+
downloadRow = handler.downloadRow = (typeof handler.buildDownloadRow === func ?
|
386
|
+
handler.buildDownloadRow(json, handler) : null);
|
160
387
|
};
|
161
388
|
|
162
389
|
this.onLoad = function (event, files, index, xhr, handler) {
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
390
|
+
var uploadTable = getUploadTable(handler),
|
391
|
+
downloadTable = getDownloadTable(handler),
|
392
|
+
callBack = function () {
|
393
|
+
if (typeof handler.onComplete === func) {
|
394
|
+
handler.onComplete(event, files, index, xhr, handler);
|
167
395
|
}
|
396
|
+
multiLoader.complete();
|
397
|
+
};
|
398
|
+
multiLoader.push(Array.prototype.slice.call(arguments, 1));
|
399
|
+
handler.initDownloadRow(event, files, index, xhr, handler);
|
400
|
+
if (uploadTable && (!downloadTable || uploadTable.get(0) === downloadTable.get(0))) {
|
401
|
+
handler.replaceNode(handler.uploadRow, handler.downloadRow, callBack);
|
402
|
+
} else {
|
403
|
+
handler.removeNode(handler.uploadRow, function () {
|
404
|
+
handler.addNode(
|
405
|
+
downloadTable,
|
406
|
+
handler.downloadRow,
|
407
|
+
callBack
|
408
|
+
);
|
168
409
|
});
|
169
|
-
}
|
410
|
+
}
|
170
411
|
};
|
171
412
|
|
172
413
|
this.dropZoneEnlarge = function () {
|
@@ -229,6 +470,20 @@
|
|
229
470
|
}
|
230
471
|
};
|
231
472
|
|
473
|
+
this.init = function () {
|
474
|
+
uploadHandler.initProgressBarAll();
|
475
|
+
if (typeof uploadHandler.initExtended === func) {
|
476
|
+
uploadHandler.initExtended();
|
477
|
+
}
|
478
|
+
};
|
479
|
+
|
480
|
+
this.destroy = function () {
|
481
|
+
if (typeof uploadHandler.destroyExtended === func) {
|
482
|
+
uploadHandler.destroyExtended();
|
483
|
+
}
|
484
|
+
uploadHandler.destroyProgressBarAll();
|
485
|
+
};
|
486
|
+
|
232
487
|
$.extend(this, options);
|
233
488
|
};
|
234
489
|
|
@@ -238,11 +493,26 @@
|
|
238
493
|
$(this).fileUpload(new UploadHandler($(this), options));
|
239
494
|
});
|
240
495
|
},
|
241
|
-
|
496
|
+
|
497
|
+
option: function (option, value, namespace) {
|
498
|
+
if (!option || (typeof option === 'string' && typeof value === undef)) {
|
499
|
+
return $(this).fileUpload('option', option, value, namespace);
|
500
|
+
}
|
501
|
+
return this.each(function () {
|
502
|
+
$(this).fileUpload('option', option, value, namespace);
|
503
|
+
});
|
504
|
+
},
|
505
|
+
|
242
506
|
destroy : function (namespace) {
|
243
507
|
return this.each(function () {
|
244
508
|
$(this).fileUpload('destroy', namespace);
|
245
509
|
});
|
510
|
+
},
|
511
|
+
|
512
|
+
upload: function (files, namespace) {
|
513
|
+
return this.each(function () {
|
514
|
+
$(this).fileUpload('upload', files, namespace);
|
515
|
+
});
|
246
516
|
}
|
247
517
|
};
|
248
518
|
|
@@ -252,7 +522,7 @@
|
|
252
522
|
} else if (typeof method === 'object' || !method) {
|
253
523
|
return methods.init.apply(this, arguments);
|
254
524
|
} else {
|
255
|
-
$.error('Method ' + method + ' does not exist on jQuery.fileUploadUI');
|
525
|
+
$.error('Method "' + method + '" does not exist on jQuery.fileUploadUI');
|
256
526
|
}
|
257
527
|
};
|
258
528
|
|