Prechádzať zdrojové kódy

10.23 上传附件需求

bihuisong 9 mesiacov pred
rodič
commit
8277c60b4e
1 zmenil súbory, kde vykonal 140 pridanie a 138 odobranie
  1. 140 138
      src/main/resources/static/BJUI/js/bjui-upload.js

+ 140 - 138
src/main/resources/static/BJUI/js/bjui-upload.js

@@ -20,64 +20,64 @@
 
     // UPLOAD CLASS DEFINITION
     // ======================
-    var Upload = function(element, options) {
-        this.$element      = $(element)
-        this.options       = options
-        this.tools         = this.TOOLS()
+    var Upload = function (element, options) {
+        this.$element = $(element)
+        this.options = options
+        this.tools = this.TOOLS()
     }
 
     Upload.DEFAULTS = {
-        fileTypeExts        : '*.jpg;*.png;*.mp4',     //允许上传的文件类型,格式'*.jpg;*.doc'
-        uploader            : '',     //文件提交的地址
-        auto                : false,  //是否开启自动上传
-        method              : 'POST', //发送请求的方式,get或post
-        multi               : false,  //是否允许选择多个文件
-        formData            : {},     //发送给服务端的参数,格式:{key1:value1,key2:value2}
-        fileObjName         : 'file', //在后端接受文件的参数名称,如PHP中的$_FILES['file']
-        fileSizeLimit       : 204800, //允许上传的文件大小,单位KB
-        previewImg          : true,   //是否预览上传图片
-        previewLoadimg      : null,   //预览图片前的载入图标
-        dragDrop            : false,  //是否允许拖动上传
-        showUploadedPercent : true,   //是否实时显示上传的百分比,如20%
-        showUploadedSize    : true,   //是否实时显示已上传的文件大小,如1M/2M
-        buttonText          : '选择上传文件',     //上传按钮上的文字
-        removeTimeout       : 1e3,              //上传完成后进度条的消失时间
-        itemTemplate        : FRAG.uploadTemp,  //上传队列显示的模板
-        breakPoints         : false,            //是否开启断点续传
-        fileSplitSize       : 1024 * 1024,      //断点续传的文件块大小,单位Byte,默认1M
-        onUploadStart       : null,  //上传开始时的动作
-        onUploadSuccess     : null,  //上传成功的动作
-        onUploadComplete    : null,  //上传完成的动作
-        onUploadError       : null,  //上传失败的动作
-        onInit              : null,  //初始化时的动作
-        onCancel            : null,  //删除掉某个文件后的回调函数,可传入参数file
-        onSelect            : null
+        fileTypeExts: '*.jpg;*.png;*.mp4',     //允许上传的文件类型,格式'*.jpg;*.doc'
+        uploader: '',     //文件提交的地址
+        auto: false,  //是否开启自动上传
+        method: 'POST', //发送请求的方式,get或post
+        multi: false,  //是否允许选择多个文件
+        formData: {},     //发送给服务端的参数,格式:{key1:value1,key2:value2}
+        fileObjName: 'file', //在后端接受文件的参数名称,如PHP中的$_FILES['file']
+        fileSizeLimit: 204800, //允许上传的文件大小,单位KB
+        previewImg: true,   //是否预览上传图片
+        previewLoadimg: null,   //预览图片前的载入图标
+        dragDrop: false,  //是否允许拖动上传
+        showUploadedPercent: true,   //是否实时显示上传的百分比,如20%
+        showUploadedSize: true,   //是否实时显示已上传的文件大小,如1M/2M
+        buttonText: '选择上传文件',     //上传按钮上的文字
+        removeTimeout: 1e3,              //上传完成后进度条的消失时间
+        itemTemplate: FRAG.uploadTemp,  //上传队列显示的模板
+        breakPoints: false,            //是否开启断点续传
+        fileSplitSize: 1024 * 1024,      //断点续传的文件块大小,单位Byte,默认1M
+        onUploadStart: null,  //上传开始时的动作
+        onUploadSuccess: null,  //上传成功的动作
+        onUploadComplete: null,  //上传完成的动作
+        onUploadError: null,  //上传失败的动作
+        onInit: null,  //初始化时的动作
+        onCancel: null,  //删除掉某个文件后的回调函数,可传入参数file
+        onSelect: null
     }
 
     Upload.MIMETYPES = {
-        zip  :[ 'application/x-zip-compressed' ],
-        jpg  :[ 'image/jpeg' ],
-        png  :[ 'image/png' ],
-        gif  :[ 'image/gif' ],
-        swf  :[ 'application/x-shockwave-flash' ],
-        doc  :[ 'application/msword' ],
-        xls  :[ 'application/vnd.ms-excel' ],
-        docx :[ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ],
-        xlsx :[ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ],
-        ppt  :[ 'application/vnd.ms-powerpoint' ],
-        pptx :[ 'application/vnd.openxmlformats-officedocument.presentationml.presentation' ],
-        mp3  :[ 'audio/mpeg' ],
-        mp4  :[ 'video/mp4' ],
-        pdf  :[ 'application/pdf' ],
-        txt  :[ 'text/plain' ],
-        xml  :[ 'text/xml' ]
+        zip: ['application/x-zip-compressed'],
+        jpg: ['image/jpeg'],
+        png: ['image/png'],
+        gif: ['image/gif'],
+        swf: ['application/x-shockwave-flash'],
+        doc: ['application/msword'],
+        xls: ['application/vnd.ms-excel'],
+        docx: ['application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
+        xlsx: ['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
+        ppt: ['application/vnd.ms-powerpoint'],
+        pptx: ['application/vnd.openxmlformats-officedocument.presentationml.presentation'],
+        mp3: ['audio/mpeg'],
+        mp4: ['video/mp4'],
+        pdf: ['application/pdf'],
+        txt: ['text/plain'],
+        xml: ['text/xml']
     }
 
-    Upload.prototype.TOOLS = function() {
-        var that  = this, options = this.options
+    Upload.prototype.TOOLS = function () {
+        var that = this, options = this.options
         var tools = {
             //将文件的单位由bytes转换为KB或MB,若第二个参数指定为true,则永远转换为KB
-            formatFileSize: function(size, byKB) {
+            formatFileSize: function (size, byKB) {
                 if (size > 1024 * 1024 && !byKB)
                     size = (Math.round(size * 100 / (1024 * 1024)) / 100).toString() + 'MB'
                 else
@@ -86,16 +86,16 @@
                 return size
             },
             //根据文件序号获取文件
-            getFile: function(index, files) {
+            getFile: function (index, files) {
                 for (var i = 0; i < files.length; i++) {
                     if (files[i].index == index) return files[i]
                 }
                 return false
             },
             //将输入的文件类型字符串转化为数组,原格式为*.jpg;*.png
-            getFileTypes: function(str) {
+            getFileTypes: function (str) {
                 var result = []
-                var arr1   = str.split(';')
+                var arr1 = str.split(';')
 
                 for (var i = 0; i < arr1.length; i++) {
                     result.push(arr1[i].split('.').pop())
@@ -103,24 +103,24 @@
                 return result
             },
             //根据后缀名获得文件的mime类型
-            getMimetype: function(name) {
+            getMimetype: function (name) {
                 return Upload.MIMETYPES[name]
             },
             //根据配置的字符串,获得上传组件accept的值
-            getAcceptString: function(str) {
-                var types  = this.getFileTypes(str)
+            getAcceptString: function (str) {
+                var types = this.getFileTypes(str)
                 var result = []
 
                 for (var i = 0; i < types.length; i++) {
                     var mime = this.getMimetype(types[i])
 
                     if (mime) result.push(mime)
-                    else result.push('.'+ types[i])
+                    else result.push('.' + types[i])
                 }
                 return result.join(',')
             },
             //过滤上传文件
-            filter: function(files) {
+            filter: function (files) {
                 var arr = []
                 var typeArray = this.getFileTypes(options.fileTypeExts)
 
@@ -129,29 +129,29 @@
                         var thisFile = files[i]
 
                         if (parseInt(this.formatFileSize(thisFile.size, true)) > options.fileSizeLimit) {
-                            that.$element.alertmsg('error', '文件"'+ thisFile.name +'"大小超出限制!')
+                            that.$element.alertmsg('error', '文件"' + thisFile.name + '"大小超出限制!')
                             continue
                         }
                         for (let j = 0; j < typeArray.length; j++) {
                             console.log("typeArray=", typeArray[j])
                         }
-                        typeArray = ["jpg", "png", "mp4"]
+                        typeArray = ["jpg", "png", "mp4", "pdf", "doc", "docx", "xls", "xlsx", "mov", "wmv", "mp3", "wav", "wma"]
                         if ($.inArray(thisFile.name.split('.').pop().toLowerCase(), typeArray) >= 0) {
                             arr.push(thisFile)
                         } else {
-                            that.$element.alertmsg('error', '文件"'+ thisFile.name +'"类型不允许12!')
+                            that.$element.alertmsg('error', '文件"' + thisFile.name + '"类型不允许!')
                         }
                     }
                 }
                 return arr
             },
             //获取选择文件,file控件
-            getFiles: function(e) {
+            getFiles: function (e) {
                 var files = e.target.files || e.dataTransfer.files // 获取文件列表对象
 
                 files = this.filter(files)
                 for (var i = 0; i < files.length; i++) {
-                    files[i].id     = files[i].lastModifiedDate.getTime() +'_'+ files[i].size +'_'+ (files[i].type || '').replace(/\W/g, '')
+                    files[i].id = files[i].lastModifiedDate.getTime() + '_' + files[i].size + '_' + (files[i].type || '').replace(/\W/g, '')
                     this.renderQueueItem(files[i])
                     that.queueData.files++
                 }
@@ -159,17 +159,17 @@
                 return files
             },
             //生成上传队列Dom
-            renderQueueItem: function(file) {
+            renderQueueItem: function (file) {
                 var uploadedSize = 0
                 var $temp = $(options.itemTemplate
-                        .replace('{fileId}', file.id)
-                        .replace('{fileName}', file.name)
-                        .replace('#upConfirm#', BJUI.regional.upload.upConfirm)
-                        .replace('#upPause#', BJUI.regional.upload.upPause)
-                        .replace('#upCancel#', BJUI.regional.upload.upCancel)
-                        .replace('{percent}', '0.00%')
-                        .replace('{uploadedSize}', '0KB')
-                        .replace('{fileSize}', this.formatFileSize(file.size)))
+                    .replace('{fileId}', file.id)
+                    .replace('{fileName}', file.name)
+                    .replace('#upConfirm#', BJUI.regional.upload.upConfirm)
+                    .replace('#upPause#', BJUI.regional.upload.upPause)
+                    .replace('#upCancel#', BJUI.regional.upload.upCancel)
+                    .replace('{percent}', '0.00%')
+                    .replace('{uploadedSize}', '0KB')
+                    .replace('{fileSize}', this.formatFileSize(file.size)))
 
                 //如果是自动上传,去掉上传按钮
                 if (options.auto) {
@@ -187,7 +187,7 @@
                 if (options.previewImg && file.type.indexOf('image') != -1) {
                     var $prevbox = $temp.find('> .preview > .img')
 
-                    if (options.previewLoadimg) $prevbox.html('<img src="'+ options.previewLoadimg +'" height="114">')
+                    if (options.previewLoadimg) $prevbox.html('<img src="' + options.previewLoadimg + '" height="114">')
                     this.previewImg(file, $prevbox)
                 } else {
                     $temp.find('> .preview').remove()
@@ -203,7 +203,7 @@
                 }
                 //判断是否显示上传百分比
                 if (options.showUploadedPercent) {
-                    $temp.find('> .percent').html((uploadedSize / file.size * 100).toFixed(2) +'%')
+                    $temp.find('> .percent').html((uploadedSize / file.size * 100).toFixed(2) + '%')
                 } else {
                     $temp.find('> .percent').remove()
                 }
@@ -211,7 +211,7 @@
                 //判断是否是自动上传
                 if (options.auto) that.fileUpload(file, uploadedSize)
 
-                $temp.on('click.bjui.upload.confirm', '.up_confirm', function(e) {
+                $temp.on('click.bjui.upload.confirm', '.up_confirm', function (e) {
                     var $this = $(this), $queue = $this.closest('.item')
 
                     $this.hide().next().show()
@@ -219,12 +219,12 @@
                 })
                 $temp.on('click.bjui.upload.cancel', '.up_cancel', this.removeQueueItem)
             },
-            successQueueItem: function(file, xhr) {
+            successQueueItem: function (file, xhr) {
                 tools.showProgress(file.id, file.size, file.size)
                 options.onUploadSuccess && options.onUploadSuccess.toFunc().call(that, file, xhr.responseText, that.$element)
                 //在指定的间隔时间后删掉进度条
-                setTimeout(function() {
-                    that.$element.find('#'+ file.id).fadeOut('normal', function() {
+                setTimeout(function () {
+                    that.$element.find('#' + file.id).fadeOut('normal', function () {
                         $(this).remove()
                         var filelen = that.$element.find('> .queue > .item:visible').length
 
@@ -235,10 +235,10 @@
                     })
                 }, options.removeTimeout)
             },
-            removeQueueItem: function(e, xhr) {
+            removeQueueItem: function (e, xhr) {
                 if (xhr) xhr.abort()
 
-                $(this).closest('.item').fadeOut('normal', function() {
+                $(this).closest('.item').fadeOut('normal', function () {
                     $(this).remove()
 
                     var filelen = that.$element.find('> .queue > .item:visible').length
@@ -250,33 +250,33 @@
 
 
             //预览上传图片
-            previewImg: function(file, $obj) {
+            previewImg: function (file, $obj) {
                 if (file && $obj.length) {
                     var reader = new FileReader()
 
-                    reader.onload = function(e) {
-                        $obj.html('<img src="'+ e.target.result +'">')
+                    reader.onload = function (e) {
+                        $obj.html('<img src="' + e.target.result + '">')
                     }
                     reader.readAsDataURL(file)
                 }
             },
             //上传进度条
-            showProgress: function(fileId, uploadedSize, fileSize) {
-                var initWidth     = uploadedSize / fileSize * 100 +'%',
-                    initFileSize  = that.tools.formatFileSize(uploadedSize),
-                    initUppercent = (uploadedSize / fileSize * 100).toFixed(2) +'%'
-                that.$element.find('#'+ fileId +' > .progress > .bar').css('width', initWidth)
+            showProgress: function (fileId, uploadedSize, fileSize) {
+                var initWidth = uploadedSize / fileSize * 100 + '%',
+                    initFileSize = that.tools.formatFileSize(uploadedSize),
+                    initUppercent = (uploadedSize / fileSize * 100).toFixed(2) + '%'
+                that.$element.find('#' + fileId + ' > .progress > .bar').css('width', initWidth)
             },
             //断点续传:获取已上传的文件片断大小
-            getUploadedSize: function(fileId) {
+            getUploadedSize: function (fileId) {
                 return localStorage.getItem(fileId) * 1
             },
             //断点续传:保存已上传的文件片断大小
-            saveUploadedSize:function(fileId, value) {
+            saveUploadedSize: function (fileId, value) {
                 localStorage.setItem(fileId, value)
             },
             //发送文件块函数
-            sendBlob: function(url, xhr, file, formdata) {
+            sendBlob: function (url, xhr, file, formdata) {
                 var fd = new FormData()
 
                 xhr.open(options.method, url, true)
@@ -295,10 +295,10 @@
         return tools
     }
 
-    Upload.prototype.init = function() {
-        var that     = this
+    Upload.prototype.init = function () {
+        var that = this
         var $element = this.$element
-        var options  = this.options
+        var options = this.options
 
         if (!(options.uploader)) {
             BJUI.debug('Upload Plugin: The options uploader is undefined!')
@@ -308,7 +308,7 @@
 
             if (!options.uploader.isFinishedTm()) {
                 $element.alertmsg('error', (options.warn || FRAG.alertPlhMsg.replace('#plhmsg#', BJUI.regional.plhmsg)))
-                BJUI.debug('Upload Plugin: The options uploader is incorrect: '+ options.uploader)
+                BJUI.debug('Upload Plugin: The options uploader is incorrect: ' + options.uploader)
                 return
             }
 
@@ -320,22 +320,22 @@
         var $uploadFrag = $(FRAG.uploadFrag
             .replaceAll('#multi#', options.multi ? 'multiple' : '')
             .replaceAll('#accept#', that.tools.getAcceptString(options.fileTypeExts))
-            .replaceAll('#btnTxt#', (options.icon ? '<i class="fa fa-'+ options.icon +'">&nbsp;&nbsp;' : '') + options.buttonText))
+            .replaceAll('#btnTxt#', (options.icon ? '<i class="fa fa-' + options.icon + '">&nbsp;&nbsp;' : '') + options.buttonText))
 
         $element
             .addClass('bjui-upload')
             .append($uploadFrag)
 
-        this.$file           = $element.find('> .bjui-upload-select-file')
+        this.$file = $element.find('> .bjui-upload-select-file')
         this.$uploadFileList = $element.find('> .queue')
-        this.queueData       = { files:0, success:0, error:0 }
+        this.queueData = {files: 0, success: 0, error: 0}
 
         //do select files
         $element
-            .on('change.bjui.upload', '.bjui-upload-select-file', function(e) {
+            .on('change.bjui.upload', '.bjui-upload-select-file', function (e) {
                 that.fileSelect(e)
             })
-            .on('click.bjui.upload', '.bjui-upload-select', function(e) {
+            .on('click.bjui.upload', '.bjui-upload-select', function (e) {
                 that.$file.trigger('click')
             })
 
@@ -344,12 +344,12 @@
         //如果允许拖动上传
         if (options.dragDrop) {
             /* 拖拽元素在目标元素头上移动的时候 */
-            $element[0].ondragover = function(ev) {
+            $element[0].ondragover = function (ev) {
                 ev.preventDefault()
                 return true
             }
 
-            $element[0].ondrop = function(e) {
+            $element[0].ondrop = function (e) {
                 that.fileSelect(e)
 
                 e.stopPropagation()
@@ -358,14 +358,14 @@
         }
     }
 
-    Upload.prototype.fileSelect = function(e) {
+    Upload.prototype.fileSelect = function (e) {
         this.$uploadFileList.show()
         this.tools.getFiles(e)
     }
 
-    Upload.prototype.fileUpload = function(file, uploadedSize) {
+    Upload.prototype.fileUpload = function (file, uploadedSize) {
         var that = this, $element = that.$element, options = that.options, tools = that.tools
-        var xhr  = false, originalFile = file
+        var xhr = false, originalFile = file
 
         //校正进度条和上传比例的误差
         xhr = new XMLHttpRequest()
@@ -376,9 +376,11 @@
         }
         if (xhr.upload) {
             // 上传进度
-            xhr.upload.onprogress = function(e) { that.onProgress(file, e.loaded, originalFile.size) }
+            xhr.upload.onprogress = function (e) {
+                that.onProgress(file, e.loaded, originalFile.size)
+            }
             // 上传回调
-            xhr.onreadystatechange = function(e) {
+            xhr.onreadystatechange = function (e) {
                 if (xhr.readyState == 4 && xhr.status == 200) {
                     var returnData = JSON.parse(xhr.responseText), upOver = false
                     if (options.breakPoints) {
@@ -422,35 +424,35 @@
 
         //暂停事件
         $element
-            .find('#'+ originalFile.id +' > .info > .up_pause')
-            .on('click.bjui.upload.pause', function(e) {
+            .find('#' + originalFile.id + ' > .info > .up_pause')
+            .on('click.bjui.upload.pause', function (e) {
                 xhr.abort()
                 $(this).hide().prev().show()
             })
 
         //取消事件
         $element
-            .find('#'+ originalFile.id +' > .info > .up_cancel')
+            .find('#' + originalFile.id + ' > .info > .up_cancel')
             .off('click.bjui.upload.cancel')
-            .on('click.bjui.upload.cancel', $.proxy(function(e) {
+            .on('click.bjui.upload.cancel', $.proxy(function (e) {
                 this.tools.removeQueueItem(e, xhr)
             }, this))
     }
 
-    Upload.prototype.onProgress = function(file, loaded, total) {
-        var that        = this, options = that.options
-        var $progress   = that.$element.find('#'+ file.id + ' .progress')
-        var thisLoaded  = loaded
+    Upload.prototype.onProgress = function (file, loaded, total) {
+        var that = this, options = that.options
+        var $progress = that.$element.find('#' + file.id + ' .progress')
+        var thisLoaded = loaded
         //根据上一次触发progress时上传的大小,得到本次的增量
-        var lastLoaded  = $progress.attr('lastLoaded') || 0
+        var lastLoaded = $progress.attr('lastLoaded') || 0
 
         loaded -= parseInt(lastLoaded)
         if (loaded > file.size) loaded = file.size
 
         that.$progressBar = $progress.children('.bar')
-        var oldWidth      = options.breakPoints ? parseFloat(that.$progressBar.get(0).style.width || 0) : 0
-        var percent       = (loaded / total * 100 + oldWidth).toFixed(2)
-        var percentText   = percent > 100 ? '100%' : percent + '%'
+        var oldWidth = options.breakPoints ? parseFloat(that.$progressBar.get(0).style.width || 0) : 0
+        var percent = (loaded / total * 100 + oldWidth).toFixed(2)
+        var percentText = percent > 100 ? '100%' : percent + '%'
 
         //校正四舍五入的计算误差
         if (options.showUploadedSize) {
@@ -470,7 +472,7 @@
         }
     }
 
-    Upload.prototype.destroy = function() {
+    Upload.prototype.destroy = function () {
 
     }
 
@@ -478,14 +480,14 @@
     // =======================
 
     function Plugin(option) {
-        var args     = arguments
+        var args = arguments
         var property = option
 
         if (window.FileReader) {
             return this.each(function () {
-                var $this   = $(this)
+                var $this = $(this)
                 var options = $.extend({}, Upload.DEFAULTS, $this.data(), typeof option == 'object' && option)
-                var data    = $this.data('bjui.upload')
+                var data = $this.data('bjui.upload')
 
                 if (!data) $this.data('bjui.upload', (data = new Upload(this, options)))
                 if (typeof property == 'string' && $.isFunction(data[property])) {
@@ -497,18 +499,18 @@
                 }
             })
         } else { //for IE8-9
-            this.each(function() {
+            this.each(function () {
                 if (!$.fn.uploadify) return
                 var options = {
-                    swf           : BJUI.PLUGINPATH +'uploadify/scripts/uploadify.swf',
-                    fileTypeExts  : '*.jpg;*.png;*.mp4',
-                    id            : 'fileInput',
-                    fileObjName   : 'file',
-                    fileSizeLimit : 204800,
-                    buttonText    : '选择上传文件',
-                    auto          : false,
-                    multi         : false,
-                    height        : 24
+                    swf: BJUI.PLUGINPATH + 'uploadify/scripts/uploadify.swf',
+                    fileTypeExts: '*.jpg;*.png;*.mp4',
+                    id: 'fileInput',
+                    fileObjName: 'file',
+                    fileSizeLimit: 204800,
+                    buttonText: '选择上传文件',
+                    auto: false,
+                    multi: false,
+                    height: 24
                 }
                 var $element = $(this), op = $element.data()
 
@@ -522,14 +524,14 @@
 
                     if (!options.uploader.isFinishedTm()) {
                         $element.alertmsg('error', (options.warn || FRAG.alertPlhMsg.replace('#plhmsg#', BJUI.regional.plhmsg)))
-                        BJUI.debug('Upload Plugin: The options uploader is incorrect: '+ options.uploader)
+                        BJUI.debug('Upload Plugin: The options uploader is incorrect: ' + options.uploader)
                         return
                     }
 
                     options.uploader = encodeURI(options.uploader)
                 }
                 if (options.id == 'fileInput') options.id = options.id + (new Date().getTime())
-                var $file = $('<input type="file" name="'+ options.name +'" id="'+ options.id +'">')
+                var $file = $('<input type="file" name="' + options.name + '" id="' + options.id + '">')
 
                 if (options.onInit && typeof options.onInit == 'string')
                     options.onInit = options.onInit.toFunc()
@@ -542,7 +544,7 @@
                 if (options.onUploadComplete && typeof options.onUploadComplete == 'string')
                     options.onUploadComplete = options.onUploadComplete.toFunc()
                 if (options.onUploadError && typeof options.onUploadError == 'string')
-                    options.onUploadError   = options.onUploadError.toFunc()
+                    options.onUploadError = options.onUploadError.toFunc()
 
                 $file.appendTo($element)
                 if (!options.auto) {
@@ -551,12 +553,12 @@
                     $upBtn
                         .hide()
                         .insertAfter($element)
-                        .click(function() {
+                        .click(function () {
                             $file.uploadify('upload', '*');
                             $(this).hide()
                         })
 
-                    options.onSelect = function() {
+                    options.onSelect = function () {
                         $upBtn.show()
                     }
                 }
@@ -567,7 +569,7 @@
 
     var old = $.fn.upload
 
-    $.fn.upload             = Plugin
+    $.fn.upload = Plugin
     $.fn.upload.Constructor = Upload
 
     // UPLOAD NO CONFLICT
@@ -581,7 +583,7 @@
     // UPLOAD DATA-API
     // ==============
 
-    $(document).on(BJUI.eventType.initUI, function(e) {
+    $(document).on(BJUI.eventType.initUI, function (e) {
         var $this = $(e.target).find('[data-toggle="upload"]')
 
         if (!$this.length) return