Javascript jQuery插件不适用于多个选择

Javascript jQuery插件不适用于多个选择,javascript,jquery,ajax,file-upload,plugins,Javascript,Jquery,Ajax,File Upload,Plugins,(函数($){ $.fn.bcatUpload=函数(选项){ if(方法[选项]){ 返回方法[options].apply(this,Array.prototype.slice.call(arguments,1)); }else if(typeof options==='object'| |!options){ return methods.init.apply(这是参数); }否则{ $.error('Method'+options+'在jQuery.bcatUpload上不存在); }

(函数($){
$.fn.bcatUpload=函数(选项){
if(方法[选项]){
返回方法[options].apply(this,Array.prototype.slice.call(arguments,1));
}else if(typeof options==='object'| |!options){
return methods.init.apply(这是参数);
}否则{
$.error('Method'+options+'在jQuery.bcatUpload上不存在);
}
}
$.fn.bcatUpload.files_数组=[];
var方法={
init:函数(参数){
返回此。每个函数(索引,el){
元素=$(该元素);
var设置=$.extend(true,{},$默认值,参数);
私有_方法。准备(元素);
元素更改(功能(事件){
event.preventDefault();
var file_list=元素[0]。文件;
$.each(文件列表、函数(索引、文件){
$.fn.bcatUpload.files\u array.push(文件);
私有方法。显示(元素);
});
});
});
},
删除:函数(索引){
元素=$(该元素);
$.fn.bcatUpload.files\u array.splice(索引,1);
log($.fn.bcatUpload.files\u数组);
私有方法。显示(元素);
},
上传:函数(){
//开始上传。。。
console.log('Uploading…');
log($.fn.bcatUpload.files\u数组);
返回方法;
}
};
var private_方法={
准备:功能(元素){
$html=element.wrap(“”).parent();
元素。隐藏();
var btn_class=($defaults.button.class==null)?“”:“class=”+$defaults.button.class+”;
$html.append(“”+$defaults.button.label+“”);
$html.append(“”);
$html.find('button')。单击(函数(事件){
元素。单击();
});
},
显示:功能(元素){
$html=element.sides('.bcat文件列表');
var文件_字符串=“”;
$.each($.fn.bcatUpload.files_数组,函数(索引,文件){
file_name=private_methods.formatFileName(文件);
文件字符串+=''+文件名+'';
文件字符串+='';
});
$html.html(文件字符串);
//注册Click事件处理程序。
//$html.find('blockquote a.close')。单击(函数(事件){
//方法.remove($(this.attr('data-index'));
// });
},
formatFileName:函数(文件){
var filename=private_methods.getFileName(file.name);
var ext=private_methods.getExtension(file.name);
如果(filename.length>20){
filename=filename.substring(0,20)+'..';
}
返回文件名+'.'+ext;
},
getExtension:函数(文件名){
var file_name_array=filename.split('.');
返回文件名数组[文件名数组.length-1];
},
getFileName:函数(文件名){
var file_name_array=filename.split('.');
var ext=private_methods.getExtension(文件名);
返回filename.substring(0,filename.length-parseInt(ext.length)-1);
},
getHumanSize:函数(字节,si){
var thresh=si?1000:1024;
if(数学绝对值(字节)=thresh&&u1KB。
max:null,//2097152=>2MB。
总计:null,//4194304=>4MB。
},
尺寸:{
min:[null,null],
max:[零,零]
},
允许的:{
分机:[],
哑剧:{
图片:[
'image/jpeg',//JPG/jpeg image。
'image/gif',//gif图像。
'image/png',//png图像。
'image/bmp'//bmp图像
], 
文件:[
'application/pdf',//pdf文件。
'application/msword',//文档文件。
'application/vnd.openxmlformats officedocument.wordprocessingml.document'//DOCX文件。
]
}
},
按钮:{
类别:null,
标签:“选择文件”,
图标:空
},
限额:0
}
}(jQuery));
$(“:file”).bcatUpload({
尺寸:{
最低:2048,
最高:5000万
}
});
div.bcat-upload-container{
显示:块;
明确:两者皆有;
}
div.bcat-upload-container按钮,#upload{
背景:黑暗;
填充:10px 15px;
边框宽度:0px;
颜色:#F2F2;
字体大小:粗体;
边界半径:3px;
}
div.bcat-upload-container.bcat-clear{clear:both;}
div.bcat-upload-container div.bcat-file-list{
显示:块;
明确:两者皆有;
}
div.bcat-upload-container div.bcat-file-list blockquote{
填充:10px;
利润率:10px;
显示:块;
左边框:2倍实心#ccc;
边框底部:1px实心#ccc;
}
div.bcat-upload-container div.bcat-file-list blockquote.filename{
字体大小:12px;
字体系列:“Courier New”;
}
div.bcat-upload-container div.bcat-file-list块报价a{
文字装饰:无;
浮动:对;
}
#上传{background:darkgreen;}