[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/resources/src/mediawiki.action/ -> mediawiki.action.view.metadata.js (source)

   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   * See also ImagePage.php#makeMetadataTable (creates the HTML)
   8   */
   9  ( function ( mw, $ ) {
  10      $( function () {
  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' );
  16  
  17          if ( !$tbody.length || !$tbody.find( '.collapsable' ).length ) {
  18              return;
  19          }
  20  
  21          $row = $( '<tr class="mw-metadata-show-hide-extended"></tr>' );
  22          $col = $( '<td colspan="2"></td>' );
  23  
  24          $link = $( '<a>', {
  25              text: showText,
  26              href: '#'
  27          } ).click( function () {
  28              if ( $table.hasClass( 'collapsed' ) ) {
  29                  $( this ).text( hideText );
  30              } else {
  31                  $( this ).text( showText );
  32              }
  33              $table.toggleClass( 'expanded collapsed' );
  34              return false;
  35          } );
  36  
  37          $col.append( $link );
  38          $row.append( $col );
  39          $tbody.append( $row );
  40  
  41          // And collapse!
  42          $table.addClass( 'collapsed' );
  43      } );
  44  
  45  }( mediaWiki, jQuery ) );


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1