-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprice.js
59 lines (54 loc) · 2.03 KB
/
price.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
function toggleAccordion(header) {
var item = header.parentNode;
item.classList.toggle('active');
}
// logout code
let button = document.getElementById('logout');
button.onclick = function () {
let userResponse = window.confirm("Do you want to sign out?");
if (userResponse) {
let isAuth = localStorage.getItem('isAuth') || "Not Authenticated";
if (isAuth !== 'Authenticated') {
alert(" user is not authenticated");
window.location.href = "./signup.html";
} else {
localStorage.setItem('isAuth', "Not Authenticated");
// location.reload();
window.location.href = "./signin.html";
}
} else {
alert('ok!');
console.log("Function not executed.");
}
}
// logout code
let buttt = document.getElementById('log');
buttt.onclick = function () {
let userResponse = window.confirm("Do you want to sign out?");
if (userResponse) {
let isAuth = localStorage.getItem('isAuth') || "Not Authenticated";
if (isAuth !== 'Authenticated') {
alert(" user is not authenticated");
window.location.href = "./signup.html";
} else {
localStorage.setItem('isAuth', "Not Authenticated");
// location.reload();
window.location.href = "./signin.html";
}
} else {
alert('ok!');
console.log("Function not executed.");
}
}
document.getElementById('mobile-menu').addEventListener('click', function () {
document.querySelector('.nav-list').classList.toggle('show');
});
document.getElementById('toggleElement').addEventListener('click', function () {
let elementToToggle = document.getElementById('elementToToggle');
// Toggle the 'hidden' class to show or hide the element
if (elementToToggle.style.display === 'none' || elementToToggle.style.display === '') {
elementToToggle.style.display = 'block';
} else {
elementToToggle.style.display = 'none';
}
});