-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
97 lines (90 loc) · 3.21 KB
/
index.html
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
86
87
88
89
90
91
92
93
94
95
96
97
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SPICE Debugger</title>
<meta name="author" content="WORM">
<link rel="stylesheet" href="styles.css">
<script src="handlebars-v4.0.5.js"></script>
</head>
<body>
<div id="content" class="container-fluid"></div>
<script>
"use strict";
var partials = [
"startup",
"file-browser",
"source-browser",
"code-viewer",
"state-timeline",
"type-mapper",
"menu-bar",
];
var menuBar = { items: ['File', 'Edit', 'View'], };
var files = {
filesA: ['a.cpp','b.cpp','c.cpp','d.cpp','e.cpp','f.cpp'],
filesB: ['g.cpp','h.cpp','i.cpp']
};
var templates = [
{ url: 'templates/debugging-interface.html', context: files, },
{
url: 'templates/debugging-interface.html',
context: { menuBar, codeViewer: { lines: [
{ code: 'int a = 1;', width: '70px', states: [
{state: 'a=1'}
] },
{ code: 'for(int i = 0; i < 5; i++) {', width: '70px', states: [
{state: 'i=0'}, {state: 'i=1'}, {state: 'i=2'}, {state: 'i=3'}, {state: 'i=4'}
] },
{ code: ' a *= 2', width: '70px', states: [
{state: 'a=2'}, {state: 'a=4'}, {state: 'a=8'}, {state: 'a=16'}, {state: 'a=32'}
] },
{ code: '}', width: '70px', states: [] },
] }, files },
},
{
url: 'templates/debugging-interface.html',
context: { menuBar, codeViewer: { lines: [
{ code: '', width: '200px', states: [
{state: '<img src="images/arr-9.png">'},{state: '<img src="images/arr-9.png">'}
] },
{ code: '', width: '200px', states: [
{state: '<img src="images/arr-9.png">'}
] },
{ code: '', width: '200px', states: [
{state: '<img src="images/arr-9.png">'}
] },
{ code: '', width: '200px', states: [
{state: '<img src="images/arr-9.png">'}
] },
{ code: '}', width: '150px', states: [] },
] } },
},
];
var templateData = templates[1];
Promise.all(partials.map(initPartial))
.then(function () { return fetch(templateData.url); })
.then(function (res) { return res.text(); })
.then(function (templateSource) {
var template = Handlebars.compile(templateSource);
var placeholder = document.getElementById('content');
placeholder.innerHTML = template(templateData.context);
});
function initPartial(name) {
return fetch('partials/' + name + '.html')
.then(function(res) { return res.text(); })
.then(function(source) { Handlebars.registerPartial(name, source); });
}
function toggleAllDirectories() {
var slice = Array.prototype.slice;
var elements = slice.call(document.getElementsByClassName('directory-caret'))
.concat(slice.call(document.getElementsByClassName('directory-listing-wrap')));
elements.forEach(function (element) {
element.classList.toggle('expand');
});
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>