-
Notifications
You must be signed in to change notification settings - Fork 0
/
minslide.html
173 lines (161 loc) · 5.75 KB
/
minslide.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>minslide</title>
<!--
Written in 2013 by Richard Wossal <richard@r-wos.org>
To the extent possible under law, the author has dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
See http://creativecommons.org/publicdomain/zero/1.0/ for details.
-->
<style>
body {
background: #afaaaa;
font-family: Helvetica, Arial, sans-serif;
overflow: hidden;
}
section {
background: #fafafa;
border: 1pt solid #fff;
border-radius: .25em;
box-shadow: 0 0 .1em .1em #888;
color: #111;
overflow: hidden;
padding: 35px;
margin: 0;
position: absolute;
-webkit-transition: left .3s;
-moz-transition: left .3s;
-o-transition: left .3s;
transition: left .3s;
}
section img {
height: 90%;
}
footer, header {
color: #777;
font-size: 50%;
width: 90%;
position: absolute;
}
footer {
bottom: 10px;
text-align: center;
}
header {
top: 10px;
text-align: left;
}
h1, h2, h3, h4 {margin: 0; padding: 0;}
h1 {font-size: 120%;}
h2 {font-size: 110%;}
p, pre, code, ul, ol {margin: 0.5em 0 0.5em 0;}
p {color: #222;}
pre, code {background: #ddd}
</style>
</head>
<body>
<!-- slides start here -->
<footer>
global footer
</footer>
<section>
<h1>minslide</h1>
<h2>minimal html5 slide deck</h2>
<p><small>(navigate with cursor keys)</small></p>
</section>
<section>
<header>local header</header>
<h1>features</h1>
<ul>
<li>single file</li>
<li>self-contained</li>
<li>doesn't need web access</li>
<li>doesn't do stuff you don't need</li>
<li>resolution independend (more or less)</li>
<li>slides link-able (<code>#</code>slide)</li>
</ul>
</section>
<section>
<header>another header</header>
<h1>does not provide</h1>
<ul>
<li>fancy styling</li>
<li>too much cross-browser support</li>
<li>speaker's notes</li>
<li>table of contents</li>
<li>print version</li>
<li>...</li>
</ul>
</section>
<section>
<h1>copyright</h1>
<ul>
<li>CC0 (public domain)</li>
<li>do with it whatever you want</li>
</ul>
</section>
<section>
<h1>get it</h1>
<p>
at <a href="http://github.com/rwos/minslide">http://github.com/rwos/minslide</a>
</p>
</section>
<!-- end of slides -->
<script>
var show = 0;
var slides = document.getElementsByTagName("section");
function update() {
if (show < 0 || isNaN(show)) show = 0;
if (show >= slides.length) show = slides.length - 1;
// url
url_parts = (document.location + "").split("#");
document.location = url_parts[0] + "#" + show;
// slide
for (var i = 0; i < slides.length; i++) {
if (i == show) {
slides[i].style.left = ((window.innerWidth - slides[i].scrollWidth) / 2) + "px";
} else if (i < show) {
slides[i].style.left = -window.innerWidth + "px";
} else {
slides[i].style.left = 50 + window.innerWidth + "px";
}
}
}
document.onkeydown = function(e) {
var event = window.event ? window.event : e;
if (event.keyCode == 37) {
show--;
event.preventDefault();
}
if (event.keyCode == 39) {
show++;
event.preventDefault();
}
update();
};
// init
var footer = document.getElementsByTagName("footer");
for (var i = 0; i < slides.length; i++) {
var height = window.innerHeight - 80 - 35*2;
slides[i].style.height = height + "px";
slides[i].style.top = "40px";
slides[i].style.width = Math.round((height/3.0)*4) + "px";
slides[i].style.fontSize = Math.round(height/15) + "px";
// move footer into slides (but skip the very first slide)
if (footer.length > 0 && i > 0) {
slides[i].appendChild(footer[0].cloneNode(true));
}
}
// hide original footer
footer[0].style.display = "none";
url_parts = (document.location + "").split("#");
if (url_parts.length == 2) {
show = parseInt(url_parts[1]);
}
update();
</script>
</body>
</html>