-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
84 lines (71 loc) · 2.88 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// EventListener for MensWear
document.querySelector("#men").addEventListener("click", mensFunction);
document.querySelector("#menBotton1").addEventListener("click", mensFunction);
document.querySelector("#menBotton2").addEventListener("click", mensFunction);
document.querySelector("#mens").addEventListener("click", mensFunction);
function mensFunction(){
window.location.href = "./menswear/menswear.html"
}
// EventListener for WomensWear
document.querySelector("#women").addEventListener("click", womensFunction);
document.querySelector("#womenBotton1").addEventListener("click", womensFunction);
document.querySelector("#womenBotton2").addEventListener("click", womensFunction);
document.querySelector("#womens").addEventListener("click", womensFunction);
function womensFunction(){
window.location.href = "./womenswear/womenswear.html"
}
// EventListener for everythingelse
document.querySelector("#else").addEventListener("click", elseFunction);
function elseFunction(){
window.location.href = "./everythingelse/every.html"
}
// EventListener for wishlists
document.querySelector("#wish").addEventListener("click", wishFunction);
function wishFunction(){
window.location.href = "./wishPage/wish.html"
}
// EventListener for search button
document.querySelector("#search").addEventListener("click", searchFunction);
function searchFunction(){
window.location.href = ""
}
//event listener for account check input when big screen
document.querySelector("#bigScreen").addEventListener("click", chkAccount);
function chkAccount(){
let currentEmail = JSON.parse(localStorage.getItem("currentEmail")) || "";
console.log(currentEmail);
if(currentEmail == "") {
window.location.replace("./login&SignupPage/login.html");
}
else {
window.location.replace("./login&SignupPage/accountDetails.html");
}
}
// EventListener for accountLogo
document.querySelector("#accountLogo").addEventListener("click", accountFunction);
function accountFunction(){
let currentEmail = JSON.parse(localStorage.getItem("currentEmail")) || "";
// console.log(currentEmail);
if(currentEmail == "") {
window.location.replace("./login&SignupPage/login.html");
}
else {
window.location.replace("./login&SignupPage/accountDetails.html");
}
}
// EventListener for shopping bag
document.querySelector("#shoppingLogo").addEventListener("click", shoppingFunction);
function shoppingFunction(){
window.location.href = "./cartPage/bag.html"
}
// EventListener for brand logo
document.querySelector("#brandLogo").addEventListener("click", brandLogoFunction);
function brandLogoFunction(){
window.location.replace("index.html");
}
// for showing the count
let previewDataFromLs = JSON.parse(localStorage.getItem("bagdata"))
if(previewDataFromLs == null) {
previewDataFromLs = [];
}
document.querySelector("#countShow").innerText = "("+previewDataFromLs.length+")";