|
12 | 12 |
|
13 | 13 | var System;
|
14 | 14 |
|
15 |
| -function SystemLoader(options) { |
16 |
| - Loader.call(this, options || {}); |
| 15 | +function SystemLoader(baseURL) { |
| 16 | + Loader.call(this); |
17 | 17 |
|
18 |
| - var baseURL; |
19 | 18 | // Set default baseURL and paths
|
20 |
| - if (typeof document != 'undefined' && document.getElementsByTagName) { |
21 |
| - baseURL = document.baseURI; |
| 19 | + if (!baseURL) { |
| 20 | + if (typeof document != 'undefined' && document.getElementsByTagName) { |
| 21 | + baseURL = document.baseURI; |
22 | 22 |
|
23 |
| - if (!baseURL) { |
24 |
| - var bases = document.getElementsByTagName('base'); |
25 |
| - baseURL = bases[0] && bases[0].href || window.location.href; |
26 |
| - } |
| 23 | + if (!baseURL) { |
| 24 | + var bases = document.getElementsByTagName('base'); |
| 25 | + baseURL = bases[0] && bases[0].href || window.location.href; |
| 26 | + } |
27 | 27 |
|
28 |
| - // sanitize out the hash and querystring |
29 |
| - baseURL = baseURL.split('#')[0].split('?')[0]; |
30 |
| - baseURL = baseURL.substr(0, baseURL.lastIndexOf('/') + 1); |
31 |
| - } |
32 |
| - else if (typeof process != 'undefined' && process.cwd) { |
33 |
| - baseURL = 'file://' + (isWindows ? '/' : '') + process.cwd() + '/'; |
34 |
| - if (isWindows) |
35 |
| - baseURL = baseURL.replace(/\\/g, '/'); |
36 |
| - } |
37 |
| - else if (typeof location != 'undefined') { |
38 |
| - baseURL = __global.location.href; |
39 |
| - } |
40 |
| - else { |
41 |
| - throw new TypeError('No environment baseURL'); |
| 28 | + // sanitize out the hash and querystring |
| 29 | + baseURL = baseURL.split('#')[0].split('?')[0]; |
| 30 | + baseURL = baseURL.substr(0, baseURL.lastIndexOf('/') + 1); |
| 31 | + } |
| 32 | + else if (typeof process != 'undefined' && process.cwd) { |
| 33 | + baseURL = 'file://' + (isWindows ? '/' : '') + process.cwd() + '/'; |
| 34 | + if (isWindows) |
| 35 | + baseURL = baseURL.replace(/\\/g, '/'); |
| 36 | + } |
| 37 | + else if (typeof location != 'undefined') { |
| 38 | + baseURL = __global.location.href; |
| 39 | + } |
| 40 | + else { |
| 41 | + throw new TypeError('No environment baseURL'); |
| 42 | + } |
42 | 43 | }
|
43 | 44 |
|
44 | 45 | this.baseURL = baseURL;
|
|
0 commit comments