Skip to content

Instantly share code, notes, and snippets.

@floriangouy
Created March 23, 2017 15:37
Show Gist options
  • Save floriangouy/29dc2303a75ac7bb5d7f0c8a2439897b to your computer and use it in GitHub Desktop.
Save floriangouy/29dc2303a75ac7bb5d7f0c8a2439897b to your computer and use it in GitHub Desktop.
Bookmarklet: Generate a Git commit message from your Redmine task or Mantis bug web page.
// Transform this source into a bookmarklet on http://bookmarklets.org/maker/
var url = window.location.href;
// Redmine Issue -> Git Commit Message
if (url.indexOf('redmine') > -1) {
var story = window.document.querySelectorAll('#content .subject p')[0].innerText;
var task = window.document.querySelectorAll('#content h2')[0].innerText;
var detail = window.document.querySelectorAll('#content .subject h3')[0].innerText;
var message = url + ' ' + story + ' - ' + task + ': ' + detail;
window.alert(message);
// Mantis Bug -> Git Commit Message
} else if (url.indexOf('mantis') > -1) {
var bug = window.document.querySelectorAll('td[colspan="5"]')[0].innerText;
var message = url + ' ' + bug;
window.alert(message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment