blob: 78ba76a109ca91bebab956ef7cd16c3832ada853 (
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
|
import onetime from 'onetime';
import {isEnterprise} from 'github-url-detection';
import features from '../feature-manager.js';
import {getUsername} from '../github-helpers/index.js';
import {registerHotkey} from '../github-helpers/hotkey.js';
function init(signal: AbortSignal): void {
// This patterns also works on gist.github.com
const origin = isEnterprise() ? location.origin : 'https://github.com';
const profileLink = new URL(getUsername()!, origin);
registerHotkey('g m', profileLink.href, {signal});
}
void features.add(import.meta.url, {
shortcuts: {
'g m': 'Go to Profile',
},
init: onetime(init),
});
/*
Test URLs:
1. Visit any page
*/
|