summaryrefslogtreecommitdiff
path: root/source/features/profile-hotkey.tsx
blob: 23c9ef84c24ceb2b7fdd8c79560db178f177a5b2 (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 onetime from 'onetime';

import features from '.';
import {getUsername} from '../github-helpers';

function init(): false | void {
	const menuItem = select(`a[href="/${getUsername()}"]`);
	if (!menuItem) {
		return false;
	}

	menuItem.dataset.hotkey = 'g m';
}

void features.add({
	id: __filebasename,
	description: 'Adds a keyboard shortcut to visit your own profile: `g` `m`.',
	screenshot: false,
	shortcuts: {
		'g m': 'Go to Profile'
	}
}, {
	init: onetime(init)
});