Skip to content
Permalink
Browse files

Footnotes: Allow return links to point to pages (not just IDs).

Fixes #7019.
  • Loading branch information...
EricDunsworth committed Jun 10, 2016
1 parent 68c8052 commit 17a03e15c44421c3a6b7ea8a1c052f92b9cadc29
Showing with 10 additions and 4 deletions.
  1. +10 −4 src/plugins/footnotes/footnotes.js
@@ -81,15 +81,21 @@ $document.on( "click vclick", "main :not(" + selector + ") sup a.fn-lnk", functi
// Listen for footnote return links that get clicked
$document.on( "click vclick", selector + " dd p.fn-rtn a", function( event ) {
var which = event.which,
ref,
refId;

// Ignore middle/right mouse button
if ( !which || which === 1 ) {
refId = "#" + wb.jqEscape( event.target.getAttribute( "href" ).substring( 1 ) );
ref = event.target.getAttribute( "href" );

// Assign focus to the link
$document.find( refId + " a" ).trigger( setFocusEvent );
return false;
// Focus on associated referrer link (if the return link points to an ID)
if ( ref.charAt( 0 ) === "#" ) {
refId = "#" + wb.jqEscape( ref.substring( 1 ) );

// Assign focus to the link
$document.find( refId + " a" ).trigger( setFocusEvent );
return false;
}
}
} );

0 comments on commit 17a03e1

Please sign in to comment.
You can’t perform that action at this time.