-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Danial Farid
authored and
Danial Farid
committed
Dec 3, 2015
1 parent
7f208af
commit 82708b1
Showing
19 changed files
with
68 additions
and
68 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* progress, resize, thumbnail, preview, validation and CORS | ||
* FileAPI Flash shim for old browsers not supporting FormData | ||
* @author Danial <[email protected]> | ||
* @version 10.1.5 | ||
* @version 10.1.6 | ||
*/ | ||
|
||
(function () { | ||
|
@@ -421,7 +421,7 @@ if (!window.FileReader) { | |
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, | ||
* progress, resize, thumbnail, preview, validation and CORS | ||
* @author Danial <[email protected]> | ||
* @version 10.1.5 | ||
* @version 10.1.6 | ||
*/ | ||
|
||
if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { | ||
|
@@ -442,13 +442,13 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { | |
|
||
var ngFileUpload = angular.module('ngFileUpload', []); | ||
|
||
ngFileUpload.version = '10.1.5'; | ||
ngFileUpload.version = '10.1.6'; | ||
|
||
ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) { | ||
var upload = this; | ||
|
||
this.isResumeSupported = function () { | ||
return window.Blob && (Blob instanceof Function) && new Blob().slice; | ||
return window.Blob && (window.Blob instanceof Function) && new window.Blob().slice; | ||
}; | ||
|
||
var resumeSupported = this.isResumeSupported(); | ||
|
@@ -602,7 +602,7 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |
if (val != null && !angular.isString(val)) { | ||
val = JSON.stringify(val); | ||
} | ||
var blob = new Blob([val], {type: 'application/json'}); | ||
var blob = new window.Blob([val], {type: 'application/json'}); | ||
blob._ngfBlob = true; | ||
return blob; | ||
}; | ||
|
@@ -623,7 +623,7 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |
|
||
this.upload = function (config, internal) { | ||
function isFile(file) { | ||
return file != null && (file instanceof Blob || (file.flashId && file.name && file.size)); | ||
return file != null && (file instanceof window.Blob || (file.flashId && file.name && file.size)); | ||
} | ||
|
||
function toResumeFile(file, formData) { | ||
|
@@ -698,7 +698,7 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |
(angular.isArray(config.transformRequest) ? | ||
config.transformRequest : [config.transformRequest]) : []; | ||
config.transformRequest.push(function (data) { | ||
var formData = new FormData(), key; | ||
var formData = new window.FormData(), key; | ||
data = data || config.fields || {}; | ||
if (config.file) { | ||
data.file = config.file; | ||
|
@@ -730,7 +730,7 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |
this.http = function (config) { | ||
config = copy(config); | ||
config.transformRequest = config.transformRequest || function (data) { | ||
if ((window.ArrayBuffer && data instanceof window.ArrayBuffer) || data instanceof Blob) { | ||
if ((window.ArrayBuffer && data instanceof window.ArrayBuffer) || data instanceof window.Blob) { | ||
return data; | ||
} | ||
return $http.defaults.transformRequest[0].apply(this, arguments); | ||
|
@@ -1946,7 +1946,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |
while (n--) { | ||
u8arr[n] = bstr.charCodeAt(n); | ||
} | ||
var blob = new Blob([u8arr], {type: mime}); | ||
var blob = new window.Blob([u8arr], {type: mime}); | ||
blob.name = name; | ||
return blob; | ||
}; | ||
|
@@ -1958,7 +1958,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |
|
||
if (upload.isResizeSupported()) { | ||
// add name getter to the blob constructor prototype | ||
Object.defineProperty(Blob.prototype, 'name', { | ||
Object.defineProperty(window.Blob.prototype, 'name', { | ||
get: function () { | ||
return this.$ngfName; | ||
}, | ||
|
@@ -2109,7 +2109,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |
$http({url: url, method: 'get', responseType: 'arraybuffer'}).then(function (resp) { | ||
var arrayBufferView = new Uint8Array(resp.data); | ||
var type = resp.headers('content-type') || 'image/WebP'; | ||
var blob = new Blob([arrayBufferView], {type: type}); | ||
var blob = new window.Blob([arrayBufferView], {type: type}); | ||
//var split = type.split('[/;]'); | ||
//blob.name = url.substring(0, 150).replace(/\W+/g, '') + '.' + (split.length > 1 ? split[1] : 'jpg'); | ||
upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), [blob], evt); | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* progress, resize, thumbnail, preview, validation and CORS | ||
* FileAPI Flash shim for old browsers not supporting FormData | ||
* @author Danial <[email protected]> | ||
* @version 10.1.5 | ||
* @version 10.1.6 | ||
*/ | ||
|
||
(function () { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, | ||
* progress, resize, thumbnail, preview, validation and CORS | ||
* @author Danial <[email protected]> | ||
* @version 10.1.5 | ||
* @version 10.1.6 | ||
*/ | ||
|
||
if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { | ||
|
@@ -23,13 +23,13 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { | |
|
||
var ngFileUpload = angular.module('ngFileUpload', []); | ||
|
||
ngFileUpload.version = '10.1.5'; | ||
ngFileUpload.version = '10.1.6'; | ||
|
||
ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) { | ||
var upload = this; | ||
|
||
this.isResumeSupported = function () { | ||
return window.Blob && (Blob instanceof Function) && new Blob().slice; | ||
return window.Blob && (window.Blob instanceof Function) && new window.Blob().slice; | ||
}; | ||
|
||
var resumeSupported = this.isResumeSupported(); | ||
|
@@ -183,7 +183,7 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |
if (val != null && !angular.isString(val)) { | ||
val = JSON.stringify(val); | ||
} | ||
var blob = new Blob([val], {type: 'application/json'}); | ||
var blob = new window.Blob([val], {type: 'application/json'}); | ||
blob._ngfBlob = true; | ||
return blob; | ||
}; | ||
|
@@ -204,7 +204,7 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |
|
||
this.upload = function (config, internal) { | ||
function isFile(file) { | ||
return file != null && (file instanceof Blob || (file.flashId && file.name && file.size)); | ||
return file != null && (file instanceof window.Blob || (file.flashId && file.name && file.size)); | ||
} | ||
|
||
function toResumeFile(file, formData) { | ||
|
@@ -279,7 +279,7 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |
(angular.isArray(config.transformRequest) ? | ||
config.transformRequest : [config.transformRequest]) : []; | ||
config.transformRequest.push(function (data) { | ||
var formData = new FormData(), key; | ||
var formData = new window.FormData(), key; | ||
data = data || config.fields || {}; | ||
if (config.file) { | ||
data.file = config.file; | ||
|
@@ -311,7 +311,7 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |
this.http = function (config) { | ||
config = copy(config); | ||
config.transformRequest = config.transformRequest || function (data) { | ||
if ((window.ArrayBuffer && data instanceof window.ArrayBuffer) || data instanceof Blob) { | ||
if ((window.ArrayBuffer && data instanceof window.ArrayBuffer) || data instanceof window.Blob) { | ||
return data; | ||
} | ||
return $http.defaults.transformRequest[0].apply(this, arguments); | ||
|
@@ -1527,7 +1527,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |
while (n--) { | ||
u8arr[n] = bstr.charCodeAt(n); | ||
} | ||
var blob = new Blob([u8arr], {type: mime}); | ||
var blob = new window.Blob([u8arr], {type: mime}); | ||
blob.name = name; | ||
return blob; | ||
}; | ||
|
@@ -1539,7 +1539,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |
|
||
if (upload.isResizeSupported()) { | ||
// add name getter to the blob constructor prototype | ||
Object.defineProperty(Blob.prototype, 'name', { | ||
Object.defineProperty(window.Blob.prototype, 'name', { | ||
get: function () { | ||
return this.$ngfName; | ||
}, | ||
|
@@ -1690,7 +1690,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |
$http({url: url, method: 'get', responseType: 'arraybuffer'}).then(function (resp) { | ||
var arrayBufferView = new Uint8Array(resp.data); | ||
var type = resp.headers('content-type') || 'image/WebP'; | ||
var blob = new Blob([arrayBufferView], {type: type}); | ||
var blob = new window.Blob([arrayBufferView], {type: type}); | ||
//var split = type.split('[/;]'); | ||
//blob.name = url.substring(0, 150).replace(/\W+/g, '') + '.' + (split.length > 1 ? split[1] : 'jpg'); | ||
upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), [blob], evt); | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.