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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.