Skip to content

Instantly share code, notes, and snippets.

@rdela
Last active May 1, 2021 16:55
Show Gist options
  • Save rdela/0adf0692583d64a9842eef59c36ffa02 to your computer and use it in GitHub Desktop.
Save rdela/0adf0692583d64a9842eef59c36ffa02 to your computer and use it in GitHub Desktop.
post link and optional selection to micro.blog mac app
javascript:if(document.getSelection().rangeCount > 0){s='> '+document.getSelection()+'\n\n';}else{s='';};t=document.title;l=location.href;p='['+t+']'+'('+l+')';document.location='microblog://post?text='+encodeURIComponent(s+p);
@rdela
Copy link
Author

rdela commented May 16, 2020

added check against document.getSelection().rangeCount > 0 instead of for the existence of document.getSelection because I was getting false positive when nothing selected, leading to the top lines having:

>

...above the linked title. This seems to fix that in Safari. Gonna test Chrome and Firefox now.

@manton
Copy link

manton commented May 1, 2021

Thanks for the reminder about this! If anyone wants to update it to start a post on the web version of Micro.blog, they can replace the microblog://post?text= with https://micro.blog/post?text=.

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