Skip to content

Instantly share code, notes, and snippets.

@hungtatai
Last active October 21, 2016 02:42
Show Gist options
  • Save hungtatai/e654ce9bb34d857d790127bce373fc64 to your computer and use it in GitHub Desktop.
Save hungtatai/e654ce9bb34d857d790127bce373fc64 to your computer and use it in GitHub Desktop.
String.prototype.copyToClipboard = function() {
/* https://gist.github.com/joeperrin-gists/8814825#gistcomment-1581738 */
var text = this;
const input = document.createElement('input');
input.style.position = 'fixed';
input.style.opacity = 0;
input.value = text;
document.body.appendChild(input);
input.select();
document.execCommand('Copy');
document.body.removeChild(input);
return text;
};
String.prototype.format = function() {
/* http://stackoverflow.com/a/4256130 */
var formatted = this;
for( var arg in arguments ) {
formatted = formatted.replace("{" + arg + "}", arguments[arg]);
}
return formatted;
};
$ = document.querySelector.bind(document);
var title = "<{0}> #{1} - {2}".format(
$('#main_container > table:nth-child(1) > tbody > tr > td:nth-child(1) > a > tt').innerText,
$('#sub_container > table:nth-child(2) > tbody > tr:nth-child(2) > td:nth-child(2)').innerText,
$('#sub_container > table:nth-child(2) > tbody > tr:nth-child(3) > td.content').innerText
)
console.log(title);
//title.copyToClipboard();
prompt('Bug Tracker Commit: ', title);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment