jquery.fileupload-rails 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -41,6 +41,8 @@ If you downloaded jquery.ui assets into your project, delete them and use [jquer
41
41
 
42
42
  ## Changelog
43
43
 
44
+ 1.4.1. Core 5.28.8.
45
+
44
46
  1.4.0. Core 5.28.4.
45
47
 
46
48
  1.3.0. Core 5.26.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "jquery.fileupload-rails"
5
- s.version = "1.4.0"
5
+ s.version = "1.4.1"
6
6
  s.author = "Semyon Perepelitsa"
7
7
  s.email = "sema@sema.in"
8
8
  s.homepage = "https://github.com/semaperepelitsa/jquery.fileupload-rails"
@@ -2,7 +2,7 @@
2
2
  //= require jquery.iframe-transport
3
3
 
4
4
  /*
5
- * jQuery File Upload Plugin 5.28.4
5
+ * jQuery File Upload Plugin 5.28.8
6
6
  * https://github.com/blueimp/jQuery-File-Upload
7
7
  *
8
8
  * Copyright 2010, Sebastian Tschan
@@ -218,7 +218,7 @@
218
218
  ],
219
219
 
220
220
  _BitrateTimer: function () {
221
- this.timestamp = (new Date()).getTime();
221
+ this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime());
222
222
  this.loaded = 0;
223
223
  this.bitrate = 0;
224
224
  this.getBitrate = function (now, loaded, interval) {
@@ -292,7 +292,7 @@
292
292
 
293
293
  _onProgress: function (e, data) {
294
294
  if (e.lengthComputable) {
295
- var now = (new Date()).getTime(),
295
+ var now = ((Date.now) ? Date.now() : (new Date()).getTime()),
296
296
  loaded;
297
297
  if (data._time && data.progressInterval &&
298
298
  (now - data._time < data.progressInterval) &&
@@ -347,8 +347,14 @@
347
347
  }
348
348
  },
349
349
 
350
+ _isInstanceOf: function (type, obj) {
351
+ // Cross-frame instanceof check
352
+ return Object.prototype.toString.call(obj) === '[object ' + type + ']';
353
+ },
354
+
350
355
  _initXHRData: function (options) {
351
- var formData,
356
+ var that = this,
357
+ formData,
352
358
  file = options.files[0],
353
359
  // Ignore non-multipart setting if not supported:
354
360
  multipart = options.multipart || !$.support.xhrFileUpload,
@@ -383,7 +389,7 @@
383
389
  });
384
390
  }
385
391
  } else {
386
- if (options.formData instanceof FormData) {
392
+ if (that._isInstanceOf('FormData', options.formData)) {
387
393
  formData = options.formData;
388
394
  } else {
389
395
  formData = new FormData();
@@ -397,12 +403,10 @@
397
403
  formData.append(paramName, options.blob, file.name);
398
404
  } else {
399
405
  $.each(options.files, function (index, file) {
400
- // Files are also Blob instances, but some browsers
401
- // (Firefox 3.6) support the File API but not Blobs.
402
406
  // This check allows the tests to run with
403
407
  // dummy objects:
404
- if ((window.Blob && file instanceof Blob) ||
405
- (window.File && file instanceof File)) {
408
+ if (that._isInstanceOf('File', file) ||
409
+ that._isInstanceOf('Blob', file)) {
406
410
  formData.append(
407
411
  options.paramName[index] || paramName,
408
412
  file,
@@ -447,7 +451,7 @@
447
451
  options.dataType = 'postmessage ' + (options.dataType || '');
448
452
  }
449
453
  } else {
450
- this._initIframeSettings(options, 'iframe');
454
+ this._initIframeSettings(options);
451
455
  }
452
456
  },
453
457
 
@@ -1048,44 +1052,50 @@
1048
1052
  },
1049
1053
 
1050
1054
  _onPaste: function (e) {
1051
- var cbd = e.originalEvent.clipboardData,
1052
- items = (cbd && cbd.items) || [],
1055
+ var items = e.originalEvent && e.originalEvent.clipboardData &&
1056
+ e.originalEvent.clipboardData.items,
1053
1057
  data = {files: []};
1054
- $.each(items, function (index, item) {
1055
- var file = item.getAsFile && item.getAsFile();
1056
- if (file) {
1057
- data.files.push(file);
1058
+ if (items && items.length) {
1059
+ $.each(items, function (index, item) {
1060
+ var file = item.getAsFile && item.getAsFile();
1061
+ if (file) {
1062
+ data.files.push(file);
1063
+ }
1064
+ });
1065
+ if (this._trigger('paste', e, data) === false ||
1066
+ this._onAdd(e, data) === false) {
1067
+ return false;
1058
1068
  }
1059
- });
1060
- if (this._trigger('paste', e, data) === false ||
1061
- this._onAdd(e, data) === false) {
1062
- return false;
1063
1069
  }
1064
1070
  },
1065
1071
 
1066
1072
  _onDrop: function (e) {
1067
1073
  var that = this,
1068
- dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer,
1074
+ dataTransfer = e.dataTransfer = e.originalEvent &&
1075
+ e.originalEvent.dataTransfer,
1069
1076
  data = {};
1070
1077
  if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
1071
1078
  e.preventDefault();
1079
+ this._getDroppedFiles(dataTransfer).always(function (files) {
1080
+ data.files = files;
1081
+ if (that._trigger('drop', e, data) !== false) {
1082
+ that._onAdd(e, data);
1083
+ }
1084
+ });
1072
1085
  }
1073
- this._getDroppedFiles(dataTransfer).always(function (files) {
1074
- data.files = files;
1075
- if (that._trigger('drop', e, data) !== false) {
1076
- that._onAdd(e, data);
1077
- }
1078
- });
1079
1086
  },
1080
1087
 
1081
1088
  _onDragOver: function (e) {
1082
- var dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer;
1083
- if (this._trigger('dragover', e) === false) {
1084
- return false;
1085
- }
1086
- if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1) {
1087
- dataTransfer.dropEffect = 'copy';
1088
- e.preventDefault();
1089
+ var dataTransfer = e.dataTransfer = e.originalEvent &&
1090
+ e.originalEvent.dataTransfer;
1091
+ if (dataTransfer) {
1092
+ if (this._trigger('dragover', e) === false) {
1093
+ return false;
1094
+ }
1095
+ if ($.inArray('Files', dataTransfer.types) !== -1) {
1096
+ dataTransfer.dropEffect = 'copy';
1097
+ e.preventDefault();
1098
+ }
1089
1099
  }
1090
1100
  },
1091
1101
 
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: jquery.fileupload-rails
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.4.0
5
+ version: 1.4.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Semyon Perepelitsa
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-26 00:00:00.000000000 Z
12
+ date: 2013-04-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  version_requirements: !ruby/object:Gem::Requirement