NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Jira next-gen - Alt+click to open issues in new tab
// @namespace https://blog.vicshih.com/2021/04/jira-next-gen-open-task-in-new-tab.html
// @version 0.5
// @description Jira next-gen - Alt+click an issue to open in a new tab.
// @author Victor Shih
// @match https://*.atlassian.net/jira/*
// @grant none
// @updateURL https://openuserjs.org/meta/vshih/Jira_next-gen_-_Alt+click_to_open_issues_in_new_tab.meta.js
// @downloadURL https://openuserjs.org/install/vshih/Jira_next-gen_-_Alt+click_to_open_issues_in_new_tab.user.js
// @copyright 2022, vshih (https://openuserjs.org/users/vshih)
// @license GPL-3.0-or-later
// ==/UserScript==
(function ($) {
'use strict';
function openIssueInTab(event, href) {
if (event.altKey || event.which == 2) {
event.stopImmediatePropagation();
event.stopPropagation();
event.preventDefault();
window.open(href, '_blank');
if (event.button == 1) {
self.focus();
}
}
}
$(document.body)
// Backlog view.
.on('click auxclick', '[data-test-id*="software-backlog.card-list.card.content-container."]', function (event) {
const href = '/browse/' + $(this).data('test-id').split('.')[4];
openIssueInTab(event, href);
})
// Board view.
.on('click auxclick', '[data-test-id="platform-board-kit.ui.card.card"]', function (event) {
console.log('got click');
const href = '/browse/' + this.id.replace(/^card-/, '');
openIssueInTab(event, href);
})
// Roadmap view.
.on('click auxclick', '[data-test-id*="roadmap.timeline-table.components.list-item.container-"]', function (event) {
const href = $(this).find('a').attr('href');
openIssueInTab(event, href);
});
})(jQuery);