diff --git a/README.md b/README.md index 97ffa26..1fa536c 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,10 @@ Supported providers (first_word): - Google (google) (Default) - YouTube (youtube) - Google Docs (docs) +- Google spreadsheets (sheets) +- Google slides (slides) +- Google Drive (drive) +- spotify (spotify) +- github (github) [Icons created by freepik on Flaticon](https://www.flaticon.com/authors/freepik) \ No newline at end of file diff --git a/github.png b/github.png new file mode 100644 index 0000000..b2f83db Binary files /dev/null and b/github.png differ diff --git a/google-drive.png b/google-drive.png new file mode 100644 index 0000000..e1e4f64 Binary files /dev/null and b/google-drive.png differ diff --git a/google-slides.png b/google-slides.png new file mode 100644 index 0000000..ede1c29 Binary files /dev/null and b/google-slides.png differ diff --git a/index.css b/index.css index 09dae3a..0b27a6c 100644 --- a/index.css +++ b/index.css @@ -15,6 +15,7 @@ body { display: flex; flex-direction: column; max-width: min(100vw, 80rem); + text-align: center; /* Hint */ } .container > * { diff --git a/index.js b/index.js index ba99abc..d4cfb19 100644 --- a/index.js +++ b/index.js @@ -6,11 +6,18 @@ document.querySelector('.search_input').addEventListener('keyup', e => { switch(search_engine){ case 'google': case 'youtube': - case 'docs': break; + case 'docs': + case 'sheets': + case 'slides': + case 'drive': + case 'spotify': + case 'github': + break; default: search_engine = 'google'; search_query = input; } - if(search_engine !== current_search) { + if(search_engine !== current_search) + { current_search = search_engine; const image = document.querySelector('.search_icon'); switch(search_engine){ @@ -26,17 +33,53 @@ document.querySelector('.search_input').addEventListener('keyup', e => { image.src = 'docs.png'; image.alt = 'Google Docs icon'; break; + case 'sheets': + image.src = 'sheets.png'; + image.alt = 'Google Sheets icon'; + break; + case 'slides': + image.src = 'google-slides.png'; + image.alt = 'Google Slides icon'; + break; + case 'drive': + image.src = 'google-drive.png'; + image.alt = 'Google Drive icon'; + break; + case 'github': + image.src = 'github.png'; + image.alt = 'GitHub icon'; + break; + case 'spotify': + image.src = 'spotify.png'; + image.alt = 'Spotify icon'; + break; } } if(e.key === 'Enter') - switch(search_engine) { + switch(search_engine) + { case 'docs': - window.location = `https://docs.google.com/document/?q=${search_query}`; + window.location = `https://docs.google.com/document/?q=${search_query.replace(search_engine + ' ', '')}`; break; case 'youtube': - window.location = `https://www.youtube.com/results?search_query=${search_query}`; + window.location = `https://www.youtube.com/results?search_query=${search_query.replace(search_engine + ' ', '')}`; + break; + case 'sheets': + window.location = `https://docs.google.com/speadsheets/?q=${search_query.replace(search_engine + ' ', '')}`; + break; + case 'slides': + window.location = `https://docs.google.com/presentation/?q=${search_query.replace(search_engine + ' ', '')}`; + break; + case 'drive': + window.location = `https://drive.google.com/drive/my-drive?=${search_query.replace(search_engine + ' ', '')}`; + break; + case 'github': + window.location = `https://github.com/search?q=${search_query.replace(search_engine + ' ', '')}`; + break; + case 'spotify': + window.location = `https://open.spotify.com/search/${search_query.replace(search_engine + ' ', '')}`; break; default: - window.location = `https://www.google.com/search?q=${search_query}`; + window.location = `https://www.google.com/search?q=${search_query.replace(search_engine + ' ', '')}`; } }); \ No newline at end of file diff --git a/sheets.png b/sheets.png new file mode 100644 index 0000000..074f7ba Binary files /dev/null and b/sheets.png differ diff --git a/spotify.png b/spotify.png new file mode 100644 index 0000000..e8aab70 Binary files /dev/null and b/spotify.png differ