blob: b53578350f828b470b5b0fb9bdd17d0b2822edfa (
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
34
35
|
import select from 'select-dom';
import * as pageDetect from 'github-url-detection';
import features from '.';
import fetchDom from '../helpers/fetch-dom';
async function bypass(detailsLink: HTMLAnchorElement): Promise<void> {
const directLink = await fetchDom<HTMLAnchorElement>(
detailsLink.href,
'[data-hydro-click*="check_suite.external_click"]'
);
if (directLink) {
detailsLink.href = directLink.href;
}
}
async function init(): Promise<void> {
// This selector excludes URLs that are already external
const thirdPartyApps = select.all<HTMLAnchorElement>('a:not([href="/apps/github-actions"]) ~ div .status-actions[href^="/"]');
// If anything errors, RGH will display the error next to the feature name
await Promise.all(thirdPartyApps.map(bypass));
}
void features.add({
id: __filebasename,
description: 'Bypasses the "Checks" interstitial when clicking the "Details" links on a PR Checks added by third-party services like Travis.',
screenshot: 'https://user-images.githubusercontent.com/2103975/49071220-c6596e80-f22d-11e8-8a1e-bdcd62aa6ece.png'
}, {
include: [
pageDetect.isPRConversation
],
init
});
|