summaryrefslogtreecommitdiff
path: root/source/features/star-repo-hotkey.tsx
blob: 61cd8f79594a1a8161b954f9e5da1e03b98d44a3 (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
import select from 'select-dom';
import * as pageDetect from 'github-url-detection';

import features from '.';

function init(): void {
	// There are two buttons: unstar and star
	for (const button of select.all('.js-social-form > button')) {
		button.dataset.hotkey = 'g s';
	}
}

void features.add({
	id: __filebasename,
	description: 'Adds a keyboard shortcut to star/unstar the current repo: `g` `s`.',
	screenshot: false,
	shortcuts: {
		'g s': 'Star and unstar repository'
	}
}, {
	include: [
		pageDetect.isRepo
	],
	init
});