-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
61 lines (51 loc) · 2.33 KB
/
index.js
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
import Reveal from "./reveal/reveal.esm.js";
import RevealNotes from "./reveal/plugin/notes/notes.esm.js";
import RevealMarkdown from "./reveal/plugin/markdown/markdown.esm.js";
import RevealHighlight from "./reveal/plugin/highlight/highlight.esm.js";
import RevealZoom from "./reveal/plugin/zoom/zoom.esm.js";
import data from "./slides/slides.md";
let backgroundImage = null;
const setup = (event) => {
const viewport = document.querySelector("#vib-background-image");
backgroundImage = window.getComputedStyle(viewport).backgroundImage;
return event;
};
const dynamicStyles = (event) => {
let id = event.currentSlide.getAttribute("id");
let viewport = document.querySelector(".reveal-viewport");
let watermarks = document.querySelector("#vib-watermarks");
let science_meets_life = document.querySelector("#science-meets-life");
switch (id) {
case "title":
viewport.style.setProperty("--r-background-color", "#1b2944");
viewport.style.setProperty("--r-heading-color", "rgb(244, 244, 244)");
viewport.style.setProperty("background-image", backgroundImage);
watermarks.style.setProperty("display", "inline");
science_meets_life.setAttribute("class", "science-meets-life-title");
break;
case "final":
viewport.style.setProperty("background-image", undefined);
viewport.style.setProperty("--r-background-color", "#1b2944");
viewport.style.removeProperty("background-image");
watermarks.style.setProperty("display", "none");
break;
default:
viewport.style.setProperty("--r-background-color", "#f4f4f4");
viewport.style.setProperty("--r-heading-color", "#1b2944");
viewport.style.setProperty("--r-selection-color", "#1b2944");
viewport.style.setProperty("--r-main-color", "#1b2944");
viewport.style.removeProperty("background-image");
watermarks.style.setProperty("display", "inline");
science_meets_life.setAttribute("class", "science-meets-life-default");
break;
}
};
window.addEventListener("DOMContentLoaded", () => {
document.querySelector("#markdown-area").innerHTML = data;
Reveal.initialize({
hash: true,
plugins: [RevealMarkdown, RevealHighlight, RevealNotes, RevealZoom],
});
Reveal.addEventListener("ready", (event) => dynamicStyles(setup(event)));
Reveal.addEventListener("slidechanged", dynamicStyles);
});