standalone.html 2.84 KB
Newer Older
Schaaf's avatar
Schaaf committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
    />
    <title>Cesium Demo</title>
    <script type="text/javascript" src="Sandcastle-header.js"></script>
    <script type="text/javascript" src="Sandcastle-client.js"></script>
    <script type="text/javascript" src="ThirdParty/pako.min.js"></script>
    <script
      type="text/javascript"
      src="../../Build/CesiumUnminified/Cesium.js"
      nomodule
    ></script>
    <script type="module" src="load-cesium-es6.js"></script>
    <script type="text/javascript" src="Sandcastle-helpers.js"></script>
    <style>
      .fullSize {
        display: none;
      }
      .sandcastle-loading::after {
        font: 24px sans-serif;
        content: "Loading...";
      }
    </style>
  </head>
  <body
    class="sandcastle-loading"
    data-sandcastle-bucket="bucket-requirejs.html"
  >
    <script type="text/javascript">
      /*global pako */
      var base64String;
      var data;

      // Since we are setting the HTML base href below, we need to get the getCesiumBaseUrl
      // upfront so that the value is correct. It gets cached for future calls.
      // This is only a problem when using combined Cesium, which is the only time Cesium
      // will be defined below.
      if (typeof Cesium !== "undefined") {
        Cesium.buildModuleUrl.getCesiumBaseUrl();
      }

      if (window.location.hash.indexOf("#c=") === 0) {
        base64String = window.location.hash.substr(3);
        data = window.decodeBase64Data(base64String, pako);
        //Handle case where demo is in a sub-directory by modifying
        //the HTML to add a base href.
        document.head.innerHTML =
          document.head.innerHTML + '<base href="' + data.baseHref + '" />';
        window.sandcastleData = data;
      }

      var code;
      if (window.sandcastleData) {
        base64String = window.location.hash.substr(3);
        data = window.sandcastleData;
        var html = data.html;
        code = data.code;
        var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
        if (isIE11) {
          html = html.replace("../templates", "templates");
        }

        // Add the HTML content
        var htmlElement = document.createElement("div");
        htmlElement.innerHTML = html;
        document.body.appendChild(htmlElement);

        // Add the JavaScript
        var scriptElement = document.createElement("script");
        var isFirefox = navigator.userAgent.indexOf("Firefox/") >= 0;
        document.head.appendChild(scriptElement);
        scriptElement.innerHTML = window.embedInSandcastleTemplate(
          code,
          isFirefox
        );
      }
    </script>
  </body>
</html>