Skip to content

Commit f1fc80c

Browse files
committed
updating fullUrl to jsUrl, updating correct src file, running build
1 parent af209e6 commit f1fc80c

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,12 @@ You can put these two files beside `angular-file-upload-shim(.min).js` on your s
9898
</script>
9999
<script src="angular-file-upload-shim.min.js"></script>...
100100
```
101-
If you are using a CDN to host your files you can aslso specify the specific location of FileAPI.min.js and FileAPI.flash.swf by using fullUrl and flashUrl:
101+
102+
If you are using a CDN to host your files you can aslso specify the specific location of FileAPI.min.js and FileAPI.flash.swf by using jsUrl and flashUrl:
102103
```html
103104
<script>
104105
FileAPI = {
105-
fullUrl: 'yourcdn.com/js/FileAPI.min.js',
106+
jsUrl: 'yourcdn.com/js/FileAPI.min.js',
106107
flashUrl: 'yourcdn.com/js/FileAPI.flash.swf'
107108
}
108109
</script>

demo/war/js/angular-file-upload-shim.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ if (window.XMLHttpRequest) {
5757
})(xhr.open);
5858
xhr.getResponseHeader = (function(orig) {
5959
return function(h) {
60-
return xhr.__fileApiXHR ? xhr.__fileApiXHR.getResponseHeader(h) : orig.apply(xhr, [h]);
60+
return xhr.__fileApiXHR ? xhr.__fileApiXHR.getResponseHeader(h) : orig.apply(xhr, [h]);
6161
}
6262
})(xhr.getResponseHeader);
6363
xhr.getAllResponseHeaders = (function(orig) {
6464
return function() {
65-
return xhr.__fileApiXHR ? xhr.__fileApiXHR.getAllResponseHeaders() : orig.apply(xhr);
65+
return xhr.__fileApiXHR ? xhr.__fileApiXHR.getAllResponseHeaders() : orig.apply(xhr);
6666
}
6767
})(xhr.getAllResponseHeaders);
6868
xhr.abort = (function(orig) {
6969
return function() {
70-
return xhr.__fileApiXHR ? xhr.__fileApiXHR.abort() : (orig == null ? null : orig.apply(xhr));
70+
return xhr.__fileApiXHR ? xhr.__fileApiXHR.abort() : (orig == null ? null : orig.apply(xhr));
7171
}
7272
})(xhr.abort);
7373
xhr.setRequestHeader = (function(orig) {
@@ -83,7 +83,7 @@ if (window.XMLHttpRequest) {
8383
}
8484
}
8585
})(xhr.setRequestHeader);
86-
86+
8787
xhr.send = function() {
8888
if (arguments[0] && arguments[0].__isShim) {
8989
var formData = arguments[0];
@@ -116,7 +116,7 @@ if (window.XMLHttpRequest) {
116116
config.data[item.key] = item.val;
117117
}
118118
}
119-
119+
120120
setTimeout(function() {
121121
if (!hasFlash) {
122122
alert('Please install Adode Flash Player to upload files.');
@@ -169,19 +169,19 @@ if (!window.FormData) {
169169
return function(e, fn, b, d) {
170170
if (isFileChange(this, e)) {
171171
wrapFileApi(this);
172-
origAddEventListener.apply(this, [e, changeFnWrapper(fn), b, d]);
172+
origAddEventListener.apply(this, [e, changeFnWrapper(fn), b, d]);
173173
} else {
174174
origAddEventListener.apply(this, [e, fn, b, d]);
175175
}
176176
}
177-
})(HTMLInputElement.prototype.addEventListener);
177+
})(HTMLInputElement.prototype.addEventListener);
178178
}
179179
if (HTMLInputElement.prototype.attachEvent) {
180180
HTMLInputElement.prototype.attachEvent = (function(origAttachEvent) {
181181
return function(e, fn) {
182182
if (isFileChange(this, e)) {
183183
wrapFileApi(this);
184-
origAttachEvent.apply(this, [e, changeFnWrapper(fn)]);
184+
origAttachEvent.apply(this, [e, changeFnWrapper(fn)]);
185185
} else {
186186
origAttachEvent.apply(this, [e, fn]);
187187
}
@@ -202,13 +202,15 @@ if (!window.FormData) {
202202
__isShim: true
203203
};
204204
};
205-
205+
206206
(function () {
207207
//load FileAPI
208208
if (!window.FileAPI || !FileAPI.upload) {
209-
var base = '', script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index, src;
209+
var base = '', jsUrl = null, script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index, src;
210210
if (window.FileAPI && window.FileAPI.jsPath) {
211211
base = window.FileAPI.jsPath;
212+
} else if (window.FileAPI && window.FileAPI.jsUrl){
213+
jsUrl = window.FileAPI.jsUrl
212214
} else {
213215
for (i = 0; i < allScripts.length; i++) {
214216
src = allScripts[i].src;
@@ -228,8 +230,8 @@ if (!window.FormData) {
228230
staticPath: base
229231
}
230232
}
231-
232-
script.setAttribute('src', base + "FileAPI.min.js");
233+
234+
script.setAttribute('src', jsUrl || base + "FileAPI.min.js");
233235
document.getElementsByTagName('head')[0].appendChild(script);
234236
}
235237
})();
@@ -241,7 +243,7 @@ if (!window.FileReader) {
241243
var _this = this, loadStarted = false;
242244
this.listeners = {};
243245
this.addEventListener = function(type, fn) {
244-
_this.listeners[type] = _this.listeners[type] || [];
246+
_this.listeners[type] = _this.listeners[type] || [];
245247
_this.listeners[type].push(fn);
246248
};
247249
this.removeEventListener = function(type, fn) {
@@ -256,7 +258,7 @@ if (!window.FileReader) {
256258
}
257259
};
258260
this.onabort = this.onerror = this.onload = this.onloadstart = this.onloadend = this.onprogress = null;
259-
261+
260262
function constructEvent(type, evt) {
261263
var e = {type: type, target: _this, loaded: evt.loaded, total: evt.total, error: evt.error};
262264
if (evt.result != null) e.target.result = evt.result;
@@ -297,4 +299,4 @@ if (!window.FileReader) {
297299
}
298300
}
299301
*/
300-
})();
302+
})();

dist/angular-file-upload-shim.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ if (!window.FormData) {
206206
(function () {
207207
//load FileAPI
208208
if (!window.FileAPI || !FileAPI.upload) {
209-
var base = '', fullUrl = false, script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index, src;
209+
var base = '', jsUrl = null, script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index, src;
210210
if (window.FileAPI && window.FileAPI.jsPath) {
211211
base = window.FileAPI.jsPath;
212-
} else if (window.FileAPI && window.FileAPI.fullUrl){
213-
fullUrl = window.FileAPI.fullUrl
212+
} else if (window.FileAPI && window.FileAPI.jsUrl){
213+
jsUrl = window.FileAPI.jsUrl
214214
} else {
215215
for (i = 0; i < allScripts.length; i++) {
216216
src = allScripts[i].src;
@@ -231,9 +231,7 @@ if (!window.FormData) {
231231
}
232232
}
233233

234-
fullUrl = fullUrl || base + "FileAPI.min.js";
235-
236-
script.setAttribute('src', fullUrl);
234+
script.setAttribute('src', jsUrl || base + "FileAPI.min.js");
237235
document.getElementsByTagName('head')[0].appendChild(script);
238236
}
239237
})();

dist/angular-file-upload-shim.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.

0 commit comments

Comments
 (0)