Create a gist now

Instantly share code, notes, and snippets.

Bookmarklet to show Paul Graham's essay footnotes inline on hover
javascript:(function(e,t,n,r,i,s,o,u){if(!(i=e.jQuery)||n>i.fn.jquery||r(i)){s=t.createElement("script");s.type="text/javascript";s.src="http://ajax.googleapis.com/ajax/libs/jquery/"+n+"/jquery.min.js";s.onload=s.onreadystatechange=function(){if(!o&&(!(u=this.readyState)||u=="loaded"||u=="complete")){r((i=e.jQuery).noConflict(1),o=1);i(s).remove()}};t.documentElement.childNodes[0].appendChild(s)}})(window,document,"1.8.3",function(e,t){var n=e("font[color]").filter(function(){if(parseInt(e(this).text(),10)>0){return true}return false}).parent();var r=e("body").html();n.each(function(){var t=e(this).attr("href").replace("#","");var n=parseInt(t.replace("f",""),10);var i=new RegExp('<a name="'+t+'">([^]*?)[[]');var s=r.match(i);if(s&&s[0]){var o=e(s[0].replace("<br>","\n")).text().replace(n+"]","");o=o.replace("csell_env = 'mud';","").replace("// Begin Y! Store Generated Code","");var u=e('<div class="note" style="background:#FFFFFF;border:3px solid #000;left:0px;top:15px;width:300px;position:absolute;padding:10px;color:#000;text-decoration:none;">'+o+"</div>");e(this).parent().hover(function(){e(this).css("position","relative").append(u)},function(){u.remove()})}})})
@vnorby
Owner
vnorby commented Nov 20, 2012

This bookmarklet will take PG's essay footnotes and make them available to you upon hover over the footnote inline so you don't have to lose your place. To add to Chrome or other browsers, simply create a new bookmark but add the above string as the URL. Then when reading a PG essay, click the bookmarklet and enjoy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment