Last active
April 8, 2021 18:44
-
-
Save hlship/8300ea44c562ed8a8e7d16c5cde5fa67 to your computer and use it in GitHub Desktop.
Greasemonkey Script to copy issue number / description to clipboard
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 Tag | |
// @description Copies the text of the JIRA issue number and description to the clipboard | |
// @version 2 | |
// @grant GM.notification | |
// @grant GM.setClipboard | |
// @include https://jira.walmart.com/browse/* | |
// ==/UserScript== | |
let key = document.getElementById("key-val") | |
let summary = document.getElementById("summary-val") | |
let tag = document.createElement("span") | |
tag.className = "aui-icon aui-icon-small aui-iconfont-tag" | |
tag.style = "cursor: pointer" | |
tag.title = "Click to copy JIRA key/summary to clipboard" | |
tag.innerHTML = "Copy Issue Tag" | |
let md = document.createElement("span") | |
md.className = "aui-icon aui-icon-small aui-iconfont-link" | |
md.style = "cursor:pointer" | |
md.title = "Click to copy MarkDown link to clipboard" | |
md.innerHTML = "Copy Issue Link" | |
key.parentNode.append(tag) | |
key.parentNode.append(md) | |
tag.addEventListener("click", function(me) { | |
let text = key.textContent.trim() + " - " + summary.textContent.trim() | |
GM.setClipboard(text) | |
GM.notification({text: "JIRA tag copied to clipboard"}) | |
}) | |
md.addEventListener("click", function(me) { | |
let issueId = key.textContent.trim() | |
let text = "[" + issueId + "](https://jira.walmart.com/browse/" + issueId + ")" | |
GM.setClipboard(text) | |
GM.notification({text: "JIRA link copied to clipboard"}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment