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: 10cb6d020745ff0cabf66f8a95dcdfaa7eca1329
4
- data.tar.gz: 7a53dbd31ad01c19401349fba74dfbd242c65c0d
3
+ metadata.gz: 112d66be392e6bc0812be36d832f4e7db693f639
4
+ data.tar.gz: bc24fc2916f2582c3ea88e039bfb4c942ba80eea
5
5
  SHA512:
6
- metadata.gz: 7384fa091913942810ff50ebf34030f10276009bb1907d5411666bfbdfb2cbb75f035423cd46425a033a93fdbdd8b2a27f9c7ef70052de00e3e3e681f31df466
7
- data.tar.gz: 38881b13b635c4c3413e9b47570adc65843d3bc360382b0cf8e7fcf56a8a23e8c865d071ad63fc4e4697998195361479989d1c2fce1981df58a9e737e6bf38fe
6
+ metadata.gz: f476dba4e32f3dddedea9a2028f55f0f2ee8edd4d9bce8a1db805a1a4cc062581feefc786fe3c46c0e2099267c76b701e9a131bcd8ce70de06e43b2158d11695
7
+ data.tar.gz: 572c802c79e39877c1346d4a2f1b60c2ca6d546aa34575e9fdd8a10ea574e0d01f60927a9571d8bf7378c8c5d8b4808914ce745de88cab0e4e7707bdf6e92a47
@@ -1,3 +1,3 @@
1
1
  module UniversalS3Uploader
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -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 passIndex(func)
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
- onResponse(index, this.response);
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", passIndex(this.options.onLoadstart), false);
133
- xhr.upload.addEventListener("progress", passIndex(this.options.onProgress), false);
134
- xhr.addEventListener("load", passIndex(this.options.onSuccess), false);
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);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: universal_s3_uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dohan Kim