-
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.
removed jquery dependency, added FileAPI.jsPath param to set the js l…
…oad path for FileAPI
- Loading branch information
1 parent
98f45d0
commit f5b9280
Showing
5 changed files
with
53 additions
and
61 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,7 +1,7 @@ | ||
/**! | ||
* AngularJS file upload/drop directive with http post and progress | ||
* @author Danial <[email protected]> | ||
* @version 1.0.1 | ||
* @version 1.0.2 | ||
*/ | ||
(function() { | ||
|
||
|
@@ -10,38 +10,34 @@ var angularFileUpload = angular.module('angularFileUpload', []); | |
angularFileUpload.html5 = !!window.FormData; | ||
|
||
if (!angularFileUpload.html5) { | ||
(function() { | ||
//load jquery | ||
if (!window.jQuery) { | ||
var script = document.createElement('script'); | ||
script.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'); | ||
document.getElementsByTagName('head')[0].appendChild(script); | ||
} | ||
})(); | ||
|
||
(function () { | ||
//load FileAPI | ||
var base = '', script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index; | ||
|
||
for (i = 0; i < allScripts.length; i++) { | ||
index = allScripts[i].src.indexOf('angular-file-upload.js') | ||
if (index == -1) { | ||
index = allScripts[i].src.indexOf('angular-file-upload.min.js'); | ||
} | ||
if (index > -1) { | ||
base = allScripts[i].src.substring(0, index); | ||
break; | ||
if (!window.FileAPI || !FileAPI.upload) { | ||
var base = '', script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index; | ||
if (window.FileAPI && window.FileAPI.jsPath) { | ||
base = window.FileAPI.jsPath; | ||
} else { | ||
for (i = 0; i < allScripts.length; i++) { | ||
index = allScripts[i].src.indexOf('angular-file-upload.js') | ||
if (index == -1) { | ||
index = allScripts[i].src.indexOf('angular-file-upload.min.js'); | ||
} | ||
if (index > -1) { | ||
base = allScripts[i].src.substring(0, index); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (!window.FileAPI || FileAPI.staticPath == null) { | ||
FileAPI = { | ||
staticPath : base | ||
if (!window.FileAPI || FileAPI.staticPath == null) { | ||
FileAPI = { | ||
staticPath: base | ||
} | ||
} | ||
|
||
script.setAttribute('src', base + 'FileAPI.min.js'); | ||
document.getElementsByTagName('head')[0].appendChild(script); | ||
} | ||
|
||
script.setAttribute('src', base + 'FileAPI.min.js'); | ||
document.getElementsByTagName('head')[0].appendChild(script); | ||
})(); | ||
} | ||
|
||
|
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
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.0.1 | ||
* @version 1.0.2 | ||
*/ | ||
(function() { | ||
|
||
|
@@ -10,38 +10,34 @@ var angularFileUpload = angular.module('angularFileUpload', []); | |
angularFileUpload.html5 = !!window.FormData; | ||
|
||
if (!angularFileUpload.html5) { | ||
(function() { | ||
//load jquery | ||
if (!window.jQuery) { | ||
var script = document.createElement('script'); | ||
script.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'); | ||
document.getElementsByTagName('head')[0].appendChild(script); | ||
} | ||
})(); | ||
|
||
(function () { | ||
//load FileAPI | ||
var base = '', script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index; | ||
|
||
for (i = 0; i < allScripts.length; i++) { | ||
index = allScripts[i].src.indexOf('angular-file-upload.js') | ||
if (index == -1) { | ||
index = allScripts[i].src.indexOf('angular-file-upload.min.js'); | ||
} | ||
if (index > -1) { | ||
base = allScripts[i].src.substring(0, index); | ||
break; | ||
if (!window.FileAPI || !FileAPI.upload) { | ||
var base = '', script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index; | ||
if (window.FileAPI && window.FileAPI.jsPath) { | ||
base = window.FileAPI.jsPath; | ||
} else { | ||
for (i = 0; i < allScripts.length; i++) { | ||
index = allScripts[i].src.indexOf('angular-file-upload.js') | ||
if (index == -1) { | ||
index = allScripts[i].src.indexOf('angular-file-upload.min.js'); | ||
} | ||
if (index > -1) { | ||
base = allScripts[i].src.substring(0, index); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (!window.FileAPI || FileAPI.staticPath == null) { | ||
FileAPI = { | ||
staticPath : base | ||
if (!window.FileAPI || FileAPI.staticPath == null) { | ||
FileAPI = { | ||
staticPath: base | ||
} | ||
} | ||
|
||
script.setAttribute('src', base + 'FileAPI.min.js'); | ||
document.getElementsByTagName('head')[0].appendChild(script); | ||
} | ||
|
||
script.setAttribute('src', base + 'FileAPI.min.js'); | ||
document.getElementsByTagName('head')[0].appendChild(script); | ||
})(); | ||
} | ||
|
||
|
Oops, something went wrong.