-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathslides.svelte
433 lines (401 loc) · 14.8 KB
/
slides.svelte
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
<script lang="ts">
import { Presentation, Slide, Notes } from '@components'
import Layout from './layout.svelte'
</script>
<!-- Typical Errors
"Uncaught TypeError: slidesInChapter[0] is undefined" and layout elements missing.
→ This can happen if a chapter is defined but has no slides.
-->
<Presentation>
<script>
// information about this presentation
const author = "Anran Wang, Christian Schuler";
const authorshort = "Wang, Schuler";
const title = "This Is My Own Title";
const subtitle = "And here is my subtitle";
const department = "Department of Informatics";
const university = "Technical University of Munich";
var currentChapterName="";
var currentChapterNumber=0;
var chapterNames=[];
var toc = false; // whether toc is to be generated
// data structure: [chapter number, chapter name, slideID]
var presentationData = [];
function newChapter(chapterName){
currentChapterName=chapterName;
currentChapterNumber++;
chapterNames.push(chapterName);
}
// called when new slide is created
var page=0;
function newPage(){
page++; //note that page n has index n-1
presentationData.push({chapternr: currentChapterNumber, chapter:currentChapterName,pagenr:page});
}
</script>
<!-- title page -->
<Slide><Layout>
<div class="m-16 flex h-[25%] w-[90%] bg-[var(--themecolor)] text-white items-center justify-center gap-[100px]">
<div>
<div class="text-[6vh]">
<span id="mytitle"> </span>
</div>
<br>
<div class="text-[4vh]">
<span id="mysubtitle"> </span>
</div>
</div>
</div>
<br>
<div>
<span id="myname"></span>
</div>
<br>
<div class="text-[3vh]">
<span id="myuni"></span>
</div>
<div class="text-[3.5vh]">
<br>
<span id="mydate"></span>
</div>
<br>
<figure class="w-full h-[20%]">
<img class="align-middle" src="title-logo.svg" alt="tum logo">
</figure>
<!-- fill in the data for this presentation -->
<script>
document.getElementById("mytitle").innerHTML=title;
document.getElementById("mysubtitle").innerHTML=subtitle;
document.getElementById("myname").innerHTML=author;
document.getElementById("myuni").innerHTML=department+"<br>"+university;
let today = new Date();
document.getElementById("mydate").innerHTML=today.toISOString().split('T')[0];
</script>
</Layout></Slide>
<!-- TOC -->
<Slide>
<script>
toc=true; // decides whether to generate table of content page
</script>
<Layout>
<toc class="flex h-full items-center justify-center gap-[100px]">
<chpicons> </chpicons>
<chpnames class="text-left"> </chpnames>
</toc>
</Layout>
</Slide>
<!-- intro -->
<script>newChapter("Introduction")</script>
<Slide><Layout>
<titlebar > On how to use these Presentation Slides </titlebar>
<ul class="a">
<li>Press F to enter full screen.</li>
<ul class="b">
<li>To better check the layout.</li>
</ul>
<br>
<li>Press fn+s to enter presenter mode.</li>
<ul class="b">
<li>Where you can see the next slide.</li>
<li>And read your notes for each slide.</li>
</ul>
</ul>
</Layout>
<Notes>
These are some presenter notes that can help during the actual presentation.<br>
They are displayed on the presenter's screen if "presenter mode" has been entered.
</Notes></Slide>
<script>newChapter("Text");</script>
<Slide><Layout>
<titlebar > Simple Text </titlebar>
<div class="flex h-full items-center justify-center gap-[100px]">
You can add text, and different media files such as<br>
images, pdfs, videos to your presentation slides.<br>
The following slides showcase some of these applications<br>
for easy reproduction.
</div>
</Layout></Slide>
<Slide><Layout>
<titlebar > A List of Text Items </titlebar>
<ul class="a" >
<li>The First Text Item.</li>
<ul class="b">
<li>The 1. Sub-Item.</li>
</ul>
<br>
<li>The Second Text Item.</li>
<ul class="b">
<li>The 2. Sub-Item.</li>
<ul class="c">
<li>Sub-Sub-Item a.</li>
<li>Sub-Sub-Item b.</li>
</ul>
<li>The 3. Sub-Item.</li>
</ul>
<br>
<li>The Third Text Item.</li>
<ul class="b">
<li>The 4. Sub-Item.</li>
</ul>
</ul>
</Layout>
<Notes>
These are some presenter notes that can help during the actual presentation.<br>
They are displayed on the presenter's screen if "presenter mode" has been entered.
</Notes></Slide>
<script> newChapter("Images"); </script>
<Slide><Layout>
<titlebar > An Image with a Caption </titlebar>
<figure>
<img src="title-logo.svg" alt="tumlogo" class="mx-auto ">
<figcaption> This is an example figure with caption. </figcaption>
</figure>
</Layout></Slide>
<Slide><Layout>
<titlebar > Here is a grid of images </titlebar>
<div class="grid mt-[10%] mx-[10%]" style="grid-template-columns: auto auto auto;">
<img src="title-logo.svg" alt="tumlogo" class="h-[40%] px-[5%]">
<img src="title-logo.svg" alt="tumlogo" class="h-[40%] px-[5%]">
<img src="title-logo.svg" alt="tumlogo" class="h-[40%] px-[5%]">
<img src="title-logo.svg" alt="tumlogo" class="h-[40%] px-[5%]">
<img src="title-logo.svg" alt="tumlogo" class="h-[40%] px-[5%]">
<img src="title-logo.svg" alt="tumlogo" class="h-[40%] px-[5%]">
</div>
</Layout></Slide>
<script> newChapter("PDFs"); </script>
<Slide><Layout>
<titlebar > Another PDF File as part of the Slide Deck </titlebar>
<div class="h-[75%] w-[90%] mx-auto my-auto">
<iframe src="media-sample.pdf#page=1&zoom=100" frameBorder="0" scrolling="auto" height="100%" width="100%" title="ESSV Publication"></iframe>
</div>
</Layout></Slide>
<script> newChapter("Videos"); </script>
<Slide><Layout>
<titlebar > Single Animated gif File (no sound) </titlebar>
<figure>
<img src="https://i.pinimg.com/originals/d3/71/7b/d3717b91b409a8eb25a4275b30d6981a.gif" alt="this slowpoke moves" class="w-[75%] h-[75%] mx-auto my-auto p-2" />
<figcaption> Stock-Gif of a Slowpoke for testing gif-display.<br> </figcaption>
</figure>
</Layout></Slide>
<Slide><Layout>
<titlebar > Single Video with multiple available Captions </titlebar>
<figure>
<video controls class="w-[70%] mx-auto my-auto p-2">
<source src="media-never_gonna_give_you_up-video_medium-43_51.mp4" type="video/mp4" />
<track kind="captions" label="English" srclang="eng" src="media-video-captions-eng.vtt"/>
<track kind="captions" label="German" srclang="deu" src="media-video-captions-deu.vtt"/>
<track kind="captions" label="Chinese" srclang="zho" src="media-video-captions-zho.vtt" default/>
<track kind="captions" label="Chinese Pinyin" srclang="zho" src="media-video-captions-zhopinyin.vtt"/>
</video>
<figcaption> Play a video file from the repository.<br> </figcaption>
</figure>
</Layout></Slide>
<Slide><Layout>
<titlebar > Multiple Videos on the same Slide </titlebar>
<div class="grid" style="grid-template-columns: auto auto;">
<figure class="w-[100%]">
<video controls class="mx-auto my-auto p-2" loop>
<source src="media-never_gonna_give_you_up-video_medium-43_51.mp4" type="video/mp4" />
<track kind="captions" label="English" srclang="eng" src="media-video-captions-eng.vtt"/>
<track kind="captions" label="German" srclang="deu" src="media-video-captions-deu.vtt"/>
<track kind="captions" label="Chinese" srclang="zho" src="media-video-captions-zho.vtt" default/>
<track kind="captions" label="Chinese Pinyin" srclang="zho" src="media-video-captions-zhopinyin.vtt"/>
</video>
<figcaption> Video that loops.<br>Default caption: Chinese. </figcaption>
</figure>
<figure class="w-[100%]">
<video controls class=" mx-auto my-auto p-2">
<source src="media-never_gonna_give_you_up-video_medium-43_51.mp4" type="video/mp4" />
<track kind="captions" label="English" srclang="eng" src="media-video-captions-eng.vtt" default/>
<track kind="captions" label="German" srclang="deu" src="media-video-captions-deu.vtt"/>
<track kind="captions" label="Chinese" srclang="zho" src="media-video-captions-zho.vtt"/>
<track kind="captions" label="Chinese Pinyin" srclang="zho" src="media-video-captions-zhopinyin.vtt"/>
</video>
<figcaption> Video without looping.<br>Default caption: English. </figcaption>
</figure>
</div>
</Layout></Slide>
<Slide><Layout>
<titlebar > Multiple Videos in a Grid </titlebar>
<div class="grid mx-auto my-auto" style="grid-template-columns: auto auto;">
<figure>
<video controls loop>
<source src="media-never_gonna_give_you_up-video_medium-00_06.mp4" type="video/mp4" />
<track kind="captions" label="English" srclang="eng" src="media-video-captions-eng.vtt" default/>
<track kind="captions" label="German" srclang="deu" src="media-video-captions-deu.vtt"/>
<track kind="captions" label="Chinese" srclang="zho" src="media-video-captions-zho.vtt"/>
<track kind="captions" label="Chinese Pinyin" srclang="zho" src="media-video-captions-zhopinyin.vtt"/>
</video>
<figcaption class="text-[2vh]"> Video with default caption: English. </figcaption>
</figure>
<figure>
<video controls loop>
<source src="media-never_gonna_give_you_up-video_medium-06_12.mp4" type="video/mp4" />
<track kind="captions" label="English" srclang="eng" src="media-video-captions-eng.vtt"/>
<track kind="captions" label="German" srclang="deu" src="media-video-captions-deu.vtt" default/>
<track kind="captions" label="Chinese" srclang="zho" src="media-video-captions-zho.vtt"/>
<track kind="captions" label="Chinese Pinyin" srclang="zho" src="media-video-captions-zhopinyin.vtt"/>
</video>
<figcaption class="text-[2vh]"> Video with default caption: German. </figcaption>
</figure>
<figure>
<video controls loop>
<source src="media-never_gonna_give_you_up-video_medium-12_18.mp4" type="video/mp4" />
<track kind="captions" label="English" srclang="eng" src="media-video-captions-eng.vtt"/>
<track kind="captions" label="German" srclang="deu" src="media-video-captions-deu.vtt"/>
<track kind="captions" label="Chinese" srclang="zho" src="media-video-captions-zho.vtt" default/>
<track kind="captions" label="Chinese Pinyin" srclang="zho" src="media-video-captions-zhopinyin.vtt"/>
</video>
<figcaption class="text-[2vh]"> Video with default caption: Chinese. </figcaption>
</figure>
<figure>
<video controls loop>
<source src="media-never_gonna_give_you_up-video_medium-18_24.mp4" type="video/mp4" />
<track kind="captions" label="English" srclang="eng" src="media-video-captions-eng.vtt"/>
<track kind="captions" label="German" srclang="deu" src="media-video-captions-deu.vtt"/>
<track kind="captions" label="Chinese" srclang="zho" src="media-video-captions-zho.vtt"/>
<track kind="captions" label="Chinese Pinyin" srclang="zho" src="media-video-captions-zhopinyin.vtt" default/>
</video>
<figcaption class="text-[2vh]"> Video with default caption: Chinese Pinyin. </figcaption>
</figure>
</div>
</Layout></Slide>
<script> newChapter("To wrap it up"); </script>
<Slide><Layout>
<titlebar > Here is the title for this slide </titlebar>
<div class="flex h-[100%] items-center justify-center">
This template is still work on progress.
</div>
</Layout></Slide>
<!-- to mimic the latex template -->
<script>
const totalSlides = document.getElementsByTagName('pagenumber').length;
const totalChapters = chapterNames.length;
var temp;
for (let i = 0; i < totalSlides; i++) {
// one section, one slide
document.getElementsByTagName('section')[i].setAttribute("id", "slide-"+(i+1));
// add author name
document.getElementsByTagName('author')[i].innerText=authorshort;
// add title
document.getElementsByTagName('mytitle')[i].innerHTML="<a href=\"#slide-1\">"+title+"</a>";
// show slide number with total slide number
document.getElementsByTagName("pagenumber")[i].innerHTML = (i+1)+"/"+totalSlides;
}
for (let i = 0; i < totalSlides; i++) {
for (let j = 0; j < totalChapters; j++) {
// fill in chapter names
temp = document.querySelectorAll("table.topbar")[i];
temp.getElementsByTagName("tr")[0].innerHTML += "<th data-chpcol=\"chpcol\" style=\"font-weight:normal\">"+chapterNames[j]+"</th>";
// document.getElementsByTagName("test")[0].innerHTML="here!";
// fill in dots
let slidesInChapter = presentationData.filter(item => item.chapter == chapterNames[j]);
let begin = slidesInChapter[0].pagenr;
let end = slidesInChapter[slidesInChapter.length-1].pagenr;
let circles=toCircle(begin,end);
temp.getElementsByTagName("tr")[1].innerHTML += "<td>"+ circles +"</td>";
}
}
for (let i = 0; i < totalSlides; i++) {
// first, find out if title page and toc exist
let chapter0 = presentationData.filter(item => item.chapternr == 0).length;
if (i>=chapter0){
// then set corresponding circle to white
let circle = document.getElementsByTagName("circle-"+(i+1))[i];
circle.style.background="white";
circle.style.border="0px";
// also the chapter names
let chapterNr = presentationData.filter(item => item.pagenr == i+1)[0].chapternr;
temp = document.getElementsByTagName("th")[(i)*(totalChapters)+chapterNr-1];
if (temp.hasAttribute("data-chpcol")){
temp.style.color="white";
}
}
}
// circles: start, start+1, . . . , end are created
function toCircle(begin,end){
let circles = "";
for (let i=begin; i<=end; i++){
circles+="<a href=\"#slide-" +i+ "\"><circle-" +i+ " class=\"dot\"> </circle-" +i+ "> </a>" ;
}
return circles;
}
// to create table of contents
if (toc) {
for (i=1; i<=chapterNames.length;i++){
document.getElementsByTagName('chpicons')[0].innerHTML += "<div class=\"chpicon\">"+i+"</div> <br>";
document.getElementsByTagName('chpnames')[0].innerHTML += "<div>"+chapterNames[i-1]+"</div> <br>";
}
}
</script>
<style>
.chpicon{
color: white;
width:180%;
background: var(--themecolor);
}
.dot {
height: 15px;
width: 15px;
background: rgba(0,0,0,0);
border-radius: 50%;
border: 1.5px solid var(--themecolorlight);
display: inline-block;
}
ul.a {
list-style-type: square;
padding:5%;
}
ul.b {
list-style-type: circle;
margin-left:5%;
padding:1%;
}
ul.c {
list-style-type: disc;
margin-left:10%;
padding:1%;
}
ul{
text-align: left;
margin-left:20%;
margin-right:5%;
padding:1%;
}
titlebar{
display: flex;
background: rgb(242,242,242);
width: 100%;
height: 9%;
text-align: left;
padding-left: 5%;
margin-bottom: 1%;
align-items: center;
font-size: 5vh;
}
figure {
border: 0px #cccccc solid;
padding: 4px;
margin: auto;
height: 75%;
width: 75%;
}
img{
height:100%;
margin:auto;
}
video{
height: 100%;
margin: auto;
}
figcaption {
background-color: rgb(242,242,242);
color: black;
font-style: italic;
margin: 1%;
padding: 1%;
text-align: center;
font-size:3vh;
}
</style>
</Presentation>