Linkify branch references

This commit is contained in:
Shadowfacts 2016-09-09 17:21:39 -04:00
parent e0be008389
commit 1ab78ebc5f
No known key found for this signature in database
GPG Key ID: F802198A7D7F309D
1 changed files with 13 additions and 1 deletions

View File

@ -52,4 +52,16 @@ if (!location.hostname.startsWith("gist")) {
exploreItem.append(exploreLink);
lastItem.before(exploreItem);
}
}
}
// linkify branch references in PRs
$("span.commit-ref").each((i, el) => {
el = $(el);
let bits = el.attr("title").split(":");
let repo = bits[0];
let branch = bits[1];
let link = $("<a></a>");
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>");