summaryrefslogtreecommitdiff
path: root/source/features/linkify-notification-repository-header.tsx
blob: 4af32884e50a41760c7b1a2b75efd6ae8ab69983 (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
import React from 'dom-chef';
import select from 'select-dom';
import features from '../libs/features';
import * as pageDetect from '../libs/page-detect';

function init(): void {
	for (const header of select.all('.js-notifications-group h6')) {
		header.append(
			<a className="text-inherit" href={'/' + header.textContent!.trim()}>
				{header.firstChild}
			</a>
		);
	}
}

features.add({
	id: __filebasename,
	description: 'Linkifies the header of each notification group (when grouped by repository).',
	screenshot: 'https://user-images.githubusercontent.com/1402241/80849887-81531c00-8c19-11ea-8777-7294ce318630.png'
}, {
	include: [
		pageDetect.isNotifications
	],
	init
});