summaryrefslogtreecommitdiff
path: root/source/features/link-to-prior-blame-line.tsx
blob: 5092cdadbaa1a1c50b8ce801b4ad6109d29f0576 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import select from 'select-dom';
import * as pageDetect from 'github-url-detection';

import features from '.';

function init(): void {
	for (const link of select.all<HTMLAnchorElement>('.reblame-link')) {
		const lineNumber = link.closest('.blame-hunk')!.querySelector('.js-line-number[id]')!.id;
		link.hash = `#${lineNumber}`;
	}
}

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