diff --git a/README.md b/README.md index 97ffa26..1a4f06c 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,8 @@ Supported providers (first_word): - Google (google) (Default) - YouTube (youtube) - Google Docs (docs) +- Google Drive (drive) +- Google Slides (slides) +- Google Sheets (sheets) [Icons created by freepik on Flaticon](https://www.flaticon.com/authors/freepik) \ No newline at end of file diff --git a/drive.png b/drive.png new file mode 100644 index 0000000..f4a76fa Binary files /dev/null and b/drive.png differ 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..4381296 100644 --- a/index.js +++ b/index.js @@ -2,9 +2,12 @@ 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).join(' '); switch(search_engine){ case 'google': + case 'drive': + case 'slides': + case 'sheets': case 'youtube': case 'docs': break; default: search_engine = 'google'; @@ -26,6 +29,19 @@ document.querySelector('.search_input').addEventListener('keyup', e => { image.src = 'docs.png'; image.alt = 'Google Docs icon'; break; + case 'drive': + image.src = 'drive.png'; + image.alt = 'Google Drive icon'; + break; + case 'slides': + image.src = 'slides.png'; + image.alt = 'Google slides icon'; + break; + case 'sheets': + image.src = 'sheets.png'; + image.alt = 'Google sheets icon'; + break; + } } if(e.key === 'Enter') @@ -36,6 +52,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/u/0/?tgif=d&q=${search_query}` ; + break; + case 'sheets': + window.location = `https://docs.google.com/spreadsheets/u/0/?tgif=d&q=${search_query}` ; + break; default: window.location = `https://www.google.com/search?q=${search_query}`; } diff --git a/sheets.png b/sheets.png new file mode 100644 index 0000000..481f5d8 Binary files /dev/null and b/sheets.png differ diff --git a/slides.png b/slides.png new file mode 100644 index 0000000..3c8309b Binary files /dev/null and b/slides.png differ