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
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 amazon2.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.
9 changes: 6 additions & 3 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ body {
box-sizing: border-box;
font-family: 'Comfortaa', cursive;
margin: 0;
background-color: #FFDEE9;
background-color: #FFDEE9;
background-image: linear-gradient(0deg, #FFDEE9 33%, #B5FFFC 100%);
}
.container {
display: flex;
flex-direction: column;
max-width: min(100vw, 80rem);
/* Hint */
align-items: center;
}
.container > * {
margin: 0.5rem;
Expand Down Expand Up @@ -48,7 +51,7 @@ body {
position: absolute;
font-size: 1.25rem;
transform-origin: left;
background-color: white;
background-color: rgba(255, 255, 255, 0.514);
padding: 0 0.5rem;
z-index: -1;
margin-left: 1.5rem;
Expand Down Expand Up @@ -80,7 +83,7 @@ body {
align-items: center;
align-self: flex-end;
color: white;
background-color: #3F51B5;
background-color: rgba(216, 46, 46, 0.313);
border-radius: 0.25rem;
border: none;
padding: 0.5rem 0.75rem;
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</head>
<body>
<div class="container">
<span class="heading">Multisearch</span>
<span class="heading">MultiSearch</span>
<span class="description">Start typing to choose a search engine</span>
<div class="search_wrapper">
<img src="google.png" alt="Google Icon" class="search_icon">
Expand Down
62 changes: 57 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@ 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(' ');

switch(search_engine){
case 'google':
case 'youtube':
case 'docs': break;
case 'drive':
case 'sheets':
case 'slides':
case 'docs':
case 'wikipedia':
case 'playstore':
case 'amazon':
break;
default: search_engine = 'google';
search_query = input;
search_query = 'google ' + input;
}
let search = search_query.split(' ').splice(1).join(' ');

if(search_engine !== current_search) {
current_search = search_engine;
const image = document.querySelector('.search_icon');
Expand All @@ -26,17 +36,59 @@ 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 = 'slides2.png';
image.alt = 'Google Slides icon';
break;
case 'sheets':
image.src = 'sheets.png';
image.alt = 'Google Sheets icon';
break;
case 'wikipedia':
image.src = 'wikipedia.png';
image.alt = 'Wikipedia icon';
break;
case 'playstore':
image.src = 'playstore3.png';
image.alt = 'Playstore icon';
break;
case 'amazon':
image.src = 'amazon2.png';
image.alt = 'Amazon 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=${search}`;
break;
case 'youtube':
window.location = `https://www.youtube.com/results?search_query=${search_query}`;
window.location = `https://www.youtube.com/results?search_query=${search}`;
break;
case 'drive':
window.location = `https://drive.google.com/drive/search?q=${search}`;
break;
case 'slides':
window.location = `https://docs.google.com/presentation/?q=${search}`;
break;
case 'sheets':
window.location = `https://docs.google.com/spreadsheets/?q=${search}`;
break;
case 'wikipedia':
window.location = `https://en.wikipedia.org/wiki/Special:Search?search=${search}`;
break;
case 'playstore':
window.location = `https://play.google.com/store/search?q=${search}`;
break;
case 'amazon':
window.location = `https://www.amazon.in/s?k=${search}`;
break;
default:
window.location = `https://www.google.com/search?q=${search_query}`;
window.location = `https://www.google.com/search?q=${search}`;
}
});
Binary file added playStore.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 playstore2.jpg
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 playstore3.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 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 sheets2.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 slides2.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 wikipedia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.