-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
164 lines (97 loc) · 3.5 KB
/
app.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
const feedBackDiv = document.querySelector(".feedBackDiv");
let updateDiv = document.querySelector(".updateDiv");
/**
* showing feedback div ..................
*/
function showFeedbackForm () {
feedbackForm.style.visibility = "visible";
updateDiv.style.visibility = "hidden";
}
if(feedBackDiv)feedBackDiv.addEventListener('click', showFeedbackForm);
let feedbackForm = document.querySelector("#feedbackForm");
const closeFeedbackFormBttn = document.getElementById("closeFeedbackForm");
/* hide feedback form */
function hideFeedbackForm() {
feedbackForm.style.visibility = "hidden";
}
if(closeFeedbackFormBttn)closeFeedbackFormBttn.addEventListener("click", hideFeedbackForm);
const manageYourAccountDIv = document.querySelector(".manageYourAccountDIv");
/**
* showing update your profile from
*/
function showupdateForm () {
updateDiv.style.visibility = "visible";
feedbackForm.style.visibility = "hidden";
}
if(manageYourAccountDIv)manageYourAccountDIv.addEventListener('click', showupdateForm);
const closeUpdateDivBttn = document.getElementById("closeUpdateDivBttn");
/**
* hidding update your profile from
*/
function hideUpdateForm(){
updateDiv.style.visibility = "hidden";
}
if(closeUpdateDivBttn)closeUpdateDivBttn.addEventListener("click", hideUpdateForm);
const loginDiv = document.getElementById("loginBox");
const login = document.getElementById("Login");
/**
* to show login form on click
*/
function showLoginDiv() {
signUpDiv.style.visibility = "hidden";
loginDiv.style.visibility = "visible";
}
if(login) login.addEventListener("click", showLoginDiv);
const loginButton = document.getElementById("login-form-submit");
const loginForm = document.getElementById("login_form");
loginButton.addEventListener("click", (e) => {
e.preventDefault();
const username = loginForm.username.value;
const password = loginForm.password.value;
if (username === "Saurabh" && password === "[email protected]") {
alert("You have successfully logged in.");
window.location.replace("home.html");
} else {
alert("wrong id password");
}
});
const closeLoginDiv = document.getElementById("closelogindiv");
/**
* Function to hide login div
*/
function hideLoginDiv() {
loginDiv.style.visibility = "hidden";
};
if(closeLoginDiv)closeLoginDiv.addEventListener('click' , hideLoginDiv);
const SwitchtoSignUp = document.getElementById("SwitchtoSignUp");
/**
* switching from login to signup
*/
function switchToSignUpFrom(){
signUpDiv.style.visibility = "visible";
loginDiv.style.visibility = "hidden";
}
if(SwitchtoSignUp)SwitchtoSignUp.addEventListener("click", switchToSignUpFrom);
const switchToLogin = document.getElementById("switchToLogin");
/**
* Switching form to signup to login
*/
function switchLoginFrom(){
signUpDiv.style.visibility = "hidden";
loginDiv.style.visibility = "visible";
}
if(switchToLogin)switchToLogin.addEventListener("click", switchLoginFrom);
const updateFormbutton = document.getElementById("updateFormbutton");
/**
* cheching confirm password and password in update my profile form
*/
function updatefrom(event) {
let updatePassword = document.getElementById("updatePassword").value;
let updateConfirmPassword = document.getElementById("updateConfirmPassword").value;
if(updatePassword != updateConfirmPassword) {
event.preventDefault();
alert("confirm Password and password must be same");
return false;
}
}
if(updateFormbutton)updateFormbutton.addEventListener("click", updatefrom);