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
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:
@founddrama great! If you have a github account and I give you access; would you send a pull request?
— Hans Petter Eikemo (@hpeikemo) May 28, 2012
- Unless of course I submitted the patch back to WP-Footnotes. But no such solution ever presented itself. [↩]
- Hard to submit a pull request to a Gist, eh? [↩]