Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@rdela 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

This comment has been minimized.

Copy link

@manton 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