socketio-file-upload
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -316,3 +316,3 @@ /* | ||
for (var i = 0; i < files.length; i++) { | ||
files[i].meta = {}; | ||
if(!files[i].meta) files[i].meta = {}; | ||
} | ||
@@ -319,0 +319,0 @@ |
@@ -11,5 +11,5 @@ /* Socket IO File Upload Client-Side Library | ||
4],g+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(m[k+1]&15)<<2|m[k+2]>>6],g+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[m[k+2]&63];2===r%3?g=g.substring(0,g.length-1)+"=":1===r%3&&(g=g.substring(0,g.length-2)+"==");e=g}}catch(y){h.emit("siofu_done",{id:c,interrupt:!0});break a}h.emit("siofu_progress",{id:c,size:a.size,start:p,end:l,content:e,base64:u})}q("progress",{file:a,bytesLoaded:l,name:n});t+=v;t<a.size?w():(h.emit("siofu_done",{id:c}),q("load", | ||
{file:a,reader:b,name:n}))};e(b,"load",l);e(b,"error",function(){h.emit("siofu_done",{id:c,interrupt:!0});r(b,"load",l)});e(b,"abort",function(){h.emit("siofu_done",{id:c,interrupt:!0});r(b,"load",l)});h.emit("siofu_start",{name:a.name,mtime:a.lastModifiedDate,meta:a.meta,size:a.size,encoding:f?"text":"octet",id:c});u.push(function(a){n=a;w()})}},w=function(a){if(0!==a.length){for(var b=0;b<a.length;b++)a[b].meta={};if(q("choose",{files:a}))for(b=0;b<a.length;b++)z(a[b])}},l=function(a){var b=a.target.files|| | ||
a.dataTransfer.files;a.preventDefault();w(b)};this.submitFiles=function(a){a&&w(a)};this.listenOnSubmit=function(a,b){b.files&&e(a,"click",function(){w(b.files)},!1)};this.listenOnArraySubmit=function(a,b){for(var c in b)this.listenOnSubmit(a,b[c])};this.listenOnInput=function(a){a.files&&e(a,"change",l,!1)};this.listenOnDrop=function(a){e(a,"dragover",function(a){a.preventDefault()},!1);e(a,"drop",l)};this.prompt=function(){var a;a=document.getElementById(d.fileInputElementId);a||(a=document.createElement("input"), | ||
a.setAttribute("type","file"),a.setAttribute("id",d.fileInputElementId),a.style.display="none",document.body.appendChild(a));e(a,"change",l,!1);var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null);a.dispatchEvent(b)};this.destroy=function(){y();var a=document.getElementById(d.fileInputElementId);a&&a.parentNode.removeChild(a);f={};p=[];u=[]};this.addEventListener=function(a,b){f[a]||(f[a]=[]);f[a].push(b)};this.removeEventListener=function(a, | ||
b){if(!f[a])return!1;for(var c=0;c<f[a].length;c++)if(f[a][c]===b)return f[a].splice(c,1),!0;return!1};this.dispatchEvent=function(a){var b=f[a.type];if(!b)return!0;for(var c=!0,d=0;d<b.length;d++)!1===b[d](a)&&(c=!1);return c};e(h,"siofu_ready",function(a){u[a.id](a.name)});e(h,"siofu_complete",function(a){q("complete",{file:p[a.id],detail:a.detail,success:a.success})});e(h,"siofu_error",function(a){q("error",{file:p[a.id],message:a.message,code:0})})}}); | ||
{file:a,reader:b,name:n}))};e(b,"load",l);e(b,"error",function(){h.emit("siofu_done",{id:c,interrupt:!0});r(b,"load",l)});e(b,"abort",function(){h.emit("siofu_done",{id:c,interrupt:!0});r(b,"load",l)});h.emit("siofu_start",{name:a.name,mtime:a.lastModifiedDate,meta:a.meta,size:a.size,encoding:f?"text":"octet",id:c});u.push(function(a){n=a;w()})}},w=function(a){if(0!==a.length){for(var b=0;b<a.length;b++)a[b].meta||(a[b].meta={});if(q("choose",{files:a}))for(b=0;b<a.length;b++)z(a[b])}},l=function(a){var b= | ||
a.target.files||a.dataTransfer.files;a.preventDefault();w(b)};this.submitFiles=function(a){a&&w(a)};this.listenOnSubmit=function(a,b){b.files&&e(a,"click",function(){w(b.files)},!1)};this.listenOnArraySubmit=function(a,b){for(var c in b)this.listenOnSubmit(a,b[c])};this.listenOnInput=function(a){a.files&&e(a,"change",l,!1)};this.listenOnDrop=function(a){e(a,"dragover",function(a){a.preventDefault()},!1);e(a,"drop",l)};this.prompt=function(){var a;a=document.getElementById(d.fileInputElementId);a|| | ||
(a=document.createElement("input"),a.setAttribute("type","file"),a.setAttribute("id",d.fileInputElementId),a.style.display="none",document.body.appendChild(a));e(a,"change",l,!1);var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null);a.dispatchEvent(b)};this.destroy=function(){y();var a=document.getElementById(d.fileInputElementId);a&&a.parentNode.removeChild(a);f={};p=[];u=[]};this.addEventListener=function(a,b){f[a]||(f[a]=[]);f[a].push(b)}; | ||
this.removeEventListener=function(a,b){if(!f[a])return!1;for(var c=0;c<f[a].length;c++)if(f[a][c]===b)return f[a].splice(c,1),!0;return!1};this.dispatchEvent=function(a){var b=f[a.type];if(!b)return!0;for(var c=!0,d=0;d<b.length;d++)!1===b[d](a)&&(c=!1);return c};e(h,"siofu_ready",function(a){u[a.id](a.name)});e(h,"siofu_complete",function(a){q("complete",{file:p[a.id],detail:a.detail,success:a.success})});e(h,"siofu_error",function(a){q("error",{file:p[a.id],message:a.message,code:0})})}}); |
{ | ||
"name": "socketio-file-upload", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Uploads files to a Node.JS server using Socket.IO", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -0,0 +0,0 @@ Socket.IO File Upload |
@@ -0,0 +0,0 @@ /* |
53874
881