WebExtension: Added shortcut.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2019-05-24 13:43:15 +02:00
parent cd5a4ecf31
commit 42fbf0a55d
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 23 additions and 2 deletions

View File

@ -49,13 +49,13 @@
"commands":
{
"open_popup":
"_execute_browser_action":
{
"suggested_key":
{
"default": "Ctrl+Shift+S"
},
"description": "Add URI to remwharead."
"description": "Open “Add URI”-popup."
}
}
}

View File

@ -8,6 +8,7 @@
<label for="archive">Use archive.org to archive URIs:</label>
<input type="checkbox" id="archive" value="archive" checked/>
</form>
<p id="shortcuts">You can edit shortcuts using the gear icon at the top right.</p>
<script src="options.js"></script>
</body>

View File

@ -16,5 +16,25 @@ function restore_options()
});
}
function info_commands(commands)
{
commands.forEach(
function(command)
{
var element = document.querySelector("#shortcuts");
var para = document.createElement("p");
var text = document.createElement("strong");
text.appendChild(document.createTextNode(command.shortcut + ": "));
para.appendChild(text);
para.appendChild(document.createTextNode(command.description));
element.appendChild(para);
});
}
document.addEventListener('DOMContentLoaded', restore_options);
document.querySelector("#archive").addEventListener("change", save_options);
var get_commands = browser.commands.getAll();
get_commands.then(info_commands);