Wrap everything in IIFEs
This commit is contained in:
parent
553a0b05d3
commit
d4e0d31a90
|
@ -5,8 +5,9 @@ let repoUrl = $("div.repohead-details-container > h1.public > strong[itemprop=na
|
||||||
// $("body").css("font-family", $("body").css("font-family").replace("BlinkMacSystemFont,", ""));
|
// $("body").css("font-family", $("body").css("font-family").replace("BlinkMacSystemFont,", ""));
|
||||||
|
|
||||||
// releases tab
|
// releases tab
|
||||||
let repoNav = $("nav.reponav");
|
(function() {
|
||||||
if (repoNav.length > 0) {
|
let repoNav = $("nav.reponav");
|
||||||
|
if (repoNav.length > 0) {
|
||||||
let releasesUrl = repoUrl + "/releases";
|
let releasesUrl = repoUrl + "/releases";
|
||||||
let releasesTab = $("<a></a>");
|
let releasesTab = $("<a></a>");
|
||||||
releasesTab.attr("href", releasesUrl);
|
releasesTab.attr("href", releasesUrl);
|
||||||
|
@ -38,10 +39,12 @@ if (repoNav.length > 0) {
|
||||||
$("nav.reponav > span:first > a").removeClass("selected");
|
$("nav.reponav > span:first > a").removeClass("selected");
|
||||||
releasesTab.addClass("selected");
|
releasesTab.addClass("selected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
// add explore link to menu
|
// add explore link to menu
|
||||||
if (!location.hostname.startsWith("gist")) {
|
(function() {
|
||||||
|
if (!location.hostname.startsWith("gist")) {
|
||||||
let lastItem = $(".header-nav[role=navigation] > .header-nav-item:last");
|
let lastItem = $(".header-nav[role=navigation] > .header-nav-item:last");
|
||||||
|
|
||||||
if (lastItem.find("a.header-nav-link").text() != "Explore") {
|
if (lastItem.find("a.header-nav-link").text() != "Explore") {
|
||||||
|
@ -54,10 +57,12 @@ if (!location.hostname.startsWith("gist")) {
|
||||||
exploreItem.append(exploreLink);
|
exploreItem.append(exploreLink);
|
||||||
lastItem.before(exploreItem);
|
lastItem.before(exploreItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
// linkify branch references in PRs
|
// linkify branch references in PRs
|
||||||
$("span.commit-ref").each((i, el) => {
|
(function() {
|
||||||
|
$("span.commit-ref").each((i, el) => {
|
||||||
el = $(el);
|
el = $(el);
|
||||||
let bits = el.attr("title").split(":");
|
let bits = el.attr("title").split(":");
|
||||||
let repo = bits[0];
|
let repo = bits[0];
|
||||||
|
@ -65,8 +70,9 @@ $("span.commit-ref").each((i, el) => {
|
||||||
let link = $("<a></a>");
|
let link = $("<a></a>");
|
||||||
link.attr("href", `https://github.com/${repo}/tree/${branch}`);
|
link.attr("href", `https://github.com/${repo}/tree/${branch}`);
|
||||||
el.wrap(link);
|
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
|
// linkify issue/pr references in issue titles
|
||||||
(function() {
|
(function() {
|
||||||
|
|
Loading…
Reference in New Issue