User:TimR/misc.js

function footnoteTarget(a) { var aTitle=Title.fromAnchor(a); // We want ".3A" rather than "%3A" or "?" here, so use the anchor property directly var anch = aTitle.anchor; if ( ! /^(cite_note-|_note-|endnote)/.test(anch) ) { return false;	} var lTitle=Title.fromURL(location.href); if ( lTitle.toString(true) != aTitle.toString(true) ) {	return false; } var el=document.getElementById(anch); while ( el && typeof el.nodeName == 'string') { var nt = el.nodeName.toLowerCase; if ( nt == 'li' ) { return el; } else if ( nt == 'body' ) { return false; } else if ( el.parentNode ) { el=el.parentNode; } else { return false; } }	return false; }