-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
42 lines (33 loc) · 1.25 KB
/
main.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
const hideable = document.getElementsByClassName("hideable");
let curProfile;
let title;
const changeProfile = () => {
if (curProfile === 'woofle') {
curProfile = 'seby';
title = 'Seby Amador';
document.querySelector("link[rel*='icon']").href = "./images/seby.jpg";
document.getElementById("other-profile-message").innerHTML = 'Woofle-related links';
} else {
curProfile = 'woofle';
title = 'Woofle';
document.querySelector("link[rel*='icon']").href = "./images/woofle.jpg";
document.getElementById("other-profile-message").innerHTML = 'music-related links';
}
for (let i = 0; i < hideable.length; i++) {
if (hideable[i].classList.contains(curProfile)) {
hideable[i].classList.remove('hidden');
}
else {
hideable[i].classList.add('hidden');
}
}
document.title = title + "'s Links";
document.getElementById("name-location").innerHTML = title;
}
//////////////////////////////////////////////////////////
changeProfile(); // set profile initially to Woofle
document.body.addEventListener('click', (event) => {
if (event.target.tagName === 'IMG') {
changeProfile(); // when pfp clicked, change profile
}
});