Skip to content

Commit

Permalink
Fix profile-hotkey (#3726)
Browse files Browse the repository at this point in the history
  • Loading branch information
yakov116 committed Nov 15, 2020
1 parent 7127351 commit 6ef2936
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/features/profile-hotkey.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import select from 'select-dom';
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 {
select('a[data-ga-click$="text:your profile"]')!.dataset.hotkey = 'g m';
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)
});

0 comments on commit 6ef2936

Please sign in to comment.