avatars_for_rails 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,529 +0,0 @@
|
|
1
|
-
/*
|
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
|
7
|
-
*
|
8
|
-
* Licensed under the MIT license:
|
9
|
-
* http://creativecommons.org/licenses/MIT/
|
10
|
-
*/
|
11
|
-
|
12
|
-
/*jslint browser: true */
|
13
|
-
/*global jQuery, FileReader, URL, webkitURL */
|
14
|
-
|
15
|
-
(function ($) {
|
16
|
-
'use strict';
|
17
|
-
|
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
|
-
};
|
42
|
-
|
43
|
-
UploadHandler = function (container, options) {
|
44
|
-
var uploadHandler = this,
|
45
|
-
dragOverTimeout,
|
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
|
-
};
|
63
|
-
|
64
|
-
this.requestHeaders = {'Accept': 'application/json, text/javascript, */*; q=0.01'};
|
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';
|
71
|
-
this.progressSelector = '.file_upload_progress div';
|
72
|
-
this.cancelSelector = '.file_upload_cancel button';
|
73
|
-
this.cssClassSmall = 'file_upload_small';
|
74
|
-
this.cssClassLarge = 'file_upload_large';
|
75
|
-
this.cssClassHighlight = 'file_upload_highlight';
|
76
|
-
this.dropEffect = 'highlight';
|
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
|
-
}
|
129
|
-
};
|
130
|
-
|
131
|
-
this.addNode = function (parentNode, node, callBack) {
|
132
|
-
if (parentNode && parentNode.length && node && node.length) {
|
133
|
-
node.css('display', 'none').appendTo(parentNode).fadeIn(function () {
|
134
|
-
if (typeof callBack === func) {
|
135
|
-
try {
|
136
|
-
callBack();
|
137
|
-
} catch (e) {
|
138
|
-
// Fix endless exception loop:
|
139
|
-
node.stop();
|
140
|
-
throw e;
|
141
|
-
}
|
142
|
-
}
|
143
|
-
});
|
144
|
-
} else if (typeof callBack === func) {
|
145
|
-
callBack();
|
146
|
-
}
|
147
|
-
};
|
148
|
-
|
149
|
-
this.removeNode = function (node, callBack) {
|
150
|
-
if (node && node.length) {
|
151
|
-
node.fadeOut(function () {
|
152
|
-
node.remove();
|
153
|
-
if (typeof callBack === func) {
|
154
|
-
try {
|
155
|
-
callBack();
|
156
|
-
} catch (e) {
|
157
|
-
// Fix endless exception loop:
|
158
|
-
node.stop();
|
159
|
-
throw e;
|
160
|
-
}
|
161
|
-
}
|
162
|
-
});
|
163
|
-
} else if (typeof callBack === func) {
|
164
|
-
callBack();
|
165
|
-
}
|
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
|
-
};
|
208
|
-
|
209
|
-
this.onAbort = function (event, files, index, xhr, handler) {
|
210
|
-
handler.removeNode(handler.uploadRow, handler.hideProgressBarAll);
|
211
|
-
};
|
212
|
-
|
213
|
-
this.cancelUpload = function (event, files, index, xhr, handler) {
|
214
|
-
var readyState = xhr.readyState;
|
215
|
-
xhr.abort();
|
216
|
-
// If readyState is below 2, abort() has no effect:
|
217
|
-
if (typeof readyState !== 'number' || readyState < 2) {
|
218
|
-
handler.onAbort(event, files, index, xhr, handler);
|
219
|
-
}
|
220
|
-
};
|
221
|
-
|
222
|
-
this.initProgressBar = function (node, value) {
|
223
|
-
if (!node || !node.length) {
|
224
|
-
return null;
|
225
|
-
}
|
226
|
-
if (typeof node.progressbar === func) {
|
227
|
-
return node.progressbar({
|
228
|
-
value: value
|
229
|
-
});
|
230
|
-
} else {
|
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;
|
243
|
-
}
|
244
|
-
};
|
245
|
-
|
246
|
-
this.destroyProgressBar = function (node) {
|
247
|
-
if (!node || !node.length) {
|
248
|
-
return null;
|
249
|
-
}
|
250
|
-
return node.progressbar('destroy');
|
251
|
-
};
|
252
|
-
|
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
|
-
}
|
260
|
-
};
|
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
|
-
|
272
|
-
this.onProgress = function (event, files, index, xhr, handler) {
|
273
|
-
if (handler.progressbar && event.lengthComputable) {
|
274
|
-
handler.progressbar.progressbar(
|
275
|
-
'value',
|
276
|
-
parseInt(event.loaded / event.total * 100, 10)
|
277
|
-
);
|
278
|
-
}
|
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
|
-
};
|
347
|
-
|
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) {
|
365
|
-
if (typeof xhr.responseText !== undef) {
|
366
|
-
return $.parseJSON(xhr.responseText);
|
367
|
-
} else {
|
368
|
-
// Instead of an XHR object, an iframe is used for legacy browsers:
|
369
|
-
return $.parseJSON(xhr.contents().text());
|
370
|
-
}
|
371
|
-
};
|
372
|
-
|
373
|
-
this.initDownloadRow = function (event, files, index, xhr, handler) {
|
374
|
-
var json, downloadRow;
|
375
|
-
try {
|
376
|
-
json = handler.response = handler.parseResponse(xhr, handler);
|
377
|
-
} catch (e) {
|
378
|
-
if (typeof handler.onError === func) {
|
379
|
-
handler.originalEvent = event;
|
380
|
-
handler.onError(e, files, index, xhr, handler);
|
381
|
-
} else {
|
382
|
-
throw e;
|
383
|
-
}
|
384
|
-
}
|
385
|
-
downloadRow = handler.downloadRow = (typeof handler.buildDownloadRow === func ?
|
386
|
-
handler.buildDownloadRow(json, handler) : null);
|
387
|
-
};
|
388
|
-
|
389
|
-
this.onLoad = function (event, files, index, xhr, handler) {
|
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);
|
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
|
-
);
|
409
|
-
});
|
410
|
-
}
|
411
|
-
};
|
412
|
-
|
413
|
-
this.dropZoneEnlarge = function () {
|
414
|
-
if (!isDropZoneEnlarged) {
|
415
|
-
if (typeof uploadHandler.dropZone.switchClass === func) {
|
416
|
-
uploadHandler.dropZone.switchClass(
|
417
|
-
uploadHandler.cssClassSmall,
|
418
|
-
uploadHandler.cssClassLarge
|
419
|
-
);
|
420
|
-
} else {
|
421
|
-
uploadHandler.dropZone.addClass(uploadHandler.cssClassLarge);
|
422
|
-
uploadHandler.dropZone.removeClass(uploadHandler.cssClassSmall);
|
423
|
-
}
|
424
|
-
isDropZoneEnlarged = true;
|
425
|
-
}
|
426
|
-
};
|
427
|
-
|
428
|
-
this.dropZoneReduce = function () {
|
429
|
-
if (typeof uploadHandler.dropZone.switchClass === func) {
|
430
|
-
uploadHandler.dropZone.switchClass(
|
431
|
-
uploadHandler.cssClassLarge,
|
432
|
-
uploadHandler.cssClassSmall
|
433
|
-
);
|
434
|
-
} else {
|
435
|
-
uploadHandler.dropZone.addClass(uploadHandler.cssClassSmall);
|
436
|
-
uploadHandler.dropZone.removeClass(uploadHandler.cssClassLarge);
|
437
|
-
}
|
438
|
-
isDropZoneEnlarged = false;
|
439
|
-
};
|
440
|
-
|
441
|
-
this.onDocumentDragEnter = function (event) {
|
442
|
-
uploadHandler.dropZoneEnlarge();
|
443
|
-
};
|
444
|
-
|
445
|
-
this.onDocumentDragOver = function (event) {
|
446
|
-
if (dragOverTimeout) {
|
447
|
-
clearTimeout(dragOverTimeout);
|
448
|
-
}
|
449
|
-
dragOverTimeout = setTimeout(function () {
|
450
|
-
uploadHandler.dropZoneReduce();
|
451
|
-
}, 200);
|
452
|
-
};
|
453
|
-
|
454
|
-
this.onDragEnter = this.onDragLeave = function (event) {
|
455
|
-
uploadHandler.dropZone.toggleClass(uploadHandler.cssClassHighlight);
|
456
|
-
};
|
457
|
-
|
458
|
-
this.onDrop = function (event) {
|
459
|
-
if (dragOverTimeout) {
|
460
|
-
clearTimeout(dragOverTimeout);
|
461
|
-
}
|
462
|
-
if (uploadHandler.dropEffect && typeof uploadHandler.dropZone.effect === func) {
|
463
|
-
uploadHandler.dropZone.effect(uploadHandler.dropEffect, function () {
|
464
|
-
uploadHandler.dropZone.removeClass(uploadHandler.cssClassHighlight);
|
465
|
-
uploadHandler.dropZoneReduce();
|
466
|
-
});
|
467
|
-
} else {
|
468
|
-
uploadHandler.dropZone.removeClass(uploadHandler.cssClassHighlight);
|
469
|
-
uploadHandler.dropZoneReduce();
|
470
|
-
}
|
471
|
-
};
|
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
|
-
|
487
|
-
$.extend(this, options);
|
488
|
-
};
|
489
|
-
|
490
|
-
methods = {
|
491
|
-
init : function (options) {
|
492
|
-
return this.each(function () {
|
493
|
-
$(this).fileUpload(new UploadHandler($(this), options));
|
494
|
-
});
|
495
|
-
},
|
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
|
-
|
506
|
-
destroy : function (namespace) {
|
507
|
-
return this.each(function () {
|
508
|
-
$(this).fileUpload('destroy', namespace);
|
509
|
-
});
|
510
|
-
},
|
511
|
-
|
512
|
-
upload: function (files, namespace) {
|
513
|
-
return this.each(function () {
|
514
|
-
$(this).fileUpload('upload', files, namespace);
|
515
|
-
});
|
516
|
-
}
|
517
|
-
};
|
518
|
-
|
519
|
-
$.fn.fileUploadUI = function (method) {
|
520
|
-
if (methods[method]) {
|
521
|
-
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
522
|
-
} else if (typeof method === 'object' || !method) {
|
523
|
-
return methods.init.apply(this, arguments);
|
524
|
-
} else {
|
525
|
-
$.error('Method "' + method + '" does not exist on jQuery.fileUploadUI');
|
526
|
-
}
|
527
|
-
};
|
528
|
-
|
529
|
-
}(jQuery));
|