Created
March 23, 2017 15:37
-
-
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.
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
// 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