1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | (function(aScriptIncludes) {
|
8 |
|
9 | "use strict";
|
10 |
|
11 | var aScripts, i, sSrc, mMatch, sBaseUrl, oScriptTag,
|
12 | bCoreRequired = false;
|
13 |
|
14 | oScriptTag = document.getElementById("sap-ui-bootstrap");
|
15 | if (oScriptTag) {
|
16 | sSrc = oScriptTag.getAttribute("src");
|
17 | mMatch = sSrc.match(/^(?:[^?#]*\/)?resources\//i);
|
18 | if (mMatch) {
|
19 | sBaseUrl = mMatch[0];
|
20 | }
|
21 | }
|
22 |
|
23 | if (sBaseUrl == null) {
|
24 | aScripts = document.getElementsByTagName("script");
|
25 |
|
26 | for (i = 0; i < aScripts.length; i++) {
|
27 | sSrc = aScripts[i].getAttribute("src");
|
28 | if (sSrc) {
|
29 | mMatch = sSrc.match(/^([^?#]*\/)sap-ui-core\.js(?:[?#]|$)/i);
|
30 | if (mMatch) {
|
31 | sBaseUrl = mMatch[1];
|
32 | break;
|
33 | }
|
34 | }
|
35 | }
|
36 | }
|
37 |
|
38 | if (sBaseUrl == null) {
|
39 | throw new Error("sap-ui-core.js: could not identify script tag!");
|
40 | }
|
41 |
|
42 | for (i = 0; i < aScriptIncludes.length; i++) {
|
43 | sSrc = aScriptIncludes[i];
|
44 | if ( sSrc.indexOf("raw:") === 0 ) {
|
45 | sSrc = sBaseUrl + sSrc.slice(4);
|
46 | document.write("<script src=\"" + sSrc + "\"></script>");
|
47 | } else if ( sSrc.indexOf("require:") === 0 ) {
|
48 | sSrc = sSrc.slice(8);
|
49 | bCoreRequired = bCoreRequired || sSrc === "sap/ui/core/Core";
|
50 | document.write("<script>sap.ui.requireSync(\"" + sSrc + "\");</script>");
|
51 | }
|
52 | }
|
53 | if ( bCoreRequired ) {
|
54 | document.write("<script>sap.ui.getCore().boot && sap.ui.getCore().boot();</script>");
|
55 | }
|
56 | }([
|
57 | "raw:ui5loader.js",
|
58 | "raw:ui5loader-autoconfig.js",
|
59 | "require:sap/ui/core/Core"
|
60 | ]));
|