-
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
1 parent
b496cf6
commit 9813193
Showing
15 changed files
with
128 additions
and
144 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,53 +1,57 @@ | ||
module.exports = function(grunt) { | ||
grunt.initConfig({ | ||
pkg : grunt.file.readJSON('package.json'), | ||
|
||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
copy : { | ||
build : { | ||
options : { | ||
processContent : function(content, srcpath) { | ||
return grunt.template.process(content); | ||
} | ||
}, | ||
files : [ { | ||
expand : true, | ||
cwd : 'demo/war/js/', | ||
src : '<%= pkg.name %>*.js', | ||
dest : 'dist/', | ||
flatten : true, | ||
filter : 'isFile' | ||
}, { | ||
expand : true, | ||
cwd : 'demo/war/js/', | ||
src : 'FileAPI.flash.swf', | ||
dest : 'dist/', | ||
flatten : true, | ||
filter : 'isFile' | ||
}, { | ||
expand : true, | ||
cwd : 'demo/war/js/', | ||
src : 'FileAPI.min.js', | ||
dest : 'dist/', | ||
flatten : true, | ||
filter : 'isFile' | ||
} ] | ||
} | ||
}, | ||
uglify : { | ||
options : { | ||
banner : '/*! <%= pkg.version %> */\n' | ||
}, | ||
build : { | ||
files : [ { | ||
'dist/<%= pkg.name %>.min.js' : 'dist/<%= pkg.name %>.js', | ||
'dist/<%= pkg.name %>-shim.min.js' : 'dist/<%= pkg.name %>-shim.js', | ||
'dist/<%= pkg.name %>-html5-shim.min.js' : 'dist/<%= pkg.name %>-html5-shim.js' | ||
} ] | ||
} | ||
} | ||
}); | ||
|
||
copy: { | ||
build: { | ||
files: [{ | ||
expand: true, | ||
cwd: 'demo/war/js/', | ||
src: '<%= pkg.name %>*.js', | ||
dest: 'dist/', | ||
flatten: true, | ||
filter: 'isFile' | ||
}, { | ||
expand: true, | ||
cwd: 'demo/war/js/', | ||
src: 'FileAPI.flash.swf', | ||
dest: 'dist/', | ||
flatten: true, | ||
filter: 'isFile' | ||
}, { | ||
expand: true, | ||
cwd: 'demo/war/js/', | ||
src: 'FileAPI.min.js', | ||
dest: 'dist/', | ||
flatten: true, | ||
filter: 'isFile' | ||
}] | ||
} | ||
}, | ||
uglify: { | ||
options: { | ||
banner: '/*! <%= pkg.version %> */\n' | ||
}, | ||
build: { | ||
files: [{ | ||
'dist/<%= pkg.name %>.min.js': 'dist/<%= pkg.name %>.js', | ||
'dist/<%= pkg.name %>-shim.min.js': 'dist/<%= pkg.name %>-shim.js', | ||
'dist/<%= pkg.name %>-html5-shim.min.js': 'dist/<%= pkg.name %>-html5-shim.js' | ||
}] | ||
} | ||
} | ||
}); | ||
// Load the plugin that provides the "uglify" task. | ||
grunt.loadNpmTasks('grunt-contrib-copy'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
|
||
// Load the plugin that provides the "uglify" task. | ||
grunt.loadNpmTasks('grunt-contrib-copy'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
|
||
// Default task(s). | ||
grunt.registerTask('default', ['copy', 'uglify']); | ||
// Default task(s). | ||
grunt.registerTask('default', [ 'copy', 'uglify' ]); | ||
|
||
}; |
This file was deleted.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/**! | ||
* AngularJS file upload shim for angular XHR HTML5 browsers | ||
* @author Danial <[email protected]> | ||
* @version 1.2.1 | ||
* @version <%= pkg.version %> | ||
*/ | ||
if (window.XMLHttpRequest) { | ||
if (window.FormData) { | ||
|
@@ -25,5 +25,6 @@ if (window.XMLHttpRequest) { | |
return xhr; | ||
} | ||
})(XMLHttpRequest); | ||
window.XMLHttpRequest.__isShim = true; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
/**! | ||
* AngularJS file upload shim for HTML5 FormData | ||
* @author Danial <[email protected]> | ||
* @version 1.2.1 | ||
* @version <%= pkg.version %> | ||
*/ | ||
(function() { | ||
|
||
if (window.XMLHttpRequest) { | ||
if (window.FormData) { | ||
// allow access to Angular XHR private field: https://github.com/angular/angular.js/issues/1934 | ||
XMLHttpRequest = (function(origXHR) { | ||
window.XMLHttpRequest = (function(origXHR) { | ||
return function() { | ||
var xhr = new origXHR(); | ||
xhr.setRequestHeader = (function(orig) { | ||
|
@@ -26,9 +26,9 @@ if (window.XMLHttpRequest) { | |
})(xhr.setRequestHeader); | ||
return xhr; | ||
} | ||
})(XMLHttpRequest); | ||
})(window.XMLHttpRequest); | ||
} else { | ||
XMLHttpRequest = (function(origXHR) { | ||
window.XMLHttpRequest = (function(origXHR) { | ||
return function() { | ||
var xhr = new origXHR(); | ||
var origSend = xhr.send; | ||
|
@@ -120,8 +120,9 @@ if (window.XMLHttpRequest) { | |
} | ||
return xhr; | ||
} | ||
})(XMLHttpRequest); | ||
})(window.XMLHttpRequest); | ||
} | ||
window.XMLHttpRequest.__isShim = true; | ||
} | ||
|
||
if (!window.FormData) { | ||
|
@@ -234,6 +235,7 @@ if (!window.FormData) { | |
})(); | ||
} | ||
|
||
/* | ||
if (!window.FileReader) { | ||
window.FileReader = function() { | ||
var _this = this, loadStarted = false; | ||
|
@@ -294,5 +296,5 @@ if (!window.FileReader) { | |
} | ||
} | ||
} | ||
|
||
*/ | ||
})(); |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/**! | ||
* AngularJS file upload/drop directive with http post and progress | ||
* @author Danial <[email protected]> | ||
* @version 1.2.1 | ||
* @version <%= pkg.version %> | ||
*/ | ||
(function() { | ||
|
||
|
@@ -18,27 +18,29 @@ angularFileUpload.service('$upload', ['$http', '$rootScope', '$timeout', functio | |
return $http.defaults.transformRequest[0](data); | ||
}; | ||
|
||
config.headers['__setXHR_'] = function() { | ||
return function(xhr) { | ||
config.__XHR = xhr; | ||
xhr.upload.addEventListener('progress', function(e) { | ||
if (config.progress) { | ||
$timeout(function() { | ||
config.progress(e); | ||
}); | ||
} | ||
}, false); | ||
//fix for firefox not firing upload progress end, also IE8-9 | ||
xhr.upload.addEventListener('load', function(e) { | ||
if (e.lengthComputable) { | ||
$timeout(function() { | ||
config.progress(e); | ||
}); | ||
} | ||
}, false); | ||
} | ||
}; | ||
|
||
if (window.XMLHttpRequest.__isShim) { | ||
config.headers['__setXHR_'] = function() { | ||
return function(xhr) { | ||
config.__XHR = xhr; | ||
xhr.upload.addEventListener('progress', function(e) { | ||
if (config.progress) { | ||
$timeout(function() { | ||
config.progress(e); | ||
}); | ||
} | ||
}, false); | ||
//fix for firefox not firing upload progress end, also IE8-9 | ||
xhr.upload.addEventListener('load', function(e) { | ||
if (e.lengthComputable) { | ||
$timeout(function() { | ||
config.progress(e); | ||
}); | ||
} | ||
}, false); | ||
} | ||
}; | ||
} | ||
|
||
var promise = $http(config); | ||
|
||
promise.progress = function(fn) { | ||
|
Binary file not shown.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/**! | ||
* AngularJS file upload shim for angular XHR HTML5 browsers | ||
* @author Danial <[email protected]> | ||
* @version 1.2.1 | ||
* @version 1.2.2 | ||
*/ | ||
if (window.XMLHttpRequest) { | ||
if (window.FormData) { | ||
|
@@ -25,5 +25,6 @@ if (window.XMLHttpRequest) { | |
return xhr; | ||
} | ||
})(XMLHttpRequest); | ||
window.XMLHttpRequest.__isShim = true; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
/**! | ||
* AngularJS file upload shim for HTML5 FormData | ||
* @author Danial <[email protected]> | ||
* @version 1.2.1 | ||
* @version 1.2.2 | ||
*/ | ||
(function() { | ||
|
||
if (window.XMLHttpRequest) { | ||
if (window.FormData) { | ||
// allow access to Angular XHR private field: https://github.com/angular/angular.js/issues/1934 | ||
XMLHttpRequest = (function(origXHR) { | ||
window.XMLHttpRequest = (function(origXHR) { | ||
return function() { | ||
var xhr = new origXHR(); | ||
xhr.setRequestHeader = (function(orig) { | ||
|
@@ -26,9 +26,9 @@ if (window.XMLHttpRequest) { | |
})(xhr.setRequestHeader); | ||
return xhr; | ||
} | ||
})(XMLHttpRequest); | ||
})(window.XMLHttpRequest); | ||
} else { | ||
XMLHttpRequest = (function(origXHR) { | ||
window.XMLHttpRequest = (function(origXHR) { | ||
return function() { | ||
var xhr = new origXHR(); | ||
var origSend = xhr.send; | ||
|
@@ -120,8 +120,9 @@ if (window.XMLHttpRequest) { | |
} | ||
return xhr; | ||
} | ||
})(XMLHttpRequest); | ||
})(window.XMLHttpRequest); | ||
} | ||
window.XMLHttpRequest.__isShim = true; | ||
} | ||
|
||
if (!window.FormData) { | ||
|
@@ -234,6 +235,7 @@ if (!window.FormData) { | |
})(); | ||
} | ||
|
||
/* | ||
if (!window.FileReader) { | ||
window.FileReader = function() { | ||
var _this = this, loadStarted = false; | ||
|
@@ -294,5 +296,5 @@ if (!window.FileReader) { | |
} | ||
} | ||
} | ||
|
||
*/ | ||
})(); |
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.