|
|
/* UploadiFive 1.2.3 Copyright (c) 2012 Reactive Apps, Ronnie Garcia Released under the UploadiFive Standard License <http://www.uploadify.com/uploadifive-standard-license>
*/ (function(d){var o={init:function(t){return this.i(function(){var s=d(this);s.data("uploadifive",{t:{},o:0,l:0,u:{count:0,selected:0,s:0,p:0,v:0,h:0},m:{g:0,_:0,F:0,p:0,count:0}});var p=s.data("uploadifive");var c=p.D=d.extend({I:true,T:false,L:"Select Files",C:false,N:true,M:false,q:"Filedata",O:0,U:false,k:{},height:30,X:false,method:"post",R:true,B:[],S:false,A:0,P:false,j:0,H:0,V:0,Y:"uploadifive.php",width:100},t);var r;if(c.U){r=c.U.split("|")}if(isNaN(c.O)){var e=parseInt(c.O)*1.024;if(c.O.indexOf("KB")>-1){c.O=e*1e3}else if(c.O.indexOf("MB")>-1){c.O=e*1e6}else if(c.O.indexOf("GB")>-1){c.O=e*1e9}}else{c.O=c.O*1024}p.Z=d('<input type="file">').G({"font-size":c.height+"px",opacity:0,position:"absolute",right:"-3px",top:"-3px","z-index":999});p.K=function(){var e=p.Z.clone();var t=e.name="input"+p.o++;if(c.R){e.W("multiple",true)}if(c.U){e.W("accept",c.U)}e.bind("change",function(){p.u.selected=0;p.u.s=0;p.u.p=0;p.u.v=0;var e=this.files.length;p.u.selected=e;if(p.u.count+e>c.A&&c.A!==0){if(d.$("onError",c.B)<0){alert("The maximum number of queue items has been reached ("+c.A+"). Please select fewer files.")}if(typeof c.J==="function"){c.J.call(s,"QUEUE_LIMIT_EXCEEDED")}}else{for(var i=0;i<e;i++){file=this.files[i];p.ee(file)}p.t[t]=this;p.K()}if(c.I){o.upload.call(s)}if(typeof c.ie==="function"){c.ie.call(s,p.u)}});if(p.te){p.te.hide()}p.button.append(e);p.te=e};p.fe=function(e){d(p.t[e]).remove();delete p.t[e];p.o--};p.ne=function(e){e.preventDefault();e.stopPropagation();p.u.selected=0;p.u.s=0;p.u.p=0;p.u.v=0;var i=e.dataTransfer;var t=i.name="input"+p.o++;var f=i.files.length;p.u.selected=f;if(p.u.count+f>c.A&&c.A!==0){if(d.$("onError",c.B)<0){alert("The maximum number of queue items has been reached ("+c.A+"). Please select fewer files.")}if(typeof c.J==="function"){c.J.call(s,"QUEUE_LIMIT_EXCEEDED")}}else{for(var n=0;n<f;n++){file=i.files[n];p.ee(file);if(r&&r.indexOf(file.type)===-1){p.error("FORBIDDEN_FILE_TYPE",file)}}p.t[t]=i}if(c.I){o.upload.call(s)}if(typeof c.re==="function"){c.re.call(s,i.files,i.files.length)}};p.oe=function(e){for(var i in p.t){input=p.t[i];limit=input.files.length;for(var t=0;t<limit;t++){existingFile=input.files[t];if(existingFile.name==e.name&&!existingFile.complete){return true}}}return false};p.le=function(e){for(var i in p.t){input=p.t[i];limit=input.files.length;for(var t=0;t<limit;t++){existingFile=input.files[t];if(existingFile.name==e.name&&!existingFile.complete){p.u.s++;o.cancel.call(s,existingFile,true)}}}};if(c.X===false){p.ae=d('<div class="uploadifive-queue-item">'+'<a class="close" href="#">X</a>'+'<div><span class="filename"></span><span class="fileinfo"></span></div>'+'<div class="progress">'+'<div class="progress-bar"></div>'+"</div>"+"</div>")}else{p.ae=d(c.X)}p.ee=function(e){if(d.$("onAddQueueItem",c.B)<0){p.le(e);e.ae=p.ae.clone();e.ae.W("id",c.id+"-file-"+p.l++);e.ae.find(".close").bind("click",function(){o.cancel.call(s,e);return false});var i=e.name;if(i.length>c.H&&c.H!==0){i=i.substring(0,c.H)+"..."}e.ae.find(".filename").ue(i);e.ae.data("file",e);p.se.append(e.ae)}if(typeof c.pe==="function"){c.pe.call(s,e)}if(e.size>c.O&&c.O!==0){p.error("FILE_SIZE_LIMIT_EXCEEDED",e)}else{p.u.v++;p.u.count++}};p.ce=function(e,i,t){if(!t)t=0;var f=i?0:500;if(e.ae){if(e.ae.find(".fileinfo").ue()!=" - Completed"){e.ae.find(".fileinfo").ue(" - Cancelled")}e.ae.find(".progress-bar").width(0);e.ae.ve(t).de(f,function(){d(this).remove()});delete e.ae;p.u.count--}};p.he=function(){var e=0;for(var i in p.t){input=p.t[i];limit=input.files.length;for(var t=0;t<limit;t++){file=input.files[t];if(!file.me&&!file.complete){e++}}}return e};p.Ee=function(i){if(d.$("onCheck",c.B)<0){d.ye({async:false});var e=d.extend(c.k,{filename:i.name});d.ge(c.C,e,function(e){i._e=parseInt(e)});if(i._e){if(!confirm("A file named "+i.name+" already exists in the upload folder.\nWould you like to replace it?")){o.cancel.call(s,i);return true}}}if(typeof c.Fe==="function"){c.Fe.call(s,i,i._e)}return false};p.De=function(a,u){if(!a.me&&!a.complete&&!a.Ie){a.Ie=true;p.m.g++;p.m.xe++;xhr=a.be=new XMLHttpRe
|