GitHub: remove Pulse and Graphs tabs

This commit is contained in:
Shadowfacts 2016-09-10 16:30:15 -04:00
parent bee7ba2fef
commit c6fd26b760
No known key found for this signature in database
GPG Key ID: F802198A7D7F309D
1 changed files with 41 additions and 28 deletions

View File

@ -2,13 +2,27 @@
let repoUrl = $("div.repohead-details-container > h1.public > strong[itemprop=name] > a").attr("href"); let repoUrl = $("div.repohead-details-container > h1.public > strong[itemprop=name] > a").attr("href");
let currentUser = $("ul.header-nav.float-right > li:last > a > img").attr("alt").substring(1); let currentUser = $("ul.header-nav.float-right > li:last > a > img").attr("alt").substring(1);
// don't use the (ugly) new font // remove pulse tab
// $("body").css("font-family", $("body").css("font-family").replace("BlinkMacSystemFont,", "")); (function() {
let repoNav = $("nav.reponav");
if (repoNav.length <= 0) return;
repoNav.find(`a[href="${repoUrl}/pulse"]`).hide();
})();
// remove graphs tab
(function() {
let repoNav = $("nav.reponav");
if (repoNav.length <= 0) return;
repoNav.find(`a[href="${repoUrl}/graphs"]`).hide();
})();
// releases tab // releases tab
(function() { (function() {
let repoNav = $("nav.reponav"); let repoNav = $("nav.reponav");
if (repoNav.length > 0) { if (repoNav.length <= 0) return;
let releasesUrl = repoUrl + "/releases"; let releasesUrl = repoUrl + "/releases";
let releasesTab = $("<a></a>"); let releasesTab = $("<a></a>");
releasesTab.attr("href", releasesUrl); releasesTab.attr("href", releasesUrl);
@ -25,7 +39,7 @@ let currentUser = $("ul.header-nav.float-right > li:last > a > img").attr("alt")
counter.addClass("counter"); counter.addClass("counter");
releasesTab.append(counter); releasesTab.append(counter);
repoNav.append(releasesTab); repoNav.find("a:last").before(releasesTab);
$.ajax({ $.ajax({
url: "https://api.github.com/repos" + repoUrl + "/releases", url: "https://api.github.com/repos" + repoUrl + "/releases",
@ -41,7 +55,6 @@ let currentUser = $("ul.header-nav.float-right > li:last > a > img").attr("alt")
$("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