| 1 |
'use strict'; |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
mw.hook( 'wikipage.content' ).add( ( $content ) => { |
| 10 |
const accessibilityLabelOne = mw.msg( 'cite_references_link_accessibility_label' ); |
| 11 |
const accessibilityLabelMany = mw.msg( 'cite_references_link_many_accessibility_label' ); |
| 12 |
|
| 13 |
$content.find( '.mw-cite-backlink' ).each( ( i, el ) => { |
| 14 |
const $links = $( el ).find( 'a' ); |
| 15 |
|
| 16 |
if ( $links.length > 1 ) { |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
$links.eq( 0 ).prepend( |
| 22 |
$( '<span>' ) |
| 23 |
.addClass( 'cite-accessibility-label' ) |
| 24 |
|
| 25 |
|
| 26 |
.text( accessibilityLabelMany + ' ' ) |
| 27 |
); |
| 28 |
} else { |
| 29 |
$links |
| 30 |
.attr( 'aria-label', accessibilityLabelOne ) |
| 31 |
.attr( 'title', accessibilityLabelOne ); |
| 32 |
} |
| 33 |
} ); |
| 34 |
} ); |