|
1 | 1 | /*
|
2 |
| - * jQuery File Upload Plugin 5.7 |
| 2 | + * jQuery File Upload Plugin 5.8 |
3 | 3 | * https://github.com/blueimp/jQuery-File-Upload
|
4 | 4 | *
|
5 | 5 | * Copyright 2010, Sebastian Tschan
|
|
767 | 767 | .unbind('change.' + ns, this._onChange);
|
768 | 768 | },
|
769 | 769 |
|
770 |
| - _beforeSetOption: function (key, value) { |
771 |
| - this._destroyEventHandlers(); |
772 |
| - }, |
773 |
| - |
774 |
| - _afterSetOption: function (key, value) { |
775 |
| - var options = this.options; |
776 |
| - if (!options.fileInput) { |
777 |
| - options.fileInput = $(); |
778 |
| - } |
779 |
| - if (!options.dropZone) { |
780 |
| - options.dropZone = $(); |
781 |
| - } |
782 |
| - this._initEventHandlers(); |
783 |
| - }, |
784 |
| - |
785 | 770 | _setOption: function (key, value) {
|
786 | 771 | var refresh = $.inArray(key, this._refreshOptionsList) !== -1;
|
787 | 772 | if (refresh) {
|
788 |
| - this._beforeSetOption(key, value); |
| 773 | + this._destroyEventHandlers(); |
789 | 774 | }
|
790 | 775 | $.Widget.prototype._setOption.call(this, key, value);
|
791 | 776 | if (refresh) {
|
792 |
| - this._afterSetOption(key, value); |
| 777 | + this._initSpecialOptions(); |
| 778 | + this._initEventHandlers(); |
793 | 779 | }
|
794 | 780 | },
|
795 | 781 |
|
796 |
| - _create: function () { |
| 782 | + _initSpecialOptions: function () { |
797 | 783 | var options = this.options;
|
798 |
| - options.namespace = options.namespace || this.widgetName; |
799 | 784 | if (options.fileInput === undefined) {
|
800 | 785 | options.fileInput = this.element.is('input:file') ?
|
801 | 786 | this.element : this.element.find('input:file');
|
802 |
| - } else if (!options.fileInput) { |
803 |
| - options.fileInput = $(); |
| 787 | + } else if (!(options.fileInput instanceof $)) { |
| 788 | + options.fileInput = $(options.fileInput); |
804 | 789 | }
|
805 |
| - if (!options.dropZone) { |
806 |
| - options.dropZone = $(); |
| 790 | + if (!(options.dropZone instanceof $)) { |
| 791 | + options.dropZone = $(options.dropZone); |
807 | 792 | }
|
| 793 | + }, |
| 794 | + |
| 795 | + _create: function () { |
| 796 | + var options = this.options, |
| 797 | + dataOpts = $.extend({}, this.element.data()); |
| 798 | + dataOpts[this.widgetName] = undefined; |
| 799 | + $.extend(options, dataOpts); |
| 800 | + options.namespace = options.namespace || this.widgetName; |
| 801 | + this._initSpecialOptions(); |
808 | 802 | this._slots = [];
|
809 | 803 | this._sequence = this._getXHRPromise(true);
|
810 | 804 | this._sending = this._active = this._loaded = this._total = 0;
|
|
0 commit comments