1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mediawiki_ynh.git synced 2024-09-03 19:46:05 +02:00
mediawiki_ynh/sources/mediawiki/resources/mediawiki.action/mediawiki.action.view.metadata.js

43 lines
No EOL
979 B
JavaScript

/**
* Exif metadata display for MediaWiki file uploads
*
* Add an expand/collapse link and collapse by default if set to
* (with JS disabled, user will see all items)
*/
( function ( mw, $ ) {
$( function () {
var $row, $col, $link,
showText = mw.msg( 'metadata-expand' ),
hideText = mw.msg( 'metadata-collapse' ),
$table = $( '#mw_metadata' ),
$tbody = $table.find( 'tbody' );
if ( !$tbody.length ) {
return;
}
$row = $( '<tr class="mw-metadata-show-hide-extended"></tr>' );
$col = $( '<td colspan="2"></td>' );
$link = $( '<a>', {
text: showText,
href: '#'
}).click(function () {
if ( $table.hasClass( 'collapsed' ) ) {
$( this ).text( hideText );
} else {
$( this ).text( showText );
}
$table.toggleClass( 'expanded collapsed' );
return false;
});
$col.append( $link );
$row.append( $col );
$tbody.append( $row );
// And collapse!
$table.addClass( 'collapsed' );
} );
}( mediaWiki, jQuery ) );