Last active
August 29, 2015 14:01
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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