Skip to content

Instantly share code, notes, and snippets.

@djyde
Created January 26, 2021 05:04
Show Gist options
  • Select an option

  • Save djyde/5a4972881df47680f92960f888ab002e to your computer and use it in GitHub Desktop.

Select an option

Save djyde/5a4972881df47680f92960f888ab002e to your computer and use it in GitHub Desktop.
Roam scripts
// 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