Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Issue with Search Bar #209

Merged
merged 16 commits into from
Nov 25, 2024
Merged
18 changes: 7 additions & 11 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,22 +608,20 @@ document.addEventListener("DOMContentLoaded", () => {
});
});

// Showing border or outline in when you click on searchbar
// Showing border or outline when you click on the searchbar
const searchbar = document.getElementById('searchbar');
searchbar.addEventListener('click', function () {
searchbar.classList.toggle('active');
// if (searchInput2.value !== "") {
// showResultBox()
// }
searchbar.addEventListener('click', function (event) {
event.stopPropagation(); // Stop the click event from propagating to the document
searchbar.classList.add('active');
});

document.addEventListener('click', function (event) {
// Check if the clicked element is not the searchbar
if (!searchbar.contains(event.target)) {
searchbar.classList.remove('active');
}
});


//search function
document.addEventListener("DOMContentLoaded", () => {
const enterBTN = document.getElementById("enterBtn");
Expand Down Expand Up @@ -669,7 +667,7 @@ document.addEventListener("DOMContentLoaded", () => {
// Set selected search engine from local storage
const storedSearchEngine = localStorage.getItem("selectedSearchEngine");
if (storedSearchEngine) {
const selectedRadioButton = document.querySelector(`input[name = "search-engine"][value = "${storedSearchEngine}"]`);
const selectedRadioButton = document.querySelector(`input[name="search-engine"][value="${storedSearchEngine}"]`);
if (selectedRadioButton) {
selectedRadioButton.checked = true;
}
Expand All @@ -687,15 +685,13 @@ document.addEventListener("DOMContentLoaded", () => {
const storedTheme = localStorage.getItem(themeStorageKey);
if (storedTheme) {
applySelectedTheme(storedTheme);
const selectedRadioButton = document.querySelector(`.colorPlate[value = "${storedTheme}"]`);
const selectedRadioButton = document.querySelector(`.colorPlate[value="${storedTheme}"]`);
if (selectedRadioButton) {
selectedRadioButton.checked = true;
}
}

});


// -----------Voice Search------------
// Function to detect Chrome and Edge on desktop
function isSupportedBrowser() {
Expand Down