User:Anomie/reftooltip.js
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button. Firefox: hold down the Shift key while clicking Reload (or press Ctrl-Shift-R). Google Chrome and Safari users can just click the Reload button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* Script to footnote text to the tooltips on footnote links. Adapted from http://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_%28proposals%29&diff=171682254&oldid=171670562
If you want to use this script, simply add the following line to your monobook.js:
importScript('User:Anomie/reftooltip.js'); // Linkback: [[User:Anomie/reftooltip.js]]
(Please keep the comment so I can see how many people use this). */
mw.loader.using('jquery.tipsy', function(){
$(document).ready(function($){
var gravity=function(){
var ns=$.fn.tipsy.autoNS.call($(this));
var we=$.fn.tipsy.autoWE.call($(this));
return ns+we;
};
var title=function(){
var n=document.getElementById(this.href.substr(this.href.indexOf("#")+1));
return n?$(n).html():'';
};
var a=$('sup.reference').find('a');
if(a.tipsy) a.tipsy({ gravity:gravity, title:title, html:true });
});
});