forked from gauravkrs/Blinkit
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathheader.html
More file actions
137 lines (114 loc) · 5.71 KB
/
header.html
File metadata and controls
137 lines (114 loc) · 5.71 KB
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
<!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>header</title>
<link rel="icon" href="https://blinkit.com/images/apple-touch-icon-change-60x60-1be1e81.png">
<link rel="stylesheet" href="./css/header.css"/>
</head>
<body id="body1">
<div id="mainheaderM1">
<ul id="ulM">
<li id="lM1"><a href="index.html" id="lM1"><img id="lM" src="https://blinkit.com/images/header/blinkit-logo-header-05a0b5f.png"/></a></li>
<li id="lM2">
<a href="#" id="lM2s"><h2 id="randomDelivery"></h2><span id="lM2ss" style="display:grid;grid-template-columns:1.5fr 1fr; text-align: center; flex-flow: row;align-items: center; "><p id="mapM">Pune, Maharashtra</p><i id="mapL" class="fa-solid fa-square-caret-down"></i></span></a>
</li>
<li id="lM3"><a href="#" style="display: flex;"><i id="searchM1" class="fa-solid fa-magnifying-glass"></i><input id="searchM2" type="search" placeholder="Search for products" /></a></li>
<li id="lM4"><a href="#">login</a></li>
<li id="lM5"><a href="#" id="lM5M"><span id="h5CM"><i style="color: white;" class="fa-solid fa-cart-shopping"></i></span><span id="h5CM" >my cart</span><span id="h5CM"></span></a></li>
<li id="lM6"><a href="#"><i class="fa-solid fa-mobile-screen"></i> get the App</a></li>
</ul>
</div>
<div id="blurpopM">
<div id="locationPopM">
<div id="locup"><i id="locup1" class="fa-solid fa-sort-up"></i></div>
<div id="locationsubpart">
<i id="crossM" class="fa-solid fa-xmark"></i>
<h3>Change Location</h3>
<div id="locationPopsubM">
<div id="locationPopsubM1"><p id="locationPopsubM11" >Detect my Location</p></div> --
<div id="locationPopsubM2">OR</div>--
<div id="locationPopsubM3">
<input id="locationPopsubM31" type="text" placeholder="Type your city Name"/>
</div>
</div>
<div id="appendCNM"></div>
</div>
</div>
</div>
</body>
</html>
<script src="https://kit.fontawesome.com/cb83d10ce2.js" crossorigin="anonymous"></script>
<script src="./script/place.js"></script>
<script type="module">
//=====================================================================Nav Bar==================================================//
//random delivary time
var randomNumber=Math.floor(Math.random()*(45-10)+9);
document.querySelector("#randomDelivery").innerHTML=`delivery in ${randomNumber} minutes`;
//city search
let body = document.querySelector("#body1");
var popmap=document.querySelector("#locationPopM");
var mainblurpop=document.querySelector("#blurpopM");
document.querySelector("#mapL").addEventListener("click",()=>{
popmap.style.visibility="visible";
popmap.style.opacity=1;
mainblurpop.style.backgroundColor="rgb(0,0,0,0.5)"
// body.style.backgroundColor="transparent";
document.querySelector("#randomDelivery").style.color="rgb(209,26,26)"
})
// LOCATION DETECTION
navigator.geolocation.getCurrentPosition(function(position) {
const lat = position.coords.latitude;
const lng = position.coords.longitude;
out(lat,lng)
});
let addressM=document.querySelector("#mapM");
async function out(lat,lng){
let rel = await fetch(`https://us1.locationiq.com/v1/reverse.php?key=pk.456518217705258731c8c7089e3a45d0&lat=${lat}&lon=${lng}&format=json`)
let data = await rel.json();
// console.log(data.address);
// console.log(data.display_name);
console.log("location aa gayi")
//LOCATION APPEND
addressM.innerHTML= `${data.address.suburb},${data.address.city},${data.address.state},${data.address.country},${data.address.postcode}`;
}
//search location
let city=JSON.parse(localStorage.getItem("cities"))
let inputM = document.querySelector("#locationPopsubM31");
let appendM=document.querySelector("#appendCNM")
inputM.addEventListener("input", input_change)
function input_change(){
let z=city.filter(function(e){
let result = inputM.value;
appendM.innerHTML="";
return e.name.includes(result);
})
console.log(z)
// {id: '2', name: 'Delhi', state: 'Delhi'}
z.forEach(({name:n,state:c})=>{
let cityname=document.createElement("p")
cityname.setAttribute("id","visibleCityM")
cityname.addEventListener("click",function(){
addressM.innerText=`${n}, ${c}`;
// console.log(n,c)
})
cityname.innerText=`${n}, ${c}`;
appendM.append(cityname)
})
}
//Exiting PopUp
let cancelPopM = document.querySelector("#crossM");
cancelPopM.addEventListener("click", ()=>{
popmap.style.visibility="none";
popmap.style.opacity=0;
mainblurpop.style.backgroundColor="rgb(0,0,0,0)"
})
//=========================================================================================================================================//
//------------------------------------------------------------Log In Page------------------------------------------------------------------//
document.querySelector("#lM4").addEventListener("click",login);
function login(){
// let maindivLM=document.createEvent("div");
}
</script>