-
Notifications
You must be signed in to change notification settings - Fork 2
/
template.html
148 lines (122 loc) · 3.75 KB
/
template.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html>
<head>
<title>{title}</title>
<meta charset="utf-8">
<link rel="stylesheet" href="{root}reveal/reset.css">
<link rel="stylesheet" href="{root}reveal/reveal.css">
<link rel="stylesheet" href="{root}reveal/theme/{theme}.css">
<!-- theme for code highlighting -->
<link rel="stylesheet" href="{root}reveal/plugin/highlight/zenburn.css">
<!-- multiplexing -->
<script>
var multiplex = {{
server: '{multiplex}',
secret: window.location.search.match(/master/gi) ? 'request' : null,
id: window.location.search.match(/receiver/gi) ? 'request' : null,
}};
multiplex['enabled'] = multiplex['id'] !== multiplex['secret'];
var showNotes = !(multiplex['id'] || multiplex['secret'] || window.location.search.match(/present/gi));
</script>
<!-- make h1 font size a little smaller -->
<style>
.reveal h1 {{
font-size: 3.10em;
}}
.reveal .speaker-notes p {{
text-shadow: none;
}}
</style>
</head>
<body>
<div class="reveal">
<div class="slides">
<!-- source markdown file -->
<section data-markdown="{presentation}" data-separator="^\n\n\n" data-separator-vertical="^\n\n" data-separator-notes="^Note:"></section>
</div>
</div>
<!-- source and configure reveal.js -->
<script src="{root}reveal/reveal.js"></script>
<script src="{root}reveal/plugin/markdown/markdown.js"></script>
<script src="{root}reveal/plugin/highlight/highlight.js"></script>
<script src="{root}reveal/plugin/zoom/zoom.js"></script>
<script src="{root}reveal/plugin/notes/notes.js"></script>
<script src="{root}reveal/plugin/math/math.js"></script>
<script>
var init = function() {{
// base plugins
var plugins = [
RevealMarkdown,
RevealHighlight,
RevealNotes,
RevealZoom,
RevealMath
];
// potential dependencies
var dependencies = [];
if (multiplex['enabled']) {{
// multiplex
dependencies.push({{ src: '{root}reveal/lib/socket/socket.io.js', async: true }});
if (multiplex['secret'] === null)
dependencies.push({{ src: '{root}reveal/ext/multiplex/client.js', async: true }});
else
dependencies.push({{ src: '{root}reveal/ext/multiplex/master.js', async: true }});
}}
// create reveal options
var reveal = {{
history: true,
plugins: plugins,
dependencies: dependencies
}};
if (multiplex['enabled']) {{
// add multiplex information
reveal['multiplex'] = {{
secret: multiplex['secret'],
id: multiplex['id'],
url: multiplex['server']
}}
}}
reveal['showNotes'] = showNotes;
Reveal.initialize(reveal);
}};
var request = function(uri, callback) {{
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.onreadystatechange = function () {{
if (xhr.readyState === XMLHttpRequest.DONE) {{
if (xhr.status === 200 || xhr.status === 304)
callback(xhr.responseText);
else
callback(null);
}}
}};
xhr.open('GET', uri, true);
xhr.send();
}};
var get_id = function() {{
request(multiplex['server'] + '/id?presentation={id}', function(response) {{
multiplex['id'] = response;
if (!response)
multiplex['enabled'] = false;
init();
}});
}};
var get_secret = function() {{
multiplex['secret'] = null;
request(multiplex['server'] + '/token?presentation={id}', function(response) {{
multiplex['secret'] = response;
if (!response)
multiplex['enabled'] = false;
get_id();
}});
}};
// determine multiplex information
if (multiplex['enabled'] && multiplex['secret'] === 'request')
get_secret();
else if (multiplex['enabled'] && multiplex['id'] === 'request')
get_id();
else
init();
</script>
</body>
</html>