summaryrefslogtreecommitdiff
path: root/source/features/dim-bots.tsx
blob: 441b476b8ccd57d4b014b368cb7464502f48a435 (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
29
30
import './dim-bots.css';
import select from 'select-dom';
import * as pageDetect from 'github-url-detection';
import features from '../libs/features';

function init(): void {
	const bots = select.all([
		/* Commits */
		'.commit-author[href$="%5Bbot%5D"]:first-child',
		'.commit-author[href$="renovate-bot"]:first-child',

		/* Issues/PRs */
		'.opened-by [href*="author%3Aapp%2F"]'
	]);
	for (const bot of bots) {
		bot.closest('.commit, .Box-row')!.classList.add('rgh-dim-bot');
	}
}

features.add({
	id: __filebasename,
	description: 'Dims commits and PRs by bots to reduce noise.',
	screenshot: 'https://user-images.githubusercontent.com/1402241/65263190-44c52b00-db36-11e9-9b33-d275d3c8479d.gif'
}, {
	include: [
		pageDetect.isCommitList,
		pageDetect.isDiscussionList
	],
	init
});