Skip to content

Instantly share code, notes, and snippets.

@CezaryDanielNowak
Last active November 26, 2018 13:48
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 CezaryDanielNowak/408b7bda4d887afec5a4e766e7591de9 to your computer and use it in GitHub Desktop.
Save CezaryDanielNowak/408b7bda4d887afec5a4e766e7591de9 to your computer and use it in GitHub Desktop.
// ==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