aboutsummaryrefslogtreecommitdiff
path: root/slides/vendor
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2018-09-23 22:43:26 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2018-09-23 22:43:26 +0200
commit6a98c802fd7400510b2469ccb9315f5d31c7155a (patch)
treec6d3c9f6e9d941e53ce50c2cedd44b91e82b8480 /slides/vendor
parent90e49e8658c551646dd889a65952ac945d5aba05 (diff)
downloadmitjafelicijan.com-6a98c802fd7400510b2469ccb9315f5d31c7155a.tar.gz
content update
Diffstat (limited to 'slides/vendor')
-rw-r--r--slides/vendor/slides.css190
-rw-r--r--slides/vendor/slides.js112
2 files changed, 302 insertions, 0 deletions
diff --git a/slides/vendor/slides.css b/slides/vendor/slides.css
new file mode 100644
index 0000000..d2e7f46
--- /dev/null
+++ b/slides/vendor/slides.css
@@ -0,0 +1,190 @@
1@charset "utf-8";
2@import url("https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&subset=latin-ext");
3
4* {
5 box-sizing: border-box;
6 background-color: transparent;
7 margin: 0;
8 padding: 0;
9 border: 0;
10 outline: none;
11 text-decoration: none;
12 position: relative;
13 box-shadow: none;
14 -moz-osx-font-smoothing: grayscale !important;
15 text-rendering: optimizeLegibility !important;
16 -webkit-font-smoothing: antialiased !important;
17}
18
19body {
20 font-family: "Roboto", sans-serif;
21 color: #222;
22 font-size: 24px;
23 margin: 0;
24 padding: 0;
25 line-height: 270%;
26 font-weight: 400;
27 color: #111;
28}
29
30.wrapper {
31 overflow: auto;
32}
33
34a {
35 color: crimson;
36 font-weight: 500;
37}
38
39table {
40 border-collapse: collapse;
41 border-spacing: 0;
42}
43
44section {
45 padding: 70px 100px;
46}
47
48nav {
49 position: fixed;
50 right: 40px;
51 bottom: 20px;
52 font-size: 80%;
53 font-weight: 500;
54}
55
56figcaption {
57 color: #888;
58 font-size: 80%;
59 margin: 0;
60 padding: 0;
61 line-height: 0;
62 font-weight: 600;
63}
64
65hr {
66 border-top: 3px solid #eee;
67 margin: 50px 0 40px 0;
68}
69
70ul,
71ol {
72 margin-left: 30px;
73}
74
75ol {
76 list-style-type: lower-roman;
77}
78
79h1,
80h2,
81h3,
82h4,
83h5,
84h6 {
85 margin: 0 0 50px 0;
86 font-weight: 700;
87 display: block;
88 color: #000;
89}
90
91h1 {
92 font-size: 300%;
93 margin-bottom: 100px;
94 line-height: 130%;
95}
96
97h2 {
98 font-size: 200%;
99}
100
101h3 {
102 font-size: 160%;
103}
104
105h4 {
106 font-size: 140%;
107}
108
109h5 {
110 font-size: 120%;
111}
112
113h6 {
114 font-size: 100%;
115}
116
117p {
118 display: block;
119 margin: 15px auto;
120 line-height: 160%;
121 color: inherit;
122}
123
124q {
125 display: inline-block;
126 font-size: 200%;
127 font-weight: 500;
128 padding: 100px 0 30px 0;
129}
130
131/* aligments */
132.left {
133 text-align: left;
134}
135
136.right {
137 text-align: right;
138}
139
140.center {
141 text-align: center;
142 margin-left: auto;
143 margin-right: auto;
144}
145
146.top {
147 vertical-align: top;
148}
149
150.middle {
151 vertical-align: middle;
152}
153
154.bottom {
155 vertical-align: bottom;
156}
157
158.full-width {
159 width: 100%;
160}
161
162/* other */
163.hide {
164 display: none;
165}
166
167.show {
168 display: block;
169}
170
171/* presentation mode */
172.wrapper:-webkit-full-screen {
173 width: 100%;
174 height: 100%;
175 background: #fff;
176 padding: 50px;
177 font-size: 28px;
178 line-height: 250%;
179}
180
181/* prism line numbers */
182pre[class*=language-] {
183 display: block;
184 background: #fff;
185 padding: 0;
186 margin-bottom: 20px;
187 font-family: 'Courier New', Courier, monospace;
188 font-size: 100%;
189 font-weight: 600;
190}
diff --git a/slides/vendor/slides.js b/slides/vendor/slides.js
new file mode 100644
index 0000000..a909352
--- /dev/null
+++ b/slides/vendor/slides.js
@@ -0,0 +1,112 @@
1window.addEventListener('load', function(evt) {
2
3 let main = document.querySelector('main');
4 let nav = document.querySelector('nav');
5 let wrapper = document.querySelector('div.wrapper');
6 let hash = window.location.hash.slice(1, window.location.hash.length);
7
8 if (hash.length == 0) {
9 main.innerHTML = '<h1>No presentation selected!</h1>';
10 } else {
11
12 fetch(`presentations/${hash}/default.pug`).then(function(response) {
13 response.text().then(function(template) {
14 if (response.status == 200) {
15 main.innerHTML = jade.render(template, {});
16 initSlideshow();
17 } else {
18 main.innerHTML = '<section><h3>Presentation does not exists!</h3></section>';
19 }
20 }).catch(function(error) {
21 console.log(error);
22 });
23 });
24
25 fetch(`presentations/${hash}/meta.json`).then(function(response) {
26 response.json().then(function(data) {
27 document.title = data.title;
28 }).catch(function(error) {
29 console.log(error);
30 });
31 });
32
33 }
34
35 function initSlideshow() {
36
37 // mathjax formulas
38 MathJax.Hub.Config({
39 //displayAlign: 'left',
40 extensions: ['tex2jax.js'],
41 jax: ['input/TeX', 'output/SVG'],
42 tex2jax: {
43 skipTags: ['script', 'noscript', 'style', 'textarea', 'code'],
44 inlineMath: [
45 ['$', '$'],
46 ["\\(", "\\)"]
47 ],
48 displayMath: [
49 ['$$', '$$'],
50 ["\\[", "\\]"]
51 ],
52 }
53 });
54 MathJax.Hub.Configured();
55
56 // syntax highlighting
57 Prism.highlightAll();
58
59 // initializes slides
60 function showSlide(slides, op) {
61 let tmpIdx = currentIdx + op;
62 if (tmpIdx >= 0 && tmpIdx < slides.length) {
63 slides.forEach(function(slide) {
64 slide.classList.add('hide');
65 });
66 slides[tmpIdx].classList.remove('hide');
67 nav.innerHTML = `${tmpIdx+1} / ${slides.length}`;
68 currentIdx = tmpIdx;
69 }
70 }
71
72 let slides = document.querySelectorAll('section');
73 let currentIdx = 0;
74 showSlide(slides, currentIdx);
75
76 document.addEventListener('keydown', function(evt) {
77 switch (evt.code) {
78 case 'ArrowRight':
79 {
80 showSlide(slides, 1);
81 break;
82 }
83 case 'ArrowLeft':
84 {
85 showSlide(slides, -1);
86 break;
87 }
88 case 'KeyF':
89 {
90 if (wrapper.requestFullscreen) {
91 wrapper.requestFullscreen();
92 } else if (wrapper.mozRequestFullScreen) {
93 wrapper.mozRequestFullScreen();
94 } else if (wrapper.webkitRequestFullscreen) {
95 wrapper.webkitRequestFullscreen();
96 } else if (wrapper.msRequestFullscreen) {
97 wrapper.msRequestFullscreen();
98 }
99 break;
100 }
101 }
102 }, false);
103
104
105 //var elem = document.getElementById("myvideo");
106 //if (elem.requestFullscreen) {
107 // elem.requestFullscreen();
108 //}
109
110 }
111
112}, false);