Merge "Allow patrolling page creations from Special:RecentChanges"
[lhc/web/wiklou.git] / resources / mediawiki.action / mediawiki.action.view.metadata.js
1 /**
2 * Exif metadata display for MediaWiki file uploads
3 *
4 * Add an expand/collapse link and collapse by default if set to
5 * (with JS disabled, user will see all items)
6 */
7 ( function ( mw, $ ) {
8 $( function () {
9 var $row, $col, $link,
10 showText = mw.msg( 'metadata-expand' ),
11 hideText = mw.msg( 'metadata-collapse' ),
12 $table = $( '#mw_metadata' ),
13 $tbody = $table.find( 'tbody' );
14
15 if ( !$tbody.length ) {
16 return;
17 }
18
19 $row = $( '<tr class="mw-metadata-show-hide-extended"></tr>' );
20 $col = $( '<td colspan="2"></td>' );
21
22 $link = $( '<a>', {
23 text: showText,
24 href: '#'
25 }).click(function () {
26 if ( $table.hasClass( 'collapsed' ) ) {
27 $( this ).text( hideText );
28 } else {
29 $( this ).text( showText );
30 }
31 $table.toggleClass( 'expanded collapsed' );
32 return false;
33 });
34
35 $col.append( $link );
36 $row.append( $col );
37 $tbody.append( $row );
38
39 // And collapse!
40 $table.addClass( 'collapsed' );
41 } );
42
43 }( mediaWiki, jQuery ) );