Skip to content

Instantly share code, notes, and snippets.

@comm1x
Created January 14, 2019 15:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save comm1x/b4af28967a17ff2f8eff8d22f124e1bb to your computer and use it in GitHub Desktop.
Save comm1x/b4af28967a17ff2f8eff8d22f124e1bb to your computer and use it in GitHub Desktop.
Add button "Copy task name" to JIRA
// ==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