From 3cd1e2dccd9476f0847c343b206df4e0dbe6c0b9 Mon Sep 17 00:00:00 2001 From: Chris Whitman Date: Wed, 23 May 2012 06:41:04 -0700 Subject: [PATCH 1/4] Remove tmpl.js (JS template engine) from manifest --- vendor/assets/javascripts/jquery-fileupload/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/vendor/assets/javascripts/jquery-fileupload/index.js b/vendor/assets/javascripts/jquery-fileupload/index.js index 0cda385..3087040 100644 --- a/vendor/assets/javascripts/jquery-fileupload/index.js +++ b/vendor/assets/javascripts/jquery-fileupload/index.js @@ -1,7 +1,6 @@ //=require jquery-fileupload/vendor/jquery.ui.widget //=require jquery-fileupload/vendor/load-image //=require jquery-fileupload/vendor/canvas-to-blob -//=require jquery-fileupload/vendor/tmpl //=require jquery-fileupload/jquery.iframe-transport //=require jquery-fileupload/jquery.fileupload //=require jquery-fileupload/jquery.fileupload-fp From 760c9569bae54d79c0b66d693ca56774f1a56c0e Mon Sep 17 00:00:00 2001 From: Waseem Ahmad Date: Wed, 17 Apr 2013 03:25:07 +0530 Subject: [PATCH 2/4] Make sure no error is raised if fileupload element is not present in DOM --- .../jquery-fileupload/jquery.fileupload-ui.js | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js index 57ef7b6..6d19391 100644 --- a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js +++ b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js @@ -146,21 +146,23 @@ if (file.error) { that._adjustMaxNumberOfFiles(1); } - that._transition($(this)).done( - function () { - var node = $(this); - template = that._renderDownload([file]) - .css('height', node.height()) - .replaceAll(node); - that._forceReflow(template); - that._transition(template).done( - function () { - data.context = $(this); - that._trigger('completed', e, data); - } - ); - } - ); + if (that) { + that._transition($(this)).done( + function () { + var node = $(this); + template = that._renderDownload([file]) + .css('height', node.height()) + .replaceAll(node); + that._forceReflow(template); + that._transition(template).done( + function () { + data.context = $(this); + that._trigger('completed', e, data); + } + ); + } + ); + } }); } else { template = that._renderDownload(data.result) From 851cda559c5a7c0e52c4ca8244ba1038e057623a Mon Sep 17 00:00:00 2001 From: Chris Whitman Date: Wed, 23 May 2012 06:41:04 -0700 Subject: [PATCH 3/4] Remove tmpl.js (JS template engine) from manifest --- vendor/assets/javascripts/jquery-fileupload/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/vendor/assets/javascripts/jquery-fileupload/index.js b/vendor/assets/javascripts/jquery-fileupload/index.js index 0cda385..3087040 100644 --- a/vendor/assets/javascripts/jquery-fileupload/index.js +++ b/vendor/assets/javascripts/jquery-fileupload/index.js @@ -1,7 +1,6 @@ //=require jquery-fileupload/vendor/jquery.ui.widget //=require jquery-fileupload/vendor/load-image //=require jquery-fileupload/vendor/canvas-to-blob -//=require jquery-fileupload/vendor/tmpl //=require jquery-fileupload/jquery.iframe-transport //=require jquery-fileupload/jquery.fileupload //=require jquery-fileupload/jquery.fileupload-fp From 5d7e0cb470862ae8e6cb854d010baf4ff6c8c182 Mon Sep 17 00:00:00 2001 From: Waseem Ahmad Date: Wed, 17 Apr 2013 03:25:07 +0530 Subject: [PATCH 4/4] Make sure no error is raised if fileupload element is not present in DOM --- .../jquery-fileupload/jquery.fileupload-ui.js | 518 ++++++++++-------- 1 file changed, 289 insertions(+), 229 deletions(-) diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js index 5d22346..6d19391 100755 --- a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js +++ b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload User Interface Plugin 8.2.1 + * jQuery File Upload User Interface Plugin 6.8.2 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2010, Sebastian Tschan @@ -10,7 +10,7 @@ */ /*jslint nomen: true, unparam: true, regexp: true */ -/*global define, window, URL, webkitURL, FileReader */ +/*global define, window, document, URL, webkitURL, FileReader */ (function (factory) { 'use strict'; @@ -19,34 +19,53 @@ define([ 'jquery', 'tmpl', - './jquery.fileupload-resize', - './jquery.fileupload-validate' + 'load-image', + './jquery.fileupload-fp' ], factory); } else { // Browser globals: factory( window.jQuery, - window.tmpl + window.tmpl, + window.loadImage ); } }(function ($, tmpl, loadImage) { 'use strict'; - $.blueimp.fileupload.prototype._specialOptions.push( - 'filesContainer', - 'uploadTemplateId', - 'downloadTemplateId' - ); - - // The UI version extends the file upload widget - // and adds complete user interface interaction: - $.widget('blueimp.fileupload', $.blueimp.fileupload, { + // The UI version extends the FP (file processing) version or the basic + // file upload widget and adds complete user interface interaction: + var parentWidget = ($.blueimpFP || $.blueimp).fileupload; + $.widget('blueimpUI.fileupload', parentWidget, { options: { // By default, files added to the widget are uploaded as soon // as the user clicks on the start buttons. To enable automatic // uploads, set the following option to true: autoUpload: false, + // The following option limits the number of files that are + // allowed to be uploaded using this widget: + maxNumberOfFiles: undefined, + // The maximum allowed file size: + maxFileSize: undefined, + // The minimum allowed file size: + minFileSize: undefined, + // The regular expression for allowed file types, matches + // against either file type or file name: + acceptFileTypes: /.+$/i, + // The regular expression to define for which files a preview + // image is shown, matched against the file type: + previewSourceFileTypes: /^image\/(gif|jpeg|png)$/, + // The maximum file size of images that are to be displayed as preview: + previewSourceMaxFileSize: 5000000, // 5MB + // The maximum width of the preview images: + previewMaxWidth: 80, + // The maximum height of the preview images: + previewMaxHeight: 80, + // By default, preview images are displayed as canvas elements + // if supported by the browser. Set the following option to false + // to always display preview images as img elements: + previewAsCanvas: true, // The ID of the upload template: uploadTemplateId: 'template-upload', // The ID of the download template: @@ -61,43 +80,28 @@ // option of the $.ajax upload requests: dataType: 'json', - // Function returning the current number of files, - // used by the maxNumberOfFiles validation: - getNumberOfFiles: function () { - return this.filesContainer.children().length; - }, - - // Callback to retrieve the list of files from the server response: - getFilesFromResponse: function (data) { - if (data.result && $.isArray(data.result.files)) { - return data.result.files; - } - return []; - }, - // The add callback is invoked as soon as files are added to the fileupload // widget (via file input selection, drag & drop or add API call). // See the basic file upload widget for more information: add: function (e, data) { - var $this = $(this), - that = $this.data('blueimp-fileupload') || - $this.data('fileupload'), + var that = $(this).data('fileupload'), options = that.options, files = data.files; - data.process(function () { - return $this.fileupload('process', data); - }).always(function () { + $(this).fileupload('process', data).done(function () { + that._adjustMaxNumberOfFiles(-files.length); + data.isAdjusted = true; + data.files.valid = data.isValidated = that._validate(files); data.context = that._renderUpload(files).data('data', data); - that._renderPreviews(data); options.filesContainer[ options.prependFiles ? 'prepend' : 'append' ](data.context); + that._renderPreviews(files, data.context); that._forceReflow(data.context); that._transition(data.context).done( function () { if ((that._trigger('added', e, data) !== false) && (options.autoUpload || data.autoUpload) && - data.autoUpload !== false && !data.files.error) { + data.autoUpload !== false && data.isValidated) { data.submit(); } } @@ -106,8 +110,15 @@ }, // Callback for the start of each file upload request: send: function (e, data) { - var that = $(this).data('blueimp-fileupload') || - $(this).data('fileupload'); + var that = $(this).data('fileupload'); + if (!data.isValidated) { + if (!data.isAdjusted) { + that._adjustMaxNumberOfFiles(-data.files.length); + } + if (!that._validate(data.files)) { + return false; + } + } if (data.context && data.dataType && data.dataType.substr(0, 6) === 'iframe') { // Iframe Transport does not support progress events. @@ -117,73 +128,65 @@ .find('.progress').addClass( !$.support.transition && 'progress-animated' ) - .attr('aria-valuenow', 100) .find('.bar').css( 'width', - '100%' + parseInt(100, 10) + '%' ); } return that._trigger('sent', e, data); }, // Callback for successful uploads: done: function (e, data) { - var that = $(this).data('blueimp-fileupload') || - $(this).data('fileupload'), - getFilesFromResponse = data.getFilesFromResponse || - that.options.getFilesFromResponse, - files = getFilesFromResponse(data), - template, - deferred; + var that = $(this).data('fileupload'), + template; if (data.context) { data.context.each(function (index) { - var file = files[index] || - {error: 'Empty file upload result'}, - deferred = that._addFinishedDeferreds(); - that._transition($(this)).done( - function () { - var node = $(this); - template = that._renderDownload([file]) - .replaceAll(node); - that._forceReflow(template); - that._transition(template).done( - function () { - data.context = $(this); - that._trigger('completed', e, data); - that._trigger('finished', e, data); - deferred.resolve(); - } - ); - } - ); + var file = ($.isArray(data.result) && + data.result[index]) || {error: 'emptyResult'}; + if (file.error) { + that._adjustMaxNumberOfFiles(1); + } + if (that) { + that._transition($(this)).done( + function () { + var node = $(this); + template = that._renderDownload([file]) + .css('height', node.height()) + .replaceAll(node); + that._forceReflow(template); + that._transition(template).done( + function () { + data.context = $(this); + that._trigger('completed', e, data); + } + ); + } + ); + } }); } else { - template = that._renderDownload(files) + template = that._renderDownload(data.result) .appendTo(that.options.filesContainer); that._forceReflow(template); - deferred = that._addFinishedDeferreds(); that._transition(template).done( function () { data.context = $(this); that._trigger('completed', e, data); - that._trigger('finished', e, data); - deferred.resolve(); } ); } }, // Callback for failed (abort or error) uploads: fail: function (e, data) { - var that = $(this).data('blueimp-fileupload') || - $(this).data('fileupload'), - template, - deferred; + var that = $(this).data('fileupload'), + template; + that._adjustMaxNumberOfFiles(data.files.length); if (data.context) { data.context.each(function (index) { if (data.errorThrown !== 'abort') { var file = data.files[index]; file.error = file.error || data.errorThrown || true; - deferred = that._addFinishedDeferreds(); that._transition($(this)).done( function () { var node = $(this); @@ -194,82 +197,62 @@ function () { data.context = $(this); that._trigger('failed', e, data); - that._trigger('finished', e, data); - deferred.resolve(); } ); } ); } else { - deferred = that._addFinishedDeferreds(); that._transition($(this)).done( function () { $(this).remove(); that._trigger('failed', e, data); - that._trigger('finished', e, data); - deferred.resolve(); } ); } }); } else if (data.errorThrown !== 'abort') { + that._adjustMaxNumberOfFiles(-data.files.length); data.context = that._renderUpload(data.files) .appendTo(that.options.filesContainer) .data('data', data); that._forceReflow(data.context); - deferred = that._addFinishedDeferreds(); that._transition(data.context).done( function () { data.context = $(this); that._trigger('failed', e, data); - that._trigger('finished', e, data); - deferred.resolve(); } ); } else { that._trigger('failed', e, data); - that._trigger('finished', e, data); - that._addFinishedDeferreds().resolve(); } }, // Callback for upload progress events: progress: function (e, data) { if (data.context) { - var progress = Math.floor(data.loaded / data.total * 100); - data.context.find('.progress') - .attr('aria-valuenow', progress) - .find('.bar').css( - 'width', - progress + '%' - ); + data.context.find('.bar').css( + 'width', + parseInt(data.loaded / data.total * 100, 10) + '%' + ); } }, // Callback for global upload progress events: progressall: function (e, data) { - var $this = $(this), - progress = Math.floor(data.loaded / data.total * 100), - globalProgressNode = $this.find('.fileupload-progress'), - extendedProgressNode = globalProgressNode - .find('.progress-extended'); - if (extendedProgressNode.length) { - extendedProgressNode.html( - ($this.data('blueimp-fileupload') || $this.data('fileupload')) - ._renderExtendedProgress(data) - ); - } - globalProgressNode - .find('.progress') - .attr('aria-valuenow', progress) + var $this = $(this); + $this.find('.fileupload-progress') .find('.bar').css( 'width', - progress + '%' - ); + parseInt(data.loaded / data.total * 100, 10) + '%' + ).end() + .find('.progress-extended').each(function () { + $(this).html( + $this.data('fileupload') + ._renderExtendedProgress(data) + ); + }); }, // Callback for uploads start, equivalent to the global ajaxStart event: start: function (e) { - var that = $(this).data('blueimp-fileupload') || - $(this).data('fileupload'); - that._resetFinishedDeferreds(); + var that = $(this).data('fileupload'); that._transition($(this).find('.fileupload-progress')).done( function () { that._trigger('started', e); @@ -278,62 +261,31 @@ }, // Callback for uploads stop, equivalent to the global ajaxStop event: stop: function (e) { - var that = $(this).data('blueimp-fileupload') || - $(this).data('fileupload'), - deferred = that._addFinishedDeferreds(); - $.when.apply($, that._getFinishedDeferreds()) - .done(function () { - that._trigger('stopped', e); - }); + var that = $(this).data('fileupload'); that._transition($(this).find('.fileupload-progress')).done( function () { - $(this).find('.progress') - .attr('aria-valuenow', '0') - .find('.bar').css('width', '0%'); + $(this).find('.bar').css('width', '0%'); $(this).find('.progress-extended').html(' '); - deferred.resolve(); + that._trigger('stopped', e); } ); }, - processstart: function () { - $(this).addClass('fileupload-processing'); - }, - processstop: function () { - $(this).removeClass('fileupload-processing'); - }, // Callback for file deletion: destroy: function (e, data) { - var that = $(this).data('blueimp-fileupload') || - $(this).data('fileupload'); + var that = $(this).data('fileupload'); if (data.url) { - $.ajax(data).done(function () { - that._transition(data.context).done( - function () { - $(this).remove(); - that._trigger('destroyed', e, data); - } - ); - }); + $.ajax(data); + that._adjustMaxNumberOfFiles(1); } + that._transition(data.context).done( + function () { + $(this).remove(); + that._trigger('destroyed', e, data); + } + ); } }, - _resetFinishedDeferreds: function () { - this._finishedUploads = []; - }, - - _addFinishedDeferreds: function (deferred) { - if (!deferred) { - deferred = $.Deferred(); - } - this._finishedUploads.push(deferred); - return deferred; - }, - - _getFinishedDeferreds: function () { - return this._finishedUploads; - }, - // Link handler, that allows to download files // by drag & drop of the links to the desktop: _enableDragToDesktop: function () { @@ -347,10 +299,21 @@ 'DownloadURL', [type, name, url].join(':') ); - } catch (ignore) {} + } catch (err) {} }); }, + _adjustMaxNumberOfFiles: function (operand) { + if (typeof this.options.maxNumberOfFiles === 'number') { + this.options.maxNumberOfFiles += operand; + if (this.options.maxNumberOfFiles < 1) { + this._disableFileInputButton(); + } else { + this._enableFileInputButton(); + } + } + }, + _formatFileSize: function (bytes) { if (typeof bytes !== 'number') { return ''; @@ -377,12 +340,12 @@ if (bits >= 1000) { return (bits / 1000).toFixed(2) + ' kbit/s'; } - return bits.toFixed(2) + ' bit/s'; + return bits + ' bit/s'; }, _formatTime: function (seconds) { var date = new Date(seconds * 1000), - days = Math.floor(seconds / 86400); + days = parseInt(seconds / 86400, 10); days = days ? days + 'd ' : ''; return days + ('0' + date.getUTCHours()).slice(-2) + ':' + @@ -406,6 +369,46 @@ this._formatFileSize(data.total); }, + _hasError: function (file) { + if (file.error) { + return file.error; + } + // The number of added files is subtracted from + // maxNumberOfFiles before validation, so we check if + // maxNumberOfFiles is below 0 (instead of below 1): + if (this.options.maxNumberOfFiles < 0) { + return 'maxNumberOfFiles'; + } + // Files are accepted if either the file type or the file name + // matches against the acceptFileTypes regular expression, as + // only browsers with support for the File API report the type: + if (!(this.options.acceptFileTypes.test(file.type) || + this.options.acceptFileTypes.test(file.name))) { + return 'acceptFileTypes'; + } + if (this.options.maxFileSize && + file.size > this.options.maxFileSize) { + return 'maxFileSize'; + } + if (typeof file.size === 'number' && + file.size < this.options.minFileSize) { + return 'minFileSize'; + } + return null; + }, + + _validate: function (files) { + var that = this, + valid = !!files.length; + $.each(files, function (index, file) { + file.error = that._hasError(file); + if (file.error) { + valid = false; + } + }); + return valid; + }, + _renderTemplate: function (func, files) { if (!func) { return $(); @@ -421,10 +424,53 @@ return $(this.options.templatesContainer).html(result).children(); }, - _renderPreviews: function (data) { - data.context.find('.preview').each(function (index, elm) { - $(elm).append(data.files[index].preview); + _renderPreview: function (file, node) { + var that = this, + options = this.options, + dfd = $.Deferred(); + return ((loadImage && loadImage( + file, + function (img) { + node.append(img); + that._forceReflow(node); + that._transition(node).done(function () { + dfd.resolveWith(node); + }); + if (!$.contains(document.body, node[0])) { + // If the element is not part of the DOM, + // transition events are not triggered, + // so we have to resolve manually: + dfd.resolveWith(node); + } + }, + { + maxWidth: options.previewMaxWidth, + maxHeight: options.previewMaxHeight, + canvas: options.previewAsCanvas + } + )) || dfd.resolveWith(node)) && dfd; + }, + + _renderPreviews: function (files, nodes) { + var that = this, + options = this.options; + nodes.find('.preview span').each(function (index, element) { + var file = files[index]; + if (options.previewSourceFileTypes.test(file.type) && + ($.type(options.previewSourceMaxFileSize) !== 'number' || + file.size < options.previewSourceMaxFileSize)) { + that._processingQueue = that._processingQueue.pipe(function () { + var dfd = $.Deferred(); + that._renderPreview(file, $(element)).done( + function () { + dfd.resolveWith(that); + } + ); + return dfd.promise(); + }); + } }); + return this._processingQueue; }, _renderUpload: function (files) { @@ -443,7 +489,7 @@ _startHandler: function (e) { e.preventDefault(); - var button = $(e.currentTarget), + var button = $(this), template = button.closest('.template-upload'), data = template.data('data'); if (data && data.submit && !data.jqXHR && data.submit()) { @@ -453,11 +499,11 @@ _cancelHandler: function (e) { e.preventDefault(); - var template = $(e.currentTarget).closest('.template-upload'), + var template = $(this).closest('.template-upload'), data = template.data('data') || {}; if (!data.jqXHR) { data.errorThrown = 'abort'; - this._trigger('fail', e, data); + e.data.fileupload._trigger('fail', e, data); } else { data.jqXHR.abort(); } @@ -465,21 +511,23 @@ _deleteHandler: function (e) { e.preventDefault(); - var button = $(e.currentTarget); - this._trigger('destroy', e, $.extend({ + var button = $(this); + e.data.fileupload._trigger('destroy', e, { context: button.closest('.template-download'), - type: 'DELETE' - }, button.data())); + url: button.attr('data-url'), + type: button.attr('data-type') || 'DELETE', + dataType: e.data.fileupload.options.dataType + }); }, _forceReflow: function (node) { - return $.support.transition && node.length && - node[0].offsetWidth; + this._reflow = $.support.transition && + node.length && node[0].offsetWidth; }, _transition: function (node) { var dfd = $.Deferred(); - if ($.support.transition && node.hasClass('fade') && node.is(':visible')) { + if ($.support.transition && node.hasClass('fade')) { node.bind( $.support.transition.end, function (e) { @@ -500,65 +548,75 @@ _initButtonBarEventHandlers: function () { var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'), - filesList = this.options.filesContainer; - this._on(fileUploadButtonBar.find('.start'), { - click: function (e) { + filesList = this.options.filesContainer, + ns = this.options.namespace; + fileUploadButtonBar.find('.start') + .bind('click.' + ns, function (e) { e.preventDefault(); - filesList.find('.start').click(); - } - }); - this._on(fileUploadButtonBar.find('.cancel'), { - click: function (e) { + filesList.find('.start button').click(); + }); + fileUploadButtonBar.find('.cancel') + .bind('click.' + ns, function (e) { e.preventDefault(); - filesList.find('.cancel').click(); - } - }); - this._on(fileUploadButtonBar.find('.delete'), { - click: function (e) { + filesList.find('.cancel button').click(); + }); + fileUploadButtonBar.find('.delete') + .bind('click.' + ns, function (e) { e.preventDefault(); - filesList.find('.toggle:checked') - .closest('.template-download') - .find('.delete').click(); + filesList.find('.delete input:checked') + .siblings('button').click(); fileUploadButtonBar.find('.toggle') .prop('checked', false); - } - }); - this._on(fileUploadButtonBar.find('.toggle'), { - change: function (e) { - filesList.find('.toggle').prop( + }); + fileUploadButtonBar.find('.toggle') + .bind('change.' + ns, function (e) { + filesList.find('.delete input').prop( 'checked', - $(e.currentTarget).is(':checked') + $(this).is(':checked') ); - } - }); + }); }, _destroyButtonBarEventHandlers: function () { - this._off( - this.element.find('.fileupload-buttonbar') - .find('.start, .cancel, .delete'), - 'click' - ); - this._off( - this.element.find('.fileupload-buttonbar .toggle'), - 'change.' - ); + this.element.find('.fileupload-buttonbar button') + .unbind('click.' + this.options.namespace); + this.element.find('.fileupload-buttonbar .toggle') + .unbind('change.' + this.options.namespace); }, _initEventHandlers: function () { - this._super(); - this._on(this.options.filesContainer, { - 'click .start': this._startHandler, - 'click .cancel': this._cancelHandler, - 'click .delete': this._deleteHandler - }); + parentWidget.prototype._initEventHandlers.call(this); + var eventData = {fileupload: this}; + this.options.filesContainer + .delegate( + '.start button', + 'click.' + this.options.namespace, + eventData, + this._startHandler + ) + .delegate( + '.cancel button', + 'click.' + this.options.namespace, + eventData, + this._cancelHandler + ) + .delegate( + '.delete button', + 'click.' + this.options.namespace, + eventData, + this._deleteHandler + ); this._initButtonBarEventHandlers(); }, _destroyEventHandlers: function () { + var options = this.options; this._destroyButtonBarEventHandlers(); - this._off(this.options.filesContainer, 'click'); - this._super(); + options.filesContainer + .undelegate('.start button', 'click.' + options.namespace) + .undelegate('.cancel button', 'click.' + options.namespace) + .undelegate('.delete button', 'click.' + options.namespace); + parentWidget.prototype._destroyEventHandlers.call(this); }, _enableFileInputButton: function () { @@ -575,7 +633,7 @@ _initTemplates: function () { var options = this.options; - options.templatesContainer = this.document[0].createElement( + options.templatesContainer = document.createElement( options.filesContainer.prop('nodeName') ); if (tmpl) { @@ -598,34 +656,36 @@ }, _initSpecialOptions: function () { - this._super(); + parentWidget.prototype._initSpecialOptions.call(this); this._initFilesContainer(); this._initTemplates(); }, _create: function () { - this._super(); - this._resetFinishedDeferreds(); + parentWidget.prototype._create.call(this); + this._refreshOptionsList.push( + 'filesContainer', + 'uploadTemplateId', + 'downloadTemplateId' + ); + if (!$.blueimpFP) { + this._processingQueue = $.Deferred().resolveWith(this).promise(); + this.process = function () { + return this._processingQueue; + }; + } }, enable: function () { - var wasDisabled = false; - if (this.options.disabled) { - wasDisabled = true; - } - this._super(); - if (wasDisabled) { - this.element.find('input, button').prop('disabled', false); - this._enableFileInputButton(); - } + parentWidget.prototype.enable.call(this); + this.element.find('input, button').prop('disabled', false); + this._enableFileInputButton(); }, disable: function () { - if (!this.options.disabled) { - this.element.find('input, button').prop('disabled', true); - this._disableFileInputButton(); - } - this._super(); + this.element.find('input, button').prop('disabled', true); + this._disableFileInputButton(); + parentWidget.prototype.disable.call(this); } });