summaryrefslogtreecommitdiff
path: root/source/features/rgh-linkify-yolo-issues.tsx
blob: e1868dba50278ba29d8d15c6d484db56d96778db (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
32
33
import * as pageDetect from 'github-url-detection';

import features from '../feature-manager.js';
import {isRefinedGitHubYoloRepo} from '../github-helpers/index.js';
import observe from '../helpers/selector-observer.js';
import {createRghIssueLink} from '../helpers/rgh-issue-link.js';

// Linkify with hovercards
function linkify(issueCell: HTMLElement): void {
	issueCell.replaceChildren(createRghIssueLink(issueCell.textContent));
}

function init(signal: AbortSignal): void {
	// .js-csv-data is the old selector
	observe(':is(.js-csv-data, .react-csv-row) td:nth-child(3)', linkify, {signal});
}

void features.add(import.meta.url, {
	asLongAs: [
		isRefinedGitHubYoloRepo,
		pageDetect.isSingleFile,
		() => location.pathname.endsWith('broken-features.csv'),
	],
	init,
});

/*

Test URLs:

https://github.com/refined-github/yolo/blob/main/broken-features.csv

*/