1 |
|
2 |
|
3 | 'use strict';
|
4 |
|
5 |
|
6 |
|
7 | var path = require('path');
|
8 |
|
9 |
|
10 |
|
11 | var FetcherIndex = require(path.join(__dirname, 'fetcher-index'));
|
12 |
|
13 |
|
14 |
|
15 | var appCacheIndex = process.browser ? window.appCacheIndex : {};
|
16 |
|
17 | var fetcherIndex = new FetcherIndex({ index: appCacheIndex });
|
18 |
|
19 | var isAMD = typeof window.define === 'function' && typeof window.define.amd !== 'undefined';
|
20 |
|
21 | var isRequireJS = isAMD && typeof window.require === 'function' && typeof window.require.load === 'function';
|
22 |
|
23 | (function () {
|
24 | var oldLoad;
|
25 |
|
26 | if (isRequireJS) {
|
27 | oldLoad = window.require.load;
|
28 |
|
29 | window.require.load = function (context, moduleId, moduleUrl) {
|
30 | var localUrl = fetcherIndex.resolveLocalUrl(moduleUrl);
|
31 | oldLoad.call(window.require, context, moduleId, localUrl);
|
32 | };
|
33 | }
|
34 | }());
|
35 |
|
36 | (function (fn) {
|
37 | if (isAMD) {
|
38 | window.require(['jquery'], fn);
|
39 | } else {
|
40 | fn(window.$);
|
41 | }
|
42 | }(function ($) {
|
43 |
|
44 | require(path.join(__dirname, 'shims', 'jquery.ajax'))(fetcherIndex, $, 'ajax');
|
45 |
|
46 | }));
|