-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.user.js
37 lines (29 loc) · 943 Bytes
/
main.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// ==UserScript==
// @name Jira Burndown Open Issue
// @namespace Violentmonkey Scripts
// @match https://carscommerce.atlassian.net/jira/software/c/projects/*/reports/burndown-chart
// @grant none
// @description Opens points (issues) on the burndown in a new tab
// ==/UserScript==
const CLICK_AREA_SELECTOR = "#ghx-chart-view";
const ISSUE_KEY_SELECTOR = "#ghx-tooltip-content-container>strong";
const BASE_JIRA_URL = "https://carscommerce.atlassian.net/browse/";
function getIssueKey() {
return document.querySelector(ISSUE_KEY_SELECTOR).innerText;
}
function makeUrl() {
return BASE_JIRA_URL + getIssueKey();
}
function openIssue() {
window.open(makeUrl(), "_blank");
}
function attachListener() {
const clickArea = document.querySelector(CLICK_AREA_SELECTOR);
if (!clickArea) {
// recurse
setTimeout(attachListener, "1000");
return;
}
clickArea.addEventListener("click", openIssue);
}
attachListener();