Skip to content

Instantly share code, notes, and snippets.

@luisgerhorst
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luisgerhorst/483eb508bc625ccc9c0e to your computer and use it in GitHub Desktop.
Save luisgerhorst/483eb508bc625ccc9c0e to your computer and use it in GitHub Desktop.
Pinboard bookmarklet to automatically open Pushpin app on iOS and regular popup on Mac.
javascript:if(/(iPad|iPhone|iPod)/g.test(navigator.userAgent)){window.location="pushpin://x-callback-url/add?url="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(document.title)}else{q=location.href;if(document.getSelection){d=document.getSelection()}else{d=""}p=document.title;void open("https://pinboard.in/add?url="+encodeURIComponent(q)+"&description="+encodeURIComponent(d)+"&title="+encodeURIComponent(p),"Pinboard","toolbar=no,width=700,height=350")}
if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent)) { // Open Pushpin
// on iOS
window.location = 'pushpin://x-callback-url/add?url=' + encodeURIComponent(location.href) +
'&title=' + encodeURIComponent(document.title);
} else { // Everywhere else open the normal Pinboard panel, you may replace
// this code with the code of the Pinboard bookmark you prefer
q = location.href;
if (document.getSelection) {
d = document.getSelection();
} else {
d = '';
};
p = document.title;
void(open('https://pinboard.in/add?url=' + encodeURIComponent(q) +
'&description=' + encodeURIComponent(d) +
'&title=' + encodeURIComponent(p),
'Pinboard',
'toolbar=no,width=700,height=350'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment