Skip to content

Instantly share code, notes, and snippets.

@kevincolten
Created June 18, 2018 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevincolten/4dffb4060521f4936e2142e102eae8d4 to your computer and use it in GitHub Desktop.
Save kevincolten/4dffb4060521f4936e2142e102eae8d4 to your computer and use it in GitHub Desktop.
Pivotal-GH Bookmarklet
// Convert to a bookmarklet at https://mrcoles.com/bookmarklet/
[...document.querySelectorAll('[data-id] a:not([aria-label])')]
.filter(el => el.href.includes('/c4eo/align-rails/pull/'))
.forEach(el => {
const tickets = el.innerText.split(']').join(' ').split('[').join(' ').split(',').join(' ').split(' ').filter(str => str[0] === '#');
const ticketEls = tickets.map(ticket => `
<a class="d-inline-block IssueLabel v-align-text-top labelstyle-de752c linked-labelstyle-de752c" style="background-color: #de752c; color: #ffffff; margin-right: 4px" title="${ticket}" href="https://www.pivotaltracker.com/n/projects/1519937/stories/${ticket.slice(1)}" target="_blank">${ticket}</a>
`);
el.parentNode.insertAdjacentHTML('beforeend', `<span class="labels lh-default">${ticketEls.join('')}</span>`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment