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