MCPcopy Create free account
hub / github.com/refined-github/refined-github / linkify

Function linkify

source/features/open-issue-to-latest-comment.tsx:14–29  ·  view source on GitHub ↗
(item: HTMLElement)

Source from the content-addressed store, hash-verified

12}
13
14function linkify(item: HTMLElement): void {
15 if (item instanceof HTMLAnchorElement) {
16 // Only PR lists are already linked
17 item.hash = getHash('pr');
18 } else {
19 // The box hash must be determine by conversation type because (React) issue lists might contain links to PRs too
20 const conversationLink = $([
21 'a[href*="/issues/"]',
22 'a[href*="/pull/"]',
23 ], closestElement('li', item));
24 const url = new URL(conversationLink.href);
25 const type = pageDetect.isIssue(url) ? 'issue' : 'pr';
26 url.hash = getHash(type);
27 wrapAll(<a href={url.href} className="Link--muted d-flex gap-1" />, ...item.childNodes);
28 }
29}
30
31function init(signal: AbortSignal): void {
32 observe(commentsCountInLists, linkify, {signal});

Callers

nothing calls this directly

Calls 2

getHashFunction · 0.85
wrapAllFunction · 0.85

Tested by

no test coverage detected