2019-06-15 02:48:38 +02:00
|
|
|
/* globals browser */
|
|
|
|
|
2019-05-24 13:05:40 +02:00
|
|
|
function save_options(e)
|
|
|
|
{
|
|
|
|
browser.storage.sync.set(
|
|
|
|
{
|
|
|
|
archive: document.querySelector("#archive").checked
|
|
|
|
});
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
|
|
|
|
function restore_options()
|
|
|
|
{
|
2019-06-15 00:24:48 +02:00
|
|
|
const item = browser.storage.sync.get('archive');
|
2019-05-24 13:05:40 +02:00
|
|
|
item.then((res) =>
|
|
|
|
{
|
2019-05-24 14:44:50 +02:00
|
|
|
if (res.archive === false)
|
|
|
|
{
|
|
|
|
document.querySelector("#archive").checked = false;
|
|
|
|
}
|
2019-05-24 13:05:40 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-05-24 13:43:15 +02:00
|
|
|
function info_commands(commands)
|
|
|
|
{
|
|
|
|
commands.forEach(
|
|
|
|
function(command)
|
|
|
|
{
|
2019-06-15 00:24:48 +02:00
|
|
|
const element = document.querySelector("#shortcuts");
|
|
|
|
const para = document.createElement("p");
|
2019-05-24 13:43:15 +02:00
|
|
|
|
2019-06-15 00:24:48 +02:00
|
|
|
const text = document.createElement("strong");
|
2019-05-24 13:43:15 +02:00
|
|
|
text.appendChild(document.createTextNode(command.shortcut + ": "));
|
|
|
|
para.appendChild(text);
|
|
|
|
para.appendChild(document.createTextNode(command.description));
|
|
|
|
|
|
|
|
element.appendChild(para);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-05-24 13:05:40 +02:00
|
|
|
document.addEventListener('DOMContentLoaded', restore_options);
|
|
|
|
document.querySelector("#archive").addEventListener("change", save_options);
|
2019-05-24 13:43:15 +02:00
|
|
|
|
2019-06-15 00:24:48 +02:00
|
|
|
const get_commands = browser.commands.getAll();
|
2019-05-24 13:43:15 +02:00
|
|
|
get_commands.then(info_commands);
|