Created
January 26, 2021 05:04
-
-
Save djyde/5a4972881df47680f92960f888ab002e to your computer and use it in GitHub Desktop.
Roam scripts
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
| // get current document title and url and transform to Roam | |
| const copyToClipboard = str => { | |
| const el = document.createElement('textarea'); | |
| el.value = str; | |
| el.setAttribute('readonly', ''); | |
| el.style.position = 'absolute'; | |
| el.style.left = '-9999px'; | |
| document.body.appendChild(el); | |
| el.select(); | |
| document.execCommand('copy'); | |
| document.body.removeChild(el); | |
| }; | |
| const title = document.title | |
| const url = location.href | |
| const raw = `- ${title} #webclips | |
| - ${url} | |
| ` | |
| copyToClipboard(raw) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment