Created
July 2, 2020 16:55
-
-
Save reneolivo/0b3bb1a8ced11810d7e5fdbecacb403c 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 Jira Issue Link | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://github.com/compucorp/*/pull/* | |
// @grant none | |
// ==/UserScript== | |
(() => { | |
const jiraBaseUrl = 'https://compucorp.atlassian.net/browse'; | |
const issueTitleElement = document.querySelector('.gh-header-title .js-issue-title'); | |
const issueNumber = /(\w+-\d+).+/.exec(issueTitleElement.innerText)[1]; | |
if (!issueNumber) { | |
return; | |
} | |
const issueLink = `<a href="${jiraBaseUrl}/${issueNumber}" target="_blank">${issueNumber}</a>`; | |
const issueTitleWithLink = issueTitleElement.innerText.replace(issueNumber, issueLink); | |
issueTitleElement.innerHTML = issueTitleWithLink; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment