Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/loader.js |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | */ |
5 | 5 | // Scope everything in "mw" ( keeps the global namespace clean ) |
6 | 6 | ( function( mw ) { |
7 | | - |
| 7 | + |
8 | 8 | mw.addClassFilePaths( { |
9 | 9 | "mw.TimedText" : "mw.TimedText.js", |
10 | 10 | "mw.style.TimedText" : "css/mw.style.TimedText.css", |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | "mw.style.TimedTextEdit" : "css/mw.style.TimedTextEdit.css", |
14 | 14 | |
15 | 15 | "RemoteMwTimedText" : "remotes/RemoteMwTimedText.js" |
16 | | -}); |
| 16 | +} ); |
17 | 17 | |
18 | 18 | var mwTimedTextRequestSet = [ |
19 | 19 | '$j.fn.menu', |
— | — | @@ -29,18 +29,21 @@ |
30 | 30 | }); |
31 | 31 | |
32 | 32 | var mwLoadTimedTextFlag = false; |
33 | | -// Merge in the timed text libs |
| 33 | +// Always Merge in the timed text libs |
34 | 34 | if( mw.getConfig( 'textInterface' ) == 'always' ) { |
35 | 35 | mwLoadTimedTextFlag = true; |
36 | 36 | } |
| 37 | + |
37 | 38 | /** |
38 | | -* Setup the load embedPlayer visit tag function hook. |
| 39 | +* Setup the load embedPlayer visit tag addSetupHook function |
39 | 40 | * |
40 | 41 | * Check if the video tags in the page support timed text |
41 | 42 | * this way we can add our timed text libraries to the initial |
42 | 43 | * request and avoid an extra round trip to the server |
43 | 44 | */ |
44 | | -mw.addHook( 'LoaderEmbedPlayerVisitTag', function( playerElement ) { |
| 45 | + |
| 46 | +// Bind the loader embed player tag viewing |
| 47 | +$j( mw ).bind( 'LoaderEmbedPlayerVisitTag', function( event, playerElement ) { |
45 | 48 | // If add timed text flag not already set check for itext, and sources |
46 | 49 | if( ! mwLoadTimedTextFlag ) { |
47 | 50 | if( $j( playerElement ).find( 'itext' ).length != 0 ) { |
— | — | @@ -55,14 +58,15 @@ |
56 | 59 | } |
57 | 60 | } |
58 | 61 | } ); |
59 | | - |
60 | 62 | // 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 ) { |
62 | 64 | // Add timed text items if flag set. |
63 | 65 | if( mwLoadTimedTextFlag ) { |
64 | 66 | $j.merge( classRequest, mwTimedTextRequestSet ); |
65 | | - } |
| 67 | + } |
| 68 | + |
66 | 69 | } ); |
| 70 | + |
67 | 71 | |
68 | 72 | // TimedText editor: |
69 | 73 | mw.addModuleLoader( 'TimedText.Edit', function( callback ) { |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js |
— | — | @@ -158,11 +158,11 @@ |
159 | 159 | } |
160 | 160 | |
161 | 161 | // Set up embedPlayer hooks: |
162 | | - embedPlayer.addHook( 'monitor', function() { |
163 | | - _this.monitor(); |
164 | | - } ) |
| 162 | + $j( embedPlayer ).bind( 'onMonitor', function() { |
| 163 | + _this.monitor() |
| 164 | + } ); |
165 | 165 | |
166 | | - embedPlayer.addHook( 'play', function() { |
| 166 | + $j( embedPlayer ).bind( 'onPlay', function() { |
167 | 167 | // Will load and setup timedText sources (if not loaded already loaded ) |
168 | 168 | _this.setupTextSources(); |
169 | 169 | } ); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/loader.js |
— | — | @@ -111,54 +111,49 @@ |
112 | 112 | * We use mw.addDOMReadyHook instead of mw.ready so that |
113 | 113 | * player interfaces are ready once mw.ready is called. |
114 | 114 | */ |
115 | | -mw.addDOMReadyHook( function() { |
| 115 | +mw.addSetupHook( function( callback ) { |
116 | 116 | if( mw.documentHasPlayerTags() ) { |
117 | 117 | var rewriteElementCount = 0; |
118 | 118 | |
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(); |
163 | 158 | } |
164 | 159 | }); |
165 | 160 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/skins/ctrlBuilder.js |
— | — | @@ -836,6 +836,25 @@ |
837 | 837 | // Related videos could be shown here |
838 | 838 | }, |
839 | 839 | |
| 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 | + |
840 | 859 | /** |
841 | 860 | * Option menu items |
842 | 861 | * |
— | — | @@ -1585,9 +1604,9 @@ |
1586 | 1605 | embedPlayer.jump_time = mw.seconds2npt( parseFloat( parseFloat( embedPlayer.getDuration() ) * perc ) + embedPlayer.start_time_sec ); |
1587 | 1606 | // mw.log('perc:' + perc + ' * ' + embedPlayer.getDuration() + ' jt:'+ this.jump_time); |
1588 | 1607 | if ( _this.longTimeDisp ) { |
1589 | | - embedPlayer.setStatus( gM( 'mwe-seek_to', embedPlayer.jump_time ) ); |
| 1608 | + ctrlObj.setStatus( gM( 'mwe-seek_to', embedPlayer.jump_time ) ); |
1590 | 1609 | } else { |
1591 | | - embedPlayer.setStatus( embedPlayer.jump_time ); |
| 1610 | + ctrlObj.setStatus( embedPlayer.jump_time ); |
1592 | 1611 | } |
1593 | 1612 | // Update the thumbnail / frame |
1594 | 1613 | if ( embedPlayer.isPlaying == false ) { |
— | — | @@ -1605,7 +1624,7 @@ |
1606 | 1625 | // set seek time (in case we have to do a url seek) |
1607 | 1626 | embedPlayer.seek_time_sec = mw.npt2seconds( embedPlayer.jump_time, true ); |
1608 | 1627 | 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' ) ); |
1610 | 1629 | embedPlayer.doSeek( perc ); |
1611 | 1630 | } |
1612 | 1631 | } |
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js |
— | — | @@ -1307,6 +1307,7 @@ |
1308 | 1308 | mw.addLoaderDialog = function( msg_txt ) { |
1309 | 1309 | mw.addDialog( msg_txt, msg_txt + '<br>' + mw.loading_spinner() ); |
1310 | 1310 | } |
| 1311 | + |
1311 | 1312 | /** |
1312 | 1313 | * NOTE: should be moved to browser detection script |
1313 | 1314 | */ |
Index: branches/js2-work/phase3/js/mwEmbed/jsScriptLoader.php |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | // Error msg |
44 | 44 | var $errorMsg = ''; |
45 | 45 | |
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; |
47 | 47 | var $outputFormat = 'js'; |
48 | 48 | |
49 | 49 | // Debug flag |
— | — | @@ -438,7 +438,7 @@ |
439 | 439 | // Output MIME type: |
440 | 440 | if( $this->outputFormat == 'css' ){ |
441 | 441 | header( 'Content-Type: text/css' ); |
442 | | - } else if ( $this->outputFormat == 'js' ) { |
| 442 | + } else if ( $this->outputFormat == 'js' || $this->outputFormat == 'messages' ) { |
443 | 443 | header( 'Content-Type: text/javascript' ); |
444 | 444 | } |
445 | 445 | header( 'Pragma: public' ); |