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

import features from '.';

// eslint-disable-next-line import/prefer-default-export
export const botSelectors = [
	/* Commits */
	'.commit-author[href$="%5Bbot%5D"]:first-child',
	'.commit-author[href$="renovate-bot"]:first-child',
	'.commit-author[href$="scala-steward"]:first-child',

	/* Issues/PRs */
	'.opened-by [href*="author%3Aapp%2F"]',
	'.labels [href$="label%3Abot"]'
];

function init(): void {
	for (const bot of select.all(botSelectors)) {
		bot.closest('.commit, .Box-row')!.classList.add('rgh-dim-bot');
	}
}

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