Last active
November 26, 2018 13:48
-
-
Save CezaryDanielNowak/408b7bda4d887afec5a4e766e7591de9 to your computer and use it in GitHub Desktop.
This file contains 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 Add ticket description next to ID | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://10clouds.atlassian.net/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
setInterval(() => { | |
const idElem = document.querySelector('#key-val'); | |
const titleElem = document.querySelector('#summary-val'); | |
if (idElem && idElem.innerText.match(/^[A-Z]*-[0-9]*$/)) { | |
const ticketID = idElem.innerText; | |
const ticketDescription = titleElem.innerText; | |
idElem.innerText = `${ticketID} ${ticketDescription}`; | |
const x = document.createElement('input'); | |
x.value = `${window.location.origin}/browse/${ticketID} ${ticketDescription}`; | |
idElem.parentNode.parentNode.parentNode.insertBefore( x, idElem.parentNode.parentNode ); | |
x.style.float = 'right'; | |
x.style.width = '100px'; | |
x.style.lineHeight = '20px'; | |
x.click = x.onfocus = function () { this.select(); } | |
} | |
}, 2000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment