summaryrefslogtreecommitdiff
path: root/source/features/linkify-commit-sha.tsx
blob: 913aa0dc56722984c1fbed8e51c5ccd864207b70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import React from 'dom-chef';
import select from 'select-dom';
import * as pageDetect from 'github-url-detection';

import {wrap} from '../helpers/dom-utils';
import features from '.';

function init(): void {
	const element = select('.sha.user-select-contain');
	if (element) {
		wrap(element, <a href={location.pathname.replace(/pull\/\d+\/commits/, 'commit')}/>);
	}
}

void features.add(__filebasename, {
	include: [
		pageDetect.isPRCommit
	],
	init
});