Last active
June 23, 2020 16:44
-
-
Save jasonseney/55f1e43c63899d45efae263f9a93573a to your computer and use it in GitHub Desktop.
Creates a URL using the document title in a format for inserting into a JIRA ticket.
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
| var link = '['+ document.title.replace("[","\\[").replace("]","\\]")+'|'+document.location.href+']'; | |
| if (prompt('Press Enter or Click Ok to copy.', link)) { | |
| var el = document.createElement('textarea'); | |
| el.value = link; | |
| el.setAttribute('readonly', ''); | |
| el.style.position = 'absolute'; | |
| el.style.left = '-9999px'; | |
| document.body.appendChild(el); | |
| document.getSelection().removeAllRanges(); | |
| el.select(); | |
| document.execCommand('copy'); | |
| document.body.removeChild(el); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment