r65987 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65986‎ | r65987 | r65988 >
Date:17:12, 6 May 2010
Author:dale
Status:deferred
Tags:
Comment:
more r65942 merge fixes
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/jsScriptLoader.php (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/skins/ctrlBuilder.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/mwEmbed.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/loader.js
@@ -3,7 +3,7 @@
44 */
55 // Scope everything in "mw" ( keeps the global namespace clean )
66 ( function( mw ) {
7 -
 7+
88 mw.addClassFilePaths( {
99 "mw.TimedText" : "mw.TimedText.js",
1010 "mw.style.TimedText" : "css/mw.style.TimedText.css",
@@ -12,7 +12,7 @@
1313 "mw.style.TimedTextEdit" : "css/mw.style.TimedTextEdit.css",
1414
1515 "RemoteMwTimedText" : "remotes/RemoteMwTimedText.js"
16 -});
 16+} );
1717
1818 var mwTimedTextRequestSet = [
1919 '$j.fn.menu',
@@ -29,18 +29,21 @@
3030 });
3131
3232 var mwLoadTimedTextFlag = false;
33 -// Merge in the timed text libs
 33+// Always Merge in the timed text libs
3434 if( mw.getConfig( 'textInterface' ) == 'always' ) {
3535 mwLoadTimedTextFlag = true;
3636 }
 37+
3738 /**
38 -* Setup the load embedPlayer visit tag function hook.
 39+* Setup the load embedPlayer visit tag addSetupHook function
3940 *
4041 * Check if the video tags in the page support timed text
4142 * this way we can add our timed text libraries to the initial
4243 * request and avoid an extra round trip to the server
4344 */
44 -mw.addHook( 'LoaderEmbedPlayerVisitTag', function( playerElement ) {
 45+
 46+// Bind the loader embed player tag viewing
 47+$j( mw ).bind( 'LoaderEmbedPlayerVisitTag', function( event, playerElement ) {
4548 // If add timed text flag not already set check for itext, and sources
4649 if( ! mwLoadTimedTextFlag ) {
4750 if( $j( playerElement ).find( 'itext' ).length != 0 ) {
@@ -55,14 +58,15 @@
5659 }
5760 }
5861 } );
59 -
6062 // Update the player loader request with timedText if the flag has been set
61 -mw.addHook( 'LoaderEmbedPlayerUpdateRequest', function( classRequest ) {
 63+$j( mw ).bind( 'LoaderEmbedPlayerUpdateRequest', function( event, classRequest ) {
6264 // Add timed text items if flag set.
6365 if( mwLoadTimedTextFlag ) {
6466 $j.merge( classRequest, mwTimedTextRequestSet );
65 - }
 67+ }
 68+
6669 } );
 70+
6771
6872 // TimedText editor:
6973 mw.addModuleLoader( 'TimedText.Edit', function( callback ) {
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js
@@ -158,11 +158,11 @@
159159 }
160160
161161 // Set up embedPlayer hooks:
162 - embedPlayer.addHook( 'monitor', function() {
163 - _this.monitor();
164 - } )
 162+ $j( embedPlayer ).bind( 'onMonitor', function() {
 163+ _this.monitor()
 164+ } );
165165
166 - embedPlayer.addHook( 'play', function() {
 166+ $j( embedPlayer ).bind( 'onPlay', function() {
167167 // Will load and setup timedText sources (if not loaded already loaded )
168168 _this.setupTextSources();
169169 } );
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/loader.js
@@ -111,54 +111,49 @@
112112 * We use mw.addDOMReadyHook instead of mw.ready so that
113113 * player interfaces are ready once mw.ready is called.
114114 */
115 -mw.addDOMReadyHook( function() {
 115+mw.addSetupHook( function( callback ) {
116116 if( mw.documentHasPlayerTags() ) {
117117 var rewriteElementCount = 0;
118118
119 - // Add the setup hook since we have player tags
120 - mw.addSetupHook( function( callback ) {
121 -
122 - // Set each player to loading ( as early on as possible )
123 - $j( mw.getConfig( 'rewritePlayerTags' ) ).each( function( index, element ){
124 -
125 - // Assign an the element an ID (if its missing one)
126 - if ( $j( element ).attr( "id" ) == '' ) {
127 - $j( element ).attr( "id", 'v' + ( rewriteElementCount++ ) );
128 - }
129 -
130 - // Add an absolute positioned loader
131 - var pos = $j( element ).offset();
132 - var left = ( $j( element ).width() ) ?
133 - parseInt( pos.left + ( .4 * $j( element ).width() ) ) :
134 - pos.left + 30;
135 - var top = ( $j( element ).height() ) ?
136 - parseInt( pos.top + ( .4 * $j( element ).height() ) ) :
137 - pos.left + 30;
138 - $j('body').append(
139 - $j('<div />')
140 - .loadingSpinner()
141 - .attr('id', 'loadSpiner_' + $j( element ).attr('id') )
142 - .css({
143 - 'width' : 32,
144 - 'height' : 32,
145 - 'position': 'absolute',
146 - 'top' : top,
147 - 'left' : left
148 - })
149 - )
150 - //$j( element ).hide();
151 - });
152 - // Load the embedPlayer module ( then run queued hooks )
153 - mw.load( 'EmbedPlayer', function ( ) {
154 - // Rewrite the rewritePlayerTags with the
155 - $j( mw.getConfig( 'rewritePlayerTags' ) ).embedPlayer();
156 - // Run the setup callback now that we have setup all the players
157 - callback();
158 - })
159 - });
160 -
161 - // Tell mwEmbed to run setup
162 - mw.setConfig( 'runSetupMwEmbed', true );
 119+ // Set each player to loading ( as early on as possible )
 120+ $j( mw.getConfig( 'rewritePlayerTags' ) ).each( function( index, element ){
 121+
 122+ // Assign an the element an ID (if its missing one)
 123+ if ( $j( element ).attr( "id" ) == '' ) {
 124+ $j( element ).attr( "id", 'v' + ( rewriteElementCount++ ) );
 125+ }
 126+
 127+ // Add an absolute positioned loader
 128+ var pos = $j( element ).offset();
 129+ var left = ( $j( element ).width() ) ?
 130+ parseInt( pos.left + ( .4 * $j( element ).width() ) ) :
 131+ pos.left + 30;
 132+ var top = ( $j( element ).height() ) ?
 133+ parseInt( pos.top + ( .4 * $j( element ).height() ) ) :
 134+ pos.left + 30;
 135+ $j('body').append(
 136+ $j('<div />')
 137+ .loadingSpinner()
 138+ .attr('id', 'loadSpiner_' + $j( element ).attr('id') )
 139+ .css({
 140+ 'width' : 32,
 141+ 'height' : 32,
 142+ 'position': 'absolute',
 143+ 'top' : top,
 144+ 'left' : left
 145+ })
 146+ )
 147+ //$j( element ).hide();
 148+ });
 149+ // Load the embedPlayer module ( then run queued hooks )
 150+ mw.load( 'EmbedPlayer', function ( ) {
 151+ // Rewrite the rewritePlayerTags with the
 152+ $j( mw.getConfig( 'rewritePlayerTags' ) ).embedPlayer();
 153+ // Run the setup callback now that we have setup all the players
 154+ callback();
 155+ })
 156+ } else {
 157+ callback();
163158 }
164159 });
165160
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/skins/ctrlBuilder.js
@@ -836,6 +836,25 @@
837837 // Related videos could be shown here
838838 },
839839
 840+ /**
 841+ * The ctrl builder updates the interface on seeking
 842+ */
 843+ onSeek: function(){
 844+ // Update the interface:
 845+ this.setStatus( gM( 'mwe-seeking' ) );
 846+ // Run the seeking hook
 847+ $j( this.embedPlayer ).trigger( 'onSeek' );
 848+ },
 849+
 850+ /**
 851+ * Updates the player status that displays short text msgs and the play clock
 852+ * @param {String} value Status string value to update
 853+ */
 854+ setStatus: function( value ) {
 855+ // update status:
 856+ this.embedPlayer.$interface.find( '.time-disp' ).html( value );
 857+ },
 858+
840859 /**
841860 * Option menu items
842861 *
@@ -1585,9 +1604,9 @@
15861605 embedPlayer.jump_time = mw.seconds2npt( parseFloat( parseFloat( embedPlayer.getDuration() ) * perc ) + embedPlayer.start_time_sec );
15871606 // mw.log('perc:' + perc + ' * ' + embedPlayer.getDuration() + ' jt:'+ this.jump_time);
15881607 if ( _this.longTimeDisp ) {
1589 - embedPlayer.setStatus( gM( 'mwe-seek_to', embedPlayer.jump_time ) );
 1608+ ctrlObj.setStatus( gM( 'mwe-seek_to', embedPlayer.jump_time ) );
15901609 } else {
1591 - embedPlayer.setStatus( embedPlayer.jump_time );
 1610+ ctrlObj.setStatus( embedPlayer.jump_time );
15921611 }
15931612 // Update the thumbnail / frame
15941613 if ( embedPlayer.isPlaying == false ) {
@@ -1605,7 +1624,7 @@
16061625 // set seek time (in case we have to do a url seek)
16071626 embedPlayer.seek_time_sec = mw.npt2seconds( embedPlayer.jump_time, true );
16081627 mw.log( 'do jump to: ' + embedPlayer.jump_time + ' perc:' + perc + ' sts:' + embedPlayer.seek_time_sec );
1609 - embedPlayer.setStatus( gM( 'mwe-seeking' ) );
 1628+ ctrlObj.setStatus( gM( 'mwe-seeking' ) );
16101629 embedPlayer.doSeek( perc );
16111630 }
16121631 }
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js
@@ -1307,6 +1307,7 @@
13081308 mw.addLoaderDialog = function( msg_txt ) {
13091309 mw.addDialog( msg_txt, msg_txt + '<br>' + mw.loading_spinner() );
13101310 }
 1311+
13111312 /**
13121313 * NOTE: should be moved to browser detection script
13131314 */
Index: branches/js2-work/phase3/js/mwEmbed/jsScriptLoader.php
@@ -42,7 +42,7 @@
4343 // Error msg
4444 var $errorMsg = '';
4545
46 - // Output format is either 'js' or 'css' or 'messages' for exclusivly msg text;
 46+ // Output format is either 'js' or 'css' or 'messages' for exclusively msg text;
4747 var $outputFormat = 'js';
4848
4949 // Debug flag
@@ -438,7 +438,7 @@
439439 // Output MIME type:
440440 if( $this->outputFormat == 'css' ){
441441 header( 'Content-Type: text/css' );
442 - } else if ( $this->outputFormat == 'js' ) {
 442+ } else if ( $this->outputFormat == 'js' || $this->outputFormat == 'messages' ) {
443443 header( 'Content-Type: text/javascript' );
444444 }
445445 header( 'Pragma: public' );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r65942* switched to .bind and .trigger based hook system ( instead of the custom ad...dale06:21, 5 May 2010

Status & tagging log