Created
November 18, 2011 17:28
-
-
Save kborchers/1377124 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 GitHub - Show pull request numbers | |
// @match https://github.com/*/*/pulls | |
// @match https://github.com/*/*/pulls/* | |
// ==/UserScript== | |
[].slice.call( document.querySelectorAll( ".listings h3" ) ).forEach(function( elem ) { | |
var anchor = elem.getElementsByTagName( "a" )[ 0 ], | |
id = anchor.href.match( /(\d+)$/ )[ 0 ], | |
span = document.createElement( "span" ), | |
tracNum = anchor.innerHTML.match( /#(\d+)/ ), | |
spanHTML; | |
if( tracNum ) { | |
spanHTML = document.createElement( "a" ); | |
spanHTML.href = "http://bugs.jqueryui.com/ticket/" + tracNum[0].substr( 1 ); | |
spanHTML.target = "_blank"; | |
spanHTML.style.color = "#F00"; | |
spanHTML.innerHTML = id + ": "; | |
span.appendChild( spanHTML ); | |
anchor.parentNode.insertBefore( span, anchor ); | |
} else { | |
span.innerHTML = id + ": "; | |
anchor.insertBefore( span, anchor.childNodes[0] ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment