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

Fix security warnings #554

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
4 changes: 1 addition & 3 deletions scripts/backup-restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ async function backupData() {

console.log("Backup completed successfully!");
} catch (error) {
await alertPrompt(
(translations[currentLanguage]?.failedbackup || translations["en"].failedbackup) + error.message
);
await alertPrompt((translations[currentLanguage]?.failedbackup || translations["en"].failedbackup) + error.message);
}
}

Expand Down
3 changes: 1 addition & 2 deletions scripts/bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ document.addEventListener("DOMContentLoaded", function () {
if (!currentBookmarkId) return;

const updatedTitle = editBookmarkName.value.trim();
const updatedURL = editBookmarkURL.value.trim();
const updatedURL = encodeURI(editBookmarkURL.value.trim());

const updatedData = { title: updatedTitle, url: updatedURL };

Expand Down Expand Up @@ -438,7 +438,6 @@ document.addEventListener("DOMContentLoaded", function () {
// Save and load the state of the bookmarks toggle
document.addEventListener("DOMContentLoaded", function () {
const bookmarksCheckbox = document.getElementById("bookmarksCheckbox");
const bookmarkGridCheckbox = document.getElementById("bookmarkGridCheckbox");

bookmarksCheckbox.addEventListener("change", async function () {
let bookmarksPermission;
Expand Down
1 change: 1 addition & 0 deletions scripts/google-apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ document.addEventListener("click", function (event) {
// Save and load toggle state
document.addEventListener("DOMContentLoaded", function () {
const googleAppsCont = document.getElementById("googleAppsCont");
const googleAppsCheckbox = document.getElementById("googleAppsCheckbox");

googleAppsCheckbox.addEventListener("change", function () {
saveCheckboxState("googleAppsCheckboxState", googleAppsCheckbox);
Expand Down
1 change: 1 addition & 0 deletions scripts/save-load-states.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function saveCheckboxState(key, checkbox) {
localStorage.setItem(key, checkbox.checked ? "checked" : "unchecked");
}

const bookmarkGridCheckbox = document.getElementById("bookmarkGridCheckbox");
// Function to load and apply checkbox state from localStorage
function loadCheckboxState(key, checkbox) {
const savedState = localStorage.getItem(key);
Expand Down
9 changes: 3 additions & 6 deletions scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

// Showing border or outline when you click on the searchbar
const searchbar = document.getElementById("searchbar");
const searchInput = document.getElementById("searchQ");
searchbar.addEventListener("click", function (event) {
event.stopPropagation(); // Stop the click event from propagating to the document
searchbar.classList.add("active");
Expand Down Expand Up @@ -61,7 +62,6 @@ document.addEventListener("DOMContentLoaded", () => {
});

const enterBTN = document.getElementById("enterBtn");
const searchInput = document.getElementById("searchQ");
const searchEngineRadio = document.getElementsByName("search-engine");
const searchDropdowns = document.querySelectorAll('[id$="-dropdown"]:not(*[data-default])');
const defaultEngine = document.querySelector('#default-dropdown-item div[id$="-dropdown"]');
Expand Down Expand Up @@ -122,9 +122,8 @@ document.addEventListener("DOMContentLoaded", () => {

localStorage.setItem("selectedSearchEngine", radioButton.value);

const searchBar = document.querySelector(".searchbar");
searchInput.focus();
searchBar.classList.add("active");
searchbar.classList.add("active");
});
});

Expand Down Expand Up @@ -563,8 +562,6 @@ document.addEventListener("DOMContentLoaded", function () {
});

document.addEventListener("keydown", function (event) {
const searchInput = document.getElementById("searchQ");
const searchBar = document.querySelector(".searchbar");
const modalContainer = document.getElementById("prompt-modal-container");

// Prevent if modal is open
Expand All @@ -578,7 +575,7 @@ document.addEventListener("keydown", function (event) {
if (event.key === "/" && event.target.tagName !== "INPUT" && event.target.tagName !== "TEXTAREA" && event.target.isContentEditable !== true) {
event.preventDefault();
searchInput.focus();
searchBar.classList.add("active");
searchbar.classList.add("active");
}
});

Expand Down
6 changes: 3 additions & 3 deletions scripts/search-suggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ document.addEventListener("DOMContentLoaded", () => {
});

// ---------------------------- Search Suggestions ----------------------------

const resultBox = document.getElementById("resultBox");

// Show the result box
function showResultBox() {
resultBox.classList.add("show");
Expand Down Expand Up @@ -77,7 +80,6 @@ document.getElementById("searchQ").addEventListener("input", async function () {
engine5: "https://www.youtube.com/results?search_query="
};
const query = this.value;
const resultBox = document.getElementById("resultBox");

if (query.length > 0) {
try {
Expand Down Expand Up @@ -222,8 +224,6 @@ async function getAutocompleteSuggestions(query) {

// Hide results when clicking outside
document.addEventListener("click", function (event) {
const searchbar = document.getElementById("searchbar");

if (!searchbar.contains(event.target)) {
hideResultBox();
}
Expand Down