Skip to content

Instantly share code, notes, and snippets.

@victorb
Last active September 5, 2016 21:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victorb/5eb6502328bd2ed902ce5293ad80f33c to your computer and use it in GitHub Desktop.
Save victorb/5eb6502328bd2ed902ce5293ad80f33c to your computer and use it in GitHub Desktop.
Makes it clear if you're on a private Github repository or not by making the header background BLACK!
// ==UserScript==
// @name GithubPrivate
// @namespace github
// @description Makes sure you know if a Github repository is Private or not
// @include https://github.com/*
// @version 1
// @grant none
// ==/UserScript==
(function() {
var current_url = window.location.href
var emptyArray = []
var isPrivate = document.querySelector('.label.label-private.v-align-middle') !== null
function main() {
if (isPrivate) {
var header = document.querySelector('.repohead.experiment-repo-nav')
header.style.backgroundColor = '#000'
var listItems = document.querySelectorAll('.reponav-item')
emptyArray.forEach.call(listItems, function (item) {
item.style.color = 'white';
})
document.querySelector('.reponav-item.selected').style.color = '#000'
var topLinks = document.querySelectorAll('.private a');
emptyArray.forEach.call(topLinks, function (link) {
link.style.color = '#95b6e0';
})
}
}
// Yes, this is shitty indeed but no other way to figure out when Github is changing pages...
if (isPrivate) {
main()
setInterval(function () {
if (current_url !== window.location.href) {
main()
}
}, 300)
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment