-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
105 lines (79 loc) · 3 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Linking pages
document.querySelector("#passivaji")
function mysivaji() {
window.location.href = "page1(passport).html"
}
document.querySelector("#blogsuraj")
function mysuraj() {
window.location.href = "blogsuraj.html"
}
document.querySelector("#walson")
function mywalson() {
window.location.href = "sortingwalson.html"
}
// Targeting Loging Button
document.getElementById("loginButton").addEventListener("click", function () {
document.querySelector(".loginContainer").style.display = "flex";
});
document.querySelector("#close").addEventListener("click", function () {
document.querySelector(".loginContainer").style.display = "none";
});
// Targeting Signup Submit Button
document.querySelector("#signupBtn").addEventListener("click", function () {
window.location.href = "signup_page_udit.html";
})
// Targeting logup Submit Button
document.querySelector("#loginForm").addEventListener("submit", function (event) {
event.preventDefault();
var loginInput = document.querySelector("#email").value;
var loginPassword = document.querySelector("#password").value;
// Getting Data From SignUP Page & Operations
let data = JSON.parse(localStorage.getItem("Database"));
function login(){
let x = false;
data.map((el)=>{
if(el.mail == loginInput && el.passcode == loginPassword){
x = true;
}
})
return x;
}
if(login() == true){
alert("Login Success");
document.querySelector(".loginContainer").style.display = "none";
document.querySelector("#loginButton").textContent = "My Account ▼";
document.querySelector("#loginButton").style.backgroundColor = "white";
document.querySelector("#loginButton").style.color = "black";
}else{
alert("Username & Password Incorrect ")
}
});
// Best Offer Image Section
var BestOfferDataArr = [];
var BestOfferfDataObj = {
image1: "https://im1.dineout.co.in/images/uploads/misc/2020/Nov/20/30offid.png?tr=tr:n-medium",
image2: "https://im1.dineout.co.in/images/uploads/misc/2020/Aug/12/20offid.png?tr=tr:n-medium",
image3: "https://im1.dineout.co.in/images/uploads/misc/2020/Aug/12/15offid.png?tr=tr:n-medium",
image4: "https://im1.dineout.co.in/images/uploads/misc/2020/Aug/12/10offid.png?tr=tr:n-medium"
}
BestOfferDataArr.push(BestOfferfDataObj);
BestOfferDataArr.map(function (elem) {
var div1 = document.createElement("div");
var img1 = document.createElement("img");
img1.setAttribute("src", elem.image1);
div1.append(img1);
var div2 = document.createElement("div");
var img2 = document.createElement("img");
img2.setAttribute("src", elem.image2);
div2.append(img2)
var div3 = document.createElement("div");
var img3 = document.createElement("img");
img3.setAttribute("src", elem.image3);
div3.append(img3)
var div4 = document.createElement("div");
var img4 = document.createElement("img");
img4.setAttribute("src", elem.image4);
div4.append(img4)
var container = document.querySelector("#BestOfferImage");
container.append(div1, div2, div3, div4);
});