NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Qlik Git/Jira Links
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Link to Jira from Github
// @author Magnus HÃ¥kansson
// @match https://github.com/**
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// run-at document-end
// @grant none
// @license MIT
// ==/UserScript==
function doIt(node) {
$("p, pre, h1, a").each(function(k,v) {
var regex = new RegExp('([A-Z]+\-[0-9]+)', 'g');
var regexNot = new RegExp('([A-Z]+\-[0-9]+)"', 'g');
var match = regex.exec($(this).html());
var matchNot = regexNot.exec($(this).html());
while (match && !matchNot) {
var newText = $(this).html().replace(match[1], '<a href="https://jira.qlikdev.com/browse/' + match[1] + '">' + match[1] + "</a>");
$(this).html(newText);
match = regex.exec($(this).text());
matchNot = regexNot.exec($(this).text());
}
});
}
waitForKeyElements ("#commits_bucket, #discussion_bucket, #files_bucket, .subnav", doIt);