|
207 | 207 | return true;
|
208 | 208 | }
|
209 | 209 |
|
210 |
| - return this.each(function() { |
211 |
| - this.html5_upload = { |
212 |
| - xhr: new XMLHttpRequest(), |
213 |
| - continue_after_abort: true |
214 |
| - }; |
215 |
| - if (options.autostart) { |
216 |
| - $(this).bind('change', upload); |
217 |
| - } |
218 |
| - for (event in available_events) { |
219 |
| - if (options[available_events[event]]) { |
220 |
| - $(this).bind("html5_upload."+available_events[event], options[available_events[event]]); |
| 210 | + try { |
| 211 | + return this.each(function() { |
| 212 | + this.html5_upload = { |
| 213 | + xhr: new XMLHttpRequest(), |
| 214 | + continue_after_abort: true |
| 215 | + }; |
| 216 | + if (options.autostart) { |
| 217 | + $(this).bind('change', upload); |
221 | 218 | }
|
222 |
| - } |
223 |
| - $(this) |
224 |
| - .bind('html5_upload.start', upload) |
225 |
| - .bind('html5_upload.cancelOne', function() { |
226 |
| - this.html5_upload['xhr'].abort(); |
227 |
| - }) |
228 |
| - .bind('html5_upload.cancelAll', function() { |
229 |
| - this.html5_upload['continue_after_abort'] = false; |
230 |
| - this.html5_upload['xhr'].abort(); |
231 |
| - }) |
232 |
| - .bind('html5_upload.destroy', function() { |
233 |
| - this.html5_upload['continue_after_abort'] = false; |
234 |
| - this.xhr.abort(); |
235 |
| - delete this.html5_upload; |
236 |
| - $(this).unbind('html5_upload.*').unbind('change', upload); |
237 |
| - }); |
238 |
| - }); |
| 219 | + for (event in available_events) { |
| 220 | + if (options[available_events[event]]) { |
| 221 | + $(this).bind("html5_upload."+available_events[event], options[available_events[event]]); |
| 222 | + } |
| 223 | + } |
| 224 | + $(this) |
| 225 | + .bind('html5_upload.start', upload) |
| 226 | + .bind('html5_upload.cancelOne', function() { |
| 227 | + this.html5_upload['xhr'].abort(); |
| 228 | + }) |
| 229 | + .bind('html5_upload.cancelAll', function() { |
| 230 | + this.html5_upload['continue_after_abort'] = false; |
| 231 | + this.html5_upload['xhr'].abort(); |
| 232 | + }) |
| 233 | + .bind('html5_upload.destroy', function() { |
| 234 | + this.html5_upload['continue_after_abort'] = false; |
| 235 | + this.xhr.abort(); |
| 236 | + delete this.html5_upload; |
| 237 | + $(this).unbind('html5_upload.*').unbind('change', upload); |
| 238 | + }); |
| 239 | + }); |
| 240 | + } |
| 241 | + catch (ex) { |
| 242 | + options.onBrowserIncompatible(); |
| 243 | + return false; |
| 244 | + } |
239 | 245 | };
|
240 | 246 | })(jQuery);
|
0 commit comments