2014-12-15 10:13:26 +00:00
/ * ! j Q u e r y U I - v 1 . 1 1 . 1 - 2 0 1 4 - 0 9 - 1 7
* http : //jqueryui.com
* Includes : widget . js
* Copyright 2014 jQuery Foundation and other contributors ; Licensed MIT * /
( function ( factory ) { if ( typeof define === "function" && define . amd ) { define ( [ "jquery" ] , factory ) ; } else { factory ( jQuery ) ; } } ( function ( $ ) {
/ * !
* 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 { events = $ . _data ( elem , "events" ) ; if ( events && events . remove ) { $ ( elem ) . triggerHandler ( "remove" ) ; } } catch ( e ) { } } orig ( elems ) ; } ; } ) ( $ . cleanData ) ; $ . widget = function ( name , base , prototype ) { var fullName , existingConstructor , constructor , basePrototype , proxiedPrototype = { } , namespace = name . split ( "." ) [ 0 ] ; name = name . split ( "." ) [ 1 ] ; fullName = namespace + "-" + name ; if ( ! prototype ) { prototype = base ; base = $ . Widget ; } $ . expr [ ":" ] [ fullName . toLowerCase ( ) ] = function ( elem ) { return ! ! $ . data ( elem , fullName ) ; } ; $ [ namespace ] = $ [ namespace ] || { } ; existingConstructor = $ [ namespace ] [ name ] ; constructor = $ [ namespace ] [ name ] = function ( options , element ) { if ( ! this . _createWidget ) { return new constructor ( options , element ) ; } if ( arguments . length ) { this . _createWidget ( options , element ) ; } } ; $ . extend ( constructor , existingConstructor , { version : prototype . version , _proto : $ . extend ( { } , prototype ) , _childConstructors : [ ] } ) ; basePrototype = new base ( ) ; 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 , { widgetEventPrefix : existingConstructor ? ( basePrototype . widgetEventPrefix || name ) : name } , proxiedPrototype , { constructor : constructor , namespace : namespace , widgetName : name , widgetFullName : fullName } ) ; if ( existingConstructor ) { $ . each ( existingConstructor . _childConstructors , function ( i , child ) { var childPrototype = child . prototype ; $ . widget ( childPrototype . namespace + "." + childPrototype . widgetName , constructor , child . _proto ) ; } ) ; 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 ) { if ( $ . isPlainObject ( value ) ) { target [ key ] = $ . isPlainObject ( target [ key ] ) ? $ . widget . extend ( { } , target [ key ] , value ) : $ . widget . extend ( { } , value ) ; } 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 ; 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 ( ) { } ; $ . Widget . _childConstructors = [ ] ; $ . Widget . prototype = { widgetName : "widget" , widgetEventPrefix : "" , defaultElement : "<div>" , options : { disabled : false , create : null } , _createWidget : function ( options , element ) { element = $ ( element || this . defaultElemen
2014-08-26 03:36:43 +00:00
// tmpl.min.js
( function ( a ) { "use strict" ; var b = function ( a , c ) { var d = /[^\w\-\.:]/ . test ( a ) ? new Function ( b . arg + ",tmpl" , "var _e=tmpl.encode" + b . helper + ",_s='" + a . replace ( b . regexp , b . func ) + "';return _s;" ) : b . cache [ a ] = b . cache [ a ] || b ( b . load ( a ) ) ; return c ? d ( c , b ) : function ( a ) { return d ( a , b ) } } ; b . cache = { } , b . load = function ( a ) { return document . getElementById ( a ) . innerHTML } , b . regexp = /([\s'\\])(?![^%]*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g , b . func = function ( a , b , c , d , e , f ) { if ( b ) return { "\n" : "\\n" , "\r" : "\\r" , "\t" : "\\t" , " " : " " } [ a ] || "\\" + a ; if ( c ) return c === "=" ? "'+_e(" + d + ")+'" : "'+(" + d + "||'')+'" ; if ( e ) return "';" ; if ( f ) return "_s+='" } , b . encReg = /[<>&"'\x00]/g , b . encMap = { "<" : "<" , ">" : ">" , "&" : "&" , '"' : """ , "'" : "'" } , b . encode = function ( a ) { return String ( a || "" ) . replace ( b . encReg , function ( a ) { return b . encMap [ a ] || "" } ) } , b . arg = "o" , b . helper = ",print=function(s,e){_s+=e&&(s||'')||_e(s);},include=function(s,d){_s+=tmpl(s,d);}" , typeof define == "function" && define . amd ? define ( function ( ) { return b } ) : a . tmpl = b } ) ( this ) ;
/ *
* jQuery Iframe Transport Plugin 1.4
* https : //github.com/blueimp/jQuery-File-Upload
*
* Copyright 2011 , Sebastian Tschan
* https : //blueimp.net
*
* Licensed under the MIT license :
* http : //www.opensource.org/licenses/MIT
* /
( function ( factory ) { if ( typeof define === "function" && define . amd ) { define ( [ "jquery" ] , factory ) ; } else { factory ( window . jQuery ) ; } } ( function ( $ ) { var counter = 0 ; $ . ajaxTransport ( "iframe" , function ( options ) { if ( options . async && ( options . type === "POST" || options . type === "GET" ) ) { var form , iframe ; return { send : function ( _ , completeCallback ) { form = $ ( '<form style="display:none;"></form>' ) ; iframe = $ ( '<iframe src="javascript:false;" name="iframe-transport-' + ( counter += 1 ) + '"></iframe>' ) . bind ( "load" , function ( ) { var fileInputClones , paramNames = $ . isArray ( options . paramName ) ? options . paramName : [ options . paramName ] ; iframe . unbind ( "load" ) . bind ( "load" , function ( ) { var response ; try { response = iframe . contents ( ) ; if ( ! response . length || ! response [ 0 ] . firstChild ) { throw new Error ( ) ; } } catch ( e ) { response = undefined ; } completeCallback ( 200 , "success" , { "iframe" : response } ) ; $ ( '<iframe src="javascript:false;"></iframe>' ) . appendTo ( form ) ; form . remove ( ) ; } ) ; form . prop ( "target" , iframe . prop ( "name" ) ) . prop ( "action" , options . url ) . prop ( "method" , options . type ) ; if ( options . formData ) { $ . each ( options . formData , function ( index , field ) { $ ( '<input type="hidden"/>' ) . prop ( "name" , field . name ) . val ( field . value ) . appendTo ( form ) ; } ) ; } if ( options . fileInput && options . fileInput . length && options . type === "POST" ) { fileInputClones = options . fileInput . clone ( ) ; options . fileInput . after ( function ( index ) { return fileInputClones [ index ] ; } ) ; if ( options . paramName ) { options . fileInput . each ( function ( index ) { $ ( this ) . prop ( "name" , paramNames [ index ] || options . paramName ) ; } ) ; } form . append ( options . fileInput ) . prop ( "enctype" , "multipart/form-data" ) . prop ( "encoding" , "multipart/form-data" ) ; } form . submit ( ) ; if ( fileInputClones && fileInputClones . length ) { options . fileInput . each ( function ( index , input ) { var clone = $ ( fileInputClones [ index ] ) ; $ ( input ) . prop ( "name" , clone . prop ( "name" ) ) ; clone . replaceWith ( input ) ; } ) ; } } ) ; form . append ( iframe ) . appendTo ( document . body ) ; } , abort : function ( ) { if ( iframe ) { iframe . unbind ( "load" ) . prop ( "src" , "javascript" . concat ( ":false;" ) ) ; } if ( form ) { form . remove ( ) ; } } } ; } } ) ; $ . ajaxSetup ( { converters : { "iframe text" : function ( iframe ) { return $ ( iframe [ 0 ] . body ) . text ( ) ; } , "iframe json" : function ( iframe ) { return $ . parseJSON ( $ ( iframe [ 0 ] . body ) . text ( ) ) ; } , "iframe html" : function ( iframe ) { return $ ( iframe [ 0 ] . body ) . html ( ) ; } , "iframe script" : function ( iframe ) { return $ . globalEval ( $ ( iframe [ 0 ] . body ) . text ( ) ) ; } } } ) ; } ) ) ;
/ *
2014-12-15 10:13:26 +00:00
* jQuery File Upload Plugin 5.42 . 1
2014-08-26 03:36:43 +00:00
* https : //github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010 , Sebastian Tschan
* https : //blueimp.net
*
* Licensed under the MIT license :
* http : //www.opensource.org/licenses/MIT
* /
2014-12-15 10:13:26 +00:00
( function ( factory ) { if ( typeof define === "function" && define . amd ) { define ( [ "jquery" , "jquery.ui.widget" ] , factory ) ; } else { factory ( window . jQuery ) ; } } ( function ( $ ) { $ . support . fileInput = ! ( new RegExp ( "(Android (1\\.[0156]|2\\.[01]))|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)|(w(eb)?OSBrowser)|(webOS)|(Kindle/(1\\.0|2\\.[05]|3\\.0))" ) . test ( window . navigator . userAgent ) || $ ( '<input type="file">' ) . prop ( "disabled" ) ) ; $ . support . xhrFileUpload = ! ! ( window . ProgressEvent && window . FileReader ) ; $ . support . xhrFormDataFileUpload = ! ! window . FormData ; $ . support . blobSlice = window . Blob && ( Blob . prototype . slice || Blob . prototype . webkitSlice || Blob . prototype . mozSlice ) ; function getDragHandler ( type ) { var isDragOver = type === "dragover" ; return function ( e ) { e . dataTransfer = e . originalEvent && e . originalEvent . dataTransfer ; var dataTransfer = e . dataTransfer ; if ( dataTransfer && $ . inArray ( "Files" , dataTransfer . types ) !== - 1 && this . _trigger ( type , $ . Event ( type , { delegatedEvent : e } ) ) !== false ) { e . preventDefault ( ) ; if ( isDragOver ) { dataTransfer . dropEffect = "copy" ; } } } ; } $ . widget ( "blueimp.fileupload" , { options : { dropZone : $ ( document ) , pasteZone : undefined , fileInput : undefined , replaceFileInput : true , paramName : undefined , singleFileUploads : true , limitMultiFileUploads : undefined , limitMultiFileUploadSize : undefined , limitMultiFileUploadSizeOverhead : 512 , sequentialUploads : false , limitConcurrentUploads : undefined , forceIframeTransport : false , redirect : undefined , redirectParamName : undefined , postMessage : undefined , multipart : true , maxChunkSize : undefined , uploadedBytes : undefined , recalculateProgress : true , progressInterval : 100 , bitrateInterval : 500 , autoUpload : true , messages : { uploadedBytes : "Uploaded bytes exceed file size" } , i18n : function ( message , context ) { message = this . messages [ message ] || message . toString ( ) ; if ( context ) { $ . each ( context , function ( key , value ) { message = message . replace ( "{" + key + "}" , value ) ; } ) ; } return message ; } , formData : function ( form ) { return form . serializeArray ( ) ; } , add : function ( e , data ) { if ( e . isDefaultPrevented ( ) ) { return false ; } if ( data . autoUpload || ( data . autoUpload !== false && $ ( this ) . fileupload ( "option" , "autoUpload" ) ) ) { data . process ( ) . done ( function ( ) { data . submit ( ) ; } ) ; } } , processData : false , contentType : false , cache : false } , _specialOptions : [ "fileInput" , "dropZone" , "pasteZone" , "multipart" , "forceIframeTransport" ] , _blobSlice : $ . support . blobSlice && function ( ) { var slice = this . slice || this . webkitSlice || this . mozSlice ; return slice . apply ( this , arguments ) ; } , _BitrateTimer : function ( ) { this . timestamp = ( ( Date . now ) ? Date . now ( ) : ( new Date ( ) ) . getTime ( ) ) ; this . loaded = 0 ; this . bitrate = 0 ; this . getBitrate = function ( now , loaded , interval ) { var timeDiff = now - this . timestamp ; if ( ! this . bitrate || ! interval || timeDiff > interval ) { this . bitrate = ( loaded - this . loaded ) * ( 1000 / timeDiff ) * 8 ; this . loaded = loaded ; this . timestamp = now ; } return this . bitrate ; } ; } , _isXHRUpload : function ( options ) { return ! options . forceIframeTransport && ( ( ! options . multipart && $ . support . xhrFileUpload ) || $ . support . xhrFormDataFileUpload ) ; } , _getFormData : function ( options ) { var formData ; if ( $ . type ( options . formData ) === "function" ) { return options . formData ( options . form ) ; } if ( $ . isArray ( options . formData ) ) { return options . formData ; } if ( $ . type ( options . formData ) === "object" ) { formData = [ ] ; $ . each ( options . formData , function ( name , value ) { formData . push ( { name : name , value : value } ) ; } ) ; return formData ; } return [ ] ; } , _getTotal : function ( files ) { var total = 0 ; $ . each ( files , function ( index , file ) { total += file . size || 1 ; } ) ; return total ; } , _initProgressObject : function ( obj ) { var progress = { loaded : 0 , total : 0 , bitrate : 0 } ; if ( obj . _progress ) { $ . extend ( obj . _progress , progress ) ; } else { obj . _progress = progress ; } } , _initResponseObject : function ( obj ) { var prop ; if ( obj . _response ) { for ( prop in obj . _response ) { if ( obj . _response . hasOwnProperty ( prop ) ) { delete obj . _response [ prop ] ; } } } else { obj . _response = { } ; } } , _onProgress : function ( e , data ) { if ( e . lengthComputable ) { var now = ( ( Date . now ) ? Date . now ( ) : ( new Date ( ) ) . getTime ( ) ) , loaded ; if ( data . _time && data . progressInterval && ( now - data . _time < data . progressInterval ) && e . loaded !== e . total ) { return ; } data . _time = now ; loaded = Math . floor ( e . loaded / e . total * ( data . chunkSize || data . _progress . total ) ) + ( data . uploadedBytes || 0 ) ; this . _progress . loaded += ( loaded - data . _progress . loaded ) ; this . _progress . bitrate = this . _bitrateTimer .
2014-08-26 03:36:43 +00:00
/ *
2014-12-15 10:13:26 +00:00
* jQuery File Upload File Processing Plugin 1.3 . 0
2014-08-26 03:36:43 +00:00
* https : //github.com/blueimp/jQuery-File-Upload
*
* Copyright 2012 , Sebastian Tschan
* https : //blueimp.net
*
* Licensed under the MIT license :
* http : //www.opensource.org/licenses/MIT
* /
2014-12-15 10:13:26 +00:00
( function ( factory ) { if ( typeof define === "function" && define . amd ) { define ( [ "jquery" , "./jquery.fileupload" ] , factory ) ; } else { factory ( window . jQuery ) ; } } ( function ( $ ) { var originalAdd = $ . blueimp . fileupload . prototype . options . add ; $ . widget ( "blueimp.fileupload" , $ . blueimp . fileupload , { options : { processQueue : [ ] , add : function ( e , data ) { var $this = $ ( this ) ; data . process ( function ( ) { return $this . fileupload ( "process" , data ) ; } ) ; originalAdd . call ( this , e , data ) ; } } , processActions : { } , _processFile : function ( data , originalData ) { var that = this , dfd = $ . Deferred ( ) . resolveWith ( that , [ data ] ) , chain = dfd . promise ( ) ; this . _trigger ( "process" , null , data ) ; $ . each ( data . processQueue , function ( i , settings ) { var func = function ( data ) { if ( originalData . errorThrown ) { return $ . Deferred ( ) . rejectWith ( that , [ originalData ] ) . promise ( ) ; } return that . processActions [ settings . action ] . call ( that , data , settings ) ; } ; chain = chain . pipe ( func , settings . always && func ) ; } ) ; chain . done ( function ( ) { that . _trigger ( "processdone" , null , data ) ; that . _trigger ( "processalways" , null , data ) ; } ) . fail ( function ( ) { that . _trigger ( "processfail" , null , data ) ; that . _trigger ( "processalways" , null , data ) ; } ) ; return chain ; } , _transformProcessQueue : function ( options ) { var processQueue = [ ] ; $ . each ( options . processQueue , function ( ) { var settings = { } , action = this . action , prefix = this . prefix === true ? action : this . prefix ; $ . each ( this , function ( key , value ) { if ( $ . type ( value ) === "string" && value . charAt ( 0 ) === "@" ) { settings [ key ] = options [ value . slice ( 1 ) || ( prefix ? prefix + key . charAt ( 0 ) . toUpperCase ( ) + key . slice ( 1 ) : key ) ] ; } else { settings [ key ] = value ; } } ) ; processQueue . push ( settings ) ; } ) ; options . processQueue = processQueue ; } , processing : function ( ) { return this . _processing ; } , process : function ( data ) { var that = this , options = $ . extend ( { } , this . options , data ) ; if ( options . processQueue && options . processQueue . length ) { this . _transformProcessQueue ( options ) ; if ( this . _processing === 0 ) { this . _trigger ( "processstart" ) ; } $ . each ( data . files , function ( index ) { var opts = index ? $ . extend ( { } , options ) : options , func = function ( ) { if ( data . errorThrown ) { return $ . Deferred ( ) . rejectWith ( that , [ data ] ) . promise ( ) ; } return that . _processFile ( opts , data ) ; } ; opts . index = index ; that . _processing += 1 ; that . _processingQueue = that . _processingQueue . pipe ( func , func ) . always ( function ( ) { that . _processing -= 1 ; if ( that . _processing === 0 ) { that . _trigger ( "processstop" ) ; } } ) ; } ) ; } return this . _processingQueue ; } , _create : function ( ) { this . _super ( ) ; this . _processing = 0 ; this . _processingQueue = $ . Deferred ( ) . resolveWith ( this ) . promise ( ) ; } } ) ; } ) ) ;
/ *
* jQuery File Upload Validation Plugin 1.1 . 2
* https : //github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013 , Sebastian Tschan
* https : //blueimp.net
*
* Licensed under the MIT license :
* http : //www.opensource.org/licenses/MIT
* /
/* global define, window */
( function ( factory ) { if ( typeof define === "function" && define . amd ) { define ( [ "jquery" , "./jquery.fileupload-process" ] , factory ) ; } else { factory ( window . jQuery ) ; } } ( function ( $ ) { $ . blueimp . fileupload . prototype . options . processQueue . push ( { action : "validate" , always : true , acceptFileTypes : "@" , maxFileSize : "@" , minFileSize : "@" , maxNumberOfFiles : "@" , disabled : "@disableValidation" } ) ; $ . widget ( "blueimp.fileupload" , $ . blueimp . fileupload , { options : { getNumberOfFiles : $ . noop , messages : { maxNumberOfFiles : "Maximum number of files exceeded" , acceptFileTypes : "File type not allowed" , maxFileSize : "File is too large" , minFileSize : "File is too small" } } , processActions : { validate : function ( data , options ) { if ( options . disabled ) { return data ; } var dfd = $ . Deferred ( ) , settings = this . options , file = data . files [ data . index ] , fileSize ; if ( options . minFileSize || options . maxFileSize ) { fileSize = file . size ; } if ( $ . type ( options . maxNumberOfFiles ) === "number" && ( settings . getNumberOfFiles ( ) || 0 ) + data . files . length > options . maxNumberOfFiles ) { file . error = settings . i18n ( "maxNumberOfFiles" ) ; } else { if ( options . acceptFileTypes && ! ( options . acceptFileTypes . test ( file . type ) || options . acceptFileTypes . test ( file . name ) ) ) { file . error = settings . i18n ( "acceptFileTypes" ) ; } else { if ( fileSize > options . maxFileSize ) { file . error = settings . i18n ( "maxFileSize" ) ; } else { if ( $ . type ( fileSize ) === "number" && fileSize < options . minFileSize ) { file . error = settings . i18n ( "minFileSize" ) ; } else { delete file . error ; } } } } if ( file . error || data . files . error ) { data . files . error = true ; dfd . rejectWith ( this , [ data ] ) ; } else { dfd . resolveWith ( this , [ data ] ) ; } return dfd . promise ( ) ; } } } ) ; } ) ) ;
2014-08-26 03:36:43 +00:00
/ *
2014-12-15 10:13:26 +00:00
* jQuery File Upload User Interface Plugin 9.6 . 0
2014-08-26 03:36:43 +00:00
* https : //github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010 , Sebastian Tschan
* https : //blueimp.net
*
* Licensed under the MIT license :
* http : //www.opensource.org/licenses/MIT
* /
2014-12-15 10:13:26 +00:00
( function ( factory ) { if ( typeof define === "function" && define . amd ) { define ( [ "jquery" , "tmpl" , "./jquery.fileupload-image" , "./jquery.fileupload-audio" , "./jquery.fileupload-video" , "./jquery.fileupload-validate" ] , factory ) ; } else { factory ( window . jQuery , window . tmpl ) ; } } ( function ( $ , tmpl ) { $ . blueimp . fileupload . prototype . _specialOptions . push ( "filesContainer" , "uploadTemplateId" , "downloadTemplateId" ) ; $ . widget ( "blueimp.fileupload" , $ . blueimp . fileupload , { options : { autoUpload : false , uploadTemplateId : "template-upload" , downloadTemplateId : "template-download" , filesContainer : undefined , prependFiles : false , dataType : "json" , messages : { unknownError : "Unknown error" } , getNumberOfFiles : function ( ) { return this . filesContainer . children ( ) . not ( ".processing" ) . length ; } , getFilesFromResponse : function ( data ) { if ( data . result && $ . isArray ( data . result . files ) ) { return data . result . files ; } return [ ] ; } , add : function ( e , data ) { if ( e . isDefaultPrevented ( ) ) { return false ; } var $this = $ ( this ) , that = $this . data ( "blueimp-fileupload" ) || $this . data ( "fileupload" ) , options = that . options ; data . context = that . _renderUpload ( data . files ) . data ( "data" , data ) . addClass ( "processing" ) ; options . filesContainer [ options . prependFiles ? "prepend" : "append" ] ( data . context ) ; that . _forceReflow ( data . context ) ; that . _transition ( data . context ) ; data . process ( function ( ) { return $this . fileupload ( "process" , data ) ; } ) . always ( function ( ) { data . context . each ( function ( index ) { $ ( this ) . find ( ".size" ) . text ( that . _formatFileSize ( data . files [ index ] . size ) ) ; } ) . removeClass ( "processing" ) ; that . _renderPreviews ( data ) ; } ) . done ( function ( ) { data . context . find ( ".start" ) . prop ( "disabled" , false ) ; if ( ( that . _trigger ( "added" , e , data ) !== false ) && ( options . autoUpload || data . autoUpload ) && data . autoUpload !== false ) { data . submit ( ) ; } } ) . fail ( function ( ) { if ( data . files . error ) { data . context . each ( function ( index ) { var error = data . files [ index ] . error ; if ( error ) { $ ( this ) . find ( ".error" ) . text ( error ) ; } } ) ; } } ) ; } , send : function ( e , data ) { if ( e . isDefaultPrevented ( ) ) { return false ; } var that = $ ( this ) . data ( "blueimp-fileupload" ) || $ ( this ) . data ( "fileupload" ) ; if ( data . context && data . dataType && data . dataType . substr ( 0 , 6 ) === "iframe" ) { data . context . find ( ".progress" ) . addClass ( ! $ . support . transition && "progress-animated" ) . attr ( "aria-valuenow" , 100 ) . children ( ) . first ( ) . css ( "width" , "100%" ) ; } return that . _trigger ( "sent" , e , data ) ; } , done : function ( e , data ) { if ( e . isDefaultPrevented ( ) ) { return false ; } var that = $ ( this ) . data ( "blueimp-fileupload" ) || $ ( this ) . data ( "fileupload" ) , getFilesFromResponse = data . getFilesFromResponse || that . options . getFilesFromResponse , files = getFilesFromResponse ( data ) , template , deferred ; 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 ( ) ; } ) ; } ) ; } ) ; } else { template = that . _renderDownload ( files ) [ that . options . prependFiles ? "prependTo" : "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 ( ) ; } ) ; } } ,
// modified 'abort/cancel', by lj. Mon Dec 15 15:44:04 CST 2014
fail : function ( e , data ) { if ( e . isDefaultPrevented ( ) ) { return false ; } var that = $ ( this ) . data ( "blueimp-fileupload" ) || $ ( this ) . data ( "fileupload" ) , template , deferred ; if ( data . context ) { data . context . each ( function ( index ) {
var file = data . files [ index ] ; if ( data . errorThrown !== "abort" ) { file . error = file . error || data . errorThrown || data . i18n ( "unknownError" ) ; } else { file . canceled = true ; }
2014-12-27 09:25:47 +00:00
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 ( "failed" , e , data ) ; that . _trigger ( "finished" , e , data ) ; deferred . resolve ( ) ; } ) ; } ) ; } ) ; } else { if ( data . errorThrown !== "abort" ) { data . context = that . _renderUpload ( data . files ) [ that . options . prependFiles ? "prependTo" : "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 ( ) ; } } } , progress : function ( e , data ) { if ( e . isDefaultPrevented ( ) ) { return false ; } var progress = Math . floor ( data . loaded / data . total * 100 ) ; if ( data . context ) { data . context . each ( function ( ) { $ ( this ) . find ( ".progress" ) . attr ( "aria-valuenow" , progress ) . children ( ) . first ( ) . css ( "width" , progress + "%" ) ; } ) ; } } , progressall : function ( e , data ) { if ( e . isDefaultPrevented ( ) ) { return false ; } 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 ) . children ( ) . first ( ) . css ( "width" , progress + "%" ) ; } , start : function ( e ) { if ( e . isDefaultPrevented ( ) ) { return false ; } var that = $ ( this ) . data ( "blueimp-fileupload" ) || $ ( this ) . data ( "fileupload" ) ; that . _resetFinishedDeferreds ( ) ; that . _transition ( $ ( this ) . find ( ".fileupload-progress" ) ) . done ( function ( ) { that . _trigger ( "started" , e ) ; } ) ; } , stop : function ( e ) { if ( e . isDefaultPrevented ( ) ) { return false ; } var that = $ ( this ) . data ( "blueimp-fileupload" ) || $ ( this ) . data ( "fileupload" ) , deferred = that . _addFinishedDeferreds ( ) ; $ . when . apply ( $ , that . _getFinishedDeferreds ( ) ) . done ( function ( ) { that . _trigger ( "stopped" , e ) ; } ) ; that . _transition ( $ ( this ) . find ( ".fileupload-progress" ) ) . done ( function ( ) { $ ( this ) . find ( ".progress" ) . attr ( "aria-valuenow" , "0" ) . children ( ) . first ( ) . css ( "width" , "0%" ) ; $ ( this ) . find ( ".progress-extended" ) . html ( " " ) ; deferred . resolve ( ) ; } ) ; } , processstart : function ( e ) { if ( e . isDefaultPrevented ( ) ) { return false ; } $ ( this ) . addClass ( "fileupload-processing" ) ; } , processstop : function ( e ) { if ( e . isDefaultPrevented ( ) ) { return false ; } $ ( this ) . removeClass ( "fileupload-processing" ) ; } , destroy : function ( e , data ) { if ( e . isDefaultPrevented ( ) ) { return false ; } var that = $ ( this ) . data ( "blueimp-fileupload" ) || $ ( this ) . data ( "fileupload" ) , removeNode = function ( ) { that . _transition ( data . context ) . done ( function ( ) { $ ( this ) . remove ( ) ; that . _trigger ( "destroyed" , e , data ) ; } ) ; } ; if ( data . url ) { data . dataType = data . dataType || that . options . dataType ; $ . ajax ( data ) . done ( removeNode ) . fail ( function ( ) { that . _trigger ( "destroyfailed" , e , data ) ; } ) ; } else { removeNode ( ) ; } } } , _resetFinishedDeferreds : function ( ) { this . _finishedUploads = [ ] ; } , _addFinishedDeferreds : function ( deferred ) { if ( ! deferred ) { deferred = $ . Deferred ( ) ; } this . _finishedUploads . push ( deferred ) ; return deferred ; } , _getFinishedDeferreds : function ( ) { return this . _finishedUploads ; } , _enableDragToDesktop : function ( ) { var link = $ ( this ) , url = link . prop ( "href" ) , name = link . prop ( "download" ) , type = "application/octet-stream" ; link . bind ( "dragstart" , function ( e ) { try { e . originalEvent . dataTransfer . setData ( "DownloadURL" , [ type , name , url ] . join ( ":" ) ) ; } catch ( ignore ) { } } ) ; } , _formatFileSize : function ( bytes ) { if ( typeof bytes !== "number" ) { return "" ; } if ( bytes >= 1000000000 ) { return ( bytes / 1000000000 ) . toFixed ( 2 ) + " GB" ; } if ( bytes >= 1000000 ) { return ( bytes / 1000000 ) . toFixed ( 2 ) + " MB" ; } return ( bytes / 1000 ) . toFixed ( 2 ) + " KB" ; } , _formatBitrate : function ( bits ) { if ( typeof bits !== "number" ) { return "" ; } bits = bits / 8 ; if ( bits >= 1000000000 ) { return ( bits / 1000000000 ) . toFixed ( 2 ) + " GB/s" ; } if ( bits >= 1000000 ) { return ( bits / 1000000 ) . toFixed ( 2 ) + " MB/s" ; } if ( bits >= 1000 ) { return ( bits / 1000 ) . toFixed ( 2 ) + " KB/s" ; } return