Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Binary file added github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added google-drive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added google-slides.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ body {
display: flex;
flex-direction: column;
max-width: min(100vw, 80rem);
text-align: center;
/* Hint */
}
.container > * {
Expand Down
55 changes: 49 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -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 + ' ', '')}`;
}
});
Binary file added sheets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spotify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.