Skip to content

Instantly share code, notes, and snippets.

@dewert
Created May 11, 2017 18:35
Show Gist options
  • Save dewert/3733afc01319f48334565bc6573deafb to your computer and use it in GitHub Desktop.
Save dewert/3733afc01319f48334565bc6573deafb to your computer and use it in GitHub Desktop.
Link to PivotalTracker story from GitHub
// ==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