-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
258 lines (187 loc) · 7.28 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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
let startTime = document.querySelector("#start_date");
startTime.addEventListener("click", () => {
startTime.style.width = "225px"
startTime.style.height = "41px"
startTime.style.marginLeft = "-1px"
startTime.style.marginTop = "-10px"
})
let EndTime = document.querySelector("#end_date");
EndTime.addEventListener("click", () => {
EndTime.style.width = "225px"
EndTime.style.height = "41px"
EndTime.style.marginLeft = "-3px"
EndTime.style.marginTop = "-10px"
})
let start="";
let sTime =[]
let start_date = document.querySelector("#start_date");
start_date.addEventListener("click", () => {
start = start_date.value;
let startArr = start.split("T");
let startArr_1 =startArr[0].split("-")
for(let i of startArr_1){
sTime.push(i)
}
})
console.log("arr",sTime)
const optionMenu = document.querySelector(".select-menu"),
selectBtn = optionMenu.querySelector(".select-btn"),
options = optionMenu.querySelectorAll(".option"),
sBtn_text = optionMenu.querySelector(".sBtn-text");
selectBtn.addEventListener("click", ()=>{
optionMenu.classList.toggle("active")
document.querySelector("#sub").style.zIndex="-1"
});
options.forEach(option =>{
option.addEventListener("click", function(){
let selectOption = option.querySelector(".option-text").innerText;
sBtn_text.innerText = selectOption;
document.querySelector("#input_place").innerText = selectOption;
optionMenu.classList.remove("active");
document.querySelector("#sub").style.zIndex="1"
} )
})
// *******top section & slide bar started*********
let img1 =
"https://www.revv.co.in/assets/RentalImages/HomeScreen/heroCarousel/ST_Desktop_1_FG.webp";
let img2 =
"https://www.revv.co.in/assets/RentalImages/HomeScreen/heroCarousel/ST_Desktop_2_FG.webp";
let img3 =
"https://www.revv.co.in/assets/RentalImages/HomeScreen/heroCarousel/ST_Desktop_3_FG.webp";
let image = [img1, img2, img3];
let i = 0;
let slideshow = document.getElementById("sub");
let id = setInterval(() => {
if (i === image.length) {
i = 0;
}
let img = document.createElement("img");
img.style = "width:50%;";
img.src = image[i];
slideshow.innerHTML = null;
slideshow.append(img);
i++;
}, 2000);
// ..........top section & slide bar Ended..........
// <!-- featured section started -->
let sliderMain_1 = document.querySelector("#slider_first-main");
let item_1 = sliderMain_1.getElementsByClassName("item_1");
function next_1(){
sliderMain_1.append(item_1[0])
}
function prev_1(){
sliderMain_1.prepend(item_1[item_1.length - 1])
}
// <!-- featured section ended -->
// <!-- sanitized & safe cars section started -->
let sliderMain_2 = document.querySelector("#slider_second-main");
let item_2 = sliderMain_2.getElementsByClassName("item_2");
function next_2(){
sliderMain_2.append(item_2[0])
}
function prev_2(){
sliderMain_2.prepend(item_2[item_2.length - 1])
}
// <!-- sanitized & safe cars section ended -->
// <!-- why rwvv section started -->
let sliderMain_3 = document.querySelector("#slider_third-main");
let item_3 = sliderMain_3.getElementsByClassName("item_3");
function next_3(){
sliderMain_3.append(item_3[0])
}
function prev_3(){
sliderMain_3.prepend(item_3[item_3.length - 1])
}
// <!-- why rwvv section started -->
// <!-- happy customers section started -->
let sliderMain_4 = document.querySelector("#slider_fourth-main");
let item_4 = sliderMain_4.getElementsByClassName("item_4");
function next_4(){
sliderMain_4.append(item_4[0])
}
function prev_4(){
sliderMain_4.prepend(item_4[item_4.length - 1])
}
// <!-- happy customers section ended -->
// navbar and login&signup
let popup = document.querySelector("#register-form1")
let popup1 = document.querySelector('#register-form')
function openpopup() {
popup.classList.add("openpopup")
}
function openpopup1() {
popup1.classList.add("openpopup")
}
async function login() {
let login_data = {
password: document.getElementById("login_password").value,
username: document.getElementById("login_username").value,
}
console.log(login_data)
login_data = JSON.stringify(login_data)
let login_link = 'https://masai-api-mocker.herokuapp.com/auth/login'
let response = await fetch(login_link, {
method: "POST",
body: login_data,
headers: {
'Content-Type': 'application/json'
}
})
let data = await response.json()
console.log(data)
window.location.href="index.html"
}
async function Register() {
let p = document.createElement("p")
p.innerText = "SIGN UP"
p.style.marginBottom = 20
let name = document.createElement("input")
let mobile = document.createElement("input")
let description = document.createElement("input")
let password = document.createElement("input")
password.setAttribute('id', 'password')
password.placeholder = "Password"
let username = document.createElement("input")
username.setAttribute('id', 'username')
username.placeholder = 'Username'
let email = document.createElement("input")
email.setAttribute('id', 'email')
email.placeholder = "Email ID"
let img1 = document.createElement("img")
img1.src = 'https://www.revv.co.in/imgs/google-login.png'
let img2 = document.createElement("img")
img2.src = 'https://www.revv.co.in/imgs/facebook-icon.png'
let button = document.createElement("button")
button.innerText = "Proceed"
button.setAttribute("id", "submit")
button.addEventListener("click", signup)
let form = document.createElement("form")
form.append(p, img1, img2, email, username, password, button)
document.querySelector("#register-form1").innerHTML = ""
document.querySelector("#register-form1").append(form, button)
}
async function signup() {
popup.classList.remove("openpopup")
let signup_data = {
name: document.getElementById('username').value,
email: document.getElementById('email').value,
password: document.getElementById('password').value,
username: document.getElementById('username').value,
mobile: document.getElementById('username').value,
description: document.getElementById('username').value
}
signup_data = JSON.stringify(signup_data)
let signup_api_link = 'https://masai-api-mocker.herokuapp.com/auth/register'
let response = await fetch(signup_api_link, {
method: "POST",
body: signup_data,
headers:
{
'Content-Type': 'application/json'
}
})
let data = await response.json()
console.log(data)
window.location.reload()
}
// navbar and login&signup