Skip to content

Commit 3f250f4

Browse files
committed
eliminate var
1 parent c26a851 commit 3f250f4

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

background.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function createContextMenu(options) {
1919
contexts: ["image"]
2020
});
2121
for (let searchProvider of options.searchProviders) {
22-
var contextMenuOptions = {
22+
let contextMenuOptions = {
2323
parentId: "Image-Reverse-Search",
2424
id: searchProvider,
2525
icons: {
@@ -38,7 +38,7 @@ function createContextMenu(options) {
3838
}
3939

4040
/* Default settings. If there is nothing in storage, use these values. */
41-
var defaultSettings = {
41+
const defaultSettings = {
4242
openInBackground: false,
4343
openTabAt: "right",
4444
searchProviders: ["google"]

options/options.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function storeSettings() {
4747
}
4848
}
4949

50-
var searchProviders = getSearchProviders();
50+
const searchProviders = getSearchProviders();
5151

5252
// if no checkbox is selected
5353
const searchProvidersError = document.getElementById("searchProvidersError");
@@ -71,6 +71,7 @@ function storeSettings() {
7171
}
7272

7373
/* Check if custom search provider is valid */
74+
let cseProvider = "";
7475
if (searchProviders.includes("other")) {
7576
const cseForm = document.getElementById("customSearchProvider");
7677
if (cseForm.checkValidity() == false || cseForm.value == null || cseForm.value == "") {
@@ -80,13 +81,13 @@ function storeSettings() {
8081
if (cseForm.value.indexOf("%s") == "-1") { // no %s in URL!
8182
toggleCSEform(false);
8283
} else {
83-
var cseProvider = cseForm.value;
84+
cseProvider = cseForm.value;
8485
}
8586
}
8687
}
8788

8889
/* If custom search provider is not valid, but checked */
89-
if (typeof cseProvider == "undefined" && searchProviders.includes("other")) {
90+
if (cseProvider === "" && searchProviders.includes("other")) {
9091
const status = document.getElementById("status");
9192
status.classList.add("alert-danger");
9293
status.textContent = chrome.i18n.getMessage("error");
@@ -97,8 +98,6 @@ function storeSettings() {
9798
status.classList.remove("alert-danger");
9899
}, 1800);
99100
return
100-
} else if (typeof cseProvider == "undefined") {
101-
var cseProvider = "";
102101
}
103102

104103
const openInBackground = document.getElementById("openInBackground").checked;

0 commit comments

Comments
 (0)