<reponame>be8386aaa/geeks<filename>Frontend-Projects/YouTube Clone/index.js<gh_stars>0const menu = document.querySelector('#menu');
console.log(menu);
const sidebar = document.querySelector('.sidebar');
console.log(sidebar);

menu.addEventListener('click', function () 
  {sidebar.classList.toggle('show-sidebar');
});

 //for videos
 
/*let api_key = "74t3tndxag9o7h0890bnpfzh4olk2h9x";
let video_http = "GET https://www.googleapis.com/youtube/v3/videos?";

fetch(video_http + new URLSearchParams({
    key: api_key,
    part: 'snippet',
    chart: 'mostPopular',
    maxResults: 1,
    regionCode: 'IN'
}))

.then(res => res.json())
.then(data => {
  console.log(data);
})*/

//search bar

const searchInput = document.querySelector('.search-bar');
const searchBtn = document.querySelector('.search-btn');

let searchLink = "https://www.youtube.com/results?search_query=";

searchBtn.addEventListener('click', () => {
   if(searchInput.value.length){
     location.href = searchLink + searchInput.value;
     console.log(searchInput);
   }
})