summaryrefslogtreecommitdiff
path: root/source/features/profile-hotkey.tsx
blob: 8abc9a6455ddf1fe2e2af4b431debc49d9403f02 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import React from 'dom-chef';
import onetime from 'onetime';
import {isEnterprise} from 'github-url-detection';

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

function init(): void {
	const profileLink = (isEnterprise() ? location.origin : 'https://github.com') + '/' + getUsername();
	document.body.append(<a hidden data-hotkey="g m" href={profileLink}/>);
}

void features.add(__filebasename, {
	shortcuts: {
		'g m': 'Go to Profile'
	},
	awaitDomReady: false,
	init: onetime(init)
});