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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
import './dim-bots.css';
import select from 'select-dom';
import * as pageDetect from 'github-url-detection';
import features from '.';
const botNames = [
'actions-user',
'bors',
'ImgBotApp',
'Octomerger',
'renovate-bot',
'rust-highfive',
'scala-steward',
'snyk-bot',
'web-flow',
];
const commitSelectors = botNames.map(bot => `.commit-author[href$="?author=${bot}"]`);
commitSelectors.push('.commit-author[href$="%5Bbot%5D"]'); // Generic `[bot]` label in author name
const commitSelector = commitSelectors.join(',');
const prSelectors = botNames.map(bot => `.opened-by [title="pull requests opened by ${bot}"]`);
prSelectors.push(
'.opened-by [href*="author%3Aapp%2F"]', // Search query `is:pr+author:app/*`
'.labels [href$="label%3Abot"]', // PR tagged with `bot` label
);
const prSelector = prSelectors.join(',');
function init(): void {
for (const bot of select.all(commitSelector)) {
// Exclude co-authored commits
if (select.all('a', bot.parentElement!).every(link => link.matches(commitSelector))) {
bot.closest('.commit, .Box-row')!.classList.add('rgh-dim-bot');
}
}
for (const bot of select.all(prSelector)) {
bot.closest('.commit, .Box-row')!.classList.add('rgh-dim-bot');
}
// Delay collapsing, but only after they're collapsed on load #5158
requestAnimationFrame(() => {
select('#repo-content-pjax-container .js-navigation-container')!.classList.add('rgh-dim-bots--after-hover');
});
}
void features.add(import.meta.url, {
include: [
pageDetect.isCommitList,
pageDetect.isConversationList,
],
exclude: [
pageDetect.isBlank, // Prevent error on empty milestone list #5544
],
deduplicate: 'has-rgh-inner',
init,
});
|