generated from ICEI-PUC-Minas-PMV-ADS/WebApplicationProject-Template-v2
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathheader.js
106 lines (86 loc) · 3.17 KB
/
header.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
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
const body = document.body;
const header = document.createElement('header');
header.id = 'header01';
header.className = 'header';
body.prepend(header);
const logo =
"<div id ='logo' class='logo'>" +
"<a href='index.html'>" +
"<img src='../assets/logoPrincipal.png' title='Vigia Virtual' alt='Vigia Virtual'/>" +
"</a>" +
"</div>"
const logo02 =
"<div id ='logo' class='logo'>" +
"<a href='pagInicial.html'>" +
"<img src='../assets/logoPrincipal.png' title='Vigia Virtual' alt='Vigia Virtual'/>" +
"</a>" +
"</div>"
const searchBar =
"<div id='searchBox' class='searchBox'>" +
"<input id='searchInput' class='search' type='text' placeholder='Pesquisa...'>" +
"<i id='searchButton' class='bi bi-search searchBtn'></i>" +
"</div>"
const login =
"<div id='login' class='login'>" +
"<button id='loginBtn' class='button'> Login </button>"
"</div>"
const fotoPerfil =
"<div id ='fotoPerfil' class='fotoPerfil'>" +
"<a href='perfil.html'>" +
"<img src='../assets/perfil.jpg' id='perfil' title='Foto de Perfil' alt='Foto de Perfil'/>" +
"</a>" +
"</div>"
const botaoVoltar =
"<div id='botaoDiv' class='botaoDiv'>" +
"<i id='botaoPagInicial' class='bi bi-chevron-compact-left'>" + "</i>" +
"</div>"
if (body.id === 'pagLogin' || body.id === 'pagCadastro') {
header.innerHTML += logo;
} else if (body.id === 'quizPag') {
header.innerHTML += botaoVoltar;
document.querySelector("#botaoDiv").addEventListener("click", () => {
window.location.href = "../pagListaQuizzes.html";
});
} else if (body.id === 'pagInicial') {
header.innerHTML += logo02;
header.innerHTML += fotoPerfil;
} else if (body.id === 'pagTutoriais' || body.id === 'pagQuizzes') {
header.innerHTML += botaoVoltar;
header.innerHTML += fotoPerfil;
document.querySelector(".botaoDiv").addEventListener("click", () => {
window.location.href = "pagInicial.html";
});
} else if (body.id === 'pagCatalogo') {
header.innerHTML += botaoVoltar;
header.innerHTML += searchBar;
header.innerHTML += fotoPerfil;
document.querySelector(".botaoDiv").addEventListener("click", () => {
window.location.href = "pagInicial.html";
});
} else if (body.id === 'pagArtigos') {
const email = localStorage.getItem('loggedInUserEmail');
if (email) {
header.innerHTML += botaoVoltar;
document.querySelector(".botaoDiv").addEventListener("click", () => {
window.location.href = "pagCatalogo.html";
});
} else {
header.innerHTML += logo;
header.innerHTML += login;
document.querySelector("#loginBtn").addEventListener("click", () => {
window.location.href = "login.html";
});
}
} else if (body.id === 'pagOqFoiFeito') {
header.innerHTML += botaoVoltar;
header.innerHTML += fotoPerfil;
document.querySelector(".botaoDiv").addEventListener("click", () => {
window.location.href = "perfil.html";
});
} else {
header.innerHTML += logo;
header.innerHTML += login;
document.querySelector("#loginBtn").addEventListener("click", () => {
window.location.href = "login.html";
});
}