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
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@ Supported providers (first_word):
- Google (google) (Default)
- YouTube (youtube)
- Google Docs (docs)
- Google Sheets (sheets)
- Google Slides (slides)
- Github (github)
- Bing (bing)
- Spotify (spotify)
- Amazon (amazon)

[Icons created by freepik on Flaticon](https://www.flaticon.com/authors/freepik)
[Icons created by freepik on Flaticon](https://www.flaticon.com/authors/freepik)
Binary file added amazon.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 background.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 bing.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 modified docs.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 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 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 modified google.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ html, body {
height: 100vh;
width: 100vw;
}

body {
background-image: url("background.png");
color:white;
display: flex;
flex-direction: column;
justify-content: center;
Expand All @@ -15,15 +18,17 @@ body {
display: flex;
flex-direction: column;
max-width: min(100vw, 80rem);
/* Hint */
align-items: center;
}
.container > * {
margin: 0.5rem;
}
.heading {
font-size: 5rem;
margin: 1.5rem;
font-weight: 500;
font-weight: 900;
font-family: 'Montserrat', sans-serif;
color: white;
}
@media screen and (max-width:540px) {
.heading {
Expand All @@ -41,6 +46,7 @@ body {
border-radius: 0.5rem;
display: flex;
align-items: center;
background-color: white;
}
.search_label{
transition: linear 0.25s;
Expand All @@ -52,6 +58,7 @@ body {
padding: 0 0.5rem;
z-index: -1;
margin-left: 1.5rem;
color: black;
}
.search_wrapper:focus-within {
border-color: #303F9F;
Expand Down Expand Up @@ -80,7 +87,7 @@ body {
align-items: center;
align-self: flex-end;
color: white;
background-color: #3F51B5;
background-color:#41c23a;
border-radius: 0.25rem;
border: none;
padding: 0.5rem 0.75rem;
Expand Down
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Comfortaa&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300&display=swap" rel="stylesheet">
<link rel="stylesheet" href="index.css">
<i class="fas fa-search"></i>
</head>
<body>
<div class="container">
Expand All @@ -20,7 +22,7 @@
<input class="search_input" type="text" name="search" alt="Search box" required pattern=".*\S+.*" id="input">
<label class="search_label" for="search">Search</label>
</div>
<button class="search_button" type="submit">Search <span class="material-icons">arrow_forward</span> </button>
<button class="search_button" type="submit" onclick="location.href='https://www.google.co.in/'" type="button">Search<span class="material-icons">arrow_forward</span> </button>
</div>
<script src="index.js"></script>
</body>
Expand Down
85 changes: 74 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,101 @@ document.querySelector('.search_input').addEventListener('keyup', e => {
let search_query = input.split(' ').splice(0).join(' ');
switch(search_engine){
case 'google':
case 'drive':
case 'slides':
case 'sheets':
case 'youtube':
case 'docs': break;
default: search_engine = 'google';
case 'docs':
case 'amazon':
case 'bing':
case 'github':
case 'spotify':
break;
default:
search_engine = 'google';
search_query = input;
}
let final_query = search_query.replace((search_engine + ' '), ''); // replacing original query without the name of the search engine
if(search_engine !== current_search) {
current_search = search_engine;
const image = document.querySelector('.search_icon');
switch(search_engine){
case 'google':
image.src = 'google.png';
image.alt = 'Google icon';
break;
image.src = 'google.png';
image.alt = 'Google icon';
break;
case 'youtube':
image.src = 'youtube.png';
image.alt = 'YouTube icon';
image.src = 'youtube.png';
image.alt = 'YouTube icon';
break;
case 'docs':
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 'bing':
image.src= 'bing.png'
image.alt= 'bing icon';
break;
case 'amazon':
image.src= 'amazon.png'
image.alt= 'Amazon icon';
break;
case 'sheets':
image.src= 'sheets.png'
image.alt=' Sheets 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) {
case 'docs':
window.location = `https://docs.google.com/document/?q=${search_query}`;
window.location = `https://docs.google.com/document/?q=${final_query}`;
l
break;
case 'youtube':
window.location = `https://www.youtube.com/results?search_query=${search_query}`;
window.location = `https://www.youtube.com/results?search_query=${final_query}`;
break;
case 'slides':
window.location = `https://docs.google.com/presentation/?q=${final_query}`;
break;
case 'drive':
window.location = `https://drive.google.com/drive/search?q=${final_query}`;
break;
case 'bing':
window.location = `https://www.bing.com/search?q=${final_query}`;
break;
case 'amazon':
window.location = `https://www.amazon.in/s?k=${final_query}`;
break;
case 'sheets':
window.location = `https://docs.google.com/spreadsheets/?q=${final_query}`;
break;
case 'google':
window.location = `https://www.google.com/search?q=${final_query}`;
break;
case 'github':
window.location = `https://github.com/search?q=${final_query}`;
break;
case 'spotify':
window.location = `https://open.spotify.com/search/${final_query}`;
break;
default:
window.location = `https://www.google.com/search?q=${search_query}`;
window.location = `https://www.google.com/search?q=${final_query}`;
}
});
});
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 slides.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.
Binary file modified youtube.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.