Last active
March 22, 2019 18:53
-
-
Save dylanbeattie/1818634309693a32fcf99960a292a441 to your computer and use it in GitHub Desktop.
Javascript bookmarklet that will copy the selected stories in Pivotal Tracker to your clipboard as bullet points with Markdown hyperlinks
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
/* | |
This bookmarklet will let you select multiple stories in Pivotal Tracker and then | |
copy story details to your clipboard in Markdown format, as: | |
* Story name [#123456579](https://www.pivotaltracker.com/story/show/123456789) | |
* Story name [#123456579](https://www.pivotaltracker.com/story/show/123456789) | |
You can then paste this into your GitHub pull request description, then paste the resulting | |
rendered HTML into release emails, Slack, etc. | |
To use it, right-click the bookmarks bar, add a new bookmark, call it 'Pivotal Release' or somethign, | |
and paste the ENTIRE block of JavaScript into the URL: field | |
Happy releasing! | |
*/ | |
javascript:(function makeReleaseNotes() { | |
function copyToClipboard(str) { | |
const el = document.createElement('textarea'); | |
el.value = str; | |
document.body.appendChild(el); | |
el.select(); | |
document.execCommand('copy'); | |
document.body.removeChild(el); | |
}; | |
let notes = ""; | |
$("a.selector.selected").each(function(index, element) { | |
let $div = $(element).closest("div.story"); | |
let story_id = $div.data("id"); | |
let story_text = $div.find("span.story_name span.tracker_markup").text(); | |
notes += `* ${story_text} [#${story_id}](https://www.pivotaltracker.com/story/show/${story_id})\n`; | |
}); | |
copyToClipboard(notes); | |
alert('Copied to clipboard!'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment