Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@joejulian
Created December 6, 2018 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joejulian/12f2a5f7879d03f937cc0c42a53d7992 to your computer and use it in GitHub Desktop.
Save joejulian/12f2a5f7879d03f937cc0c42a53d7992 to your computer and use it in GitHub Desktop.
// ==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