Add keyboard shortcut

This commit is contained in:
Corbin Davenport 2022-12-18 17:22:16 -05:00
parent 915e0fe189
commit 902bfe950e
3 changed files with 17 additions and 2 deletions

View File

@ -30,4 +30,9 @@ document.querySelectorAll('input,select').forEach(function (el) {
})
})
// Open keyboard shortcut
document.querySelector('#mastodon-keyboard-shortcut').addEventListener('click', function() {
chrome.tabs.create({ url: 'chrome://extensions/shortcuts#:~:text=Share%20to%20Mastodon' })
})
loadSettings()

View File

@ -17,6 +17,12 @@
},
"default_title": "Share this page to Mastodon"
},
"commands": {
"_execute_action": {
"suggested_key": "Ctrl+Shift+S",
"description": "Share current page on Mastodon"
}
},
"permissions": [
"contextMenus",
"storage",

View File

@ -17,14 +17,18 @@
<body>
<div class="container-fluid">
<!-- Alert for no server -->
<div class="alert alert-primary d-none" id="mastodon-server-alert" role="alert">
<div class="alert alert-primary d-none mb-3" id="mastodon-server-alert" role="alert">
You have to enter a server before you can share links!
</div>
<!-- Server select -->
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Mastodon server</label>
<label for="mastodon-server" class="form-label">Mastodon server</label>
<input type="text" class="form-control" id="mastodon-server" placeholder="yourserver.social" disabled>
</div>
<!-- Link to keyboard shortcut -->
<div class="mb-3">
<button type="button" class="btn btn-sm btn-primary w-100" id="mastodon-keyboard-shortcut">Change keyboard shortcut</button>
</div>
<hr>
<p>If you find Share to Mastodon useful, please donate to support continued development. It would mean a lot!</p>
<div class="row mb-3">