summaryrefslogtreecommitdiff
path: root/source/features/rgh-linkify-yolo-issues.tsx
blob: cabd6a29f74c8aaa1f26e3587916e18afa30494e (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
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 {linkifyIssues} from '../github-helpers/dom-formatters.js';

// Linkify with hovercards
function linkify(issueCell: HTMLElement): void {
	issueCell.textContent = '#' + issueCell.textContent!;
	linkifyIssues({owner: 'refined-github', name: 'refined-github'}, issueCell);
}

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,
});