diff --git a/common/js/plugins/jquery.fileupload/LICENSE.txt b/common/js/plugins/jquery.fileupload/LICENSE.txt deleted file mode 100755 index 87a644638..000000000 --- a/common/js/plugins/jquery.fileupload/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright © 2010 Sebastian Tschan, https://blueimp.net - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/common/js/plugins/jquery.fileupload/css/jquery.fileupload-noscript.css b/common/js/plugins/jquery.fileupload/css/jquery.fileupload-noscript.css index 2409bfb0a..64d728fc3 100644 --- a/common/js/plugins/jquery.fileupload/css/jquery.fileupload-noscript.css +++ b/common/js/plugins/jquery.fileupload/css/jquery.fileupload-noscript.css @@ -1,20 +1,20 @@ @charset "UTF-8"; /* - * jQuery File Upload Plugin NoScript CSS + * jQuery File Upload Plugin NoScript CSS 1.2.0 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ .fileinput-button input { position: static; opacity: 1; filter: none; - font-size: inherit !important; + font-size: inherit; direction: inherit; } .fileinput-button span { diff --git a/common/js/plugins/jquery.fileupload/css/jquery.fileupload-ui-noscript.css b/common/js/plugins/jquery.fileupload/css/jquery.fileupload-ui-noscript.css index 30651acf0..87f110cdb 100644 --- a/common/js/plugins/jquery.fileupload/css/jquery.fileupload-ui-noscript.css +++ b/common/js/plugins/jquery.fileupload/css/jquery.fileupload-ui-noscript.css @@ -1,13 +1,13 @@ @charset "UTF-8"; /* - * jQuery File Upload UI Plugin NoScript CSS + * jQuery File Upload UI Plugin NoScript CSS 8.8.5 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2012, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ .fileinput-button i, diff --git a/common/js/plugins/jquery.fileupload/css/jquery.fileupload-ui.css b/common/js/plugins/jquery.fileupload/css/jquery.fileupload-ui.css index 9e36c42c5..76fb376de 100644 --- a/common/js/plugins/jquery.fileupload/css/jquery.fileupload-ui.css +++ b/common/js/plugins/jquery.fileupload/css/jquery.fileupload-ui.css @@ -1,13 +1,13 @@ @charset "UTF-8"; /* - * jQuery File Upload UI Plugin CSS + * jQuery File Upload UI Plugin CSS 9.0.0 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2010, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ .fileupload-buttonbar .btn, diff --git a/common/js/plugins/jquery.fileupload/css/jquery.fileupload.css b/common/js/plugins/jquery.fileupload/css/jquery.fileupload.css index 8ae3b09d4..fb6044d34 100644 --- a/common/js/plugins/jquery.fileupload/css/jquery.fileupload.css +++ b/common/js/plugins/jquery.fileupload/css/jquery.fileupload.css @@ -1,19 +1,18 @@ @charset "UTF-8"; /* - * jQuery File Upload Plugin CSS + * jQuery File Upload Plugin CSS 1.3.0 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ .fileinput-button { position: relative; overflow: hidden; - display: inline-block; } .fileinput-button input { position: absolute; @@ -22,7 +21,7 @@ margin: 0; opacity: 0; -ms-filter: 'alpha(opacity=0)'; - font-size: 200px !important; + font-size: 200px; direction: ltr; cursor: pointer; } diff --git a/common/js/plugins/jquery.fileupload/js/app.js b/common/js/plugins/jquery.fileupload/js/app.js index e6b7bce3e..548a60d31 100644 --- a/common/js/plugins/jquery.fileupload/js/app.js +++ b/common/js/plugins/jquery.fileupload/js/app.js @@ -1,18 +1,18 @@ /* - * jQuery File Upload Plugin Angular JS Example + * jQuery File Upload Plugin Angular JS Example 1.2.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ /* jshint nomen:false */ /* global window, angular */ -;(function () { +(function () { 'use strict'; var isOnGitHub = window.location.hostname === 'blueimp.github.io', diff --git a/common/js/plugins/jquery.fileupload/js/cors/jquery.postmessage-transport.js b/common/js/plugins/jquery.fileupload/js/cors/jquery.postmessage-transport.js index 2a0c38cb6..65c19e6b1 100644 --- a/common/js/plugins/jquery.fileupload/js/cors/jquery.postmessage-transport.js +++ b/common/js/plugins/jquery.fileupload/js/cors/jquery.postmessage-transport.js @@ -1,17 +1,17 @@ /* - * jQuery postMessage Transport Plugin + * jQuery postMessage Transport Plugin 1.1.2 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2011, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ /* global define, require, window, document */ -;(function (factory) { +(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: @@ -64,12 +64,6 @@ loc = $('').prop('href', options.postMessage)[0], target = loc.protocol + '//' + loc.host, xhrUpload = options.xhr().upload; - // IE always includes the port for the host property of a link - // element, but not in the location.host or origin property for the - // default http port 80 and https port 443, so we strip it: - if (/^(http:\/\/.+:80)|(https:\/\/.+:443)$/.test(target)) { - target = target.replace(/:(80|443)$/, ''); - } return { send: function (_, completeCallback) { counter += 1; diff --git a/common/js/plugins/jquery.fileupload/js/cors/jquery.xdr-transport.js b/common/js/plugins/jquery.fileupload/js/cors/jquery.xdr-transport.js index a4e2699c6..2dfd0faf8 100644 --- a/common/js/plugins/jquery.fileupload/js/cors/jquery.xdr-transport.js +++ b/common/js/plugins/jquery.fileupload/js/cors/jquery.xdr-transport.js @@ -1,12 +1,12 @@ /* - * jQuery XDomainRequest Transport Plugin + * jQuery XDomainRequest Transport Plugin 1.1.4 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2011, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT * * Based on Julian Aubourg's ajaxHooks xdr.js: * https://github.com/jaubourg/ajaxHooks/ @@ -14,7 +14,7 @@ /* global define, require, window, XDomainRequest */ -;(function (factory) { +(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: diff --git a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-angular.js b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-angular.js index 1c2055276..e4ef3926b 100644 --- a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-angular.js +++ b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-angular.js @@ -1,18 +1,18 @@ /* - * jQuery File Upload AngularJS Plugin + * jQuery File Upload AngularJS Plugin 2.2.0 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ /* jshint nomen:false */ -/* global define, angular, require */ +/* global define, angular */ -;(function (factory) { +(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: @@ -24,16 +24,6 @@ './jquery.fileupload-video', './jquery.fileupload-validate' ], factory); - } else if (typeof exports === 'object') { - // Node/CommonJS: - factory( - require('jquery'), - require('angular'), - require('./jquery.fileupload-image'), - require('./jquery.fileupload-audio'), - require('./jquery.fileupload-video'), - require('./jquery.fileupload-validate') - ); } else { factory(); } @@ -101,7 +91,7 @@ angular.forEach(data.files, function (file) { filesCopy.push(file); }); - scope.$parent.$applyAsync(function () { + scope.$apply(function () { addFileMethods(scope, data); var method = scope.option('prependFiles') ? 'unshift' : 'push'; @@ -110,7 +100,7 @@ data.process(function () { return scope.process(data); }).always(function () { - scope.$parent.$applyAsync(function () { + scope.$apply(function () { addFileMethods(scope, data); scope.replace(filesCopy, data.files); }); @@ -122,6 +112,12 @@ } }); }, + progress: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + data.scope.$apply(); + }, done: function (e, data) { if (e.isDefaultPrevented()) { return false; @@ -201,8 +197,8 @@ // The FileUploadController initializes the fileupload widget and // provides scope methods to control the File Upload functionality: .controller('FileUploadController', [ - '$scope', '$element', '$attrs', '$window', 'fileUpload','$q', - function ($scope, $element, $attrs, $window, fileUpload, $q) { + '$scope', '$element', '$attrs', '$window', 'fileUpload', + function ($scope, $element, $attrs, $window, fileUpload) { var uploadMethods = { progress: function () { return $element.fileupload('progress'); @@ -264,21 +260,19 @@ $scope.applyOnQueue = function (method) { var list = this.queue.slice(0), i, - file, - promises = []; + file; for (i = 0; i < list.length; i += 1) { file = list[i]; if (file[method]) { - promises.push(file[method]()); + file[method](); } } - return $q.all(promises); }; $scope.submit = function () { - return this.applyOnQueue('$submit'); + this.applyOnQueue('$submit'); }; $scope.cancel = function () { - return this.applyOnQueue('$cancel'); + this.applyOnQueue('$cancel'); }; // Add upload methods to the scope: angular.extend($scope, uploadMethods); @@ -326,11 +320,9 @@ 'fileuploadprocessalways', 'fileuploadprocessstop' ].join(' '), function (e, data) { - $scope.$parent.$applyAsync(function () { - if ($scope.$emit(e.type, data).defaultPrevented) { - e.preventDefault(); - } - }); + if ($scope.$emit(e.type, data).defaultPrevented) { + e.preventDefault(); + } }).on('remove', function () { // Remove upload methods from the scope, // when the widget is removed: diff --git a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-audio.js b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-audio.js index a25377619..1e3d05de4 100644 --- a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-audio.js +++ b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-audio.js @@ -1,18 +1,18 @@ /* - * jQuery File Upload Audio Preview Plugin + * jQuery File Upload Audio Preview Plugin 1.0.4 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ /* jshint nomen:false */ /* global define, require, window, document */ -;(function (factory) { +(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: @@ -25,8 +25,7 @@ // Node/CommonJS: factory( require('jquery'), - require('blueimp-load-image/js/load-image'), - require('./jquery.fileupload-process') + require('load-image') ); } else { // Browser globals: diff --git a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-image.js b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-image.js index 65fc6d7b8..266b088de 100644 --- a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-image.js +++ b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-image.js @@ -1,18 +1,18 @@ /* - * jQuery File Upload Image Preview & Resize Plugin + * jQuery File Upload Image Preview & Resize Plugin 1.7.3 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ /* jshint nomen:false */ /* global define, require, window, Blob */ -;(function (factory) { +(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: @@ -20,8 +20,8 @@ 'jquery', 'load-image', 'load-image-meta', - 'load-image-scale', 'load-image-exif', + 'load-image-ios', 'canvas-to-blob', './jquery.fileupload-process' ], factory); @@ -29,12 +29,7 @@ // Node/CommonJS: factory( require('jquery'), - require('blueimp-load-image/js/load-image'), - require('blueimp-load-image/js/load-image-meta'), - require('blueimp-load-image/js/load-image-scale'), - require('blueimp-load-image/js/load-image-exif'), - require('blueimp-canvas-to-blob'), - require('./jquery.fileupload-process') + require('load-image') ); } else { // Browser globals: diff --git a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-jquery-ui.js b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-jquery-ui.js index 7b136b379..e6cf5c722 100644 --- a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-jquery-ui.js +++ b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-jquery-ui.js @@ -1,31 +1,25 @@ /* - * jQuery File Upload jQuery UI Plugin + * jQuery File Upload jQuery UI Plugin 8.7.2 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ /* jshint nomen:false */ /* global define, require, window */ -;(function (factory) { +(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: - define([ - 'jquery', - './jquery.fileupload-ui' - ], factory); + define(['jquery', './jquery.fileupload-ui'], factory); } else if (typeof exports === 'object') { // Node/CommonJS: - factory( - require('jquery'), - require('./jquery.fileupload-ui') - ); + factory(require('jquery')); } else { // Browser globals: factory(window.jQuery); diff --git a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-process.js b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-process.js index 638f0d26b..da78fa033 100644 --- a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-process.js +++ b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-process.js @@ -1,18 +1,18 @@ /* - * jQuery File Upload Processing Plugin + * jQuery File Upload Processing Plugin 1.3.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2012, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ /* jshint nomen:false */ /* global define, require, window */ -;(function (factory) { +(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: @@ -22,10 +22,7 @@ ], factory); } else if (typeof exports === 'object') { // Node/CommonJS: - factory( - require('jquery'), - require('./jquery.fileupload') - ); + factory(require('jquery')); } else { // Browser globals: factory( @@ -87,7 +84,7 @@ settings ); }; - chain = chain.then(func, settings.always && func); + chain = chain.pipe(func, settings.always && func); }); chain .done(function () { @@ -154,7 +151,7 @@ }; opts.index = index; that._processing += 1; - that._processingQueue = that._processingQueue.then(func, func) + that._processingQueue = that._processingQueue.pipe(func, func) .always(function () { that._processing -= 1; if (that._processing === 0) { diff --git a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-ui.js b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-ui.js index 5058084b4..1a8e36cc1 100644 --- a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-ui.js +++ b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-ui.js @@ -1,24 +1,24 @@ /* - * jQuery File Upload User Interface Plugin + * jQuery File Upload User Interface Plugin 9.6.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2010, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ /* jshint nomen:false */ /* global define, require, window */ -;(function (factory) { +(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: define([ 'jquery', - 'blueimp-tmpl', + 'tmpl', './jquery.fileupload-image', './jquery.fileupload-audio', './jquery.fileupload-video', @@ -28,11 +28,7 @@ // Node/CommonJS: factory( require('jquery'), - require('blueimp-tmpl'), - require('./jquery.fileupload-image'), - require('./jquery.fileupload-audio'), - require('./jquery.fileupload-video'), - require('./jquery.fileupload-validate') + require('tmpl') ); } else { // Browser globals: @@ -72,10 +68,10 @@ // The expected data type of the upload response, sets the dataType // option of the $.ajax upload requests: dataType: 'json', - + // Error and info messages: messages: { - unknownError: 'Unknown error' + unknownError: 'Unknown error' }, // Function returning the current number of files, diff --git a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-validate.js b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-validate.js index eebeb3733..cb0d9f8b6 100644 --- a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-validate.js +++ b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-validate.js @@ -1,17 +1,17 @@ /* - * jQuery File Upload Validation Plugin + * jQuery File Upload Validation Plugin 1.1.3 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ /* global define, require, window */ -;(function (factory) { +(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: @@ -21,10 +21,7 @@ ], factory); } else if (typeof exports === 'object') { // Node/CommonJS: - factory( - require('jquery'), - require('./jquery.fileupload-process') - ); + factory(require('jquery')); } else { // Browser globals: factory( @@ -39,7 +36,7 @@ { action: 'validate', // Always trigger this action, - // even if the previous action was rejected: + // even if the previous action was rejected: always: true, // Options taken from the global options map: acceptFileTypes: '@', diff --git a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-video.js b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-video.js index aedcec2ba..db5f24800 100644 --- a/common/js/plugins/jquery.fileupload/js/jquery.fileupload-video.js +++ b/common/js/plugins/jquery.fileupload/js/jquery.fileupload-video.js @@ -1,18 +1,18 @@ /* - * jQuery File Upload Video Preview Plugin + * jQuery File Upload Video Preview Plugin 1.0.4 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ /* jshint nomen:false */ /* global define, require, window, document */ -;(function (factory) { +(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: @@ -25,8 +25,7 @@ // Node/CommonJS: factory( require('jquery'), - require('blueimp-load-image/js/load-image'), - require('./jquery.fileupload-process') + require('load-image') ); } else { // Browser globals: diff --git a/common/js/plugins/jquery.fileupload/js/jquery.fileupload.js b/common/js/plugins/jquery.fileupload/js/jquery.fileupload.js index 629f57a25..ab0748fc0 100644 --- a/common/js/plugins/jquery.fileupload/js/jquery.fileupload.js +++ b/common/js/plugins/jquery.fileupload/js/jquery.fileupload.js @@ -1,24 +1,24 @@ /* - * jQuery File Upload Plugin + * jQuery File Upload Plugin 5.42.3 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2010, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ /* jshint nomen:false */ /* global define, require, window, document, location, Blob, FormData */ -;(function (factory) { +(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: define([ 'jquery', - 'jquery-ui/ui/widget' + 'jquery.ui.widget' ], factory); } else if (typeof exports === 'object') { // Node/CommonJS: @@ -43,7 +43,7 @@ '|(Kindle/(1\\.0|2\\.[05]|3\\.0))' ).test(window.navigator.userAgent) || // Feature detection for all other devices: - $('').prop('disabled')); + $('').prop('disabled')); // The FileReader API is not actually used, but works as feature detection, // as some Safari versions (5?) support XHR file uploads via the FormData API, @@ -453,7 +453,7 @@ } if (!multipart || options.blob || !this._isInstanceOf('File', file)) { options.headers['Content-Disposition'] = 'attachment; filename="' + - encodeURI(file.uploadName || file.name) + '"'; + encodeURI(file.name) + '"'; } if (!multipart) { options.contentType = file.type || 'application/octet-stream'; @@ -489,11 +489,7 @@ }); } if (options.blob) { - formData.append( - paramName, - options.blob, - file.uploadName || file.name - ); + formData.append(paramName, options.blob, file.name); } else { $.each(options.files, function (index, file) { // This check allows the tests to run with @@ -656,7 +652,7 @@ data.process = function (resolveFunc, rejectFunc) { if (resolveFunc || rejectFunc) { data._processQueue = this._processQueue = - (this._processQueue || getPromise([this])).then( + (this._processQueue || getPromise([this])).pipe( function () { if (data.errorThrown) { return $.Deferred() @@ -664,7 +660,7 @@ } return getPromise(arguments); } - ).then(resolveFunc, rejectFunc); + ).pipe(resolveFunc, rejectFunc); } return this._processQueue || getPromise([this]); }; @@ -734,7 +730,7 @@ promise = dfd.promise(), jqXHR, upload; - if (!(this._isXHRUpload(options) && slice && (ub || ($.type(mcs) === 'function' ? mcs(options) : mcs) < fs)) || + if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) || options.data) { return false; } @@ -757,7 +753,7 @@ o.blob = slice.call( file, ub, - ub + ($.type(mcs) === 'function' ? mcs(o) : mcs), + ub + mcs, file.type ); // Store the current chunk size, as the blob itself @@ -949,9 +945,9 @@ if (this.options.limitConcurrentUploads > 1) { slot = $.Deferred(); this._slots.push(slot); - pipe = slot.then(send); + pipe = slot.pipe(send); } else { - this._sequence = this._sequence.then(send, send); + this._sequence = this._sequence.pipe(send, send); pipe = this._sequence; } // Return the piped Promise object, enhanced with an abort method, @@ -1050,19 +1046,13 @@ _replaceFileInput: function (data) { var input = data.fileInput, - inputClone = input.clone(true), - restoreFocus = input.is(document.activeElement); + inputClone = input.clone(true); // Add a reference for the new cloned file input to the data argument: data.fileInputClone = inputClone; $('
').append(inputClone)[0].reset(); // Detaching allows to insert the fileInput on another form // without loosing the file input value: input.after(inputClone).detach(); - // If the fileInput had focus before it was detached, - // restore focus to the inputClone. - if (restoreFocus) { - inputClone.focus(); - } // Avoid memory leaks with the detached file input: $.cleanData(input.unbind('remove')); // Replace the original file input element in the fileInput @@ -1084,8 +1074,6 @@ _handleFileTreeEntry: function (entry, path) { var that = this, dfd = $.Deferred(), - entries = [], - dirReader, errorHandler = function (e) { if (e && !e.entry) { e.entry = entry; @@ -1113,7 +1101,8 @@ readEntries(); } }, errorHandler); - }; + }, + dirReader, entries = []; path = path || ''; if (entry.isFile) { if (entry._file) { @@ -1130,7 +1119,7 @@ dirReader = entry.createReader(); readEntries(); } else { - // Return an empty list for file system items + // Return an empy list for file system items // other than files or directories: dfd.resolve([]); } @@ -1144,7 +1133,7 @@ $.map(entries, function (entry) { return that._handleFileTreeEntry(entry, path); }) - ).then(function () { + ).pipe(function () { return Array.prototype.concat.apply( [], arguments @@ -1213,7 +1202,7 @@ return $.when.apply( $, $.map(fileInput, this._getSingleFileInputFiles) - ).then(function () { + ).pipe(function () { return Array.prototype.concat.apply( [], arguments @@ -1316,10 +1305,6 @@ this._off(this.options.fileInput, 'change'); }, - _destroy: function () { - this._destroyEventHandlers(); - }, - _setOption: function (key, value) { var reinit = $.inArray(key, this._specialOptions) !== -1; if (reinit) { diff --git a/common/js/plugins/jquery.fileupload/js/jquery.iframe-transport.js b/common/js/plugins/jquery.fileupload/js/jquery.iframe-transport.js index 8d25c4641..b7581f23f 100644 --- a/common/js/plugins/jquery.fileupload/js/jquery.iframe-transport.js +++ b/common/js/plugins/jquery.fileupload/js/jquery.iframe-transport.js @@ -1,17 +1,17 @@ /* - * jQuery Iframe Transport Plugin + * jQuery Iframe Transport Plugin 1.8.3 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2011, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: - * https://opensource.org/licenses/MIT + * http://www.opensource.org/licenses/MIT */ -/* global define, require, window, document, JSON */ +/* global define, require, window, document */ -;(function (factory) { +(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: @@ -27,14 +27,7 @@ 'use strict'; // Helper variable to create unique names for the transport iframes: - var counter = 0, - jsonAPI = $, - jsonParse = 'parseJSON'; - - if ('JSON' in window && 'parse' in JSON) { - jsonAPI = JSON; - jsonParse = 'parse'; - } + var counter = 0; // The iframe transport accepts four additional options: // options.fileInput: a jQuery collection of file input fields @@ -204,7 +197,7 @@ return iframe && $(iframe[0].body).text(); }, 'iframe json': function (iframe) { - return iframe && jsonAPI[jsonParse]($(iframe[0].body).text()); + return iframe && $.parseJSON($(iframe[0].body).text()); }, 'iframe html': function (iframe) { return iframe && $(iframe[0].body).html(); diff --git a/common/js/plugins/jquery.fileupload/js/vendor/jquery.ui.widget.js b/common/js/plugins/jquery.fileupload/js/vendor/jquery.ui.widget.js index 914b8ffb8..5ac2ed5a5 100644 --- a/common/js/plugins/jquery.fileupload/js/vendor/jquery.ui.widget.js +++ b/common/js/plugins/jquery.fileupload/js/vendor/jquery.ui.widget.js @@ -1,751 +1,562 @@ -/*! jQuery UI - v1.12.1+CommonJS - 2018-02-10 - * http://jqueryui.com - * Includes: widget.js - * Copyright jQuery Foundation and other contributors; Licensed MIT */ +/*! jQuery UI - v1.11.1+CommonJS - 2014-09-17 +* http://jqueryui.com +* Includes: widget.js +* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ (function( factory ) { - if ( typeof define === "function" && define.amd ) { + if ( typeof define === "function" && define.amd ) { - // AMD. Register as an anonymous module. - define([ "jquery" ], factory ); - } else if ( typeof exports === "object" ) { + // AMD. Register as an anonymous module. + define([ "jquery" ], factory ); - // Node/CommonJS - factory( require( "jquery" ) ); - } else { + } else if (typeof exports === "object") { + // Node/CommonJS: + factory(require("jquery")); - // Browser globals - factory( jQuery ); - } + } else { + + // Browser globals + factory( jQuery ); + } }(function( $ ) { - - $.ui = $.ui || {}; - - var version = $.ui.version = "1.12.1"; - - - /*! - * jQuery UI Widget 1.12.1 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ - - //>>label: Widget - //>>group: Core - //>>description: Provides a factory for creating stateful widgets with a common API. - //>>docs: http://api.jqueryui.com/jQuery.widget/ - //>>demos: http://jqueryui.com/widget/ - - - - var widgetUuid = 0; - var widgetSlice = Array.prototype.slice; - - $.cleanData = ( function( orig ) { - return function( elems ) { - var events, elem, i; - for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { - try { - - // Only trigger remove when necessary to save time - events = $._data( elem, "events" ); - if ( events && events.remove ) { - $( elem ).triggerHandler( "remove" ); - } - - // Http://bugs.jquery.com/ticket/8235 - } catch ( e ) {} - } - orig( elems ); - }; - } )( $.cleanData ); - - $.widget = function( name, base, prototype ) { - var existingConstructor, constructor, basePrototype; - - // ProxiedPrototype allows the provided prototype to remain unmodified - // so that it can be used as a mixin for multiple widgets (#8876) - var proxiedPrototype = {}; - - var namespace = name.split( "." )[ 0 ]; - name = name.split( "." )[ 1 ]; - var fullName = namespace + "-" + name; - - if ( !prototype ) { - prototype = base; - base = $.Widget; - } - - if ( $.isArray( prototype ) ) { - prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); - } - - // Create selector for plugin - $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { - return !!$.data( elem, fullName ); - }; - - $[ namespace ] = $[ namespace ] || {}; - existingConstructor = $[ namespace ][ name ]; - constructor = $[ namespace ][ name ] = function( options, element ) { - - // Allow instantiation without "new" keyword - if ( !this._createWidget ) { - return new constructor( options, element ); - } - - // Allow instantiation without initializing for simple inheritance - // must use "new" keyword (the code above always passes args) - if ( arguments.length ) { - this._createWidget( options, element ); - } - }; - - // Extend with the existing constructor to carry over any static properties - $.extend( constructor, existingConstructor, { - version: prototype.version, - - // Copy the object used to create the prototype in case we need to - // redefine the widget later - _proto: $.extend( {}, prototype ), - - // Track widgets that inherit from this widget in case this widget is - // redefined after a widget inherits from it - _childConstructors: [] - } ); - - basePrototype = new base(); - - // We need to make the options hash a property directly on the new instance - // otherwise we'll modify the options hash on the prototype that we're - // inheriting from - basePrototype.options = $.widget.extend( {}, basePrototype.options ); - $.each( prototype, function( prop, value ) { - if ( !$.isFunction( value ) ) { - proxiedPrototype[ prop ] = value; - return; - } - proxiedPrototype[ prop ] = ( function() { - function _super() { - return base.prototype[ prop ].apply( this, arguments ); - } - - function _superApply( args ) { - return base.prototype[ prop ].apply( this, args ); - } - - return function() { - var __super = this._super; - var __superApply = this._superApply; - var returnValue; - - this._super = _super; - this._superApply = _superApply; - - returnValue = value.apply( this, arguments ); - - this._super = __super; - this._superApply = __superApply; - - return returnValue; - }; - } )(); - } ); - constructor.prototype = $.widget.extend( basePrototype, { - - // TODO: remove support for widgetEventPrefix - // always use the name + a colon as the prefix, e.g., draggable:start - // don't prefix for widgets that aren't DOM-based - widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name - }, proxiedPrototype, { - constructor: constructor, - namespace: namespace, - widgetName: name, - widgetFullName: fullName - } ); - - // If this widget is being redefined then we need to find all widgets that - // are inheriting from it and redefine all of them so that they inherit from - // the new version of this widget. We're essentially trying to replace one - // level in the prototype chain. - if ( existingConstructor ) { - $.each( existingConstructor._childConstructors, function( i, child ) { - var childPrototype = child.prototype; - - // Redefine the child widget using the same prototype that was - // originally used, but inherit from the new version of the base - $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, - child._proto ); - } ); - - // Remove the list of existing child constructors from the old constructor - // so the old child constructors can be garbage collected - delete existingConstructor._childConstructors; - } else { - base._childConstructors.push( constructor ); - } - - $.widget.bridge( name, constructor ); - - return constructor; - }; - - $.widget.extend = function( target ) { - var input = widgetSlice.call( arguments, 1 ); - var inputIndex = 0; - var inputLength = input.length; - var key; - var value; - - for ( ; inputIndex < inputLength; inputIndex++ ) { - for ( key in input[ inputIndex ] ) { - value = input[ inputIndex ][ key ]; - if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { - - // Clone objects - if ( $.isPlainObject( value ) ) { - target[ key ] = $.isPlainObject( target[ key ] ) ? - $.widget.extend( {}, target[ key ], value ) : - - // Don't extend strings, arrays, etc. with objects - $.widget.extend( {}, value ); - - // Copy everything else by reference - } else { - target[ key ] = value; - } - } - } - } - return target; - }; - - $.widget.bridge = function( name, object ) { - var fullName = object.prototype.widgetFullName || name; - $.fn[ name ] = function( options ) { - var isMethodCall = typeof options === "string"; - var args = widgetSlice.call( arguments, 1 ); - var returnValue = this; - - if ( isMethodCall ) { - - // If this is an empty collection, we need to have the instance method - // return undefined instead of the jQuery instance - if ( !this.length && options === "instance" ) { - returnValue = undefined; - } else { - this.each( function() { - var methodValue; - var instance = $.data( this, fullName ); - - if ( options === "instance" ) { - returnValue = instance; - return false; - } - - if ( !instance ) { - return $.error( "cannot call methods on " + name + - " prior to initialization; " + - "attempted to call method '" + options + "'" ); - } - - if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) { - return $.error( "no such method '" + options + "' for " + name + - " widget instance" ); - } - - methodValue = instance[ options ].apply( instance, args ); - - if ( methodValue !== instance && methodValue !== undefined ) { - returnValue = methodValue && methodValue.jquery ? - returnValue.pushStack( methodValue.get() ) : - methodValue; - return false; - } - } ); - } - } else { - - // Allow multiple hashes to be passed on init - if ( args.length ) { - options = $.widget.extend.apply( null, [ options ].concat( args ) ); - } - - this.each( function() { - var instance = $.data( this, fullName ); - if ( instance ) { - instance.option( options || {} ); - if ( instance._init ) { - instance._init(); - } - } else { - $.data( this, fullName, new object( options, this ) ); - } - } ); - } - - return returnValue; - }; - }; - - $.Widget = function( /* options, element */ ) {}; - $.Widget._childConstructors = []; - - $.Widget.prototype = { - widgetName: "widget", - widgetEventPrefix: "", - defaultElement: "
", - - options: { - classes: {}, - disabled: false, - - // Callbacks - create: null - }, - - _createWidget: function( options, element ) { - element = $( element || this.defaultElement || this )[ 0 ]; - this.element = $( element ); - this.uuid = widgetUuid++; - this.eventNamespace = "." + this.widgetName + this.uuid; - - this.bindings = $(); - this.hoverable = $(); - this.focusable = $(); - this.classesElementLookup = {}; - - if ( element !== this ) { - $.data( element, this.widgetFullName, this ); - this._on( true, this.element, { - remove: function( event ) { - if ( event.target === element ) { - this.destroy(); - } - } - } ); - this.document = $( element.style ? - - // Element within the document - element.ownerDocument : - - // Element is window or document - element.document || element ); - this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); - } - - this.options = $.widget.extend( {}, - this.options, - this._getCreateOptions(), - options ); - - this._create(); - - if ( this.options.disabled ) { - this._setOptionDisabled( this.options.disabled ); - } - - this._trigger( "create", null, this._getCreateEventData() ); - this._init(); - }, - - _getCreateOptions: function() { - return {}; - }, - - _getCreateEventData: $.noop, - - _create: $.noop, - - _init: $.noop, - - destroy: function() { - var that = this; - - this._destroy(); - $.each( this.classesElementLookup, function( key, value ) { - that._removeClass( value, key ); - } ); - - // We can probably remove the unbind calls in 2.0 - // all event bindings should go through this._on() - this.element - .off( this.eventNamespace ) - .removeData( this.widgetFullName ); - this.widget() - .off( this.eventNamespace ) - .removeAttr( "aria-disabled" ); - - // Clean up events and states - this.bindings.off( this.eventNamespace ); - }, - - _destroy: $.noop, - - widget: function() { - return this.element; - }, - - option: function( key, value ) { - var options = key; - var parts; - var curOption; - var i; - - if ( arguments.length === 0 ) { - - // Don't return a reference to the internal hash - return $.widget.extend( {}, this.options ); - } - - if ( typeof key === "string" ) { - - // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } - options = {}; - parts = key.split( "." ); - key = parts.shift(); - if ( parts.length ) { - curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); - for ( i = 0; i < parts.length - 1; i++ ) { - curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; - curOption = curOption[ parts[ i ] ]; - } - key = parts.pop(); - if ( arguments.length === 1 ) { - return curOption[ key ] === undefined ? null : curOption[ key ]; - } - curOption[ key ] = value; - } else { - if ( arguments.length === 1 ) { - return this.options[ key ] === undefined ? null : this.options[ key ]; - } - options[ key ] = value; - } - } - - this._setOptions( options ); - - return this; - }, - - _setOptions: function( options ) { - var key; - - for ( key in options ) { - this._setOption( key, options[ key ] ); - } - - return this; - }, - - _setOption: function( key, value ) { - if ( key === "classes" ) { - this._setOptionClasses( value ); - } - - this.options[ key ] = value; - - if ( key === "disabled" ) { - this._setOptionDisabled( value ); - } - - return this; - }, - - _setOptionClasses: function( value ) { - var classKey, elements, currentElements; - - for ( classKey in value ) { - currentElements = this.classesElementLookup[ classKey ]; - if ( value[ classKey ] === this.options.classes[ classKey ] || - !currentElements || - !currentElements.length ) { - continue; - } - - // We are doing this to create a new jQuery object because the _removeClass() call - // on the next line is going to destroy the reference to the current elements being - // tracked. We need to save a copy of this collection so that we can add the new classes - // below. - elements = $( currentElements.get() ); - this._removeClass( currentElements, classKey ); - - // We don't use _addClass() here, because that uses this.options.classes - // for generating the string of classes. We want to use the value passed in from - // _setOption(), this is the new value of the classes option which was passed to - // _setOption(). We pass this value directly to _classes(). - elements.addClass( this._classes( { - element: elements, - keys: classKey, - classes: value, - add: true - } ) ); - } - }, - - _setOptionDisabled: function( value ) { - this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); - - // If the widget is becoming disabled, then nothing is interactive - if ( value ) { - this._removeClass( this.hoverable, null, "ui-state-hover" ); - this._removeClass( this.focusable, null, "ui-state-focus" ); - } - }, - - enable: function() { - return this._setOptions( { disabled: false } ); - }, - - disable: function() { - return this._setOptions( { disabled: true } ); - }, - - _classes: function( options ) { - var full = []; - var that = this; - - options = $.extend( { - element: this.element, - classes: this.options.classes || {} - }, options ); - - function processClassString( classes, checkOption ) { - var current, i; - for ( i = 0; i < classes.length; i++ ) { - current = that.classesElementLookup[ classes[ i ] ] || $(); - if ( options.add ) { - current = $( $.unique( current.get().concat( options.element.get() ) ) ); - } else { - current = $( current.not( options.element ).get() ); - } - that.classesElementLookup[ classes[ i ] ] = current; - full.push( classes[ i ] ); - if ( checkOption && options.classes[ classes[ i ] ] ) { - full.push( options.classes[ classes[ i ] ] ); - } - } - } - - this._on( options.element, { - "remove": "_untrackClassesElement" - } ); - - if ( options.keys ) { - processClassString( options.keys.match( /\S+/g ) || [], true ); - } - if ( options.extra ) { - processClassString( options.extra.match( /\S+/g ) || [] ); - } - - return full.join( " " ); - }, - - _untrackClassesElement: function( event ) { - var that = this; - $.each( that.classesElementLookup, function( key, value ) { - if ( $.inArray( event.target, value ) !== -1 ) { - that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); - } - } ); - }, - - _removeClass: function( element, keys, extra ) { - return this._toggleClass( element, keys, extra, false ); - }, - - _addClass: function( element, keys, extra ) { - return this._toggleClass( element, keys, extra, true ); - }, - - _toggleClass: function( element, keys, extra, add ) { - add = ( typeof add === "boolean" ) ? add : extra; - var shift = ( typeof element === "string" || element === null ), - options = { - extra: shift ? keys : extra, - keys: shift ? element : keys, - element: shift ? this.element : element, - add: add - }; - options.element.toggleClass( this._classes( options ), add ); - return this; - }, - - _on: function( suppressDisabledCheck, element, handlers ) { - var delegateElement; - var instance = this; - - // No suppressDisabledCheck flag, shuffle arguments - if ( typeof suppressDisabledCheck !== "boolean" ) { - handlers = element; - element = suppressDisabledCheck; - suppressDisabledCheck = false; - } - - // No element argument, shuffle and use this.element - if ( !handlers ) { - handlers = element; - element = this.element; - delegateElement = this.widget(); - } else { - element = delegateElement = $( element ); - this.bindings = this.bindings.add( element ); - } - - $.each( handlers, function( event, handler ) { - function handlerProxy() { - - // Allow widgets to customize the disabled handling - // - disabled as an array instead of boolean - // - disabled class as method for disabling individual parts - if ( !suppressDisabledCheck && - ( instance.options.disabled === true || - $( this ).hasClass( "ui-state-disabled" ) ) ) { - return; - } - return ( typeof handler === "string" ? instance[ handler ] : handler ) - .apply( instance, arguments ); - } - - // Copy the guid so direct unbinding works - if ( typeof handler !== "string" ) { - handlerProxy.guid = handler.guid = - handler.guid || handlerProxy.guid || $.guid++; - } - - var match = event.match( /^([\w:-]*)\s*(.*)$/ ); - var eventName = match[ 1 ] + instance.eventNamespace; - var selector = match[ 2 ]; - - if ( selector ) { - delegateElement.on( eventName, selector, handlerProxy ); - } else { - element.on( eventName, handlerProxy ); - } - } ); - }, - - _off: function( element, eventName ) { - eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + - this.eventNamespace; - element.off( eventName ).off( eventName ); - - // Clear the stack to avoid memory leaks (#10056) - this.bindings = $( this.bindings.not( element ).get() ); - this.focusable = $( this.focusable.not( element ).get() ); - this.hoverable = $( this.hoverable.not( element ).get() ); - }, - - _delay: function( handler, delay ) { - function handlerProxy() { - return ( typeof handler === "string" ? instance[ handler ] : handler ) - .apply( instance, arguments ); - } - var instance = this; - return setTimeout( handlerProxy, delay || 0 ); - }, - - _hoverable: function( element ) { - this.hoverable = this.hoverable.add( element ); - this._on( element, { - mouseenter: function( event ) { - this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); - }, - mouseleave: function( event ) { - this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); - } - } ); - }, - - _focusable: function( element ) { - this.focusable = this.focusable.add( element ); - this._on( element, { - focusin: function( event ) { - this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); - }, - focusout: function( event ) { - this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); - } - } ); - }, - - _trigger: function( type, event, data ) { - var prop, orig; - var callback = this.options[ type ]; - - data = data || {}; - event = $.Event( event ); - event.type = ( type === this.widgetEventPrefix ? - type : - this.widgetEventPrefix + type ).toLowerCase(); - - // The original event may come from any element - // so we need to reset the target on the new event - event.target = this.element[ 0 ]; - - // Copy original event properties over to the new event - orig = event.originalEvent; - if ( orig ) { - for ( prop in orig ) { - if ( !( prop in event ) ) { - event[ prop ] = orig[ prop ]; - } - } - } - - this.element.trigger( event, data ); - return !( $.isFunction( callback ) && - callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || - event.isDefaultPrevented() ); - } - }; - - $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { - $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { - if ( typeof options === "string" ) { - options = { effect: options }; - } - - var hasOptions; - var effectName = !options ? - method : - options === true || typeof options === "number" ? - defaultEffect : - options.effect || defaultEffect; - - options = options || {}; - if ( typeof options === "number" ) { - options = { duration: options }; - } - - hasOptions = !$.isEmptyObject( options ); - options.complete = callback; - - if ( options.delay ) { - element.delay( options.delay ); - } - - if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { - element[ method ]( options ); - } else if ( effectName !== method && element[ effectName ] ) { - element[ effectName ]( options.duration, options.easing, callback ); - } else { - element.queue( function( next ) { - $( this )[ method ](); - if ( callback ) { - callback.call( element[ 0 ] ); - } - next(); - } ); - } - }; - } ); - - var widget = $.widget; - +/*! + * jQuery UI Widget 1.11.1 + * http://jqueryui.com + * + * Copyright 2014 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/jQuery.widget/ + */ + + +var widget_uuid = 0, + widget_slice = Array.prototype.slice; + +$.cleanData = (function( orig ) { + return function( elems ) { + var events, elem, i; + for ( i = 0; (elem = elems[i]) != null; i++ ) { + try { + + // Only trigger remove when necessary to save time + events = $._data( elem, "events" ); + if ( events && events.remove ) { + $( elem ).triggerHandler( "remove" ); + } + + // http://bugs.jquery.com/ticket/8235 + } catch( e ) {} + } + orig( elems ); + }; +})( $.cleanData ); + +$.widget = function( name, base, prototype ) { + var fullName, existingConstructor, constructor, basePrototype, + // proxiedPrototype allows the provided prototype to remain unmodified + // so that it can be used as a mixin for multiple widgets (#8876) + proxiedPrototype = {}, + namespace = name.split( "." )[ 0 ]; + + name = name.split( "." )[ 1 ]; + fullName = namespace + "-" + name; + + if ( !prototype ) { + prototype = base; + base = $.Widget; + } + + // create selector for plugin + $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { + return !!$.data( elem, fullName ); + }; + + $[ namespace ] = $[ namespace ] || {}; + existingConstructor = $[ namespace ][ name ]; + constructor = $[ namespace ][ name ] = function( options, element ) { + // allow instantiation without "new" keyword + if ( !this._createWidget ) { + return new constructor( options, element ); + } + + // allow instantiation without initializing for simple inheritance + // must use "new" keyword (the code above always passes args) + if ( arguments.length ) { + this._createWidget( options, element ); + } + }; + // extend with the existing constructor to carry over any static properties + $.extend( constructor, existingConstructor, { + version: prototype.version, + // copy the object used to create the prototype in case we need to + // redefine the widget later + _proto: $.extend( {}, prototype ), + // track widgets that inherit from this widget in case this widget is + // redefined after a widget inherits from it + _childConstructors: [] + }); + + basePrototype = new base(); + // we need to make the options hash a property directly on the new instance + // otherwise we'll modify the options hash on the prototype that we're + // inheriting from + basePrototype.options = $.widget.extend( {}, basePrototype.options ); + $.each( prototype, function( prop, value ) { + if ( !$.isFunction( value ) ) { + proxiedPrototype[ prop ] = value; + return; + } + proxiedPrototype[ prop ] = (function() { + var _super = function() { + return base.prototype[ prop ].apply( this, arguments ); + }, + _superApply = function( args ) { + return base.prototype[ prop ].apply( this, args ); + }; + return function() { + var __super = this._super, + __superApply = this._superApply, + returnValue; + + this._super = _super; + this._superApply = _superApply; + + returnValue = value.apply( this, arguments ); + + this._super = __super; + this._superApply = __superApply; + + return returnValue; + }; + })(); + }); + constructor.prototype = $.widget.extend( basePrototype, { + // TODO: remove support for widgetEventPrefix + // always use the name + a colon as the prefix, e.g., draggable:start + // don't prefix for widgets that aren't DOM-based + widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name + }, proxiedPrototype, { + constructor: constructor, + namespace: namespace, + widgetName: name, + widgetFullName: fullName + }); + + // If this widget is being redefined then we need to find all widgets that + // are inheriting from it and redefine all of them so that they inherit from + // the new version of this widget. We're essentially trying to replace one + // level in the prototype chain. + if ( existingConstructor ) { + $.each( existingConstructor._childConstructors, function( i, child ) { + var childPrototype = child.prototype; + + // redefine the child widget using the same prototype that was + // originally used, but inherit from the new version of the base + $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); + }); + // remove the list of existing child constructors from the old constructor + // so the old child constructors can be garbage collected + delete existingConstructor._childConstructors; + } else { + base._childConstructors.push( constructor ); + } + + $.widget.bridge( name, constructor ); + + return constructor; +}; + +$.widget.extend = function( target ) { + var input = widget_slice.call( arguments, 1 ), + inputIndex = 0, + inputLength = input.length, + key, + value; + for ( ; inputIndex < inputLength; inputIndex++ ) { + for ( key in input[ inputIndex ] ) { + value = input[ inputIndex ][ key ]; + if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { + // Clone objects + if ( $.isPlainObject( value ) ) { + target[ key ] = $.isPlainObject( target[ key ] ) ? + $.widget.extend( {}, target[ key ], value ) : + // Don't extend strings, arrays, etc. with objects + $.widget.extend( {}, value ); + // Copy everything else by reference + } else { + target[ key ] = value; + } + } + } + } + return target; +}; + +$.widget.bridge = function( name, object ) { + var fullName = object.prototype.widgetFullName || name; + $.fn[ name ] = function( options ) { + var isMethodCall = typeof options === "string", + args = widget_slice.call( arguments, 1 ), + returnValue = this; + + // allow multiple hashes to be passed on init + options = !isMethodCall && args.length ? + $.widget.extend.apply( null, [ options ].concat(args) ) : + options; + + if ( isMethodCall ) { + this.each(function() { + var methodValue, + instance = $.data( this, fullName ); + if ( options === "instance" ) { + returnValue = instance; + return false; + } + if ( !instance ) { + return $.error( "cannot call methods on " + name + " prior to initialization; " + + "attempted to call method '" + options + "'" ); + } + if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { + return $.error( "no such method '" + options + "' for " + name + " widget instance" ); + } + methodValue = instance[ options ].apply( instance, args ); + if ( methodValue !== instance && methodValue !== undefined ) { + returnValue = methodValue && methodValue.jquery ? + returnValue.pushStack( methodValue.get() ) : + methodValue; + return false; + } + }); + } else { + this.each(function() { + var instance = $.data( this, fullName ); + if ( instance ) { + instance.option( options || {} ); + if ( instance._init ) { + instance._init(); + } + } else { + $.data( this, fullName, new object( options, this ) ); + } + }); + } + + return returnValue; + }; +}; + +$.Widget = function( /* options, element */ ) {}; +$.Widget._childConstructors = []; + +$.Widget.prototype = { + widgetName: "widget", + widgetEventPrefix: "", + defaultElement: "
", + options: { + disabled: false, + + // callbacks + create: null + }, + _createWidget: function( options, element ) { + element = $( element || this.defaultElement || this )[ 0 ]; + this.element = $( element ); + this.uuid = widget_uuid++; + this.eventNamespace = "." + this.widgetName + this.uuid; + this.options = $.widget.extend( {}, + this.options, + this._getCreateOptions(), + options ); + + this.bindings = $(); + this.hoverable = $(); + this.focusable = $(); + + if ( element !== this ) { + $.data( element, this.widgetFullName, this ); + this._on( true, this.element, { + remove: function( event ) { + if ( event.target === element ) { + this.destroy(); + } + } + }); + this.document = $( element.style ? + // element within the document + element.ownerDocument : + // element is window or document + element.document || element ); + this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); + } + + this._create(); + this._trigger( "create", null, this._getCreateEventData() ); + this._init(); + }, + _getCreateOptions: $.noop, + _getCreateEventData: $.noop, + _create: $.noop, + _init: $.noop, + + destroy: function() { + this._destroy(); + // we can probably remove the unbind calls in 2.0 + // all event bindings should go through this._on() + this.element + .unbind( this.eventNamespace ) + .removeData( this.widgetFullName ) + // support: jquery <1.6.3 + // http://bugs.jquery.com/ticket/9413 + .removeData( $.camelCase( this.widgetFullName ) ); + this.widget() + .unbind( this.eventNamespace ) + .removeAttr( "aria-disabled" ) + .removeClass( + this.widgetFullName + "-disabled " + + "ui-state-disabled" ); + + // clean up events and states + this.bindings.unbind( this.eventNamespace ); + this.hoverable.removeClass( "ui-state-hover" ); + this.focusable.removeClass( "ui-state-focus" ); + }, + _destroy: $.noop, + + widget: function() { + return this.element; + }, + + option: function( key, value ) { + var options = key, + parts, + curOption, + i; + + if ( arguments.length === 0 ) { + // don't return a reference to the internal hash + return $.widget.extend( {}, this.options ); + } + + if ( typeof key === "string" ) { + // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } + options = {}; + parts = key.split( "." ); + key = parts.shift(); + if ( parts.length ) { + curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); + for ( i = 0; i < parts.length - 1; i++ ) { + curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; + curOption = curOption[ parts[ i ] ]; + } + key = parts.pop(); + if ( arguments.length === 1 ) { + return curOption[ key ] === undefined ? null : curOption[ key ]; + } + curOption[ key ] = value; + } else { + if ( arguments.length === 1 ) { + return this.options[ key ] === undefined ? null : this.options[ key ]; + } + options[ key ] = value; + } + } + + this._setOptions( options ); + + return this; + }, + _setOptions: function( options ) { + var key; + + for ( key in options ) { + this._setOption( key, options[ key ] ); + } + + return this; + }, + _setOption: function( key, value ) { + this.options[ key ] = value; + + if ( key === "disabled" ) { + this.widget() + .toggleClass( this.widgetFullName + "-disabled", !!value ); + + // If the widget is becoming disabled, then nothing is interactive + if ( value ) { + this.hoverable.removeClass( "ui-state-hover" ); + this.focusable.removeClass( "ui-state-focus" ); + } + } + + return this; + }, + + enable: function() { + return this._setOptions({ disabled: false }); + }, + disable: function() { + return this._setOptions({ disabled: true }); + }, + + _on: function( suppressDisabledCheck, element, handlers ) { + var delegateElement, + instance = this; + + // no suppressDisabledCheck flag, shuffle arguments + if ( typeof suppressDisabledCheck !== "boolean" ) { + handlers = element; + element = suppressDisabledCheck; + suppressDisabledCheck = false; + } + + // no element argument, shuffle and use this.element + if ( !handlers ) { + handlers = element; + element = this.element; + delegateElement = this.widget(); + } else { + element = delegateElement = $( element ); + this.bindings = this.bindings.add( element ); + } + + $.each( handlers, function( event, handler ) { + function handlerProxy() { + // allow widgets to customize the disabled handling + // - disabled as an array instead of boolean + // - disabled class as method for disabling individual parts + if ( !suppressDisabledCheck && + ( instance.options.disabled === true || + $( this ).hasClass( "ui-state-disabled" ) ) ) { + return; + } + return ( typeof handler === "string" ? instance[ handler ] : handler ) + .apply( instance, arguments ); + } + + // copy the guid so direct unbinding works + if ( typeof handler !== "string" ) { + handlerProxy.guid = handler.guid = + handler.guid || handlerProxy.guid || $.guid++; + } + + var match = event.match( /^([\w:-]*)\s*(.*)$/ ), + eventName = match[1] + instance.eventNamespace, + selector = match[2]; + if ( selector ) { + delegateElement.delegate( selector, eventName, handlerProxy ); + } else { + element.bind( eventName, handlerProxy ); + } + }); + }, + + _off: function( element, eventName ) { + eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; + element.unbind( eventName ).undelegate( eventName ); + }, + + _delay: function( handler, delay ) { + function handlerProxy() { + return ( typeof handler === "string" ? instance[ handler ] : handler ) + .apply( instance, arguments ); + } + var instance = this; + return setTimeout( handlerProxy, delay || 0 ); + }, + + _hoverable: function( element ) { + this.hoverable = this.hoverable.add( element ); + this._on( element, { + mouseenter: function( event ) { + $( event.currentTarget ).addClass( "ui-state-hover" ); + }, + mouseleave: function( event ) { + $( event.currentTarget ).removeClass( "ui-state-hover" ); + } + }); + }, + + _focusable: function( element ) { + this.focusable = this.focusable.add( element ); + this._on( element, { + focusin: function( event ) { + $( event.currentTarget ).addClass( "ui-state-focus" ); + }, + focusout: function( event ) { + $( event.currentTarget ).removeClass( "ui-state-focus" ); + } + }); + }, + + _trigger: function( type, event, data ) { + var prop, orig, + callback = this.options[ type ]; + + data = data || {}; + event = $.Event( event ); + event.type = ( type === this.widgetEventPrefix ? + type : + this.widgetEventPrefix + type ).toLowerCase(); + // the original event may come from any element + // so we need to reset the target on the new event + event.target = this.element[ 0 ]; + + // copy original event properties over to the new event + orig = event.originalEvent; + if ( orig ) { + for ( prop in orig ) { + if ( !( prop in event ) ) { + event[ prop ] = orig[ prop ]; + } + } + } + + this.element.trigger( event, data ); + return !( $.isFunction( callback ) && + callback.apply( this.element[0], [ event ].concat( data ) ) === false || + event.isDefaultPrevented() ); + } +}; + +$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { + $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { + if ( typeof options === "string" ) { + options = { effect: options }; + } + var hasOptions, + effectName = !options ? + method : + options === true || typeof options === "number" ? + defaultEffect : + options.effect || defaultEffect; + options = options || {}; + if ( typeof options === "number" ) { + options = { duration: options }; + } + hasOptions = !$.isEmptyObject( options ); + options.complete = callback; + if ( options.delay ) { + element.delay( options.delay ); + } + if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { + element[ method ]( options ); + } else if ( effectName !== method && element[ effectName ] ) { + element[ effectName ]( options.duration, options.easing, callback ); + } else { + element.queue(function( next ) { + $( this )[ method ](); + if ( callback ) { + callback.call( element[ 0 ] ); + } + next(); + }); + } + }; +}); + +var widget = $.widget;