From 3e9eba3a1e348a6f15c5387ea718762f0a038e1b Mon Sep 17 00:00:00 2001 From: Ashutosh Kumawat Date: Fri, 30 Jun 2023 20:12:12 +0530 Subject: [PATCH 1/2] something is done --- about.html | 4 ++-- activities.html | 47 ++++++++++++++++++++++++++++++++++++--- bookVenue.html | 12 +++++++--- components/footer.js | 17 ++++++++------ components/navbarblack.js | 2 +- index.html | 4 ++-- scripts/bookVenue.js | 9 ++++++++ styles/footer.css | 1 + 8 files changed, 78 insertions(+), 18 deletions(-) diff --git a/about.html b/about.html index 4bf65ca..6c625bb 100644 --- a/about.html +++ b/about.html @@ -50,14 +50,14 @@
- +
- +

diff --git a/activities.html b/activities.html index 436a3f9..a635a98 100644 --- a/activities.html +++ b/activities.html @@ -14,7 +14,7 @@

@@ -30,7 +30,7 @@ @@ -541,8 +541,20 @@ city_names.sort((a,b)=>a-b); //console.log(city_names) + // function D_Fun_C(data){ + // data.map((({city})=>{ + // var showcities=document.querySelector("#citynames"); + // var p=document.createElement("p"); + // var line=document.createElement("hr"); + // p.innerHTML=city; + + // showcities.append(p,line); + // }) + // } + + for(var i=0; i{ + debounce(mainFun); +}); + +let id; +function debounce(func){ + if(id){ + clearTimeout(id); + } + id = setTimeout(() => { + func(); + },400) +}; + + +const mainFun = async () => { + try{ + let query = document.getElementById("typesearch").value; + let response = await fetch(""); + let data = await response.json(); + console.log(data); + D_Fun_C(data); + } + catch(error){ + console.log(error); + } +} diff --git a/bookVenue.html b/bookVenue.html index 7d21410..b92a54d 100644 --- a/bookVenue.html +++ b/bookVenue.html @@ -13,15 +13,19 @@ + + + + @@ -134,81 +137,81 @@ \ No newline at end of file + + diff --git a/scripts/blog.js b/scripts/blog.js index 0a443ff..687fb4e 100644 --- a/scripts/blog.js +++ b/scripts/blog.js @@ -12,23 +12,23 @@ - let quoteUrl = "https://bodybuilding-quotes1.p.rapidapi.com/random-quote"; - fetch(quoteUrl, { - "method": "GET", - "headers": { - "x-rapidapi-host": "bodybuilding-quotes1.p.rapidapi.com", - "x-rapidapi-key": "a867a75115msh062cacb248defc3p1037f9jsnb868cbef939c" - } - }) - .then((res)=>{ - return res.json() - }) - .then((res)=>{ - console.log(res); - let quote = document.querySelector("#quote"); - let value = res.quote; - quote.textContent = value; - }) + // let quoteUrl = "https://bodybuilding-quotes1.p.rapidapi.com/random-quote"; + // fetch(quoteUrl, { + // "method": "GET", + // "headers": { + // "x-rapidapi-host": "bodybuilding-quotes1.p.rapidapi.com", + // "x-rapidapi-key": "a867a75115msh062cacb248defc3p1037f9jsnb868cbef939c" + // } + // }) + // .then((res)=>{ + // return res.json() + // }) + // .then((res)=>{ + // console.log(res); + // let quote = document.querySelector("#quote"); + // let value = res.quote; + // quote.textContent = value; + // }) @@ -44,7 +44,8 @@ document.querySelector("#first-blog").addEventListener("click", ()=>{ - + + window.open("https://blog.playo.co/humansofplayo-how-to-submit-a-story/" , '_blank'); }) @@ -64,45 +65,53 @@ //Api call for Sports news content start==================> import appendNews from "../components/appendnews.js"; - // import apiCall from "../components/apicall.js"; - -// function fetchNews(){ + import apiCall from "../components/apicall.js"; -// //let apiKey_blog = "b140754e118c4b63a8e580772d4446a1"; -// //let bloglink = `https://newsapi.org/v2/top-headlines?country=in&category=sports&pageSize=10&apiKey=${apiKey_blog}`; -// // let response = apiCall(bloglink); -// // response.then((res)=>{ -// // console.log(res.articles); -// // let appendlocation = document.querySelector(".dynamic-news"); -// // appendNews(res.articles, appendlocation); + function fetchNews(){ -// // }) -// // .catch((e)=>{ -// // console.log(e); -// // }) + let apiKey_blog = "f1e386e609754803ac12e5449af5a32f"; + let bloglink = `https://newsapi.org/v2/everything?q=sports&apiKey=${apiKey_blog}&pageSize=10`; + if(page_no){ + bloglink+=`&page=${page_no}`; + } -// } - - - - //Edit - function fetchNews(){ - let apiKey_blog = "b140754e118c4b63a8e580772d4446a1"; - let bloglink = `https://newsapi.org/v2/top-headlines?country=in&category=sports&pageSize=10&apiKey=${process.env.BLOG_API_KEY}`; - fetch(bloglink) - .then((res)=>{ - return res.json(); - }) - .then((res)=>{ + let response = apiCall(bloglink); + response.then((res)=>{ + console.log(res.articles); let appendlocation = document.querySelector(".dynamic-news"); appendNews(res.articles, appendlocation); + }) .catch((e)=>{ console.log(e); - }) - } + }) + + } + + document.getElementById("sports-news").addEventListener("click",function(){ + fetchNews(); + }) + +// Edit +// function fetchNews(){ +// let apiKey_blog = "b140754e118c4b63a8e580772d4446a1"; +// let bloglink = `https://newsapi.org/v2/top-headlines?country=in&category=sports&pageSize=10&apiKey=${process.env.BLOG_API_KEY}`; +// fetch(bloglink) +// .then((res)=>{ +// return res.json(); +// }) +// .then((res)=>{ +// let appendlocation = document.querySelector(".dynamic-news"); +// appendNews(res.articles, appendlocation); +// }) +// .catch((e)=>{ +// console.log(e); +// }) +// } + + + - fetchNews() @@ -116,33 +125,43 @@ //Api call for health news start==================> document.querySelector("#health-news").addEventListener("click", ()=>{ - console.log("Test") - - document.querySelector("#sports-news").style.backgroundColor = "#F3F3F2"; - document.querySelector("#sports-news").style.borderBottom = "none"; - document.querySelector("#health-news").style.backgroundColor = "white"; - document.querySelector("#health-news").style.borderBottom = "3px solid #548A2F" - + healthFun(page_no); + }) + // console.log("Test") + + function healthFun(page_no){ + document.querySelector("#sports-news").style.backgroundColor = "#F3F3F2"; + document.querySelector("#sports-news").style.borderBottom = "none"; + document.querySelector("#health-news").style.backgroundColor = "white"; + document.querySelector("#health-news").style.borderBottom = "3px solid #548A2F" + + + + + let apiKey_health = "f1e386e609754803ac12e5449af5a32f"; + let bloglink_health = `https://newsapi.org/v2/everything?q=health&apiKey=${apiKey_health}&pageSize=10`; + if(page_no){ + bloglink_health+=`&page=${page_no}`; + } + + fetch(bloglink_health) + .then((res)=>{ + return res.json(); + }) + .then((res)=>{ + let appendlocation = document.querySelector(".dynamic-news"); + appendNews(res.articles, appendlocation); + }) + .catch((e)=>{ + console.log(e); + + }) + + } - let apiKey_health = "b140754e118c4b63a8e580772d4446a1"; - let bloglink_health = `https://newsapi.org/v2/top-headlines?country=in&category=health&pageSize=12&apiKey=${process.env.BLOG_API_KEY}`; - - fetch(bloglink_health) - .then((res)=>{ - return res.json(); - }) - .then((res)=>{ - let appendlocation = document.querySelector(".dynamic-news"); - appendNews(res.articles, appendlocation); - }) - .catch((e)=>{ - console.log(e); - - }) - - }) + @@ -152,31 +171,31 @@ //If user click one sports button start ========================> - document.querySelector("#sports-news").addEventListener("click", ()=>{ - - document.querySelector("#sports-news").style.backgroundColor = "white"; - document.querySelector("#sports-news").style.borderBottom = "3px solid #548A2F" - document.querySelector("#health-news").style.backgroundColor = "#F3F3F2"; - document.querySelector("#health-news").style.borderBottom = "none"; - - //Api work ==> - let apiKey_blog = "b140754e118c4b63a8e580772d4446a1"; - let bloglink = `https://newsapi.org/v2/top-headlines?country=in&category=sports&pageSize=10&apiKey=${process.env.BLOG_API_KEY}`; - fetch(bloglink) - .then((res)=>{ - return res.json(); - }) - .then((res)=>{ - let appendlocation = document.querySelector(".dynamic-news"); - appendNews(res.articles, appendlocation); - }) - .catch((e)=>{ - console.log(e); - }) - - fetchNews() + // document.querySelector("#sports-news").addEventListener("click", ()=>{ - }) + // document.querySelector("#sports-news").style.backgroundColor = "white"; + // document.querySelector("#sports-news").style.borderBottom = "3px solid #548A2F" + // document.querySelector("#health-news").style.backgroundColor = "#F3F3F2"; + // document.querySelector("#health-news").style.borderBottom = "none"; + + // //Api work ==> + // let apiKey_blog = "b140754e118c4b63a8e580772d4446a1"; + // let bloglink = `https://newsapi.org/v2/top-headlines?country=in&category=sports&pageSize=10&apiKey=${process.env.BLOG_API_KEY}`; + // fetch(bloglink) + // .then((res)=>{ + // return res.json(); + // }) + // .then((res)=>{ + // let appendlocation = document.querySelector(".dynamic-news"); + // appendNews(res.articles, appendlocation); + // }) + // .catch((e)=>{ + // console.log(e); + // }) + + // fetchNews() + + // }) //If user click one sports button end==========================> @@ -185,46 +204,63 @@ //Search Feature in news api start================================> - document.querySelector("#search").addEventListener('keypress' , (event)=>{ - //console.log(event); - let value = document.querySelector("#search").value; + // document.querySelector("#search").addEventListener('keypress' , (event)=>{ + // //console.log(event); + // let value = document.querySelector("#search").value; - if(value == "" || value == undefined || value == null){ - fetchNews() - return false; - } + // if(value == "" || value == undefined || value == null){ + // fetchNews() + // return false; + // } - if(event.key == "Enter"){ + // if(event.key == "Enter"){ //code for search feature //https://newsapi.org/v2/everything?q=Apple&from=2022-01-18&sortBy=popularity&apiKey=API_KEY - console.log("test") - let search_key = "b140754e118c4b63a8e580772d4446a1"; - let search_link = `https://newsapi.org/v2/everything?q=${value}&from=2022-01-18&sortBy=popularity&pageSize=10&language=en&apiKey=${process.env.BLOG_API_KEY}`; + // console.log("test") + // let search_key = "b140754e118c4b63a8e580772d4446a1"; + // let search_link = `https://newsapi.org/v2/everything?q=${value}&from=2022-01-18&sortBy=popularity&pageSize=10&language=en&apiKey=${process.env.BLOG_API_KEY}`; - fetch(search_link) - .then((res)=>{ - return res.json(); - }) - .then((res)=>{ - let appendlocation = document.querySelector(".dynamic-news"); - appendNews(res.articles, appendlocation); - }) - .catch((e)=>{ - console.log(e); - }) + // fetch(search_link) + // .then((res)=>{ + // return res.json(); + // }) + // .then((res)=>{ + // let appendlocation = document.querySelector(".dynamic-news"); + // appendNews(res.articles, appendlocation); + // }) + // .catch((e)=>{ + // console.log(e); + // }) - console.log("Test") + // console.log("Test") - } + // } + + // }); - }); + + +// showUsers(page_no); + +// async function showUsers(page_no){ +// let url = `https://newsapi.org/v2/everything?q=health&apiKey=${api}&pageSize=10`; + +// if(page_no){ +// url+=`&page=${page_no}`; +// } +// let response = await fetch(url); +// let data = await response.json(); +// displayData(data.articles); +// } + + @@ -234,6 +270,160 @@ //Search Feature in news api End================================> +let page_no=1; +let total_page; + +let api = "f1e386e609754803ac12e5449af5a32f"; +async function fetching(page_no){ + let query = document.getElementById("search").value; + + try{ + let url = `https://newsapi.org/v2/everything?q=${query}&apiKey=${api}&pageSize=10`; + + if(page_no){ + url+=`&page=${page_no}`; + } + var response = await fetch(url); + let data =await response.json(); + + console.log(data.articles); + displayData(data.articles); + } + catch(error){ + // console.log(error); + } +} + +// fetching(); + +document.getElementById("search").addEventListener("keyup",()=>{ + debounce(fetching); +}); + +let id; +function debounce(func){ + if(id){ + clearTimeout(id); + } + id = setTimeout(() => { + func(); + },500) +}; + +let container = document.querySelector(".dynamic-news"); +function displayData(data){ + container.innerHTML = ""; + + data.forEach(function(elem){ + + let title = document.createElement("h3"); + let image = document.createElement("img"); + // let source = document.createElement("href"); + + // source.innerHTML = elem.url; + // elem.addEventListener("click",()=>{ + // location.href = elem.url; + // }) + + image.src = elem.urlToImage; + image.addEventListener("click",function(){ + location.href = elem.url; + }) + title.innerText = elem.title; + + container.append(image,title); + + }) + +} + + +// pagination function + + + + + +// function showUserDetails(data){ +// container.innerHTML = ""; +// let cardListDiv = document.createElement("div"); +// cardListDiv.setAttribute("class","card-list"); + +// data.forEach(function(elem){ +// let cardDiv = document.createElement("div"); +// cardDiv.setAttribute("class","card") + +// let cardImg = document.createElement("div"); +// cardImg.setAttribute("class","card_img") + +// let image = document.createElement("img"); +// image.src = elem.avatar; + +// cardImg.append(image); + +// let cardBodyDiv = document.createElement("div"); +// cardBodyDiv.setAttribute("class","card_body"); + +// let h3 = document.createElement("h3"); +// h3.setAttribute("class","card_item card_title"); +// h3.innerHTML = elem.firstname+" "+elem.lastname; + +// let cardItemDiv = document.createElement("div"); +// cardItemDiv.setAttribute("class","card_item card_description"); +// cardItemDiv.innerHTML = elem.email; + +// cardBodyDiv.append(h3,cardItemDiv); +// cardDiv.append(cardImg,cardBodyDiv); + +// cardListDiv.append(cardDiv); + +// }) + +// mainSection.append(cardListDiv); +// } + + +let button1 = document.createElement("button"); +button1.innerHTML = 1; +button1.addEventListener("click",function(){ + fetching(1); + healthFun(1); +}) +let button2 = document.createElement("button"); +button2.innerHTML = 2; +button2.addEventListener("click",function(){ + fetching(2); + healthFun(2); +}) +let button3 = document.createElement("button"); +button3.innerHTML = 3; +button3.addEventListener("click",function(){ + fetching(3); + healthFun(3); +}) +let button4 = document.createElement("button"); +button4.innerHTML = 4; +button4.addEventListener("click",function(){ + fetching(4); + healthFun(4); +}) +let button5 = document.createElement("button"); +button5.innerHTML = 5; +button5.addEventListener("click",function(){ + fetching(5); + healthFun(5); +}) +let button6 = document.createElement("button"); +button6.innerHTML = 6; +button6.addEventListener("click",function(){ + fetching(6); + healthFun(6); +}) + +let mainContainer = document.getElementById("Container"); + +mainContainer.append(button1,button2,button3,button4,button5,button6); + diff --git a/scripts/pay.js b/scripts/pay.js index 165b4ed..bff9799 100644 --- a/scripts/pay.js +++ b/scripts/pay.js @@ -26,85 +26,90 @@ close.addEventListener("click", ()=>{ //If user is logged in -login() - -function login(){ - console.log("test") - let loginStatus = localStorage.getItem("login") - console.log(typeof(loginStatus)) - if(loginStatus === "true"){ - let ph = localStorage.getItem("mobileNumber"); - console.log(ph) - document.querySelector("#myBtn").textContent = ph; - open.addEventListener("click", ()=>{ - modal_container.classList.remove("show") - window.location.href = "login_profile.html"; - }) +// login() + +// function login(){ +// console.log("test") +// let loginStatus = localStorage.getItem("login") +// console.log(typeof(loginStatus)) +// if(loginStatus === "true"){ +// let ph = localStorage.getItem("mobileNumber"); +// console.log(ph) +// document.querySelector("#myBtn").textContent = ph; +// open.addEventListener("click", ()=>{ +// modal_container.classList.remove("show") +// window.location.href = "login_profile.html"; +// }) - } - else{ - return false; - } - -} - - - -//When user add mobile number to it -document.querySelector("#sendOTP").addEventListener("click", ()=>{ - let mobNo = document.querySelector("#input").value; - if(mobNo.length != 10){ - alert("Please Give correct Mobile Number"); - } - else{ - localStorage.setItem("mobileNumber", mobNo); - // modal_container.style.visibility = "hidden"; - // document.querySelector(".loginp") - document.querySelector("#entermobile").textContent = `We have sent an OTP to ${mobNo}`; - document.querySelector("#rem1").style.visibility = "hidden"; - document.querySelector("#rem2").style.visibility = "hidden"; - document.querySelector("#countryDrop").style.visibility = "hidden"; - document.querySelector("#input").value = null; - document.querySelector("#input").placeholder = "Enter OTP" - document.querySelector("input").style.textAlign = "center"; - document.querySelector("#sendOTP").style.visibility = "hidden"; - document.querySelector("#giveOTP").style.visibility = "visible"; - - document.querySelector("#giveOTP").addEventListener("click", ()=>{ - - let otp = document.querySelector("input").value; - if(otp == "123456"){ - // alert("success"); - modal_container.classList.remove("show") - document.querySelector("#myBtn").textContent = mobNo; - localStorage.setItem("login", true); - - - open.addEventListener("click", ()=>{ - modal_container.classList.remove("show") - window.location.href = "login_profile.html"; - login() - - }) - - - } - else{ - alert("Wrong OTP"); - document.querySelector("#entermobile").textContent = `Enter Your mobile number`; - document.querySelector("#rem1").style.visibility = "visible"; - document.querySelector("#rem2").style.visibility = "visible"; - document.querySelector("#countryDrop").style.visibility = "visible"; - document.querySelector("#input").value = null; - document.querySelector("#input").placeholder = "Enter Mobile Number" - document.querySelector("#sendOTP").style.visibility = "visible"; - document.querySelector("#giveOTP").style.visibility = "hidden"; - - } - - }) +// } +// else{ +// return false; +// } + +// } + + + +// //When user add mobile number to it +// document.querySelector("#sendOTP").addEventListener("click", ()=>{ +// let mobNo = document.querySelector("#input").value; +// if(mobNo.length != 10){ +// alert("Please Give correct Mobile Number"); +// } +// else{ +// localStorage.setItem("mobileNumber", mobNo); +// // modal_container.style.visibility = "hidden"; +// // document.querySelector(".loginp") +// document.querySelector("#entermobile").textContent = `We have sent an OTP to ${mobNo}`; +// document.querySelector("#rem1").style.visibility = "hidden"; +// document.querySelector("#rem2").style.visibility = "hidden"; +// document.querySelector("#countryDrop").style.visibility = "hidden"; +// document.querySelector("#input").value = null; +// document.querySelector("#input").placeholder = "Enter OTP" +// document.querySelector("input").style.textAlign = "center"; +// document.querySelector("#sendOTP").style.visibility = "hidden"; +// document.querySelector("#giveOTP").style.visibility = "visible"; + +// document.querySelector("#giveOTP").addEventListener("click", ()=>{ + +// let otp = document.querySelector("input").value; +// if(otp == "123456"){ +// // alert("success"); +// modal_container.classList.remove("show") +// document.querySelector("#myBtn").textContent = mobNo; +// localStorage.setItem("login", true); + + +// open.addEventListener("click", ()=>{ +// modal_container.classList.remove("show") +// window.location.href = "login_profile.html"; +// login() + +// }) + + +// } +// else{ +// alert("Wrong OTP"); +// document.querySelector("#entermobile").textContent = `Enter Your mobile number`; +// document.querySelector("#rem1").style.visibility = "visible"; +// document.querySelector("#rem2").style.visibility = "visible"; +// document.querySelector("#countryDrop").style.visibility = "visible"; +// document.querySelector("#input").value = null; +// document.querySelector("#input").placeholder = "Enter Mobile Number" +// document.querySelector("#sendOTP").style.visibility = "visible"; +// document.querySelector("#giveOTP").style.visibility = "hidden"; + +// } + +// }) - } -}) +// } +// }) + +//Login and pop up full functionalities end + + + -//Login and pop up full functionalities end \ No newline at end of file +// rayjor payment method diff --git a/styles/blog.css b/styles/blog.css index 0f11a9b..2bcc8fd 100644 --- a/styles/blog.css +++ b/styles/blog.css @@ -330,7 +330,10 @@ overflow: hidden; border: 1px solid transparent; } - + + .dynamic-news > img{ + width: 100%; + } /* Dynamic part End */ @@ -371,7 +374,7 @@ border-bottom: 2px solid #548A2F; } - .head-box >div:hover:{ + .head-box >div:hover { border-bottom: 2px solid #548A2F; } diff --git a/venues.html b/venues.html index 1242da4..f16da01 100644 --- a/venues.html +++ b/venues.html @@ -33,7 +33,8 @@