From ea41fb41bfa0cea4420e2228de379b50520664ef Mon Sep 17 00:00:00 2001 From: Laurent Espitallier Date: Mon, 7 Aug 2017 18:25:13 +0200 Subject: [PATCH] Code cleaning --- background.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/background.js b/background.js index e7b4e7d..4f9dec2 100644 --- a/background.js +++ b/background.js @@ -1,8 +1,3 @@ -var instance; -var windowWidth; -var windowHeight; -var noQueryStrings; - function onError(error) { console.log(`Error: ${error}`); } @@ -19,16 +14,16 @@ function shareURL(donnees){ browser.storage.local.get(["instance_url","window_width","window_height","remove_querystrings"],function(item){ - instance = item["instance_url"]; - windowWidth = item["window_width"]; - windowHeight = item["window_height"]; - noQueryStrings = item["remove_querystrings"]; + let instance = item["instance_url"]; + let windowWidth = item["window_width"]; + let windowHeight = item["window_height"]; + let noQueryStrings = item["remove_querystrings"]; - var tab = tabs[0]; + let tab = tabs[0]; // manages Mozilla Firefox reader mode - var rawUrl = tab.url; - var partToRemove = "about:reader?url="; + let rawUrl = tab.url; + let partToRemove = "about:reader?url="; if(rawUrl.includes(partToRemove)) { rawUrl = rawUrl.substring(partToRemove.length); rawUrl = decodeURIComponent(rawUrl); @@ -39,7 +34,7 @@ function shareURL(donnees){ rawUrl = rawUrl.split("?")[0]; } - var url = instance + "/bookmarks.php?action=add&address=" + encodeURIComponent(rawUrl) + "&title=" + encodeURIComponent(tabs[0].title) + "&description=" + encodeURIComponent(donnees); + let url = instance + "/bookmarks.php?action=add&address=" + encodeURIComponent(rawUrl) + "&title=" + encodeURIComponent(tabs[0].title) + "&description=" + encodeURIComponent(donnees); widthInt = Number(windowWidth); heightInt = Number(windowHeight);