diff --git a/index.html b/index.html index 39a32e3..05c6a09 100644 --- a/index.html +++ b/index.html @@ -1538,7 +1538,7 @@

Material You New Tab

type="text">
Host your own proxy + id="HostproxyButton" target="_blank" rel="noopener noreferrer">Host your own proxy
@@ -1622,7 +1622,7 @@

Material You New Tab

Privacy policy + id="PrivacyPolicy" target="_blank" rel="noopener noreferrer">Privacy policy
@@ -1648,7 +1648,7 @@

Material You New Tab

Learn more + id="LearnMoreButton" target="_blank" rel="noopener noreferrer">Learn more
@@ -1905,7 +1905,7 @@

Material You New Tab

To change your homepage like the new tab as well, visit this link and follow the instructions. + target="_blank" rel="noopener noreferrer">this link and follow the instructions.
diff --git a/scripts/backup-restore.js b/scripts/backup-restore.js index d7af821..156a56c 100644 --- a/scripts/backup-restore.js +++ b/scripts/backup-restore.js @@ -39,8 +39,6 @@ async function backupData() { document.body.appendChild(link); link.click(); document.body.removeChild(link); - - console.log("Backup completed successfully!"); } catch (error) { await alertPrompt((translations[currentLanguage]?.failedbackup || translations["en"].failedbackup) + error.message); } diff --git a/scripts/bookmarks.js b/scripts/bookmarks.js index 7e8d5d8..833a5a7 100644 --- a/scripts/bookmarks.js +++ b/scripts/bookmarks.js @@ -29,7 +29,7 @@ const sortAlphabetical = document.getElementById("sortAlphabetical"); const sortTimeAdded = document.getElementById("sortTimeAdded"); let currentSortMethod = localStorage.getItem("bookmarkSortMethod") || 'title'; -var bookmarksAPI; +let bookmarksAPI; if (isFirefox) { bookmarksAPI = browser.bookmarks; } else if (isChromiumBased) { @@ -300,7 +300,7 @@ function setBookmarkFavicon(faviconElement, pageUrl) { }; // Try browser-specific favicon first (Chromium only) - if (!isFirefox || !isOpera) { + if (!isFirefox && !isOpera) { faviconElement.src = `chrome-extension://${chrome.runtime.id}/_favicon/?pageUrl=${encodeURIComponent(pageUrl)}&size=32`; faviconElement.onerror = googleFallback; } else { diff --git a/scripts/clock.js b/scripts/clock.js index 83db59b..4e3a3b6 100644 --- a/scripts/clock.js +++ b/scripts/clock.js @@ -97,10 +97,10 @@ async function initializeClock() { let isFirstLoad = true; // Retrieve current time and calculate initial angles - var currentTime = new Date(); - var initialSeconds = currentTime.getSeconds(); - var initialMinutes = currentTime.getMinutes(); - var initialHours = currentTime.getHours(); + const currentTime = new Date(); + const initialSeconds = currentTime.getSeconds(); + const initialMinutes = currentTime.getMinutes(); + const initialHours = currentTime.getHours(); // Initialize cumulative rotations cumulativeSecondRotation = initialSeconds * 6; @@ -123,22 +123,22 @@ async function initializeClock() { function updateDate() { if (clocktype === "analog") { - var currentTime = new Date(); - var dayOfWeek = currentTime.getDay(); - var dayOfMonth = currentTime.getDate(); - var month = currentTime.getMonth(); + const currentTime = new Date(); + const dayOfWeek = currentTime.getDay(); + const dayOfMonth = currentTime.getDate(); + const month = currentTime.getMonth(); // Define the current language const currentLanguage = getLanguageStatus("selectedLanguage") || "en"; // Get the translated name of the day - var dayName = translations[currentLanguage]?.days?.[dayOfWeek] ?? translations["en"].days[dayOfWeek]; + const dayName = translations[currentLanguage]?.days?.[dayOfWeek] ?? translations["en"].days[dayOfWeek]; // Get the translated name of the month - var monthName = translations[currentLanguage]?.months?.[month] ?? translations["en"].months[month]; + const monthName = translations[currentLanguage]?.months?.[month] ?? translations["en"].months[month]; // Localize the day of the month - var localizedDayOfMonth = localizeNumbers(dayOfMonth.toString(), currentLanguage); + const localizedDayOfMonth = localizeNumbers(dayOfMonth.toString(), currentLanguage); // DATE DISPLAY FOR ANALOG CLOCK const dateDisplay = { @@ -211,10 +211,10 @@ async function initializeClock() { } function updateanalogclock() { - var currentTime = new Date(); - var currentSeconds = currentTime.getSeconds(); - var currentMinutes = currentTime.getMinutes(); - var currentHours = currentTime.getHours(); + const currentTime = new Date(); + const currentSeconds = currentTime.getSeconds(); + const currentMinutes = currentTime.getMinutes(); + const currentHours = currentTime.getHours(); // Calculate the new rotation values let newSecondRotation = currentSeconds * 6; // 6° per second diff --git a/scripts/search-suggestions.js b/scripts/search-suggestions.js index 539aa9c..01bdcf1 100644 --- a/scripts/search-suggestions.js +++ b/scripts/search-suggestions.js @@ -210,7 +210,7 @@ let lastRedditRequestTime = 0; async function getAutocompleteSuggestions(query) { const clientParam = getClientParam(); // Get the browser client parameter dynamically - var selectedOption = document.querySelector('input[name="search-engine"]:checked').value; + const selectedOption = document.querySelector('input[name="search-engine"]:checked').value; // 🔒 Throttle Reddit API calls const now = Date.now(); diff --git a/scripts/search.js b/scripts/search.js index b1b8f7a..392839f 100644 --- a/scripts/search.js +++ b/scripts/search.js @@ -217,11 +217,11 @@ function performSearch(query) { } } catch (error) { // Fallback to Google if an error occurs - var fallbackUrl = searchQueryURLs.engine1 + encodeURIComponent(searchTerm); + const fallbackUrl = searchQueryURLs.engine1 + encodeURIComponent(searchTerm); window.location.href = fallbackUrl; } } else { - var searchUrl = searchQueryURLs[selectedOption] + encodeURIComponent(searchTerm); + const searchUrl = searchQueryURLs[selectedOption] + encodeURIComponent(searchTerm); window.location.href = searchUrl; } } @@ -259,23 +259,23 @@ if (storedSearchEngine) { const dropdownItems = document.querySelectorAll(".dropdown-item:not(*[data-default])"); let selectedIndex = -1; -// Function to update the selected item +// Attach mouse hover listeners once (not on every keydown) +dropdownItems.forEach((item) => { + item.addEventListener("mouseenter", () => { + item.classList.add("selected"); + }); + item.addEventListener("mouseleave", () => { + item.classList.remove("selected"); + }); +}); + +// Function to update the selected item (keyboard navigation only) function updateSelection() { - // let hasSelected = []; dropdownItems.forEach((item, index) => { - - item.addEventListener("mouseenter", () => { - item.classList.add("selected"); - }) - item.addEventListener("mouseleave", () => { - item.classList.remove("selected"); - }) - if (index === selectedIndex) { - item.focus() + item.focus(); item.classList.add("selected"); } else { - item.focus() item.classList.remove("selected"); } });