forked from aakarshpatel84/Ideacart-clone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page2.js
303 lines (292 loc) · 26.3 KB
/
page2.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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
let productArr = [
{
img: "https://images-eu.ssl-images-amazon.com/images/I/51%2BrEve6ToL.jpg",
name: "Prasun Roy's Ringo and the Yogi",
details:
"Ringo has just turned ten, and is very excited to go on a trekking expedition organized by Bharat Scouts and guides. During the expedition in joshimath, Ringo befriends a Yogi, who tells him inspiring adventurous stories. Soon after, a catastrophic cloudburst causes devastating floods and landslides in the entire Uttarakhand. The only hope for the Boys to return Home is to seek help from a nearby Army base camp. Ringo & The Yogi brave the calamities through the mountains and try to reach the army camp, finding a way through the dense and dangerous forest. Do they ultimately reach the army base and inform them about the location of the trekking camp? Does destiny lead Ringo and the Yogi to victory? And most importantly, who is the mysterious Yogi?.",
category: "Literature & Fiction",
price: 620,
rating: 4.3,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/51G%2Bv0iOsmL.jpg",
name: "The Secular Enlightenment",
details:
"A major new History of how the Enlightenment transformed people's everyday lives The Secular Enlightenment is a panoramic account of the radical ways that life began to change for ordinary people in the age of Locke, Voltaire, and Rousseau. In this landmark book, familiar Enlightenment figures share places with voices that have remained largely unheard until now, from freethinkers and freemasons to French materialists, anticlerical Catholics, pantheists, pornographers, readers, and travelers. Margaret Jacob, one of our most esteemed historians of the Enlightenment, reveals how this newly secular outlook was not a wholesale rejection of Christianity but rather a new mental space in which to encounter the world on its own terms. She takes readers from London and Amsterdam to Berlin, Vienna, Turin, and Naples, drawing on rare archival materials to show how ideas central to the emergence of secular democracy touched all facets of daily life. Human frailties once attributed to sin were now viewed through the lens of the newly conceived social sciences. People entered churches not to pray but to admire the architecture, and spent their Sunday mornings reading a newspaper or even a risqu book. The secular-minded pursued their own temporal and commercial well-being without concern for the life hereafter, regarding their successes as the rewards for their actions, their failures as the result of blind economic forces. A majestic work of intellectual and cultural History, The Secular Enlightenment demonstrates how secular values and pursuits took hold of eighteenth-century Europe, spilled into the American colonies, and left their lasting imprint on the Western world for generations to come.",
category: "Religion",
price: 2085,
rating: 4.6,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/41D-XSTTpnL.jpg",
name: "Mantramala: Revised Second Edition",
details:
"The only book on Mantras you will need. Over 400 mantras in Sanskrit and transliteration, sourced from the ancient mystical texts. Full explanations of the mantras and how to chant them. The Hindu calendar decoded. Learn how to make mantras more powerful with visualisations, how to enhance your day with shlokas and how to use the festivals for self growth. From the vast selection, find the mantra which is just right to help you fulfil your desires",
category: "Religion",
price: 395,
rating: 2.6,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/510hv652IOL.jpg",
name: "Prehistory: The Making of the Human Mind (Modern Library Chronicles)",
details:
"In Prehistory, the award-winning archaeologist and renowned scholar Colin Renfrew covers human existence before the advent of written records–the overwhelming majority of our time here on earth–and gives an incisive, concise, and lively survey of the past, and of how scholars and scientists labor to bring it to light. Renfrew begins by looking at Prehistory as a discipline, detailing how breakthroughs such as radiocarbon dating and DNA analysis have helped us to define humankind’s past–how things have changed–much more clearly than was possible just a half century ago. As for why things have changed, Renfrew pinpoints some of the issues and challenges, past and present, that confront the study of Prehistory and its investigators. Renfrew then offers a summary of human Prehistory from early hominids to the rise of literate civilization that is refreshingly free of conventional wisdom and grand “unified” theories. In this invaluable account, Colin Renfrew delivers a meticulously researched and passionately argued chronicle about our life on earth–and our ongoing quest to understand it",
category: "Religion",
price: 524,
rating: 3.1,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/51g1kgksM9L.jpg",
name: "365 Tales from Islam",
details:
"Practiced by 1.8 billion people, Islam is the world’s second largest religion. 365 Tales From Islam is a rich treasure trove of legend, lore and wisdom taken from the holy book and the Prophet’s life, which bring out the Beauty and experience surrounding Islam. Enjoy these beautifully illustrated stories as you go on your journey through Arabia and other lan",
category: "Religion",
price: 565,
rating: 2.1,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/51DsW2SY9lL.jpg",
name: "Alex Rider: Secret Weapon",
details:
"An essential collection of seven explosive Alex Rider stories by number one bestselling author, Anthony Horowitz. Ever since MI6 recognized his potential, Alex Rider has constantly been thrust into the line of danger. From a routine visit to the dentist that turns into a chase through the streets of London, to a school trip with a deadly twist, no day has ever been ordinary for the Teenage super-spy. This collection of thrilling adventures features familiar and new assailants from the best-loved world of Alex Rider and also includes three never-before-seen stories.",
category: "Literature & Fiction",
price: 994,
rating: 1.2,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/51xS2KOxUDL.jpg",
name: "My First Quran With Pictures",
details:
"Often children memorise Surah after Surah of the Quran without knowing even it's simple meanings and we as parents find it difficult to explain it to them. With the help of this picture book your children will be able to read Juzz Amma in Arabic and instantly know the simple meaning of the verses through engaging illustrations.It will help your children visualise the simple meanings of the verses which will later make the Tafsir and the explanations of the verses easier for them to grasp.This bright and colourful book will also help make memorising the Quran much more fun and enjoyable for them.This book has been checked by Sheikh Dr Abdullah ibn Yusuf Aljudai and finally approved for printing.Although it is aimed at children aged 7 and above, with the parent's help in explaining the pictures, children younger than 7 could also benefit from it.",
category: "Literature & Fiction",
price: 1089,
rating: 2.3,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/51YIXBImSaL.jpg",
name: "The Illustrated Stories of Akbar and Birbal: Classic Tales from India",
details:
"The stories of ‘Akbar and Birbal’ are the most cherished folklores of India that have been passed from one generation to another, enthralling both young and adult readers. This book is a beautifully illustrated compilation of several tales of wit and wisdom, built upon the themes of loyalty and friendship.",
category: "Literature & Fiction",
price: 168,
rating: 4.7,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/41PmaGYPC3L.jpg",
name: "The Godmothers: Stories that Inspire",
details:
"A Godmother is a woman who takes the place of a mother and helps her Goddaughter accomplish her goals and succeed in life, by being there for her, and supporting her in the journey. Anyone can become a Godmother - a friend, a teacher, a sister, a daughter, a colleague...The Godmothers is a selection of short stories about women, young and old, and their Godmothers. These are stories about women who help other women grow, achieve, and live a free life. Every story has two key protagonists: the Godmother and her Goddaughter. The stories describe how the Godmother supports her Goddaughter to overcome a struggle in her life. Each story talks about a different challenge, in a different context, thereby touching upon a variety of women's issues such as female foeticide, domestic violence, sexual harassment, corporate growth challenges, and so on.The stories aim to provoke women to selflessly support other women around them. It is an attempt to motivate women to take their own little step towards achieving gender justice and women's empowerment. If every woman decided to support one other woman in need, we will not be far from reaching our dream of gender equality",
category: "Literature & Fiction",
price: 249,
rating: 3.6,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/51ZcocLVDVL.jpg",
name: "How To Drive: The Ultimate Guide, from the Man Who Was the Stig",
details:
"Driving is the most dangerous thing each of us does on a daily basis - and yet the average learner receives just eighteen hours' training - less than a Starbucks barista. In this inspirational, fully illustrated, highly entertaining book, former Top Gear star Ben Collins uses his super-charged experience of racing, stunt-work and cutting-edge Scientific knowledge to tell you all of the things you didn't learn on your test - and in the process will make your driving safer, more economical and a lot more enjoyable. The skills described in How to Drive, from skid control to gear changes that are as smooth as a cashmere codpiece, have been honed on racing tracks by the greatest drivers in the world. This is the stuff your instructor missed, your dad forgot and your mates pretend to know . . . but don't. Packed with illustrations, gobsmacking driving anecdotes, Humour and wisdom, this is the ultimate book for anyone who wants to be better at something they do every day of their life. The world population of motor vehicles exceeded a billion a couple of years ago. Let's make sure their owners understand how to use them.",
category: "Literature & Fiction",
price: 1200,
rating: 1.2,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/51P2ZjJD6dL.jpg",
name: "The Kid Who Came From Space",
details:
"The stunning new 10+ story from the bestselling and award-winning author of time travelling with a hamster, for anyone who loved the Humour of wall-e, the action of star Wars and the deeply touching emotion of et. A small village in the wilds of northumberland is rocked by the disappearance of twelve-year-old Tammy. Only her twin brother, Ethan, knows she is safe – and the extraordinary truth of where she is. It is a secret he must keep, or risk never seeing her again. But that doesn't mean he’s going to give up. Together with his friend Iggy and the mysterious (and very hairy) hellyann, Ethan teams up with a spaceship called Philip, and Suzy the trained chicken, for a nail-biting chase to get his sister back…that will take him further than anyone has ever been befor",
category: "Literature & Fiction",
price: 359,
rating: 3.1,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/51ju6PYJMnL.jpg",
name: "Puffin Classics: Timeless Tales from Marwar",
details:
"For centuries, Rajasthan has been a gold mine of oral traditions and histories, with Padma Shri Vijaydan Detha being one of the foremost storytellers of all time.Giving a new lease of life to his writings, Timeless Tales from Marwar is a handpicked collection of folk tales from the everlasting works of Detha's celebrated Batan ri Phulwari meaning 'Garden of Tales'. Collected and written over the span of nearly fifty years, this fourteen-volume assortment of Rajasthani folk stories earned him the moniker-the Shakespeare of Rajasthan. This selection--retold in Detha's magical narrative style complete with vivid imagery--offers some of the oldest and most popular fables from the Thar Desert region. Discover tales of handsome rajkanwars, evil witches, exploitative thakars, miserly seths, clever insects, benevolent snakes and more. Vishes Kothari's vivid English translation introduces one of the most venerated figures in Rajasthani folk culture to a wider audience. This tribute to Detha's rich legacy is a collector's edition for all ages.Introduction by Aruna Roy.",
category: "Literature & Fiction",
price: 195,
rating: 3.8,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/515vgbHuT5L.jpg",
name: "Pandit Vishnu Sharma's Panchatantra: Illustrated Tales From Ancient India (Hardback, Special edition)",
details:
"Pandit Vishnu Sharma Panchatantra, retold by br>Shubha Vilas, is an amazing compilation of moral Stories from the five Books of Panchatantra, namely mitra-bheda, mitralábha, kákolùkïyam, labdhapranásam and aparïksitakárakam. With clever moral Stories and delightful illustrations, this plush hardback book is unlike any other version of the Panchatantra! Br>shubha Vilas adds to the stories his own energy and insights, and the stories are brought to life by ishan’s marvellous illustrations. Every moral lesson at the end of every br>Chapter is a practical guide for life for children and adults alike",
category: "Literature & Fiction",
price: 699,
rating: 3.6,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/51XsYN%2BcOwL.jpg",
name: "Dying Fall",
details:
"Ruth Galloway, forensic archaeologist, spends her life looking at death. But now death has found her, with the news that her long-time friend Dan Golding has been killed. Ruth's grief soon turns to suspicion when she receives a desperate letter from Dan, sent the day before he died. He had made a ground-breaking discovery and was petrified of the consequences. Ruth is compelled to Travel north to investigate further, alongside DCI Harry Nelson who is also drawn into the case, but where Ruth goes, so does her daughter Kate. This time, the risks are even higher",
category: "Literature & Fiction",
price: 254,
rating: 3.6,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/516K8D6BRCL.jpg",
name: "Ruskin Bond's Happy Birthday, World!",
details:
"This book has been written by Ruskin Bond, who has written books like Happy Birthday, World!,A MURDER IN MUSSOORIE AND OTHER TALES,RHODODENDRONS IN THE MIST: My Favourite Tales of the Himalaya,A Gallery of Rascals: My Favourite Tales of Rogues, Rapscallions & Ne'er-Do-Wells,Coming Round the Mountain: In the Year of Independence. The books are written in Literature & Fiction,Short Stories,Contemporary Fiction,Biographies & Autobiographies category. This book is read by people who are interested in reading books in category : Literature & Fiction. So, if you want to explore books similar to This book, you must read and buy this book.",
category: "Literature & Fiction",
price: 180,
rating: 2.6,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/41GbFo7BGnL.jpg",
name: "BEES BADI BIMARIYAN",
details:
"This book has been written by PREMCHANDRA SWARNKAR, who has written books like BEES BADI BIMARIYAN. The books are written in Health, Family & Personal Development category. This book is read by people who are interested in reading books in category : Health, Family & Personal Development. So, if you want to explore books similar to This book, you must read and buy this bo",
category: "Health",
price: 102,
rating: 4.2,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/51ku8c4I%2B8L.jpg",
name: "Biology For Engineers",
details:
"Biology is an important part of Engineering analysis and design, and it is important that students in Engineering programs, as well as ecologists and environmentalists, become well-acquainted with the fundamentals of biology as they relate to their field.This is the first book on the subject designed specifically for students of BTech and BE courses, as the subject has now been introduced to the syllabus.",
category: "Health",
price: 205,
rating: 4.0,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/41VLdUtAK6L.jpg",
name: "Herbert M Shelton's The Science and Fine Art of Fasting",
details:
"In his 1934 book, The Science and Fine Art of Fasting, Herbert M. Shelton outlined his Theory that fasting is a key component in promoting healing. The book's ideas run counter to the well-known conventional wisdom that those who are sick must eat to keep up their strength and posits that fasting is a natural part of the rhythm of life. Shelton's book outlines the History of this practice and explains the following in detail: what is fasting, the purpose of fasting, how to fast successfully, intermittent fasting for healing, and the benefits of fasting in General.Shelton was writing before the advent of genetic Theory and modern medicine. His beliefs were criticized during his time, and he even faced legal penalties for publishing his views. But modern science is now beginning to show that, in some instances, his theories were accurate. Caloric restriction has been repeatedly shown to increase life span in animals, and researchers, such as David Sinclair of Harvard University, have discovered the cellular and genetic mechanisms that respond to such techniques.According to Shelton, when someone is fasting, the energy typically going into eating and digestion is instead redirected to promote health and well-being. Fasting works as a method of resetting the body's metabolism and has a multitude of applications. Shelton divided fasting into two distinct periods: eating and abstaining. Both periods are considered to be vital aspects of the same process. As a child on his family's farm, Shelton observed animals abstain from food when upset, wounded, sick, or just simply not hungry. Shelton came to understand this behavior as a means of survival. Man, as part of the organic world, has many reasons to mimic such behavior and has done so throughout History--as is seen in various religious practices throughout the world. Shelton viewed the purpose of fasting as a natural occurrence that generated healing and restorative benefits. As with animals, Shelton believed abstention from food is sometimes more beneficial than its consumption. For more than 10,000 years, fasting was used to alleviate human illness. In his book, Shelton gives anecdotal evidence of humans fasting for periods of 60 days or more and shows the practice has been known to cure a wide range of Diseases such as epilepsy, typhoid fever, cataracts, and obesity.Over the course of 30 years, Shelton conducted 25,000 fasts ranging from three days to over two months. Throughout the duration of the studies conducted, Shelton found the number of red blood cells increased during a fast and that a General rejuvenation occured. He claims to have observed rapid healing of wounds and various organ Systems in patients undergoing the practice. In one case, a group of university students studied for one week without food and showed remarkable improvement in their performance. He asserted that addicts found relief through fasting and that other mental conditions showed improvement through his methods.Herbert M.Shelton and his works remain popular in the alternative medicine community even today, especially in the realms of fasting and restorative care.",
category: "Health",
price: 5602,
rating: 4.2,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/41ysrg59VuL.jpg",
name: "Healthy and Sustainable Food Systems",
details:
"How long would it take for you to read Healthy and Sustainable Food System",
category: "Health",
price: 563,
rating: 2.1,
},
{
img: "https://images-eu.ssl-images-amazon.com/images/I/419DbljOyvL.jpg",
name: "The Athlete's Guide to Recovery: Rest, Relax, and Restore for Peak Performance",
details:
"The Athlete's Guide to Recovery is the first comprehensive, practical exploration of the art and science of athletic rest. If you've hit a wall in your training, maybe it's because your body isn't recovering enough from each workout to become stronger. Hard workouts tear down the body, but rest allows the body to repair and come back stronger than before. Athletes who neglect their recovery will gain little from workouts, risking injury, overtraining, and burn out. The Athlete's Guide to Recovery offers a full exploration of rest and recovery for athletes. In her book, certified Triathlon and Running coach and pioneering Yoga for athletes instructor Sage Rountree will guide you to full recovery and improved performance, revealing how to measure your fatigue and recovery, how much rest you need, and how to make the best use of recovery tools. Drawing on her own experience along with interviews with coaches, trainers, and elite athletes, Rountree details daily recovery techniques, demystifying common aids like ice baths, compression apparel, and supplements. She explains in detail how to employ restorative practices such as massage, Meditation, and Yoga. You will learn which methods work best and how and when they are most effective. The Athlete's Guide to Recovery explores: * Periodization and overtraining * Ways to measure fatigue and recovery including heart rate tests, heart rate variability, EPOC, and apps * Stress reduction * Sleep, napping, nutrition, hydration, and supplements * Cold and heat like icing, ice baths, saunas, steam rooms, whirlpools, and heating pads * Home remedies including compression wear, creams, and salts * Technological aids like e-stim, ultrasound, Normatec * Massage, self-massage, and foam rolling * Restorative Yoga * Meditation and breathing Then you can put these tools and techniques to practice using two comprehensive recovery plans for both short- and long-distance training. This invaluable resource will enable you to maintain that hard-to-find balance between rigorous training and rest so that you can feel great and compete at your highest level.",
category: "Health",
price: 302,
rating: 4.6,
},
];
displayfunction(productArr);
function displayfunction() {
document.querySelector("#containerForBook").innerHTML = "";
productArr.forEach(function (el) {
let box = document.createElement("div");
let box11 = document.createElement("div");
box11.setAttribute("id", "box11");
let proImgDiv = document.createElement("div");
let proImg = document.createElement("img");
proImg.setAttribute("src", el.img);
proImgDiv.append(proImg);
let proNameDiv = document.createElement("div");
let proName = document.createElement("p");
proName.innerText = el.name;
proNameDiv.append(proName);
box11.append(proImgDiv, proNameDiv);
box11.addEventListener("click", function () {
localStorage.setItem("currentPageData", JSON.stringify(el));
location.href = "productPage.html";
});
let box12 = document.createElement("div");
box12.setAttribute("id", "box12");
let proCategory = document.createElement("div");
proCategory.innerText = "Category :" + " " + el.category;
let proRating = document.createElement("div");
proRating.innerText = el.rating + " " + "✡";
let proPrice = document.createElement("div");
proPrice.innerText = "₹" + el.price;
let buycart = document.createElement("div");
buycart.setAttribute("id", "buycart");
let proBuy = document.createElement("button");
proBuy.innerText = "Buy Now";
proBuy.addEventListener("click", function () {
let cartData = JSON.parse(localStorage.getItem("buyCartData")) || [];
if (cartDatapresent(cartData, el) === false) {
cartData.push(el);
localStorage.setItem("buyCartData", JSON.stringify(cartData));
} else {
alert("Item already in cart");
}
location.href = "cart.html"; // give cart page href
});
let proCart = document.createElement("button");
proCart.innerText = "Add to Cart";
proCart.addEventListener("click", function () {
let cartData = JSON.parse(localStorage.getItem("buyCartData")) || [];
if (cartDatapresent(cartData, el) === false) {
cartData.push(el);
localStorage.setItem("buyCartData", JSON.stringify(cartData));
alert("Item successfully added to cart");
} else {
alert("Item already in cart");
}
});
buycart.append(proBuy, proCart);
box12.append(proCategory, proRating, proPrice, buycart);
box.append(box11, box12);
document.querySelector("#containerForBook").append(box);
});
function cartDatapresent(cartData, el) {
for (let i = 0; i < cartData.length; i++) {
if (cartData[i].name === el.name) {
return true;
}
}
return false;
}
}
document.querySelector("#page1").addEventListener("click", function () {
location.href = "index.html"; //next page number 2 href
});
document.querySelector("#page3").addEventListener("click", function () {
location.href = "page3.html"; //next page number 2 href
});
filterPrice.addEventListener("change", myPriceFilter);
function myPriceFilter() {
let filterByPrice = document.querySelector("#filterPrice").value;
if (filterByPrice == "SortbyPrice") {
window.location.reload();
} else if (filterByPrice == "LowToHigh") {
productArr.sort(function (a, b) {
return a.price - b.price;
});
displayfunction(productArr);
} else if (filterByPrice == "HighToLow") {
productArr.sort(function (a, b) {
return b.price - a.price;
});
displayfunction(productArr);
}
}
document
.querySelector("#filterRating")
.addEventListener("change", myfilterRating);
function myfilterRating() {
let filterByRating = document.querySelector("#filterRating").value;
if (filterByRating == "SortbyRating") {
window.location.reload();
} else if (filterByRating == "HighToLow") {
productArr.sort(function (a, b) {
return b.rating - a.rating;
});
displayfunction(productArr);
} else if (filterByRating == "LowToHigh") {
productArr.sort(function (a, b) {
return a.rating - b.rating;
});
displayfunction(productArr);
}
}