2 * Exif metadata display for MediaWiki file uploads
4 * Add an expand/collapse link and collapse by default if set to
5 * (with JS disabled, user will see all items)
7 * See also ImagePage.php#makeMetadataTable (creates the HTML)
11 var $row
, $col
, $link
,
12 showText
= mw
.msg( 'metadata-expand' ),
13 hideText
= mw
.msg( 'metadata-collapse' ),
14 $table
= $( '#mw_metadata' ),
15 $tbody
= $table
.find( 'tbody' );
17 if ( !$tbody
.find( '.collapsable' ).length
) {
21 $row
= $( '<tr class="mw-metadata-show-hide-extended"></tr>' );
22 $col
= $( '<td colspan="2"></td>' );
30 .on( 'click keypress', function ( e
) {
33 e
.type
=== 'keypress' && e
.which
=== 13
35 if ( $table
.hasClass( 'collapsed' ) ) {
36 $( this ).text( hideText
);
38 $( this ).text( showText
);
40 $table
.toggleClass( 'expanded collapsed' );
46 $tbody
.append( $row
);
49 $table
.addClass( 'collapsed' );
52 }( mediaWiki
, jQuery
) );