blob: 332e2af222fb527b859d48ab5cb332e98a310912 (
plain) (
blame)
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
|
/* Add stylesheet to page */
var presStyle = document.createElement('link');
presStyle.type = 'text/css';
presStyle.rel = 'stylesheet';
presStyle.href = '/presentation.css';
document.head.appendChild(presStyle);
/* Print button */
const printBtn = document.getElementById('printBtn');
printBtn.onclick = function() {
window.print();
}
/* Next and previous buttons */
const prevSlideBtn = document.getElementById('prevSlideBtn');
const nextSlideBtn = document.getElementById('nextSlideBtn');
const slides = document.getElementsByClassName('slide');
var slideIndex = 0;
function showSlide(mod) {
slides[slideIndex].classList.remove('absolute-slide');
slideIndex = (slides.length + slideIndex + mod) % slides.length;
slides[slideIndex].classList.add('absolute-slide');
}
prevSlideBtn.onclick = function() {
showSlide(-1);
}
nextSlideBtn.onclick = function() {
showSlide(+1);
}
/* Present button */
const presentCont = document.getElementById('presentCont');
const presentBtn = document.getElementById('presentBtn');
presentBtn.onclick = function() {
// Hide the whole page
document.body.classList.toggle('invisible');
document.body.classList.toggle('no-overflow');
// Fix background color
document.body.classList.toggle('body-bg-color');
// Show the slide controller
presentCont.classList.toggle('absolute-cont');
prevSlideBtn.classList.toggle('nodisplay');
nextSlideBtn.classList.toggle('nodisplay');
// Show the first slide
slides[slideIndex].classList.toggle('absolute-slide');
slideIndex = 0;
window.scrollTo(0, 0); // Alignment of presentation to screen
}
|