Created
May 11, 2017 18:35
-
-
Save dewert/3733afc01319f48334565bc6573deafb to your computer and use it in GitHub Desktop.
Link to PivotalTracker story from GitHub
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 Link to Pivotal from GitHub | |
// @namespace http://dvan.ca | |
// @version 0.1 | |
// @description Adds <a> tag to Pivotal story number in pull request | |
// @author De Wet van Niekerk | |
// @match https://github.com/* | |
// @grant none | |
// @require https://code.jquery.com/jquery-3.2.1.min.js | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// ==/UserScript== | |
waitForKeyElements('.js-issue-title', addPivotalLink); | |
function addPivotalLink(jNode) { | |
var myRegexp = /\[\#([0-9]+)\](.+)/; | |
var match = myRegexp.exec(jNode.html()); | |
jNode.html('<a href="https://www.pivotaltracker.com/story/show/'+match[1]+'">[#'+match[1]+']</a>'+match[2]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment