Last active
November 1, 2016 16:06
-
-
Save grafuls/9b94d8e5e5e679fb407164c90545557f to your computer and use it in GitHub Desktop.
gerrit bookmark for copying refs for jenkins
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
javascript:(function(){ | |
function copyTextToClipboard(text) { | |
var textArea = document.createElement("textarea"); | |
textArea.style.position = 'fixed'; | |
textArea.style.top = 0; | |
textArea.style.left = 0; | |
textArea.style.width = '2em'; | |
textArea.style.height = '2em'; | |
textArea.style.padding = 0; | |
textArea.style.border = 'none'; | |
textArea.style.outline = 'none'; | |
textArea.style.boxShadow = 'none'; | |
textArea.style.background = 'transparent'; | |
textArea.value = text; | |
document.body.appendChild(textArea); | |
textArea.select(); | |
try { | |
var successful = document.execCommand('copy'); | |
var msg = successful ? 'successful' : 'unsuccessful'; | |
console.log('Copying text command was ' + msg); | |
} catch (err) { | |
console.log('Oops, unable to copy'); | |
} | |
document.body.removeChild(textArea); | |
} | |
$(".com-google-gerrit-client-change-ChangeScreen_BinderImpl_GenCss_style-popdown").children[2].click(); | |
copyTextToClipboard($('.downloadBoxCopyLabel').children[0].innerText); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment