From d429a6e74c1bd2cdcbe103546516cfcfa46e4bf2 Mon Sep 17 00:00:00 2001 From: NikhileswarReddyMachammagari Date: Sat, 18 Jun 2022 21:11:16 +0530 Subject: [PATCH 1/2] completed all tasks --- index.css | 1 + index.js | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/index.css b/index.css index 09dae3a..8276150 100644 --- a/index.css +++ b/index.css @@ -32,6 +32,7 @@ body { } .description { font-style: oblique; + text-align: center; } .search_wrapper { border: 0.125rem solid rgb(23, 23, 23); diff --git a/index.js b/index.js index ba99abc..25653d4 100644 --- a/index.js +++ b/index.js @@ -2,10 +2,13 @@ let current_search = 'google' document.querySelector('.search_input').addEventListener('keyup', e => { const input = e.target.value; let search_engine = input.split(' ')[0].toLowerCase(); - let search_query = input.split(' ').splice(0).join(' '); + let search_query = input.split(' ').splice(1); switch(search_engine){ case 'google': case 'youtube': + case 'sheets': + case 'slides': + case 'drive': case 'docs': break; default: search_engine = 'google'; search_query = input; @@ -26,6 +29,18 @@ document.querySelector('.search_input').addEventListener('keyup', e => { image.src = 'docs.png'; image.alt = 'Google Docs icon'; break; + case 'slides': + image.src = "slides.png"; + image.alt = "Google Slides icon"; + break; + case 'drive': + image.src = "drive.png"; + image.alt = "Google drive icon"; + break; + case 'sheets': + image.src = "sheets.png"; + image.alt = "Google Sheets icon"; + break; } } if(e.key === 'Enter') @@ -36,6 +51,15 @@ document.querySelector('.search_input').addEventListener('keyup', e => { case 'youtube': window.location = `https://www.youtube.com/results?search_query=${search_query}`; break; + case 'drive': + window.location = `https://drive.google.com/drive/search?q=${search_query}`; + break; + case 'slides': + window.location = `https://docs.google.com/presentation/?q=${search_query}`; + break; + case 'sheets': + window.location = `https://docs.google.com/spreadsheets?q=${search_query}`; + break; default: window.location = `https://www.google.com/search?q=${search_query}`; } From d108a82266138a67089d65a3ab352c17ca97e58d Mon Sep 17 00:00:00 2001 From: NikhileswarReddyMachammagari Date: Sat, 18 Jun 2022 22:40:24 +0530 Subject: [PATCH 2/2] commit --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 25653d4..4e8064a 100644 --- a/index.js +++ b/index.js @@ -57,7 +57,7 @@ document.querySelector('.search_input').addEventListener('keyup', e => { case 'slides': window.location = `https://docs.google.com/presentation/?q=${search_query}`; break; - case 'sheets': + case 'sheets': window.location = `https://docs.google.com/spreadsheets?q=${search_query}`; break; default: