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() loadSettings()

View File

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

View File

@ -17,14 +17,18 @@
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
<!-- Alert for no server --> <!-- 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! You have to enter a server before you can share links!
</div> </div>
<!-- Server select --> <!-- Server select -->
<div class="mb-3"> <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> <input type="text" class="form-control" id="mastodon-server" placeholder="yourserver.social" disabled>
</div> </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> <hr>
<p>If you find Share to Mastodon useful, please donate to support continued development. It would mean a lot!</p> <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"> <div class="row mb-3">