Created
January 17, 2012 18:56
-
-
Save becw/1628136 to your computer and use it in GitHub Desktop.
Pinboard bookmarklets for Google Reader
This file contains 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
// Pinboard bookmarklets that work for expanded items in Google Reader as well | |
// as for web pages in general. | |
// BOOKMARKLET VERSIONS | |
// Pinboard, no tags, minified | |
javascript:(function(){var a,b;if(location.href.search(/^https?:\/\/(www.)?google.com\/reader\/.+$/)===0){var c=document.getElementById("current-entry");if(c&&c.className.search(/(^| )expanded( |$)/)!=-1){var d=c.getElementsByClassName("entry-title-link");if(d.length){a=d[0].getAttribute("href");b=d[0].firstChild.nodeValue}}}else{a=location.href;b=document.title}if(a){void open("http://pinboard.in/add?later=yes&noui=yes&jump=close&url="+encodeURIComponent(a)+"&title="+encodeURIComponent(b),"Pinboard","toolbar=no,width=100,height=100")}})() | |
// Pinboard, with tags, uglified | |
javascript:(function(){var a,b,c;if(location.href.search(/^https?:\/\/(www.)?google.com\/reader\/.+$/)===0){var d=document.getElementById("current-entry");if(d&&d.className.search(/(^| )expanded( |$)/)!=-1){var e=d.getElementsByClassName("entry-title-link");if(e.length){a=e[0].getAttribute("href");b=e[0].firstChild.nodeValue}}}else{a=location.href;b=document.title}if(document.getSelection){c=document.getSelection()}else{c=""}if(a){void open("http://pinboard.in/add?showtags=yes&url="+encodeURIComponent(a)+"&description="+encodeURIComponent(c)+"&title="+encodeURIComponent(b),"Pinboard","toolbar=no,width=700,height=600")}})() | |
// READABLE VERSIONS | |
// Pinboard, no tags | |
javascript: | |
(function() { | |
var q, p; | |
if (location.href.search(/^https?:\/\/(www.)?google.com\/reader\/.+$/) === 0) { | |
var current = document.getElementById('current-entry'); | |
if (current && current.className.search(/(^| )expanded( |$)/) != -1) { | |
var link = current.getElementsByClassName('entry-title-link'); | |
if (link.length) { | |
q = link[0].getAttribute('href'); | |
p = link[0].firstChild.nodeValue; | |
} | |
} | |
} | |
else { | |
q=location.href; | |
p=document.title; | |
} | |
if (q) { | |
void(open('http://pinboard.in/add?later=yes&noui=yes&jump=close&url='+encodeURIComponent(q)+'&title='+encodeURIComponent(p),'Pinboard','toolbar=no,width=100,height=100')); | |
} | |
})() | |
// Pinboard, with tags | |
javascript: | |
(function() { | |
var q, p, d; | |
if (location.href.search(/^https?:\/\/(www.)?google.com\/reader\/.+$/) === 0) { | |
var current = document.getElementById('current-entry'); | |
if (current && current.className.search(/(^| )expanded( |$)/) != -1) { | |
var link = current.getElementsByClassName('entry-title-link'); | |
if (link.length) { | |
q = link[0].getAttribute('href'); | |
p = link[0].firstChild.nodeValue; | |
} | |
} | |
} | |
else { | |
q=location.href; | |
p=document.title; | |
} | |
if (document.getSelection) { | |
d=document.getSelection(); | |
} | |
else{ | |
d=''; | |
} | |
if (q) { | |
void(open('http://pinboard.in/add?showtags=yes&url='+encodeURIComponent(q)+'&description='+encodeURIComponent(d)+'&title='+encodeURIComponent(p),'Pinboard','toolbar=no,width=700,height=600')); | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment