Forked from lcorneliussen/jira-extract-issue-links.js
Last active
August 29, 2016 18:15
-
-
Save mheiniger/6181dc4115c0a218c2b2 to your computer and use it in GitHub Desktop.
Extract issues from Jira for copy&paste
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
/* Create the bookmarklet here: http://mrcoles.com/bookmarklet/ */ | |
/* copy selected issues from agile planning lists */ | |
var issues = jQuery('.ghx-selected') | |
.filter('.js-issue') | |
.map(function(i, issue) { | |
var k = jQuery(issue).attr("data-issue-key"); | |
var s = jQuery(issue).find('.ghx-summary').attr("title"); | |
var type = jQuery(issue).find('.ghx-type').attr("title"); | |
var link = jQuery(issue).find('.js-key-link').attr("href"); | |
return { key: k, summary: s, type: type, link: link} | |
}).toArray(); | |
/* copy issue from open issue */ | |
var t = document.title.replace(" - JIRA", ""); | |
var match = t.match(/\[(.*)\]/); | |
if (match) { | |
var k = match[1]; | |
issues.push({ key: k, summary: t.replace("[" + k + "] ", "")}) | |
} | |
/* create list */ | |
var host = window.location.protocol + "//" + window.location.hostname; | |
var links = jQuery.map(issues, function(i){ | |
return i.type + ": [" + i.key + "] " + host + i.link + " " + i.summary; | |
}); | |
window.prompt ("Copy to clipboard: Ctrl+C, Enter", links.join("\r\n")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment