Skip to content
3 changes: 1 addition & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ GitHub Enterprise is also supported. More info in the options.
<p><img src="https://user-images.githubusercontent.com/1402241/35192861-3f4a1bf6-fecc-11e7-8b9f-35ee019c6cdf.gif">
<tr>
<th width="50%">
<p><a title="linkify-code"></a> Linkifies issue/PR references and URLs in code
<p><a title="linkify-code"></a> Linkifies issue/PR references and URLs in code and conversation titles
<p><img src="https://cloud.githubusercontent.com/assets/170270/25370217/61718820-29b3-11e7-89c5-2959eaf8cac8.png">
<th width="50%">
<p><a title="restore-file"></a> Adds a button to revert all the changes to a file in a PR
Expand Down Expand Up @@ -319,7 +319,6 @@ Thanks for contributing! 🦋🙌
- [](# "close-out-of-view-modals") [Automatically closes dropdown menus when they’re no longer visible.](https://user-images.githubusercontent.com/1402241/37022353-531c676e-2155-11e8-96cc-80d934bb22e0.gif)
- [](# "deprioritize-marketplace-link") Moves the "Marketplace" link from the black header bar to the profile dropdown.
- [](# "parse-backticks") [Renders `` `text in backticks` `` in issue titles, commit titles and more places.](https://user-images.githubusercontent.com/170270/55060505-31179b00-50a4-11e9-99a9-c3691ba38d66.png)
- [](# "format-conversation-titles") [Makes issue/PR references in issue/PR titles clickable and renders `` `text in backticks` ``.](https://user-images.githubusercontent.com/22439276/58927232-71ae2780-876b-11e9-941e-bb56a7389123.png)
- [](# "trending-menu-item") Adds a `Trending` link to the global navbar and a keyboard shortcut: <kbd>g</kbd> <kbd>t</kbd>.
- [](# "navigate-pages-with-arrow-keys") Adds shortcuts to navigate through pages with pagination: <kbd>←</kbd> and <kbd>→</kbd>.
- [](# "open-all-notifications") [Adds a button to open all your unread notifications at once.](https://user-images.githubusercontent.com/1402241/80861295-fbad8b80-8c6d-11ea-87a4-8025fbc3a3f4.png)
Expand Down
38 changes: 0 additions & 38 deletions source/features/format-conversation-titles.tsx

This file was deleted.

18 changes: 18 additions & 0 deletions source/features/linkify-code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ import {observe} from 'selector-observer';
import * as pageDetect from 'github-url-detection';

import features from '.';
import onConversationHeaderUpdate from '../github-events/on-conversation-header-update';
import {linkifiedURLClass, linkifyURLs, linkifyIssues} from '../github-helpers/dom-formatters';

function initTitle(): void {
for (const title of select.all('.js-issue-title')) {
if (!select.exists('a', title)) {
linkifyIssues(title);
}
}
}

function init(): void {
const selectors = [
'.js-blob-wrapper',
Expand Down Expand Up @@ -42,4 +51,13 @@ void features.add(__filebasename, {
pageDetect.isGist
],
init: onetime(init)
}, {
include: [
pageDetect.isPR,
pageDetect.isIssue
],
additionalListeners: [
onConversationHeaderUpdate
],
init: initTitle
});
1 change: 0 additions & 1 deletion source/features/parse-backticks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ function init(): void {
'#user-repositories-list [itemprop="description"]', // `isUserProfileRepoTab` repository description
'.js-hovercard-content > .Popover-message .link-gray-dark', // Hovercard (GHE)
'.js-hovercard-content > .Popover-message .Link--primary', // Hovercard
'.js-issue-title', // `isDiscussion`
'a[data-hovercard-type="discussion"]' // `isDiscussionList`
].map(selector => selector + ':not(.rgh-backticks-already-parsed)').join();

Expand Down
22 changes: 20 additions & 2 deletions source/features/rgh-linkify-features.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@ import * as pageDetect from 'github-url-detection';
import {wrap} from '../helpers/dom-utils';
import features from '.';
import {isNotRefinedGitHubRepo} from '../github-helpers';
import onConversationHeaderUpdate from '../github-events/on-conversation-header-update';

// eslint-disable-next-line import/prefer-default-export
export function linkifyFeature(codeElement: HTMLElement): void {
function linkifyFeature(codeElement: HTMLElement): void {
const id = codeElement.textContent as FeatureID;
if (features.list.includes(id) && !codeElement.closest('a')) {
wrap(codeElement, <a href={`/sindresorhus/refined-github/blob/main/source/features/${id}.tsx`}/>);
}
}

function initTitle(): void {
for (const possibleFeature of select.all('.js-issue-title code')) {
linkifyFeature(possibleFeature);
}
}

function init(): void {
for (const possibleMention of select.all('.js-comment-body code')) {
linkifyFeature(possibleMention);
Expand All @@ -28,4 +34,16 @@ void features.add(__filebasename, {
isNotRefinedGitHubRepo
],
init
}, {
include: [
pageDetect.isPR,
pageDetect.isIssue
],
exclude: [
isNotRefinedGitHubRepo
],
additionalListeners: [
onConversationHeaderUpdate
],
init: initTitle
});
1 change: 0 additions & 1 deletion source/refined-github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ import './features/wait-for-build';
import './features/hide-inactive-deployments';
import './features/pull-request-hotkey';
import './features/quick-review-buttons';
import './features/format-conversation-titles';
import './features/embed-gist-inline';
import './features/comments-time-machine-links';
import './features/hide-issue-list-autocomplete';
Expand Down