Last active
May 22, 2022 22:28
-
-
Save manuc66/52a6d6674bb075fe60d4acd869b5cbd9 to your computer and use it in GitHub Desktop.
Jira key & summary to Clipboard for commit log
This file contains hidden or 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 Jira key & summary to Clipboard for commit log | |
// @namespace sremy | |
// @version 2.0.1 | |
// @description Quick copy of task key and summary from JIRA to clipboard (for commit) | |
// @author Sébastien REMY, Emmanuel Counasse | |
// @match https://jira.atlassian.com/browse/* | |
// @match https://jira.*/browse/* | |
// @require https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js | |
// @require https://cdn.jsdelivr.net/npm/[email protected]/notify.min.js | |
// ==/UserScript== | |
var $ = jQuery; // or https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js | |
let clipboard = new ClipboardJS('#clipboardBtn', { | |
text: function(trigger) { | |
return $('#key-val').text() + ' - ' + $('#summary-val').text(); | |
} | |
}); | |
clipboard.on('success', function(e) { | |
$.notify("Copied to clipboard. " + e.text, "info"); | |
}); | |
clipboard.on('error', function(e) { | |
$.notify("Failed to copy", "error"); | |
}); | |
function init() { | |
'use strict'; | |
if(!$('#clipboardBtn').length) { | |
$('.aui-toolbar2-primary').append("<button id='clipboardBtn' class='aui-button aui-style'><img style='display: block;' src='https://clipboardjs.com/assets/images/clippy.svg' width='15' alt='Copy key and title to clipboard'></button>"); | |
} | |
} | |
$(document).ajaxComplete(init); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wider matching