Created
December 6, 2018 21:27
-
-
Save joejulian/12f2a5f7879d03f937cc0c42a53d7992 to your computer and use it in GitHub Desktop.
Make Jira open links in a new tab. Code courtesy of Peter Regin https://www.reddit.com/r/jira/comments/8gsv03/greasemonkey_script_to_open_external_links_in_new/dylydyy/
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