Skip to content

Instantly share code, notes, and snippets.

@rockymanobi
Last active August 14, 2020 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rockymanobi/0c95c9f72f3ca09558b8def068a7d839 to your computer and use it in GitHub Desktop.
Save rockymanobi/0c95c9f72f3ca09558b8def068a7d839 to your computer and use it in GitHub Desktop.
Bookmarklet that copies URL, title, content of Github Issue
javascript:(function(){ function copyTextToClipboard(textVal){ const copyFrom = document.createElement("textarea"); copyFrom.textContent = textVal; const bodyElm = document.getElementsByTagName("body")[0]; bodyElm.appendChild(copyFrom); copyFrom.select(); const retVal = document.execCommand('copy'); bodyElm.removeChild(copyFrom); return retVal; } const href = location.href; const title = document.querySelector('.js-issue-title').innerHTML.trim(); const issue = document.querySelector('textarea[name="issue[body]"]').value; const text = [href, title, issue].join('\n\n#######\n\n'); alert(text); copyTextToClipboard(text); }())
@rockymanobi
Copy link
Author

Bookmarkletの設定をして、GithubのIssueの画面から呼び出してあげると、クリップボードに URL, Issueタイトル, 本文がコピーされます。今の所ZenHubでも使えました。

copy_issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment