Created
January 14, 2019 15:31
-
-
Save comm1x/b4af28967a17ff2f8eff8d22f124e1bb to your computer and use it in GitHub Desktop.
Add button "Copy task name" to JIRA
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 Copy jira task name | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://kafoodle.atlassian.net/browse/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const copyToClipboard = str => { | |
const el = document.createElement('textarea'); | |
el.value = str; | |
el.setAttribute('readonly', ''); | |
el.style.position = 'absolute'; | |
el.style.left = '-9999px'; | |
document.body.appendChild(el); | |
el.select(); | |
document.execCommand('copy'); | |
document.body.removeChild(el); | |
}; | |
const copyTaskName = () => { | |
var i = $(".issue-link:first").text(); | |
var d = $("#summary-val").text(); | |
var desc = i + " " + d; | |
copyToClipboard(desc); | |
}; | |
var btn = document.createElement("button"); | |
btn.onclick = copyTaskName; | |
btn.innerText = "Copy task name"; | |
document.querySelector(".aui-nav-breadcrumbs").append(btn); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment