Created
September 30, 2012 19:42
-
-
Save ttscoff/3808261 to your computer and use it in GitHub Desktop.
Bookmarklet to send all links within clicked div/table to Pinboard
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
// Edit pinboard_user and pinboard_pass to your own settings below | |
// copy the bookmarklet code and create a new bookmark with the code as the url | |
// Run it on a page. If it works, hovering around the page will cause red outlines to appear | |
// clicking on a section will grab all of the links in the innermost section and send them to pinboard | |
// WARNING: may screw up and create a shitload of links in your Pinboard account | |
// | |
// Todo: rewrite w/o jQuery, better filtering of detected links, don't grab image links | |
javascript:var user='pinboard_user',pass='pinboard_pass';(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7",function($,L){$(document).ready(function(){$("div,table").on("mouseover mouseout click",function(a){a.type==="mouseover"?$(this).css({outline:"1px solid red"}):$("div,table").css({outline:"none"});if(a.type==="click"){a.preventDefault();var i,linkage=$(this).find('a');linkage.each(function(link,i){console.log($(this).attr('href'));var t=open('https://'+user+':'+pass+'@pinboard.in/add?later=yes&noui=yes&jump=close&url='+encodeURIComponent($(this).attr('href'))+'&title='+encodeURIComponent($(this).text()),'Pinboard'+i,'toolbar=no,width=100,height=100');t.blur();});return false;}});});}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment