Index: trunk/phase3/skins/common/metadata.js |
— | — | @@ -1,53 +0,0 @@ |
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 | | -// attachMetadataToggle('mw_metadata', 'More...', 'Fewer...'); |
8 | | - |
9 | | -window.attachMetadataToggle = function( tableId, showText, hideText ) { |
10 | | - if ( document.createTextNode ) { |
11 | | - var box = document.getElementById( tableId ); |
12 | | - if ( !box ) { |
13 | | - return false; |
14 | | - } |
15 | | - |
16 | | - var tbody = box.getElementsByTagName('tbody')[0]; |
17 | | - |
18 | | - var row = document.createElement( 'tr' ); |
19 | | - |
20 | | - var col = document.createElement( 'td' ); |
21 | | - col.colSpan = 2; |
22 | | - |
23 | | - var link = document.createElement( 'a' ); |
24 | | - link.href = '#'; |
25 | | - |
26 | | - link.onclick = function() { |
27 | | - if ( box.className == 'mw_metadata collapsed' ) { |
28 | | - changeText( link, hideText ); |
29 | | - box.className = 'mw_metadata expanded'; |
30 | | - } else { |
31 | | - changeText( link, showText ); |
32 | | - box.className = 'mw_metadata collapsed'; |
33 | | - } |
34 | | - return false; |
35 | | - }; |
36 | | - |
37 | | - var text = document.createTextNode( hideText ); |
38 | | - |
39 | | - link.appendChild( text ); |
40 | | - col.appendChild( link ); |
41 | | - row.appendChild( col ); |
42 | | - tbody.appendChild( row ); |
43 | | - |
44 | | - // And collapse! |
45 | | - link.onclick(); |
46 | | - |
47 | | - return true; |
48 | | - } |
49 | | - return false; |
50 | | -}; |
51 | | - |
52 | | -$( document ).ready( function() { |
53 | | - attachMetadataToggle( 'mw_metadata', mw.msg( 'metadata-expand' ), mw.msg( 'metadata-collapse' ) ); |
54 | | -} ); |
Index: trunk/phase3/includes/ImagePage.php |
— | — | @@ -156,7 +156,7 @@ |
157 | 157 | if ( $showmeta ) { |
158 | 158 | $wgOut->addHTML( Xml::element( 'h2', array( 'id' => 'metadata' ), wfMsg( 'metadata' ) ) . "\n" ); |
159 | 159 | $wgOut->addWikiText( $this->makeMetadataTable( $formattedMetadata ) ); |
160 | | - $wgOut->addModules( array( 'mediawiki.legacy.metadata' ) ); |
| 160 | + $wgOut->addModules( array( 'mediawiki.action.view.metadata' ) ); |
161 | 161 | } |
162 | 162 | |
163 | 163 | $css = $this->repo->getDescriptionStylesheetUrl(); |
Index: trunk/phase3/resources/mediawiki.action/mediawiki.action.view.metadata.js |
— | — | @@ -0,0 +1,38 @@ |
| 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 | + |
| 8 | +$( document ).ready( function() { |
| 9 | + var showText = mw.msg( 'metadata-expand' ); |
| 10 | + var hideText = mw.msg( 'metadata-collapse' ); |
| 11 | + |
| 12 | + var $table = $( '#mw_metadata' ); |
| 13 | + var $tbody = $table.find( 'tbody' ); |
| 14 | + if ( !$tbody.length ) { |
| 15 | + return; |
| 16 | + } |
| 17 | + |
| 18 | + var $row = $( '<tr></tr>' ); |
| 19 | + var $col = $( '<td colspan="2"></td>' ); |
| 20 | + |
| 21 | + var $link = $( '<a></a>', { |
| 22 | + 'text': showText |
| 23 | + }).click(function() { |
| 24 | + if ( $table.is( '.collapsed' ) ) { |
| 25 | + $( this ).text( hideText ); |
| 26 | + } else { |
| 27 | + $( this ).text( showText ); |
| 28 | + } |
| 29 | + $table.toggleClass( 'expanded, collapsed' ); |
| 30 | + return false; |
| 31 | + }); |
| 32 | + |
| 33 | + $col.append( $link ); |
| 34 | + $row.append( $col ); |
| 35 | + $tbody.append( $row ); |
| 36 | + |
| 37 | + // And collapse! |
| 38 | + $table.addClass( 'collapsed' ); |
| 39 | +} ); |
Property changes on: trunk/phase3/resources/mediawiki.action/mediawiki.action.view.metadata.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 40 | + native |
Index: trunk/phase3/resources/Resources.php |
— | — | @@ -416,6 +416,10 @@ |
417 | 417 | 'mediawiki.action.view.rightClickEdit' => array( |
418 | 418 | 'scripts' => 'resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js', |
419 | 419 | ), |
| 420 | + 'mediawiki.action.view.metadata' => array( |
| 421 | + 'scripts' => 'resources/mediawiki.action/mediawiki.action.view.metadata.js', |
| 422 | + 'messages' => array( 'metadata-expand', 'metadata-collapse' ), |
| 423 | + ), |
420 | 424 | 'mediawiki.action.watch.ajax' => array( |
421 | 425 | 'scripts' => 'resources/mediawiki.action/mediawiki.action.watch.ajax.js', |
422 | 426 | 'dependencies' => 'mediawiki.util', |
— | — | @@ -555,13 +559,6 @@ |
556 | 560 | 'localBasePath' => "{$GLOBALS['IP']}/skins", |
557 | 561 | 'dependencies' => 'mediawiki.legacy.wikibits', |
558 | 562 | ), |
559 | | - 'mediawiki.legacy.metadata' => array( |
560 | | - 'scripts' => 'common/metadata.js', |
561 | | - 'remoteBasePath' => $GLOBALS['wgStylePath'], |
562 | | - 'localBasePath' => "{$GLOBALS['IP']}/skins", |
563 | | - 'dependencies' => 'mediawiki.legacy.wikibits', |
564 | | - 'messages' => array( 'metadata-expand', 'metadata-collapse' ), |
565 | | - ), |
566 | 563 | 'mediawiki.legacy.mwsuggest' => array( |
567 | 564 | 'scripts' => 'common/mwsuggest.js', |
568 | 565 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |