Last active
January 20, 2017 08:34
-
-
Save fokot/de0c3b6ebe6e6e541d249cf6db45d818 to your computer and use it in GitHub Desktop.
JIRA 2 git commit name - tampermonkey plugin
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
// ==UserScript== | |
// @name JIRA2Git | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://ceai-io.atlassian.net/browse/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.querySelector('#stalker div.aui-page-header-image').onclick = function(e) { | |
function val (id) { | |
return document.getElementById(id).textContent; | |
} | |
if(e.shiftKey || e.altKey || e.ctrlKey || e.metaKey){ | |
var b = val('key-val') + '-' + val('summary-val'); | |
var branchName = b.replace(/\s/g, '-').replace(':', '-').replace(/-+/g, '-').replace("'", '').replace("(", '/').replace(")", '/').replace(":", '-').replace("[", '/').replace("]", '/').replace("}", '/').replace("}", '/').replace("&", 'and'); | |
window.prompt ("Copy to clipboard: Ctrl+C, Enter", branchName); | |
} else { | |
var bb = val('key-val') + ' - ' + val('summary-val'); | |
window.prompt ("Copy to clipboard: Ctrl+C, Enter", bb); | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment