webextension: Replaced var with const and let.
This commit is contained in:
parent
59ec3f6d6d
commit
91d3059e13
|
@ -9,7 +9,7 @@ function save_options(e)
|
|||
|
||||
function restore_options()
|
||||
{
|
||||
var item = browser.storage.sync.get('archive');
|
||||
const item = browser.storage.sync.get('archive');
|
||||
item.then((res) =>
|
||||
{
|
||||
if (res.archive === false)
|
||||
|
@ -24,10 +24,10 @@ function info_commands(commands)
|
|||
commands.forEach(
|
||||
function(command)
|
||||
{
|
||||
var element = document.querySelector("#shortcuts");
|
||||
var para = document.createElement("p");
|
||||
const element = document.querySelector("#shortcuts");
|
||||
const para = document.createElement("p");
|
||||
|
||||
var text = document.createElement("strong");
|
||||
const text = document.createElement("strong");
|
||||
text.appendChild(document.createTextNode(command.shortcut + ": "));
|
||||
para.appendChild(text);
|
||||
para.appendChild(document.createTextNode(command.description));
|
||||
|
@ -39,5 +39,5 @@ function info_commands(commands)
|
|||
document.addEventListener('DOMContentLoaded', restore_options);
|
||||
document.querySelector("#archive").addEventListener("change", save_options);
|
||||
|
||||
var get_commands = browser.commands.getAll();
|
||||
const get_commands = browser.commands.getAll();
|
||||
get_commands.then(info_commands);
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
var taburl = "";
|
||||
var archive = "";
|
||||
let taburl = "";
|
||||
let archive = "";
|
||||
|
||||
function set_taburl(tabs) // Set taburl to URL of current tab.
|
||||
{
|
||||
let tab = tabs[0];
|
||||
const tab = tabs[0];
|
||||
taburl = tab.url;
|
||||
}
|
||||
|
||||
function get_tags() // get tags from text input.
|
||||
{
|
||||
let tags = txttags.value;
|
||||
const tags = txttags.value;
|
||||
if (tags != "")
|
||||
{
|
||||
return "-t '" + tags + "' ";
|
||||
|
@ -19,7 +19,7 @@ function get_tags() // get tags from text input.
|
|||
|
||||
function read_options()
|
||||
{
|
||||
var item = browser.storage.sync.get('archive');
|
||||
const item = browser.storage.sync.get('archive');
|
||||
item.then((res) =>
|
||||
{
|
||||
if (res.archive === false)
|
||||
|
@ -55,13 +55,13 @@ function launch(args) // Launch wrapper and send tags + URL to stdin.
|
|||
msgstatus.textContent = "Launching remwharead…";
|
||||
msgerror.textContent = "";
|
||||
console.log("Sending: " + args + " to remwharead");
|
||||
var sending = browser.runtime.sendNativeMessage("remwharead", args);
|
||||
const sending = browser.runtime.sendNativeMessage("remwharead", args);
|
||||
sending.then(onResponse, onError);
|
||||
}
|
||||
|
||||
function add()
|
||||
{
|
||||
var arguments = get_tags() + archive + taburl;
|
||||
let arguments = get_tags() + archive + taburl;
|
||||
launch(arguments);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue