fine_uploader 3.4.1 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -49,7 +49,6 @@ qq.FineUploader = function(o){
49
49
  button: 'qq-upload-button',
50
50
  drop: 'qq-upload-drop-area',
51
51
  dropActive: 'qq-upload-drop-area-active',
52
- dropDisabled: 'qq-upload-drop-area-disabled',
53
52
  list: 'qq-upload-list',
54
53
  progressBar: 'qq-progress-bar',
55
54
  file: 'qq-upload-file',
@@ -79,7 +78,8 @@ qq.FineUploader = function(o){
79
78
  enableTooltip: true
80
79
  },
81
80
  messages: {
82
- tooManyFilesError: "You may only drop one file"
81
+ tooManyFilesError: "You may only drop one file",
82
+ unsupportedBrowser: "Unrecoverable error - this browser does not permit file uploading of any kind."
83
83
  },
84
84
  retry: {
85
85
  showAutoRetryNote: true,
@@ -134,34 +134,40 @@ qq.FineUploader = function(o){
134
134
 
135
135
  // overwrite options with user supplied
136
136
  qq.extend(this._options, o, true);
137
- this._wrapCallbacks();
138
-
139
- // overwrite the upload button text if any
140
- // same for the Cancel button and Fail message text
141
- this._options.template = this._options.template.replace(/\{dragZoneText\}/g, this._options.text.dragZone);
142
- this._options.template = this._options.template.replace(/\{uploadButtonText\}/g, this._options.text.uploadButton);
143
- this._options.template = this._options.template.replace(/\{dropProcessingText\}/g, this._options.text.dropProcessing);
144
- this._options.fileTemplate = this._options.fileTemplate.replace(/\{cancelButtonText\}/g, this._options.text.cancelButton);
145
- this._options.fileTemplate = this._options.fileTemplate.replace(/\{retryButtonText\}/g, this._options.text.retryButton);
146
- this._options.fileTemplate = this._options.fileTemplate.replace(/\{deleteButtonText\}/g, this._options.text.deleteButton);
147
- this._options.fileTemplate = this._options.fileTemplate.replace(/\{statusText\}/g, "");
148
-
149
- this._element = this._options.element;
150
- this._element.innerHTML = this._options.template;
151
- this._listElement = this._options.listElement || this._find(this._element, 'list');
152
-
153
- this._classes = this._options.classes;
154
-
155
- if (!this._button) {
156
- this._button = this._createUploadButton(this._find(this._element, 'button'));
137
+
138
+ if (!qq.supportedFeatures.uploading || (this._options.cors.expected && !qq.supportedFeatures.uploadCors)) {
139
+ this._options.element.innerHTML = "<div>" + this._options.messages.unsupportedBrowser + "</div>"
157
140
  }
141
+ else {
142
+ this._wrapCallbacks();
143
+
144
+ // overwrite the upload button text if any
145
+ // same for the Cancel button and Fail message text
146
+ this._options.template = this._options.template.replace(/\{dragZoneText\}/g, this._options.text.dragZone);
147
+ this._options.template = this._options.template.replace(/\{uploadButtonText\}/g, this._options.text.uploadButton);
148
+ this._options.template = this._options.template.replace(/\{dropProcessingText\}/g, this._options.text.dropProcessing);
149
+ this._options.fileTemplate = this._options.fileTemplate.replace(/\{cancelButtonText\}/g, this._options.text.cancelButton);
150
+ this._options.fileTemplate = this._options.fileTemplate.replace(/\{retryButtonText\}/g, this._options.text.retryButton);
151
+ this._options.fileTemplate = this._options.fileTemplate.replace(/\{deleteButtonText\}/g, this._options.text.deleteButton);
152
+ this._options.fileTemplate = this._options.fileTemplate.replace(/\{statusText\}/g, "");
153
+
154
+ this._element = this._options.element;
155
+ this._element.innerHTML = this._options.template;
156
+ this._listElement = this._options.listElement || this._find(this._element, 'list');
158
157
 
159
- this._bindCancelAndRetryEvents();
158
+ this._classes = this._options.classes;
160
159
 
161
- this._dnd = this._setupDragAndDrop();
160
+ if (!this._button) {
161
+ this._button = this._createUploadButton(this._find(this._element, 'button'));
162
+ }
163
+
164
+ this._bindCancelAndRetryEvents();
165
+
166
+ this._dnd = this._setupDragAndDrop();
162
167
 
163
- if (this._options.paste.targetElement && this._options.paste.promptForName) {
164
- this._setupPastePrompt();
168
+ if (this._options.paste.targetElement && this._options.paste.promptForName) {
169
+ this._setupPastePrompt();
170
+ }
165
171
  }
166
172
  };
167
173
 
@@ -177,7 +183,7 @@ qq.extend(qq.FineUploader.prototype, {
177
183
  this._dnd.setupExtraDropzone(element);
178
184
  },
179
185
  removeExtraDropzone: function(element){
180
- return this._dnd.removeExtraDropzone(element);
186
+ return this._dnd.removeDropzone(element);
181
187
  },
182
188
  getItemByFileId: function(id){
183
189
  var item = this._listElement.firstChild;
@@ -207,53 +213,49 @@ qq.extend(qq.FineUploader.prototype, {
207
213
  _setupDragAndDrop: function() {
208
214
  var self = this,
209
215
  dropProcessingEl = this._find(this._element, 'dropProcessing'),
210
- dnd, preventSelectFiles, defaultDropAreaEl;
216
+ dropZoneElements = this._options.dragAndDrop.extraDropzones,
217
+ preventSelectFiles;
211
218
 
212
219
  preventSelectFiles = function(event) {
213
220
  event.preventDefault();
214
221
  };
215
222
 
216
223
  if (!this._options.dragAndDrop.disableDefaultDropzone) {
217
- defaultDropAreaEl = this._find(this._options.element, 'drop');
224
+ dropZoneElements.push(this._find(this._options.element, 'drop'));
218
225
  }
219
226
 
220
- dnd = new qq.DragAndDrop({
221
- dropArea: defaultDropAreaEl,
222
- extraDropzones: this._options.dragAndDrop.extraDropzones,
223
- hideDropzones: this._options.dragAndDrop.hideDropzones,
224
- multiple: this._options.multiple,
227
+ return new qq.DragAndDrop({
228
+ dropZoneElements: dropZoneElements,
229
+ hideDropZonesBeforeEnter: this._options.dragAndDrop.hideDropzones,
230
+ allowMultipleItems: this._options.multiple,
225
231
  classes: {
226
232
  dropActive: this._options.classes.dropActive
227
233
  },
228
234
  callbacks: {
229
- dropProcessing: function(isProcessing, files) {
235
+ processingDroppedFiles: function() {
230
236
  var input = self._button.getInput();
231
237
 
232
- if (isProcessing) {
233
- qq(dropProcessingEl).css({display: 'block'});
234
- qq(input).attach('click', preventSelectFiles);
235
- }
236
- else {
237
- qq(dropProcessingEl).hide();
238
- qq(input).detach('click', preventSelectFiles);
239
- }
238
+ qq(dropProcessingEl).css({display: 'block'});
239
+ qq(input).attach('click', preventSelectFiles);
240
+ },
241
+ processingDroppedFilesComplete: function(files) {
242
+ var input = self._button.getInput();
243
+
244
+ qq(dropProcessingEl).hide();
245
+ qq(input).detach('click', preventSelectFiles);
240
246
 
241
247
  if (files) {
242
248
  self.addFiles(files);
243
249
  }
244
250
  },
245
- error: function(code, filename) {
246
- self._itemError(code, filename);
251
+ dropError: function(code, errorData) {
252
+ self._itemError(code, errorData);
247
253
  },
248
- log: function(message, level) {
254
+ dropLog: function(message, level) {
249
255
  self.log(message, level);
250
256
  }
251
257
  }
252
258
  });
253
-
254
- dnd.setup();
255
-
256
- return dnd;
257
259
  },
258
260
  _leaving_document_out: function(e){
259
261
  return ((qq.chrome() || (qq.safari() && qq.windows())) && e.clientX == 0 && e.clientY == 0) // null coords for Chrome and Safari Windows
@@ -319,7 +321,7 @@ qq.extend(qq.FineUploader.prototype, {
319
321
  qq(item).removeClass(this._classes.retrying);
320
322
  qq(this._find(item, 'progressBar')).hide();
321
323
 
322
- if (!this._options.disableCancelForFormUploads || qq.isXhrUploadSupported()) {
324
+ if (!this._options.disableCancelForFormUploads || qq.supportedFeatures.ajaxUploading) {
323
325
  qq(this._find(item, 'cancel')).hide();
324
326
  }
325
327
  qq(this._find(item, 'spinner')).hide();
@@ -453,7 +455,7 @@ qq.extend(qq.FineUploader.prototype, {
453
455
  },
454
456
  _addToList: function(id, name){
455
457
  var item = qq.toElement(this._options.fileTemplate);
456
- if (this._options.disableCancelForFormUploads && !qq.isXhrUploadSupported()) {
458
+ if (this._options.disableCancelForFormUploads && !qq.supportedFeatures.ajaxUploading) {
457
459
  var cancelLink = this._find(item, 'cancel');
458
460
  qq(cancelLink).remove();
459
461
  }
@@ -470,7 +472,7 @@ qq.extend(qq.FineUploader.prototype, {
470
472
 
471
473
  this._listElement.appendChild(item);
472
474
 
473
- if (this._options.display.fileSizeOnSubmit && qq.isXhrUploadSupported()) {
475
+ if (this._options.display.fileSizeOnSubmit && qq.supportedFeatures.ajaxUploading) {
474
476
  this._displayFileSize(id);
475
477
  }
476
478
  },
@@ -507,7 +509,7 @@ qq.extend(qq.FineUploader.prototype, {
507
509
 
508
510
  var item = target.parentNode;
509
511
  while(item.qqFileId === undefined) {
510
- item = target = target.parentNode;
512
+ item = item.parentNode;
511
513
  }
512
514
 
513
515
  if (qq(target).hasClass(self._classes.deleteButton)) {
@@ -573,7 +575,7 @@ qq.extend(qq.FineUploader.prototype, {
573
575
  spinnerEl.style.display = "inline-block";
574
576
  },
575
577
  _showCancelLink: function(item) {
576
- if (!this._options.disableCancelForFormUploads || qq.isXhrUploadSupported()) {
578
+ if (!this._options.disableCancelForFormUploads || qq.supportedFeatures.ajaxUploading) {
577
579
  var cancelLink = this._find(item, 'cancel');
578
580
 
579
581
  qq(cancelLink).css({display: 'inline'});
@@ -177,7 +177,7 @@ qq.trimStr = function(string) {
177
177
 
178
178
  qq.isFileOrInput = function(maybeFileOrInput) {
179
179
  "use strict";
180
- if (qq.isBlob(maybeFileOrInput) && window.File && maybeFileOrInput instanceof File) {
180
+ if (window.File && maybeFileOrInput instanceof File) {
181
181
  return true;
182
182
  }
183
183
  else if (window.HTMLInputElement) {
@@ -200,7 +200,7 @@ qq.isFileOrInput = function(maybeFileOrInput) {
200
200
 
201
201
  qq.isBlob = function(maybeBlob) {
202
202
  "use strict";
203
- return window.Blob && maybeBlob instanceof Blob;
203
+ return window.Blob && Object.prototype.toString.call(maybeBlob) === '[object Blob]';
204
204
  };
205
205
 
206
206
  qq.isXhrUploadSupported = function() {
@@ -224,7 +224,7 @@ qq.isFileChunkingSupported = function() {
224
224
  "use strict";
225
225
  return !qq.android() && //android's impl of Blob.slice is broken
226
226
  qq.isXhrUploadSupported() &&
227
- (File.prototype.slice || File.prototype.webkitSlice || File.prototype.mozSlice);
227
+ (File.prototype.slice !== undefined || File.prototype.webkitSlice !== undefined || File.prototype.mozSlice !== undefined);
228
228
  };
229
229
 
230
230
  qq.extend = function (first, second, extendNested) {
metadata CHANGED
@@ -1,30 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fine_uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.1
5
- prerelease:
4
+ version: 3.5.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alif Rachmawadi
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-12 00:00:00.000000000 Z
11
+ date: 2013-04-26 00:00:00.000000000 Z
13
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
14
27
  - !ruby/object:Gem::Dependency
15
28
  name: vendorer
16
29
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
30
  requirements:
19
- - - ! '>='
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: tzinfo
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sass-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
20
60
  - !ruby/object:Gem::Version
21
61
  version: '0'
22
62
  type: :development
23
63
  prerelease: false
24
64
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
65
  requirements:
27
- - - ! '>='
66
+ - - '>='
28
67
  - !ruby/object:Gem::Version
29
68
  version: '0'
30
69
  description: User-friendly file-uploading experience over the web
@@ -34,58 +73,75 @@ executables: []
34
73
  extensions: []
35
74
  extra_rdoc_files: []
36
75
  files:
37
- - .gitignore
38
- - Gemfile
39
- - LICENSE.txt
40
- - README.md
41
- - Rakefile
42
- - Vendorfile
43
- - fine_uploader.gemspec
44
- - lib/fine_uploader.rb
76
+ - lib/fine_uploader/engine.rb
45
77
  - lib/fine_uploader/version.rb
78
+ - lib/fine_uploader.rb
46
79
  - vendor/assets/images/fine_uploader/loading.gif
47
80
  - vendor/assets/images/fine_uploader/processing.gif
81
+ - vendor/assets/stylesheets/fine_uploader.css.scss
48
82
  - vendor/assets/javascripts/fine_uploader.js
49
- - vendor/assets/javascripts/fine_uploader/ajax.requester.js
50
- - vendor/assets/javascripts/fine_uploader/button.js
51
- - vendor/assets/javascripts/fine_uploader/deletefile.ajax.requester.js
52
- - vendor/assets/javascripts/fine_uploader/dnd.js
53
- - vendor/assets/javascripts/fine_uploader/handler.base.js
54
83
  - vendor/assets/javascripts/fine_uploader/handler.form.js
55
- - vendor/assets/javascripts/fine_uploader/handler.xhr.js
84
+ - vendor/assets/javascripts/fine_uploader/util.js
85
+ - vendor/assets/javascripts/fine_uploader/dnd.js
86
+ - vendor/assets/javascripts/fine_uploader/uploader.js
87
+ - vendor/assets/javascripts/fine_uploader/deletefile.ajax.requester.js
56
88
  - vendor/assets/javascripts/fine_uploader/header.js
89
+ - vendor/assets/javascripts/fine_uploader/window.receive.message.js
90
+ - vendor/assets/javascripts/fine_uploader/ajax.requester.js
57
91
  - vendor/assets/javascripts/fine_uploader/iframe.xss.response.js
58
- - vendor/assets/javascripts/fine_uploader/jquery-plugin.js
92
+ - vendor/assets/javascripts/fine_uploader/handler.base.js
59
93
  - vendor/assets/javascripts/fine_uploader/paste.js
94
+ - vendor/assets/javascripts/fine_uploader/handler.xhr.js
60
95
  - vendor/assets/javascripts/fine_uploader/promise.js
61
96
  - vendor/assets/javascripts/fine_uploader/uploader.basic.js
62
- - vendor/assets/javascripts/fine_uploader/uploader.js
63
- - vendor/assets/javascripts/fine_uploader/util.js
64
- - vendor/assets/javascripts/fine_uploader/window.receive.message.js
65
- - vendor/assets/stylesheets/fine_uploader.css.scss
97
+ - vendor/assets/javascripts/fine_uploader/jquery-plugin.js
98
+ - vendor/assets/javascripts/fine_uploader/button.js
99
+ - Rakefile
100
+ - README.markdown
101
+ - test/test_helper.rb
102
+ - test/fine_uploader_test.rb
103
+ - test/dummy/config/boot.rb
104
+ - test/dummy/config/application.rb
105
+ - test/dummy/config/routes.rb
106
+ - test/dummy/config/initializers/secret_token.rb
107
+ - test/dummy/config/environment.rb
108
+ - test/dummy/log/test.log
109
+ - test/dummy/app/assets/stylesheets/application.css
110
+ - test/dummy/app/assets/javascripts/application.js
111
+ - test/dummy/config.ru
66
112
  homepage: https://github.com/subosito/fine_uploader
67
- licenses: []
113
+ licenses:
114
+ - MIT
115
+ metadata: {}
68
116
  post_install_message:
69
117
  rdoc_options: []
70
118
  require_paths:
71
119
  - lib
72
120
  required_ruby_version: !ruby/object:Gem::Requirement
73
- none: false
74
121
  requirements:
75
- - - ! '>='
122
+ - - '>='
76
123
  - !ruby/object:Gem::Version
77
124
  version: '0'
78
125
  required_rubygems_version: !ruby/object:Gem::Requirement
79
- none: false
80
126
  requirements:
81
- - - ! '>='
127
+ - - '>='
82
128
  - !ruby/object:Gem::Version
83
129
  version: '0'
84
130
  requirements: []
85
131
  rubyforge_project:
86
- rubygems_version: 1.8.23
132
+ rubygems_version: 2.0.0
87
133
  signing_key:
88
- specification_version: 3
134
+ specification_version: 4
89
135
  summary: User-friendly file-uploading experience over the web
90
- test_files: []
91
- has_rdoc:
136
+ test_files:
137
+ - test/test_helper.rb
138
+ - test/fine_uploader_test.rb
139
+ - test/dummy/config/boot.rb
140
+ - test/dummy/config/application.rb
141
+ - test/dummy/config/routes.rb
142
+ - test/dummy/config/initializers/secret_token.rb
143
+ - test/dummy/config/environment.rb
144
+ - test/dummy/log/test.log
145
+ - test/dummy/app/assets/stylesheets/application.css
146
+ - test/dummy/app/assets/javascripts/application.js
147
+ - test/dummy/config.ru
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in fine_uploader.gemspec
4
- gemspec
@@ -1,20 +0,0 @@
1
- MIT License
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.