forked from web-development-session-content/playo-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivities.html
217 lines (163 loc) · 5.45 KB
/
activities.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="./css/explore.css">
<link rel="stylesheet" href="./css/popup.css">
<link rel="stylesheet" href="./css/">
<link rel="stylesheet" href="./styles/footer.css">
</head>
<body>
<div id="explorenavbar" style="height: 50px; margin-bottom: 50px;">
<div id="logodiv" >
<a href="index.html">
<img id="logo" src="https://playo.co/_next/image?url=https%3A%2F%2Fplayo-website.gumlet.io%2Fplayo-website-v2%2FLogo%2Bwith%2BTrademark_Filled.png&w=1920&q=75" alt="playo logo" style="margin-top: 7px;">
</a>
</div>
</div>
<!-- popupwindow ------------------------------------------------------ -->
<div id="show">
<!--popupwindow show here -->
</div>
</div>
<!-- -->
<div id="searchbar" style="margin-bottom: 25px;">
<input type="text" id="typesearch" placeholder="Type a city" style="border: 1px solid grey; border-top-left-radius: 2px; border-top-right-radius: 2px;">
<button id="searchbtn" >Detect</button>
</div>
<div id="citynames" style="margin-bottom: 110px; border: 1px solid rgb(214, 212, 212); padding: 20px; box-sizing: border-box; border-radius: 2px; color: #424242;">
<p>All citiies</p>
<hr>
</div>
<div id="footer"></div>
</body>
</html>
<script type="module">
import getpopup from "./components/popup.js"
document.getElementById("show").innerHTML=getpopup();
import footer from "./components/footer.js"
let container = document.querySelector("#footer");
container.innerHTML = footer();
//console.log(city_names)
//console.log(city_names)
document.getElementById("typesearch").addEventListener("keyup", () => {
Find_City(Debouncing);
});
let id;
let Find_City = (deb) => {
if (id) {
clearTimeout(id);
}
id = setTimeout(() => {
deb();
}, 400);
};
FetchCity()
async function FetchCity() {
// let city = document.getElementById("typesearch").value;
// console.log(city);
let res = await fetch(`http://localhost:3000/city-name`)
let data = await res.json();
// data.sort((a,b)=>a.name<b.name);
// console.log(Sortdata);
display_City(data);
}
async function Debouncing(){
let city_name=document.getElementById("typesearch").value;
// console.log(city);
let res=await fetch(`http://localhost:3000/city-name?q=${city_name}`)
let data=await res.json();
console.log(data);
display_City(data);
}
function display_City(Arr){
var Show_city=document.querySelector("#citynames");
Show_city.innerHTML=""
Arr.map(({name})=>{
var p=document.createElement("p");
p.setAttribute("class","city_name");
p.style.cursor="pointer";
p.textContent=name;
p.addEventListener("click",()=>{
let data = {
city: p.textContent,
};
localStorage.setItem("name", JSON.stringify(data));
console.log(data)
window.location.href = "explore.html";
})
var line=document.createElement("hr");
Show_city.append(p,line);
})
}
// popupstartshere-----------------------
// var modal = document.getElementById("myModal");
// var modal1=document.getElementById("myModal1")
// // Get the button that opens the modal
// var btn = document.getElementById("myBtn");
// // btn.innerHTML= JSON.parse(localStorage.getItem("myLocal"))[0]|| "Login/Signup";
// var submit=document.getElementById("btn");
// var verify=document.getElementById("btn2")
// Get the <span> element that closes the modal
// var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
// btn.onclick = function() {
// if (btn.innerHTML=="Login/Signup"){
// modal.style.display = "block";
// }
// else{
// document.getElementById("dropdowndiv").style.visibility="visible";
// }
// }
// submit.onclick=function(){
// var mobnumber=document.querySelector("#mobnum").value;
// //console.log(mobnumber)
// if(mobnumber){
// modal.style.display = "none";
// modal1.style.display = "block";
// }
// else{
// alert("pls fill no.");
// }
// }
// verify.onclick = function(event) {
// event.preventDefault()
// var data=JSON.parse(localStorage.getItem("myLocal"))
// console.log(data[0]);
// btn.innerHTML=data[0]
// modal.style.display = "none";
// modal1.style.display = "none";
// }
// // When the user clicks on <span> (x), close the modal
// span.onclick = function() {
// modal1.style.display = "none";
// modal.style.display = "none";
// }
// // When the user clicks anywhere outside of the modal, close it
// window.onclick = function(event) {
// if (event.target == modal) {
// modal.style.display = "none";
// }
// }
// document.getElementById("form").addEventListener("submit",myFn)
// // var arr=JSON.parse(localStorage.getItem("myLocal"))||[]
// function myFn(event)
// {var arr=[];
// event.preventDefault()
// var myobj=document.querySelector("#mobnum").value;
// arr.push(myobj)
// localStorage.setItem("myLocal",JSON.stringify(arr))
// }
// function find() {
// // let c= document.getElementById("cities").value
// // console.log(c)
// let data = {
// city: document.getElementById("typesearch").value,
// };
// let location = localStorage.setItem("name", JSON.stringify(data));
// window.location.href = "explore.html";
// }
</script>