aboutsummaryrefslogtreecommitdiffstats
path: root/demo/index.html
blob: 1729e44cb2c4bee3c8261f04fbfe8d559e89c055 (plain)
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
<!doctype html>
<html>
<head>
  <title>Vaadin Elements Code Examples</title>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <script src="../../marked/lib/marked.js"></script>

  <script src="../../code-example/vendor/prismjs/prism.js"></script>
  <link rel="stylesheet" href="../../code-example/vendor/prismjs/prism.css">
  <link rel="stylesheet" href="../../elements-demo-resources/demo.css">

  <script src="../ga.js"></script>
  <style type="text/css">
    #readme code {
      font-size: 12px;
      max-height: none !important;
    }
  </style>
</head>
<body>

  <section id="readme">
  </section>
  <script>
    var readme = document.getElementById("readme");
    var xhr = new XMLHttpRequest();
    
    xhr.onload = function (e) {
      if (xhr.readyState === 4) {
        if (xhr.status === 200) {
          readme.innerHTML = marked(xhr.responseText);
          [].forEach.call(readme.querySelectorAll("pre"), function(pre) {
            var code = document.createElement("code");
            code.innerHTML = pre.innerHTML;
            var parent = pre.parentElement;
            parent.insertBefore(code, pre);
            parent.removeChild(pre);

            code.className = "language-markup";
            Prism.highlightElement(code);
          });
        } else {
          console.error(xhr.statusText);
        }
      }
    };
    xhr.onerror = function (e) {
      console.error(xhr.statusText);
    };
    xhr.open("GET", "../README.md");
    xhr.send();

  </script>

</body>
</html>