-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathscript.js
45 lines (38 loc) · 1.17 KB
/
script.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
/* If you're feeling fancy you can add interactivity
to your site with Javascript */
// prints a message in the browser's dev tools console
console.log("Hello 🌎");
const display = document.getElementById("motivato");
const motivation = [
{
quote: "Planting popcorn does not produce more popcorn",
person: "Farmer Ted",
},
{
quote: "White whale, bad whale",
person: "Confucious (Moby Dick)",
},
{
quote: "Use the strobe function to disorientate your attacker",
person: "Flashlight",
},
{
quote: "Apply liberally to your erogenous zones",
person: "Spice Bomb",
},
{
quote: "Help me, I'm bleaching",
person: "The Great Barrier Reef",
},
];
function motivateMe() {
const listLength = motivation.length;
const randVal = motivation[Math.floor(Math.random() * listLength)];
display.innerHTML = `<blockquote>"${randVal.quote}"</blockquote><cite>${randVal.person}</cite>`;
}
motivateMe();
var changeThemeButton = document.querySelector("#change-theme");
changeThemeButton.addEventListener("click", (e) => {
document.body.classList.toggle("dark-theme");
console.log(document.body.classList.contains("dark-theme"));
});