universal_s3_uploader 0.0.3 → 0.0.4

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: 911a298d9727cc3fbe9630b6738260be106fb193
4
- data.tar.gz: bbafefe7772f18d5f7a5aa1adfed149ad17fcb57
3
+ metadata.gz: a6290b11a71f2ead219fee3faf6b9c7f07c42ca0
4
+ data.tar.gz: 61ded007c33c2c8a14c11b84eb1dda57dbf6a261
5
5
  SHA512:
6
- metadata.gz: 591aa7c0c011ae3f9d308fafc646607a757b8b58da69149ae99a188f8f7740958f38b0a3e730e0beec9e5e2a634ea4a2d0bdd72479a29501962441ed2e962bb4
7
- data.tar.gz: 3a05de1196c21acf28117e9705142eab21755ca151f13f1e494b9d518250acb30b5ebdddf7353c4dd15fa55b1af29218e7c89560a08fae6cce1ec3ded1dda3b3
6
+ metadata.gz: debeccf40d0f3a8281a02409d1eef0dbffe808dc141639b074f5f1651abd1be513144e2901d29aa4ab67baeef47630f721734fa96fce8f0c86a400fa421a2381
7
+ data.tar.gz: f69229e84b3977cf7efbd8cef42b29e24506e7f601d3f77d11c44666615e16cf0481f6d9c669739a63ba3d292a0505fd8a9dda3fff6710a601642076d930bb50
@@ -56,8 +56,8 @@ module UniversalS3Uploader
56
56
  tag += av.hidden_field_tag :Signature, signature, id: nil
57
57
  tag += av.file_field_tag :file, multiple: true, accept: 'image/*'
58
58
 
59
- tag += '<object id="swfUploader" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=11,1,0,0">'
60
- tag += '<param name="movie" value="/assets/S3Uploader.swf">'
59
+ tag += '<object id="flashUploader" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=11,1,0,0">'
60
+ tag += '<param name="movie" value="/assets/universal_s3_uploader.swf">'
61
61
  tag += '<param name="wmode" value="transparent">'
62
62
  tag += '</object>'
63
63
  end
@@ -2,14 +2,6 @@
2
2
  {
3
3
  $.fn.universal_s3_uploader = function(options)
4
4
  {
5
- if (this.length > 1)
6
- {
7
- this.each(function()
8
- {
9
- $(this).universal_s3_uploader(options);
10
- });
11
- }
12
-
13
5
  if (!this.universalS3UploaderInstance)
14
6
  {
15
7
  this.universalS3UploaderInstance = new UniversalS3Uploader(this, options);
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.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dohan Kim
@@ -21,9 +21,7 @@ files:
21
21
  - lib/universal_s3_uploader.rb
22
22
  - lib/universal_s3_uploader/engine.rb
23
23
  - lib/universal_s3_uploader/view_helper.rb
24
- - vendor/assets/flash/S3Uploader.as
25
- - vendor/assets/flash/S3Uploader.fla
26
- - vendor/assets/flash/S3Uploader.swf
24
+ - vendor/assets/flash/universal_s3_uploader.swf
27
25
  - vendor/assets/javascripts/universal_s3_uploader.js
28
26
  homepage: http://rubygems.org/gems/universal_s3_uploader
29
27
  licenses:
@@ -1,120 +0,0 @@
1
- package
2
- {
3
- import flash.display.Sprite;
4
- import flash.events.MouseEvent;
5
- import flash.net.FileReferenceList;
6
- import flash.events.Event;
7
- import flash.net.FileReference;
8
- import flash.external.ExternalInterface;
9
- import flash.net.URLVariables;
10
- import flash.net.URLRequest;
11
- import flash.net.URLRequestMethod;
12
- import flash.net.FileFilter;
13
- import flash.events.ProgressEvent;
14
- import flash.display.Stage;
15
- import flash.events.DataEvent;
16
-
17
- public class S3Uploader extends Sprite
18
- {
19
- private var button;
20
- private var files;
21
- private var params;
22
-
23
- private function log(str:*):void
24
- {
25
- ExternalInterface.call("console.log", str);
26
- }
27
-
28
- public function S3Uploader()
29
- {
30
- getRequestData();
31
- makeButton();
32
- }
33
-
34
- private function getRequestData()
35
- {
36
- if (ExternalInterface.available)
37
- {
38
- params = new URLVariables();
39
- ExternalInterface.addCallback("sendFormData", receiveFormData);
40
- }
41
- }
42
-
43
- private function receiveFormData(name:String, value:String):void
44
- {
45
- params[name] = value;
46
- }
47
-
48
- private function makeButton():void
49
- {
50
- button = new Sprite();
51
- button.graphics.beginFill(0x0000ff, 0);
52
- button.graphics.drawRect(0,0,100,100);
53
- button.graphics.endFill();
54
- button.buttonMode = true;
55
- button.addEventListener(MouseEvent.CLICK, clickHandler);
56
-
57
- addChild(button);
58
- }
59
-
60
- private function clickHandler(evt:MouseEvent):void
61
- {
62
- files = new FileReferenceList();
63
- files.addEventListener(Event.SELECT, selectHandler);
64
-
65
- var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
66
- files.browse(new Array(imageTypes));
67
- }
68
-
69
- private function selectHandler(evt:Event):void
70
- {
71
- var index = 0;
72
- for each (var file in files.fileList)
73
- {
74
- upload(file, index++);
75
- }
76
- }
77
-
78
- private function upload(file:FileReference, index:int):void
79
- {
80
- var request:URLRequest = new URLRequest('http://' + params["bucket"] + '.s3.amazonaws.com');
81
- request.method = URLRequestMethod.POST;
82
- request.data = params;
83
-
84
- function passIndex(func:Function):Function
85
- {
86
- return function handler(evt:Event):void { func(index, evt); }
87
- }
88
-
89
- file.addEventListener(Event.OPEN, passIndex(openHandler));
90
- file.addEventListener(ProgressEvent.PROGRESS, passIndex(progressHandler));
91
- file.addEventListener(Event.COMPLETE, passIndex(completeHandler));
92
- file.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, passIndex(uploadCompleteDataHandler));
93
-
94
- file.upload(request, 'file');
95
- }
96
-
97
- private function openHandler(index:int, evt:Event):void
98
- {
99
- ExternalInterface.call("$('form.universal_s3_uploader').universal_s3_uploader().options.onLoadstart", index);
100
- }
101
-
102
- private function progressHandler(index:int, evt:ProgressEvent):void
103
- {
104
- var event = new Object();
105
- event.loaded = evt.bytesLoaded;
106
- event.total = evt.bytesTotal;
107
- ExternalInterface.call("$('form.universal_s3_uploader').universal_s3_uploader().options.onProgress", index, event);
108
- }
109
-
110
- private function completeHandler(index:int, evt:Event):void
111
- {
112
- ExternalInterface.call("$('form.universal_s3_uploader').universal_s3_uploader().options.onSuccess", index);
113
- }
114
-
115
- private function uploadCompleteDataHandler(index:int, evt:DataEvent):void
116
- {
117
- ExternalInterface.call("$('form.universal_s3_uploader').universal_s3_uploader().options.onResponse", evt.data);
118
- }
119
- }
120
- }
Binary file