universal_s3_uploader 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 112d66be392e6bc0812be36d832f4e7db693f639
|
|
4
|
+
data.tar.gz: bc24fc2916f2582c3ea88e039bfb4c942ba80eea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f476dba4e32f3dddedea9a2028f55f0f2ee8edd4d9bce8a1db805a1a4cc062581feefc786fe3c46c0e2099267c76b701e9a131bcd8ce70de06e43b2158d11695
|
|
7
|
+
data.tar.gz: 572c802c79e39877c1346d4a2f1b60c2ca6d546aa34575e9fdd8a10ea574e0d01f60927a9571d8bf7378c8c5d8b4808914ce745de88cab0e4e7707bdf6e92a47
|
|
@@ -14,26 +14,22 @@
|
|
|
14
14
|
|
|
15
15
|
var defaultOptions =
|
|
16
16
|
{
|
|
17
|
-
onValidation: function(index)
|
|
17
|
+
onValidation: function(index, filename, event)
|
|
18
18
|
{
|
|
19
19
|
return true;
|
|
20
20
|
},
|
|
21
|
-
onLoadstart: function(index, event)
|
|
21
|
+
onLoadstart: function(index, filename, event)
|
|
22
22
|
{
|
|
23
23
|
console.log(index + " will be uploaded.");
|
|
24
24
|
},
|
|
25
|
-
onProgress: function(index, event)
|
|
25
|
+
onProgress: function(index, filename, event)
|
|
26
26
|
{
|
|
27
27
|
var percentage = Math.round(event.loaded * 100 / event.total);
|
|
28
28
|
console.log(percentage + " %");
|
|
29
29
|
},
|
|
30
|
-
onSuccess: function(index, event)
|
|
30
|
+
onSuccess: function(index, filename, event)
|
|
31
31
|
{
|
|
32
32
|
console.log(index + " was successfully uploaded.");
|
|
33
|
-
},
|
|
34
|
-
onResponse: function(index, response)
|
|
35
|
-
{
|
|
36
|
-
console.log(response);
|
|
37
33
|
}
|
|
38
34
|
};
|
|
39
35
|
|
|
@@ -116,23 +112,16 @@
|
|
|
116
112
|
});
|
|
117
113
|
fd.append('file', file);
|
|
118
114
|
|
|
119
|
-
function
|
|
120
|
-
{
|
|
121
|
-
return function(event) { $.proxy(func, this)(index, event); }
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
var onResponse = this.options.onResponse;
|
|
125
|
-
function callResponseHandler(event)
|
|
115
|
+
function passIndexFilename(func)
|
|
126
116
|
{
|
|
127
|
-
|
|
117
|
+
return function(event) { $.proxy(func, this)(index, file.name, event); }
|
|
128
118
|
}
|
|
129
119
|
|
|
130
120
|
var xhr = new XMLHttpRequest();
|
|
131
121
|
|
|
132
|
-
xhr.addEventListener("loadstart",
|
|
133
|
-
xhr.upload.addEventListener("progress",
|
|
134
|
-
xhr.addEventListener("load",
|
|
135
|
-
xhr.addEventListener("load", callResponseHandler, false);
|
|
122
|
+
xhr.addEventListener("loadstart", passIndexFilename(this.options.onLoadstart), false);
|
|
123
|
+
xhr.upload.addEventListener("progress", passIndexFilename(this.options.onProgress), false);
|
|
124
|
+
xhr.addEventListener("load", passIndexFilename(this.options.onSuccess), false);
|
|
136
125
|
|
|
137
126
|
xhr.open('POST', this.element.attr('action'), true);
|
|
138
127
|
xhr.send(fd);
|