found drama

get oblique

there: I fixed Footnotify

by Rob Friesel

About nine months ago, Hans Petter Eikemo announced his Chrome/Safari extension called Footnotify which is like a “lightbox” for “Daring Fireball style” footnote links. I loved it immediately but found that it did not work for the footnotes on this blog you’re reading here. To be pedantic: they worked on the landing page, but not on the individual single-post pages. This was my first clue that something “fixable” was wrong.

I dug deeper and discovered that the plugin only worked when the footnote link was an in-page anchor like this: #footnote_1 — but it broke on my single-post pages because the links got rendered like this: /page/#footnote_1. My first thought was to try to coerce “anchors only” links from WP-Footnotes, but something deep in the bowels of WordPress is forcing those relative paths onto the front of the href. And even then, that would only solve my problem on my blog.1

So: How to fix this?

The answer is in the click handler:

The above click handler comes from lines 179-213 in this (more complete) Gist. The RegEx I’ve added is perhaps not the safest, and perhaps a little naïve but it got the job done for me on the first pass.

Eikemo: if you’re reading this, I’d love to get it merged back for others to enjoy but all I saw was the Gist.2 (See update below.)

Also: thanks to Stack Overflow user Sathya for this answer. Until Footnotify is updated with this change, you’ll need to hack it in yourself this way.

Now to fix the mangled styles in the “Footnotified” footnote lightbox dealie…

(Ed. note: a version of this post first appeared on my “!undefined” Tumblr blog. [link])

UPDATE: Seems Eikemo saw the post:

  1. Unless of course I submitted the patch back to WP-Footnotes. But no such solution ever presented itself. []
  2. Hard to submit a pull request to a Gist, eh? []

About Rob Friesel

Software engineer by day, science fiction writer by night. Author of The PhantomJS Cookbook and a short story in Please Do Not Remove. View all posts by Rob Friesel →

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*