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)
8 * - ImagePage.php#makeMetadataTable (creates the HTML)
9 * - skins/common/shared.css (hides tr.collapsable inside table.collapsed)
11 ( function ( mw, $ ) {
13 var $row, $col, $link,
14 showText = mw.msg( 'metadata-expand' ),
15 hideText = mw.msg( 'metadata-collapse' ),
16 $table = $( '#mw_metadata' ),
17 $tbody = $table.find( 'tbody' );
19 if ( !$tbody.length || !$tbody.find( '.collapsable' ).length ) {
23 $row = $( '<tr class="mw-metadata-show-hide-extended"></tr>' );
24 $col = $( '<td colspan="2"></td>' );
29 } ).click( function () {
30 if ( $table.hasClass( 'collapsed' ) ) {
31 $( this ).text( hideText );
33 $( this ).text( showText );
35 $table.toggleClass( 'expanded collapsed' );
41 $tbody.append( $row );
44 $table.addClass( 'collapsed' );
47 }( mediaWiki, jQuery ) );