(wrapper: HTMLElement)
| 7 | import observe from '../helpers/selector-observer.js'; |
| 8 | |
| 9 | function linkifyContent(wrapper: HTMLElement): void { |
| 10 | // Mark code block as touched to avoid `shorten-links` from acting on these new links in code |
| 11 | wrapper.classList.add(linkifiedUrlClass); |
| 12 | |
| 13 | linkifyUrls(wrapper); |
| 14 | |
| 15 | const currentRepo = pageDetect.isGlobalSearchResults() |
| 16 | // Look for the link on the line number |
| 17 | ? getRepo($('.blob-num a', wrapper.parentElement!).href) |
| 18 | : getRepo(); |
| 19 | // Some non-repo pages like gists have issue references #3844 |
| 20 | // They make no sense, but we still want `linkifyURLs` to run there |
| 21 | if (!currentRepo) { |
| 22 | return; |
| 23 | } |
| 24 | |
| 25 | // $$optional because the content might not have any comments |
| 26 | for (const element of $$optional('.pl-c', wrapper)) { |
| 27 | linkifyIssues(currentRepo, element); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | function init(signal: AbortSignal): void { |
| 32 | observe(codeElementsSelector, linkifyContent, {signal}); |
nothing calls this directly
no test coverage detected