Add this JavaScript as a bookmarklet using: http://mrcoles.com/bookmarklet/
Note: In Safari, you'll also need to enable Develop > Experimental Features > Modern Media Controls.
Add this JavaScript as a bookmarklet using: http://mrcoles.com/bookmarklet/
Note: In Safari, you'll also need to enable Develop > Experimental Features > Modern Media Controls.
| let title = document.title; | |
| const link = document.location.href; | |
| if (link.match(/app.asana.com/)) { title = title.match(/.*-\ (.*)\ -\ Asana$/)[1] } | |
| const markdown = `[${title || link}](${link})`; | |
| const textarea = document.createElement('textarea'); | |
| textarea.innerText = markdown; | |
| document.body.appendChild(textarea); | |
| textarea.select(); | |
| const remove = () => { textarea.remove(); }; | |
| const copied = document.execCommand('copy'); | |
| if (copied) { | |
| console.log(`Copied \`${markdown}\` to clipboard`); | |
| remove(); | |
| } else { | |
| textarea.style.height = '50px'; | |
| textarea.style.left = '0px'; | |
| textarea.style.position = 'absolute'; | |
| textarea.style.top = '0px'; | |
| textarea.style.width = '200px'; | |
| textarea.select(); | |
| textarea.addEventListener('blur', remove); | |
| } |