mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-12 09:10:32 +00:00
Merge "Get rid of one nesting level in highlighting code"
This commit is contained in:
commit
8ae3b13d1a
|
@ -45,28 +45,28 @@
|
||||||
textNode = textNode.firstChild;
|
textNode = textNode.firstChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( textNode.nodeType === Node.TEXT_NODE &&
|
if ( textNode.nodeType !== Node.TEXT_NODE || textNode.data.trim() === '' ) {
|
||||||
textNode.data.trim() !== ''
|
return;
|
||||||
) {
|
|
||||||
accessibilityLabel = mw.msg( 'cite_references_link_accessibility_back_label' );
|
|
||||||
upArrow = textNode.data.trim();
|
|
||||||
// The text node typically contains "↑ ", and we need to keep the space.
|
|
||||||
textNode.data = textNode.data.replace( upArrow, '' );
|
|
||||||
|
|
||||||
// Create a plain text and a clickable "↑". CSS :target selectors make sure only
|
|
||||||
// one is visible at a time.
|
|
||||||
$upArrowLink = $( '<a>' )
|
|
||||||
.addClass( 'mw-cite-up-arrow-backlink' )
|
|
||||||
.attr( 'aria-label', accessibilityLabel )
|
|
||||||
.attr( 'title', accessibilityLabel )
|
|
||||||
.text( upArrow );
|
|
||||||
$backlinkWrapper.prepend(
|
|
||||||
$( '<span>' )
|
|
||||||
.addClass( 'mw-cite-up-arrow' )
|
|
||||||
.text( upArrow ),
|
|
||||||
$upArrowLink
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
accessibilityLabel = mw.msg( 'cite_references_link_accessibility_back_label' );
|
||||||
|
upArrow = textNode.data.trim();
|
||||||
|
// The text node typically contains "↑ ", and we need to keep the space.
|
||||||
|
textNode.data = textNode.data.replace( upArrow, '' );
|
||||||
|
|
||||||
|
// Create a plain text and a clickable "↑". CSS :target selectors make sure only
|
||||||
|
// one is visible at a time.
|
||||||
|
$upArrowLink = $( '<a>' )
|
||||||
|
.addClass( 'mw-cite-up-arrow-backlink' )
|
||||||
|
.attr( 'aria-label', accessibilityLabel )
|
||||||
|
.attr( 'title', accessibilityLabel )
|
||||||
|
.text( upArrow );
|
||||||
|
$backlinkWrapper.prepend(
|
||||||
|
$( '<span>' )
|
||||||
|
.addClass( 'mw-cite-up-arrow' )
|
||||||
|
.text( upArrow ),
|
||||||
|
$upArrowLink
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$upArrowLink.attr( 'href', $backlink.attr( 'href' ) );
|
$upArrowLink.attr( 'href', $backlink.attr( 'href' ) );
|
||||||
|
|
Loading…
Reference in a new issue