r84936 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84935‎ | r84936 | r84937 >
Date:23:10, 28 March 2011
Author:dale
Status:deferred
Tags:
Comment:
* removed "upload text file" feature ( bug 28151 ) The 'adding text' interfaces are too experimental we will leave the event triggers there so gadgets can support timed text contribution interfaces ( ie miro subs ie : http://commons.wikimedia.org/wiki/Commons:Universal_Subtitles )
* removed extra msgs in timedText class
* other minor code clean up
Modified paths:
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/kskin/mw.PlayerSkinKskin.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/TimedText.config.php (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/TimedText.loader.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/resources/mw.TimedText.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/resources/mw.TimedTextEdit.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php
@@ -56,7 +56,7 @@
5757 }
5858
5959 function getTagName(){
60 - return ( $this->isVideo )? 'video' : 'audio';
 60+ return ( $this->isVideo ) ? 'video' : 'audio';
6161 }
6262
6363 function toHtml( $options = array() ) {
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/TimedText.config.php
@@ -12,9 +12,10 @@
1313 "TimedText.ShowInterface" => "auto",
1414
1515 /**
16 - * If the "add timed text" link / interface should be exposed
 16+ * If the "add timed text" link / interface should be exposed
 17+ * allows usere to upload text files to the wiki
1718 */
18 - 'TimedText.showAddTextLink' => true,
 19+ 'TimedText.showAddTextLink' => false,
1920
2021 // The category for listing videos that need transcription:
2122 'TimedText.NeedsTranscriptCategory' => 'Videos needing subtitles'
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/TimedText.loader.js
@@ -19,23 +19,20 @@
2020 } );
2121
2222 /**
23 - * Check if we should load the timedText interface or not.
 23+ * Check timedText is active for a given embedPlayer
 24+ * @param {object} embedPlayer The player to be checked for timedText properties
2425 */
2526 mw.isTimedTextSupported = function( embedPlayer ) {
2627 if( mw.getConfig( 'TimedText.ShowInterface' ) == 'always' ) {
2728 return true;
2829 }
29 - // Do a module check for timed Text support ( note this module check is synchronous )
30 - var supportsTimedText = false;
31 - $( embedPlayer ).trigger('SupportsTimedText', function( moduleSupportsTimedText) {
32 - if( moduleSupportsTimedText ){
33 - supportsTimedText = true;
34 - }
35 - });
 30+ // Do a module check for timed Text support ( module must add data property 'SupportsTimedText' )
 31+ $( embedPlayer ).trigger('SupportsTimedText' );
3632
37 - if( supportsTimedText ){
 33+ if( $( embedPlayer ).data( 'SupportsTimedText' ) ){
3834 return true;
3935 }
 36+
4037 // Check for standard 'track' attribute:
4138 if ( $( embedPlayer ).find( 'track' ).length != 0 ) {
4239 return true;
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/resources/mw.TimedText.js
@@ -128,7 +128,7 @@
129129 }
130130
131131 // Load user preferences config:
132 - var preferenceConfig = $.cookie( 'TimedText.Prefrences' );
 132+ var preferenceConfig = $.cookie( 'TimedText.Preferences' );
133133 if( preferenceConfig !== null ) {
134134 this.config = JSON.parse( preferenceConfig );
135135 }
@@ -762,14 +762,15 @@
763763 showTimedTextEditUI: function( mode ) {
764764 var _this = this;
765765 // Show a loader:
766 - mw.addLoaderDialog( gM( 'mwe-timedtext-loading-text-edit' ));
 766+ mw.addLoaderDialog( gM( 'mwe-timedtext-loading-text-edit' ) );
767767 // Load the timedText edit interface
768 - mw.load( 'TimedText.Edit', function() {
 768+ mw.load( 'mw.TimedTextEdit', function() {
769769 if( ! _this.editText ) {
770770 _this.editText = new mw.TimedTextEdit( _this );
771771 }
772772 // Close the loader:
773773 mw.closeLoaderDialog();
 774+ // Show the upload text ui:
774775 _this.editText.showUI();
775776 });
776777 },
@@ -869,8 +870,8 @@
870871 var _this = this;
871872 if( layoutMode != _this.config.layout ) {
872873 // Update the config and redraw layout
873 - _this.config.layout = layoutMode;
874 -
 874+ _this.config.layout = layoutMode;
 875+
875876 // Update the display:
876877 _this.updateLayout();
877878 }
@@ -880,7 +881,7 @@
881882 * Updates the timed text layout ( should be called when config.layout changes )
882883 */
883884 updateLayout: function() {
884 - var $playerTarget = this.embedPlayer.$interface;
 885+ var $playerTarget = this.embedPlayer.$interface;
885886 $playerTarget.find('.track').remove();
886887 this.refreshDisplay();
887888 },
@@ -935,15 +936,17 @@
936937 */
937938 refreshDisplay: function() {
938939 // Update the configuration object
939 - $.cookie( 'TimedText.Prefrences', JSON.stringify( this.config ) );
 940+ $.cookie( 'TimedText.Preferences', JSON.stringify( this.config ) );
940941
941942 // Empty out previous text to force an interface update:
942943 this.prevText = [];
 944+
943945 // Refresh the Menu (if it has a target to refresh)
944946 if( this.menuTarget ) {
945947 mw.log('bind menu refresh display');
946948 this.bindMenu( this.menuTarget, false );
947949 }
 950+
948951 // Issues a "monitor" command to update the timed text for the new layout
949952 this.monitor();
950953 },
@@ -1012,9 +1015,11 @@
10131016 }
10141017
10151018 //Add in the "add text" to the end of the interface:
1016 - $langMenu.append(
1017 - _this.getLiAddText()
1018 - );
 1019+ if( mw.getConfig( 'TimedText.ShowAddTextLink' ) && _this.embedPlayer.apiTitleKey ){
 1020+ $langMenu.append(
 1021+ _this.getLiAddText()
 1022+ );
 1023+ }
10191024
10201025 return $langMenu;
10211026 },
@@ -1101,7 +1106,12 @@
11021107 'height' : this.embedPlayer.getHeight()
11031108 })
11041109 );
1105 -
 1110+ // Resize the interface for layoutMode == 'below' ( if not in full screen)
 1111+ if( ! this.embedPlayer.controlBuilder.fullscreenMode ){
 1112+ this.embedPlayer.$interface.animate({
 1113+ 'height': this.embedPlayer.getHeight()
 1114+ });
 1115+ }
11061116 $playerTarget.append( $track );
11071117
11081118 } else if ( layoutMode == 'below') {
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/resources/mw.TimedTextEdit.js
@@ -2,33 +2,7 @@
33 * Timed text edit interface based off of participatory culture foundation timed text mockups.
44 */
55 ( function( mw, $ ) {
6 -mw.addMessages( {
7 - "mwe-timedtext-editor" : "Timed text editor",
8 - "mwe-timedtext-stage-transcribe" : "Transcribe",
9 - "mwe-timedtext-stage-sync" : "Sync",
10 - "mwe-timedtext-stage-translate" : "Translate",
11 - "mwe-timedtext-stage-upload" : "Upload from local file",
126
13 - "mwe-timedtext-select-language": "Select language",
14 - "mwe-timedtext-file-language": "Subtitle file language",
15 -
16 - "mwe-timedtext-upload-text": "Upload text file",
17 - "mwe-timedtext-uploading-text": "Uploading text file",
18 - "mwe-timedtext-upload-text-desc-title": "Upload a text file",
19 - "mwe-timedtext-upload-text-desc-help": "The upload text file interface accepts .srt files",
20 - "mwe-timedtext-upload-text-desc-help-browse": "Browse your local computer for the srt file you want to upload",
21 - "mwe-timedtext-upload-text-desc-help-select" : "Select the language of the file",
22 - "mwe-timedtext-upload-text-desc-help-review" : "Review / edit the text content and then press upload to add the text",
23 - "mwe-timedtext-upload-text-preview" : "Review text",
24 -
25 - "mwe-timedtext-upload-text-success" : "Upload of timed text was successful",
26 - "mwe-timedtext-upload-text-done" : "Upload done",
27 - "mwe-timedtext-upload-text-fail-desc" : "Upload was unsuccessful",
28 - "mwe-timedtext-upload-text-fail-title" : "Upload failed",
29 - "mwe-timedtext-upload-text-another" : "Upload another",
30 - "mwe-timedtext-upload-text-done-uploading" : "Done uploading"
31 -} );
32 -
337 mw.TimedTextEdit = function( parentTimedText ) {
348 return this.init( parentTimedText );
359 };
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/kskin/mw.PlayerSkinKskin.js
@@ -91,7 +91,7 @@
9292 $menuBar = $( '<ul />' )
9393 .addClass( 'k-menu-bar' );
9494
95 - // dont include about player menu item ( FIXME should be moved to a init function )
 95+ // Don't include about player menu item ( FIXME should be moved to a init function )
9696 delete ctrlObj.supportedMenuItems['aboutPlayerLibrary'];
9797
9898 // Output menu item containers:
@@ -231,9 +231,14 @@
232232 .text ( gM( 'mwe-embedplayer-close_btn' ) );
233233 } );
234234 this.$playerTarget.find( '.play-btn-large' ).fadeOut( 'fast' );
 235+
 236+ $( this.embedPlayer ).trigger( 'displayMenuOverlay' );
235237
236 - $(this.embedPlayer).trigger( 'displayMenuOverlay' );
237 -
 238+ // By default show the credits ( if nothing else is displayed )
 239+ if( this.$playerTarget.find( '.menu-screen :visible' ).length == 0 ){
 240+ this.showMenuItem( 'credits' );
 241+ }
 242+
238243 // Set the Options Menu display flag to true:
239244 this.keepControlBarOnScreen = true;
240245 },
@@ -268,7 +273,7 @@
269274 // Grab the context from the "clicked" menu item
270275 var mk = $( this ).attr( 'rel' );
271276
272 - // hide all menu items
 277+ // get the target iitem
273278 $targetItem = $playerTarget.find( '.menu-' + mk );
274279
275280 // call the function showMenuItem
@@ -369,7 +374,7 @@
370375
371376 // Allow modules to load and add credits
372377 $( embedPlayer ).triggerQueueCallback( 'ShowCredits', $creditsTarget, function( status ){
373 - // Check if the first ShowCredits binding returned false:
 378+ // If no module is showing credits add no-video credits msg:
374379 if( !status || status[0] == false ){
375380 $creditsTarget.text(
376381 gM('mwe-embedplayer-no-video_credits')

Status & tagging log