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