Skip to content

Commit

Permalink
Footnotes: Allow return links to point to pages (not just IDs).
Browse files Browse the repository at this point in the history
Fixes #7019.
  • Loading branch information
EricDunsworth committed Jun 10, 2016
1 parent 68c8052 commit 17a03e1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/plugins/footnotes/footnotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
} );

Expand Down

0 comments on commit 17a03e1

Please sign in to comment.