Created
December 6, 2018 21:26
-
-
Save joejulian/76eecdb6053694e3469911baed53fdd8 to your computer and use it in GitHub Desktop.
Make Jira open links in a new tab.
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 Links in new tab | |
// @description Target _blank | |
// @match https://jira.mesosphere.com/* | |
// @grant none | |
// @version 1.0.1 | |
// ==/UserScript== | |
function init() { | |
$("a") | |
.each(function() { | |
var href = $(this) | |
.attr("href"); | |
if (href !== undefined && (href.indexOf("http://") >= 0 || href.indexOf("https://") >= 0)) { | |
$(this) | |
.attr("target", "_blank"); | |
} | |
}); | |
} | |
window.addEventListener("load", function() { | |
setTimeout(init, 2000); | |
$(document) | |
.bind("DOMSubtreeModified", function() { | |
init(); | |
}); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment