blob: e86fcc68d341d8af7d0033420764d5e1782db2c6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import select from 'select-dom';
import * as pageDetect from 'github-url-detection';
import features from '.';
function addQuickSubmit(): void {
select('textarea[aria-label="Describe this release"]')?.classList.add('js-quick-submit');
}
function init(): void {
const createReleaseButton = select('a[href$="/releases/new"]:not([data-hotkey])');
if (createReleaseButton) {
createReleaseButton.dataset.hotkey = 'c';
}
}
void features.add({
id: __filebasename,
description: 'Adds a keyboard shortcut to create a new release while on the Releases page: `c`.',
screenshot: false,
shortcuts: {
c: 'Create a new release',
'control enter': 'Publish a release'
}
}, {
include: [
pageDetect.isReleasesOrTags
],
init
}, {
include: [
pageDetect.isReleasesOrTags, // If the release couldn't be published, GitHub changes the url to /releases while still being on the "New release" page
pageDetect.isNewRelease,
pageDetect.isEditingRelease
],
init: addQuickSubmit
});
|