-
Notifications
You must be signed in to change notification settings - Fork 4
/
p7.html
257 lines (213 loc) · 8.39 KB
/
p7.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
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
<!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>
</head>
<link rel="stylesheet" href="commonstyles.css">
<link rel="stylesheet" href="./style/navbar.css">
<body>
<div id="navbar-top">
</div>
<div id="banner">
<img src="https://img.gkbcdn.com/s3/bn/2206/1500x125-62a9512c2b40c91d488eee03.jpg">
</div>
<div id="mainalpha">
<div id="prodimg">
</div>
<div id="details">
</div>
</div>
<div id="extra">
<div class="extrap"><a href="#description"><h3 >Description</h3></a></div>
<div class="extrap"><a href="#reviews"><h3>Reviews</h3></a></div>
<div class="extrap"> <a href="#QnA"><h3>QnA</h3></a></div>
</div>
<h2 class="highlights">Highlights</h2>
<div id="description"></div>
<h2 class="highlights">Customer Reviews</h2>
<div id="reviews">
User 1:   Lorem ipsum dolor, sit amet consectetur adipisicing elit. Rerum placeat magnam maxime vero perspiciatis quod, fuga cum vel dolores, ex ipsa! Adipisci quis cumque impedit, enim necessitatibus reiciendis. Maiores, autem.<br><br><hr>
User 2:   Lorem ipsum dolor, sit amet consectetur adipisicing elit. Rerum placeat magnam maxime vero perspiciatis quod, fuga cum vel dolores, ex ipsa! Adipisci quis cumque impedit, enim necessitatibus reiciendis. Maiores, autem.<br><br><hr>
User 3:   Lorem ipsum dolor, sit amet consectetur adipisicing elit. Rerum placeat magnam maxime vero perspiciatis quod, fuga cum vel dolores, ex ipsa! Adipisci quis cumque impedit, enim necessitatibus reiciendis. Maiores, autem.<br>
</div>
<h2 class="highlights">Questions & Answers</h2>
<div id="QnA">
<p>Temporarily no Discussion</p>
</div>
</body>
</html>
<script type="module">
import {navbar,footer} from "./navbar/navbar.js"
document.getElementById("navbar-top").innerHTML = navbar()
//------------------------------------------------------------------------//
let images=['https://m.media-amazon.com/images/I/61s7HIvOAsL._SX679_.jpg',
'https://m.media-amazon.com/images/I/61VRhutSuFL._SX679_.jpg',
'https://m.media-amazon.com/images/I/61i9i1A-L1L._SX679_.jpg'
]
let items=JSON.parse(localStorage.getItem("addcart"))||[];
document.getElementById("noofpro").innerText = items.length
console.log(items)
let obj={
image:'https://img.gkbcdn.com/p/2017-07-26/xiaomi-wifi-amplifier-pro-black-1574132393616._w280_p1_.jpg',
detail:'Xiaomi WiFi Amplifier Pro 2X2 External Antenna 300Mbps',
fullname:'Xiaomi WiFi Amplifier Pro 2X2 External Antenna 300Mbps Support 64 Devices Simultaneous Link - Black',
brand:"Xiamomi",
original:'1609',
beforeprice:"2173",
discpercent:"26",
count:1,
rating:'4.99 120 Reviews ',
descriptionimg:'https://img.gkbcdn.com/s3/d/201708/4889a487-a61b-4304-b014-284e96d75af4.jpg',
description:`2 x 2 External antennes: transmission rate is up to 300Mbps, WiFi signal covers widely.
Expand WiFi signal easily and stably, just 3 steps to be adapted with the mainstram routers.
Suitable to large house: when rooms such as bedrooms and bathrooms cannot meet the network need, you can match one to others depending on various stuations.
The ability of recieving signal is upgraded once more, self-networking covers strongly and widely.
Supports at most 64 devices to connect the with the network simultaneously.
Intelligent detection, guards network's unobstruction.
Classic mode of power interface, convenient and intimate.
Firmware upgrades automatically in spare time.
`,
}
import {sshow,descrip} from "./appendfetch.js";
let product_cont=document.querySelector('#details');
let title=document.createElement('h4')
title.innerText=obj.fullname;
let div1=document.createElement('div');
div1.id='rating';
let star= document.createElement('img')
star.src='./download.png';
star.className='icons'
let rating= document.createElement('p')
rating.innerText=`${obj.rating} `;
let brand = document.createElement('p');
brand.innerText= `Brand: ${obj.brand}`
div1.append(star,rating,brand)
let div2=document.createElement("div")
div2.id='flashdeal'
let tbolt= document.createElement('img')
tbolt.className='icons'
tbolt.src="./thunderbolt.jpg"
let flashdeal=document.createElement('h4')
flashdeal.id="fdtext"
flashdeal.innerText=`Flashdeal`
let div21=document.createElement('div');
div21.id="timers"
let timer1= document.createElement('h4');
let timer2= document.createElement('h4')
timer1.innerText="Ends in 1 day 10 : 10 :";
timer2.innerText=" 0";
//TO display timer
function timer(){
let i=59
let j=10;
let id=setInterval(function(){
// console.log(i)
if(j==0){
// h.innerText="0"
clearInterval(id)
}
timer2.innerText=` ${i} `;
i--;
if(i==0){
j--;
timer1.innerText="Ends in 1 day 10 : "+j+" : ";
i=60;
}
},1000)
}
timer();
div21.append(timer1,timer2)
div2.append(tbolt,flashdeal,div21)
let price=document.createElement('div');
price.id="price"
price.innerHTML=`<p id="actprice">₹${obj.original}</p>
<p id="origprice">₹<s>${obj.beforeprice}</s></p>
<p id="discpercent">${obj.discpercent}% OFF</p>
`
//-------------------------------------------------------------------------------//
let counter=document.createElement('div');
counter.id="counter"
let count=obj.count;
let qty=document.createElement('div');
qty.innerHTML=`QTY : `
let countdisplay=document.createElement('div');
countdisplay.id="count"
countdisplay.innerText=count;
let incb=document.createElement("div")
incb.id="countplus"
incb.innerText="+"
let decb=document.createElement("div")
decb.innerText="-"
decb.id="countminus"
decb.addEventListener("click", decFun);
function decFun() {
if(count==1)
count=1;
else
count--;
countdisplay.innerText = count;
obj.count=count;
// localStorage.setItem("counterValue", count);
}
incb.addEventListener("click", incFun);
function incFun() {
count++;
countdisplay.innerText = count;
obj.count=count;
// localStorage.setItem("counterValue", count);
}
counter.append(qty,decb,countdisplay,incb)
//--------------------------------------------------------------------------------------//
let shipping=document.createElement("p")
shipping.id="shipping"
shipping.innerText="Shipping within 3-5 days, Delivery within 10 days"
let buycart=document.createElement("div")
buycart.id="buycart"
let bt1=document.createElement("button")
bt1.id="addcart"
let bt2=document.createElement('button')
bt2.id="buynow"
bt1.innerText="Add to Cart"
bt2.innerText="Buy Now"
bt1.addEventListener("click",buy)
buycart.append(bt1,bt2)
let payment=document.createElement("div")
payment.id="payment"
let pay=document.createElement("p")
pay.innerText="Payment: "
pay.style.marginTop="3%"
let paypal=document.createElement('img')
paypal.src="./paypal.png"
paypal.id="iconpay"
payment.append(pay,paypal)
product_cont.append(title,div1,div2,price,counter,shipping,buycart,payment)
let container=document.querySelector("#prodimg");
sshow(container,images)
let description=document.getElementById("description")
descrip(description,obj)
function buy(){
if(items.length==0||items[items.length-1].detail!==obj.detail)
items.push(obj)
else
items[items.length-1]=obj;
localStorage.setItem("addcart",JSON.stringify(items))
document.getElementById("noofpro").innerText=items.length;
alert("Product added successfully")
}
//to redirect to cart page
bt2.addEventListener("click",()=>{
window.location.href="cart.html"
})
//to check and display name in navbar
var user = JSON.parse(localStorage.getItem("user"))
if(user.name ==null){
document.getElementById("signin").innerText = "signin"
}
else{
document.getElementById("signin").innerText = user.name
}
document.getElementById("noofpro").innerText = items.length
</script>