Skip to content

Commit 6b6ac5e

Browse files
Danial FaridDanial Farid
authored andcommitted
fixed IE8-9 danialfarid#800
1 parent ca115b3 commit 6b6ac5e

18 files changed

+63
-58
lines changed

demo/src/main/webapp/js/FileAPI.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/src/main/webapp/js/ng-file-upload-all.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**!
22
* AngularJS file upload/drop directive and service with progress and abort
33
* @author Danial <danial.farid@gmail.com>
4-
* @version 5.0.3
4+
* @version 5.0.4
55
*/
66
var ngFileUpload = angular.module('ngFileUpload', []);
77

8-
ngFileUpload.version = '5.0.3';
8+
ngFileUpload.version = '5.0.4';
99
ngFileUpload.service('Upload', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
1010
function patchXHR(fnName, newFn) {
1111
window.XMLHttpRequest.prototype[fnName] = newFn(window.XMLHttpRequest.prototype[fnName]);
@@ -739,7 +739,7 @@ ngFileUpload.service('Upload', ['$http', '$q', '$timeout', function ($http, $q,
739739
* AngularJS file upload/drop directive and service with progress and abort
740740
* FileAPI Flash shim for old browsers not supporting FormData
741741
* @author Danial <danial.farid@gmail.com>
742-
* @version 5.0.3
742+
* @version 5.0.4
743743
*/
744744

745745
(function () {
@@ -756,7 +756,12 @@ ngFileUpload.service('Upload', ['$http', '$q', '$timeout', function ($http, $q,
756756
}
757757
}
758758

759-
if ((window.XMLHttpRequest && !window.FormData) || (window.FileAPI && FileAPI.forceLoad)) {
759+
if (!window.FileAPI) {
760+
window.FileAPI = {};
761+
}
762+
763+
FileAPI.shouldLoad = (window.XMLHttpRequest && !window.FormData) || FileAPI.forceLoad;
764+
if (FileAPI.shouldLoad) {
760765
var initializeUploadListener = function (xhr) {
761766
if (!xhr.__listeners) {
762767
if (!xhr.upload) xhr.upload = {};
@@ -991,13 +996,9 @@ ngFileUpload.service('Upload', ['$http', '$q', '$timeout', function ($http, $q,
991996
};
992997
}
993998

994-
if ((window.XMLHttpRequest && !window.FormData) || (window.FileAPI && FileAPI.forceLoad)) {
999+
if (FileAPI.shouldLoad) {
9951000

9961001
//load FileAPI
997-
if (!window.FileAPI) {
998-
window.FileAPI = {};
999-
}
1000-
10011002
if (FileAPI.forceLoad) {
10021003
FileAPI.html5 = false;
10031004
}

demo/src/main/webapp/js/ng-file-upload-all.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/src/main/webapp/js/ng-file-upload-shim.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* AngularJS file upload/drop directive and service with progress and abort
33
* FileAPI Flash shim for old browsers not supporting FormData
44
* @author Danial <danial.farid@gmail.com>
5-
* @version 5.0.3
5+
* @version 5.0.4
66
*/
77

88
(function () {
@@ -19,7 +19,12 @@
1919
}
2020
}
2121

22-
if ((window.XMLHttpRequest && !window.FormData) || (window.FileAPI && FileAPI.forceLoad)) {
22+
if (!window.FileAPI) {
23+
window.FileAPI = {};
24+
}
25+
26+
FileAPI.shouldLoad = (window.XMLHttpRequest && !window.FormData) || FileAPI.forceLoad;
27+
if (FileAPI.shouldLoad) {
2328
var initializeUploadListener = function (xhr) {
2429
if (!xhr.__listeners) {
2530
if (!xhr.upload) xhr.upload = {};
@@ -254,13 +259,9 @@
254259
};
255260
}
256261

257-
if ((window.XMLHttpRequest && !window.FormData) || (window.FileAPI && FileAPI.forceLoad)) {
262+
if (FileAPI.shouldLoad) {
258263

259264
//load FileAPI
260-
if (!window.FileAPI) {
261-
window.FileAPI = {};
262-
}
263-
264265
if (FileAPI.forceLoad) {
265266
FileAPI.html5 = false;
266267
}

demo/src/main/webapp/js/ng-file-upload-shim.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/src/main/webapp/js/ng-file-upload.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**!
22
* AngularJS file upload/drop directive and service with progress and abort
33
* @author Danial <danial.farid@gmail.com>
4-
* @version 5.0.3
4+
* @version 5.0.4
55
*/
66
var ngFileUpload = angular.module('ngFileUpload', []);
77

8-
ngFileUpload.version = '5.0.3';
8+
ngFileUpload.version = '5.0.4';
99
ngFileUpload.service('Upload', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
1010
function patchXHR(fnName, newFn) {
1111
window.XMLHttpRequest.prototype[fnName] = newFn(window.XMLHttpRequest.prototype[fnName]);

0 commit comments

Comments
 (0)