Linkify issue/pr references in issue titles

This commit is contained in:
Shadowfacts 2016-09-09 17:55:40 -04:00
parent 1ab78ebc5f
commit 553a0b05d3
No known key found for this signature in database
GPG Key ID: F802198A7D7F309D
1 changed files with 12 additions and 2 deletions

View File

@ -1,10 +1,12 @@
// utils
let repoUrl = $("div.repohead-details-container > h1.public > strong[itemprop=name] > a").attr("href");
// don't use the (ugly) new font
// $("body").css("font-family", $("body").css("font-family").replace("BlinkMacSystemFont,", ""));
// releases tab
let repoNav = $("nav.reponav");
if (repoNav.length > 0) {
let repoUrl = $("div.repohead-details-container > h1.public > strong[itemprop=name] > a").attr("href");
let releasesUrl = repoUrl + "/releases";
let releasesTab = $("<a></a>");
releasesTab.attr("href", releasesUrl);
@ -64,4 +66,12 @@ $("span.commit-ref").each((i, el) => {
link.attr("href", `https://github.com/${repo}/tree/${branch}`);
el.wrap(link);
});
$("body").after("<style>span.commit-ref:hover, span.commit-ref:hover span { text-decoration: underline; }</style>");
$("body").after("<style>span.commit-ref:hover, span.commit-ref:hover span { text-decoration: underline; }</style>");
// linkify issue/pr references in issue titles
(function() {
let title = $("span.js-issue-title");
if (/#(\d+)/.test(title.text())) {
title.html(title.text().replace(/#(\d+)/, `<a href="${repoUrl}/issues/$1">#$1</a>`));
}
})();