Skip to content

Instantly share code, notes, and snippets.

@roNn23
Created June 24, 2019 14:04
Show Gist options
  • Save roNn23/be4074421a6cc465ed3c456a9eb017dd to your computer and use it in GitHub Desktop.
Save roNn23/be4074421a6cc465ed3c456a9eb017dd to your computer and use it in GitHub Desktop.
// full version
(function () {
var node = document.createElement('textarea')
var selection = document.getSelection()
let issue = '';
if(document.querySelector('#issuekey-val')) {
issue = document.querySelector('#issuekey-val').textContent;
}
if(document.querySelector('#key-val')) {
issue = document.querySelector('#key-val').textContent;
}
let summary = document.querySelector('#summary-val').textContent;
let text = `[TASK] ${issue} ${summary}`;
node.textContent = text
document.body.appendChild(node)
selection.removeAllRanges()
node.select()
document.execCommand('copy')
selection.removeAllRanges()
document.body.removeChild(node)
})()
// minified version for the browser
javascript:!function(){var e=document.createElement("textarea"),t=document.getSelection();let o="";document.querySelector("#issuekey-val")&&(o=document.querySelector("#issuekey-val").textContent),document.querySelector("#key-val")&&(o=document.querySelector("#key-val").textContent);let n=`[TASK] ${o} ${document.querySelector("#summary-val").textContent}`;e.textContent=n,document.body.appendChild(e),t.removeAllRanges(),e.select(),document.execCommand("copy"),t.removeAllRanges(),document.body.removeChild(e)}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment