Last active
September 26, 2016 02:15
-
-
Save tkrkt/cab0b40ffe6edc73c6e3 to your computer and use it in GitHub Desktop.
Add "MyGists" link to GitHub Gist's header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name MyGists | |
// @namespace jp.tkrkt | |
// @description Add MyGists Button on Gist | |
// @include https://gist.github.com/* | |
// @version 3 | |
// @grant none | |
// ==/UserScript== | |
var meta = document.querySelector('meta[name=user-login]'); | |
if (meta){ | |
var user = meta.getAttribute('content'); | |
var container = document.querySelector('.header-nav[role=navigation]'); | |
var li = document.createElement('li'); | |
li.setAttribute('class', 'header-nav-item'); | |
var a = document.createElement('a'); | |
a.setAttribute('class', 'header-nav-link'); | |
a.setAttribute('href', '/' + user); | |
a.textContent = 'My Gists'; | |
li.appendChild(a); | |
container.insertBefore(li, container.firstChild); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment