r65137 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65136‎ | r65137 | r65138 >
Date:20:05, 16 April 2010
Author:dale
Status:deferred
Tags:
Comment:
* improved iPad compatibility (added touch display of controls )
* moved loading spinner up in display time order for player.
* fixed menu css issue
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadForm.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/nativeEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/skins/ctrlBuilder.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/skins/mvpcf/EmbedPlayer.css (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/mwEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/mwEmbedFrame.php (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/tests/Player_Themable.html (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/mwEmbedFrame.php
@@ -158,7 +158,7 @@
159159 if( $this->apiTitleKey || count( $this->sources ) != 0 ) {
160160 echo $this->getVideoTag();
161161 } else {
162 - echo "Error: mwEmbedFrame missing required parameter";
 162+ echo "Error: mwEmbedFrame missing required parameter ( src or apiTitleKey )";
163163 }
164164 ?>
165165 </body>
Index: branches/js2-work/phase3/js/mwEmbed/tests/Player_Themable.html
@@ -5,7 +5,7 @@
66 <title> Sample Themed Player </title>
77 Pre-loading demo ( stuff ) likely needed for video display
88 <!--
9 - <script type="text/javascript" src="../jsScriptLoader.php?debug=true&class=window.jQuery,mwEmbed,$j.ui,mw.EmbedPlayer,nativeEmbed,kplayerEmbed,javaEmbed,vlcEmbed,ctrlBuilder,mvpcfConfig,kskinConfig,$j.fn.menu,$j.cookie,$j.ui.slider,mw.TimedText"></script>
 9+ <script type="text/javascript" src="../jsScriptLoader.php?debug=true&class=window.jQuery,mwEmbed,$j.ui,mw.EmbedPlayer,nativeEmbed,kplayerEmbed,javaEmbed,vlcEmbed,ctrlBuilder,mvpcfConfig,kskinConfig,$j.fn.menu,mw.style.jquerymenu,$j.cookie,$j.ui.slider,mw.TimedText"></script>
1010 <script type="text/javascript" src="../jsScriptLoader.php?debug=true&class=mwEmbed"></script>
1111 <link rel="stylesheet" href="../skins/styles.css" type="text/css" media="screen" />
1212 <link rel="stylesheet" href="../skins/mvpcf/EmbedPlayer.css" type="text/css" media="screen" />
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadForm.js
@@ -382,7 +382,7 @@
383383 $j( uploadMenuTarget ).empty().loadingSpinner();
384384
385385 // if selectUploadProviderCb is set run the callback
386 - if( selectUploadProviderCb ){
 386+ if( selectUploadProviderCb ) {
387387 selectUploadProviderCb( uploadProvider )
388388 }
389389
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js
@@ -155,7 +155,7 @@
156156 /**
157157 * Issues a seek to the playerElement
158158 */
159 - doSeek:function( prec ) {
 159+ doSeek: function( prec ) {
160160 var _this = this;
161161 if( this.playerElement ) {
162162 var seek_time = prec * this.getDuration();
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/loader.js
@@ -103,8 +103,39 @@
104104 */
105105 mw.addDOMReadyHook( function() {
106106 if( mw.documentHasPlayerTags() ) {
 107+ var rewriteElementCount = 0;
 108+
107109 // Add the setup hook since we have player tags
108 - mw.addSetupHook( function( callback ) {
 110+ mw.addSetupHook( function( callback ) {
 111+
 112+ // Set each player to loading ( as early on as possible )
 113+ $j( mw.getConfig( 'rewritePlayerTags' ) ).each( function( index, element ){
 114+
 115+ // Assign an the element an ID (if its missing one)
 116+ if ( $j( element ).attr( "id" ) == '' ) {
 117+ $j( element ).attr( "id", 'v' + ( rewriteElementCount++ ) );
 118+ }
 119+
 120+ // Hide the video tag and add a loader:
 121+ var pos = $j( element ).offset();
 122+ $j( element ).css({
 123+ 'opacity' : 0,
 124+ 'position': 'absolute'
 125+ } )
 126+
 127+ $j('body').append(
 128+ $j('<div />')
 129+ .loadingSpinner()
 130+ .attr('id', 'loadSpiner_' + $j( element ).attr('id') )
 131+ .css({
 132+ 'width' : 32,
 133+ 'height' : 32,
 134+ 'position': 'absolute',
 135+ 'top' : pos.top + 30,
 136+ 'left' : pos.left + 30,
 137+ })
 138+ )
 139+ });
109140 // Load the embedPlayer module ( then run queued hooks )
110141 mw.load( 'EmbedPlayer', function ( ) {
111142 // Rewrite the rewritePlayerTags with the
@@ -139,7 +170,8 @@
140171 'JSON'
141172 ],
142173 [
143 - '$j.fn.menu',
 174+ '$j.fn.menu',
 175+ 'mw.style.jquerymenu',
144176 '$j.ui.slider'
145177 ]
146178 ];
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -333,18 +333,14 @@
334334 */
335335 addElement: function( element, attributes ) {
336336 var _this = this;
337 -
338 - // Assign id if unset
339 - var element_id = $j( element ).attr( "id" );
340 - if ( element_id == '' ) {
341 - element_id = 'v' + this.playerList.length;
342 - $j( element ).attr( "id", element_id);
343 - }
344 -
 337+
 338+ if ( !element.id || element.id == '' ) {
 339+ mw.log("Error: element is missing id ");
 340+ }
345341 mw.log('EmbedPlayerManager: addElement:: ' + element.id );
346342
347343 // Add the element id to playerList
348 - this.playerList.push( element_id );
 344+ this.playerList.push( element.id );
349345
350346 // Check for class based player skin
351347 var skinClassRequest = [ ];
@@ -372,8 +368,8 @@
373369 var playlistPlayer = new mw.PlayList( element, attributes );
374370
375371 // Swap in playlist player interface
376 - _this.swapEmbedPlayerElement( element, playlistPlayer );
377 -
 372+ _this.swapEmbedPlayerElement( element, playlistPlayer );
 373+
378374 // Issue the checkPlayerSources call to the new playlist interface:
379375 $j( '#' + playlistPlayer.id ).get(0).showPlayer();
380376 } );
@@ -381,26 +377,27 @@
382378 case 'video':
383379 case 'audio':
384380 // By default treat the rewrite request as "video"
385 - default:
386 - var ranPlayerSwapFlag = false;
387 -
 381+ default:
 382+ var ranPlayerSwapFlag = false;
388383 // Local callback to runPlayer swap once element has metadata
389 - function runPlayerSwap() {
390 - if( ranPlayerSwapFlag )
 384+ function runPlayerSwap() {
 385+ if( ranPlayerSwapFlag ){
391386 return ;
 387+ }
392388 mw.log("runPlayerSwap::" + $j( element ).attr('id') );
393389 ranPlayerSwapFlag = true;
394390 var playerInterface = new mw.EmbedPlayer( element , attributes);
395 - _this.swapEmbedPlayerElement( element, playerInterface );
 391+ _this.swapEmbedPlayerElement( element, playerInterface );
396392 // Issue the checkPlayerSources call to the new player interface:
397 - // make sure to use the element that is in the DOM:
398 - $j( '#' + $j( element ).attr('id') ).get(0).checkPlayerSources();
 393+ // make sure to use the element that is in the DOM:
 394+ $j( '#' + playerInterface.id ).get(0).checkPlayerSources();
399395 }
400396
401397 if( waitForMeta ) {
402398 mw.log(' WaitForMeta ( video missing height (' + $j( element ).attr('height') + '), width (' + $j( element ).attr('width') + ') or duration' );
403399 element.removeEventListener( "loadedmetadata", runPlayerSwap, true );
404400 element.addEventListener( "loadedmetadata", runPlayerSwap, true );
 401+
405402 // Time-out of 5 seconds ( maybe still playable but no timely metadata )
406403 setTimeout( runPlayerSwap, 5000 );
407404 }else{
@@ -497,8 +494,15 @@
498495 $j( swapPlayerElement ).css( {
499496 'width' : playerInterface.width + 'px',
500497 'height' : playerInterface.height + 'px'
501 - } ).loadingSpinner();
502 -
 498+ } )
 499+ //if we don't already have a loadSpiner add one:
 500+ if( ! $j('#loadSpiner_' + playerInterface.id ).length ){
 501+ $j( swapPlayerElement ).append(
 502+ $j('<div style="margin:auto;top:35%;position:relative;width:32px;height:32px;"/>')
 503+ .loadingSpinner()
 504+ .addClass( "loadingSpinner" )
 505+ );
 506+ }
503507 return true;
504508 },
505509
@@ -516,6 +520,9 @@
517521 mw.log( 'ReadyToPlay callback player:' + player.id );
518522 player.readyToPlay = true;
519523
 524+ // Remove the player loader spiner:
 525+ $j('#loadSpiner_' + player.id ).remove();
 526+
520527 var is_ready = true;
521528 for ( var i = 0; i < this.playerList.length; i++ ) {
522529 var currentPlayer = $j( '#' + this.playerList[i] ).get( 0 );
@@ -1256,11 +1263,7 @@
12571264 }
12581265 if ( $j( element ).attr( 'poster' ) ) {
12591266 _this.poster = $j( element ).attr( 'poster' );
1260 - }
1261 - // Set by default thumb value if not found
1262 - if( ! _this.poster ) {
1263 - _this.poster = mw.getConfig( 'images_path' ) + 'vid_default_thumb.jpg' ;
1264 - }
 1267+ }
12651268
12661269 // Set the skin name from the class
12671270 var sn = $j(element).attr( 'class' );
@@ -1329,9 +1332,15 @@
13301333 }
13311334 } );
13321335 },
1333 -
13341336
13351337 /**
 1338+ * for plugin-players to update supported features
 1339+ */
 1340+ updateFeatureSupport: function(){
 1341+ return ;
 1342+ },
 1343+
 1344+ /**
13361345 * Set the width & height from css style attribute, element attribute, or by default value
13371346 * if no css or attribute is provided set a callback to resize.
13381347 *
@@ -1644,8 +1653,8 @@
16451654
16461655 // Load the selected player
16471656 this.selected_player.load( function() {
1648 - // Get the selected player Interface
1649 - var playerInterface = window[ _this.selected_player.library + 'Embed' ];
 1657+ // Get embed library player Interface
 1658+ var playerInterface = window[ _this.selected_player.library + 'Embed' ];
16501659
16511660 for ( var method in playerInterface ) {
16521661 if ( _this[method] && !_this['parent_' + method] ) {
@@ -1653,6 +1662,9 @@
16541663 }
16551664 _this[ method ] = playerInterface[method];
16561665 }
 1666+ // Run any constructor code:
 1667+ _this.updateFeatureSupport();
 1668+
16571669 _this.getDuration();
16581670 _this.showPlayer();
16591671 // Call the global player mannager to inform this video interface is 100% ready:
@@ -1730,14 +1742,14 @@
17311743 /**
17321744 * Get the plugin embed html ( should be implemented by embed player interface )
17331745 */
1734 - doEmbedHTML : function() {
 1746+ doEmbedHTML: function() {
17351747 return 'Error: function doEmbedHTML should be implemented by embed player interface ';
17361748 },
17371749
17381750 /**
17391751 * Seek function (should be implemented by embed player interface )
17401752 */
1741 - doSeek : function( percent ) {
 1753+ doSeek: function( percent ) {
17421754 var _this = this;
17431755 if ( this.supportsURLTimeEncoding() ) {
17441756 // Make sure this.seek_time_sec is up-to-date:
@@ -1854,8 +1866,7 @@
18551867 * Show the player
18561868 */
18571869 showPlayer : function () {
1858 - mw.log( 'Show player: ' + this.id );
1859 -
 1870+ mw.log( 'Show player: ' + this.id );
18601871 // Set-up the local ctrlBuilder instance:
18611872 this.ctrlBuilder = new ctrlBuilder( this );
18621873
@@ -2094,9 +2105,21 @@
20952106 var thumb_html = '';
20962107 var class_atr = '';
20972108 var style_atr = '';
2098 -
 2109+
 2110+ // Set by default thumb value if not found
 2111+ var posterSrc = ( this.poster ) ? this.poster :
 2112+ mw.getConfig( 'images_path' ) + 'vid_default_thumb.jpg';
 2113+
 2114+ // Remove any old thumbnail items:
 2115+ $j( this ).find( '.playerPoster,.loadingSpinner,.play-btn-large' ).remove();
 2116+
 2117+ var dummyvid = document.createElement( "video" );
20992118 // put it all in the div container dc_id
2100 - $j( this ).html(
 2119+
 2120+ // Poster support is not very consistant in browsers
 2121+ // use a jpg poster image:
 2122+ // use a jpg thumbnail:
 2123+ $j( this ).append(
21012124 $j( '<img />' )
21022125 .css({
21032126 'position' : 'relative',
@@ -2105,9 +2128,10 @@
21062129 })
21072130 .attr({
21082131 'id' : 'img_thumb_' + this.id,
2109 - 'src' : this.poster
 2132+ 'src' : posterSrc
21102133 })
2111 - );
 2134+ .addClass( 'playerPoster' )
 2135+ );
21122136
21132137 if ( this.controls
21142138 && this.height > this.ctrlBuilder.getComponentHeight( 'playButtonLarge' )
@@ -2148,11 +2172,16 @@
21492173 }
21502174 } else {
21512175 // Output all the video sources:
2152 - for( var i=0; i < this.mediaElement.length; i++ ){
 2176+ for( var i=0; i < this.mediaElement.sources.length; i++ ){
 2177+ var source = this.mediaElement.sources[i];
21532178 if( source.src ) {
2154 - iframeUrl +='src[]=' + escape( mw.absoluteUrl( source.src ) ) + '&';
 2179+ iframeUrl += 'src[]=' + escape( mw.absoluteUrl( source.src ) ) + '&';
21552180 }
2156 - }
 2181+ }
 2182+ // Output the poster attr
 2183+ if( this.poster ){
 2184+ iframeUrl += 'poster=' + escape( this.poster ) + '&';
 2185+ }
21572186 }
21582187
21592188 // Set the skin if set to something other than default
@@ -2247,7 +2276,8 @@
22482277 embedCode += '&gt;';
22492278
22502279 // Output all the video sources:
2251 - for( var i=0; i < this.mediaElement.length; i++ ){
 2280+ for( var i=0; i < this.mediaElement.sources.length; i++ ){
 2281+ var source = this.mediaElement.sources[i];
22522282 if( source.src ) {
22532283 embedCode +='&lt;source src=&quot;' +
22542284 mw.absoluteUrl( source.src ) +
@@ -2831,7 +2861,7 @@
28322862 preference : { },
28332863
28342864 // Stores the default set of players for a given mime type
2835 - default_players : { },
 2865+ default_players : { },
28362866
28372867 /**
28382868 * Initializartion function sets the default order for players for
@@ -2875,6 +2905,18 @@
28762906 },
28772907
28782908 /**
 2909+ * Checks if a player is supported by id
 2910+ */
 2911+ isSupportedPlayer: function( player_id ){
 2912+ for( var i=0; i < this.players.length; i++ ){
 2913+ if( this.players[i].id == player_id ){
 2914+ return true;
 2915+ }
 2916+ }
 2917+ return false;
 2918+ },
 2919+
 2920+ /**
28792921 * get players that support a given mimeType
28802922 *
28812923 * @param {String} mimeType Mime type of player set
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/skins/ctrlBuilder.js
@@ -380,7 +380,7 @@
381381 _this.showControlBar();
382382 // Once we move the mouse keep displayed for 4 seconds
383383 setTimeout(checkMovedMouse, 4000);
384 - }else{
 384+ } else {
385385 // Check for mouse movement every 250ms
386386 _this.hideControlBar();
387387 setTimeout(checkMovedMouse, 250 );
@@ -508,15 +508,25 @@
509509 // Set up local pointer to the embedPlayer
510510 var embedPlayer = this.embedPlayer;
511511 var _this = this;
 512+ var $interface = embedPlayer.$interface;
512513
513514 // Setup target shortcut to control-bar
514 - $target = embedPlayer.$interface;
 515+ $target = embedPlayer.$interface;
515516 var mouseIn = false;
516517 // Add hide show bindings for control overlay (if overlay is enabled )
517 - if( _this.checkOverlayControls() ) {
 518+ if( ! _this.checkOverlayControls() ) {
 519+ $interface.unbind().show();
 520+ } else { // hide show controls:
 521+ //$interface.css({'background-color': 'red'});
 522+ // Bind a startTouch to show controls
 523+ $interface.bind( 'touchstart', function() {
 524+ _this.showControlBar();
 525+ // ( once the user touched the video "don't hide" )
 526+ } );
518527 // Add a special absolute overlay for hover ( to keep menu displayed
519 - $j( embedPlayer.$interface ).hover(
 528+ $interface.hover(
520529 function(){
 530+ mw.log("CALL HOVER");
521531 // Show controls with a set timeout ( avoid fade in fade out on short mouse over )
522532 setTimeout( function() {
523533 if( mouseIn ){
@@ -529,7 +539,7 @@
530540 mouseIn = false;
531541 // Hide controls ( delay hide if menu is visible )
532542 function hideCheck(){
533 - if ( embedPlayer.$interface.find( '.overlay-win' ).length != 0
 543+ if ( $interface.find( '.overlay-win' ).length != 0
534544 || $j('.menuPositionHelper').is(':visible' ) ) {
535545 setTimeout( hideCheck, 250 );
536546 return ;
@@ -543,8 +553,6 @@
544554 setTimeout( hideCheck, 1000 );
545555 }
546556 );
547 - } else {
548 - $j( embedPlayer.$interface ).unbind().show();
549557 }
550558
551559 // Add recommend firefox if we have non-native playback:
@@ -585,7 +593,8 @@
586594 * Show the control bar
587595 */
588596 showControlBar : function(){
589 - var animateDuration = 'slow';
 597+ var animateDuration = 'slow';
 598+ $j( this.embedPlayer.getPlayerElement() ).css('z-index', '1')
590599 // Move up itext if present
591600 this.embedPlayer.$interface.find( '.itext' )
592601 .animate(
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/skins/mvpcf/EmbedPlayer.css
@@ -5,7 +5,6 @@
66 /*Video player*/
77 .mv-player {
88 color: #FFF;
9 - background: #000;
109 }
1110
1211 /* large play button: */
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/nativeEmbed.js
@@ -37,6 +37,18 @@
3838 // if the object supports playlist functions
3939 'playlist_swap_loader' : true
4040 },
 41+ /**
 42+ * updates the supported features given the "type of player"
 43+ */
 44+ updateFeatureSupport: function(){
 45+ // iWhatever devices appear to have a broken
 46+ // dom overlay implementation of video atm. (hopefully iphone OS 4 fixes this )
 47+ if ((navigator.userAgent.indexOf('iPhone') != -1) ||
 48+ (navigator.userAgent.indexOf('iPod') != -1) ||
 49+ (navigator.userAgent.indexOf('iPad') != -1)) {
 50+ this.supports.overlays = false;
 51+ }
 52+ },
4153
4254 /**
4355 * Return the embed code
@@ -57,11 +69,9 @@
5870 'height' : '100%'
5971 } )
6072 )
61 - mw.log( "Embed code: " + $j( this ).html() )
62 -
63 - setTimeout( function() {
64 - _this.postEmbedJS();
65 - }, 150 );
 73+ mw.log( "Embed code: " + $j( this ).html() );
 74+ // directly run postEmbedJS ( if playerElement is not avaliable it will retry )
 75+ _this.postEmbedJS();
6676 },
6777
6878 /**
@@ -70,14 +80,13 @@
7181 postEmbedJS: function() {
7282 var _this = this;
7383 mw.log( "f:native:postEmbedJS:" );
74 - this.getPlayerElement();
75 - if ( typeof this.playerElement != 'undefined' ) {
76 -
77 - // Setup some bindings:
78 - var vid = $j( this.playerElement ).get(0);
79 -
 84+
 85+ // Setup local pointer:
 86+ var vid = this.getPlayerElement();
 87+ if ( typeof this.playerElement != 'undefined' ) {
 88+ // Setup some bindings:
8089 // Bind events to local js methods:
81 - vid.addEventListener( 'canplaythrough', function() { _this.canplaythrough }, true);
 90+ vid.addEventListener( 'canplaythrogh', function() { _this.canplaythrough }, true);
8291 vid.addEventListener( 'loadedmetadata', function() { _this.onloadedmetadata() }, true);
8392 vid.addEventListener( 'progress', function( e ) { _this.onprogress( e ) }, true);
8493 vid.addEventListener( 'ended', function() { _this.onended() }, true);
@@ -86,11 +95,16 @@
8796
8897 // Check for load flag
8998 if ( this.onlyLoadFlag ) {
90 - this.playerElement.load();
 99+ vid.pause();
 100+ vid.load();
91101 } else {
92102 // Issue play request
93 - this.playerElement.play();
 103+ vid.play();
94104 }
 105+
 106+ // Run the "hook" for any extensions that need to bind things to the actual video elemnt
 107+ this.runHook( 'postEmbedJS' )
 108+
95109 setTimeout( function() {
96110 _this.monitor();
97111 }, 100 );
@@ -99,16 +113,16 @@
100114 // False inserts don't seem to be as much of a problem as before:
101115 mw.log( 'Could not grab vid obj trying again:' + typeof this.playerElement );
102116 this.grab_try_count++;
103 - if ( this.grab_count == 20 ) {
 117+ if ( this.grab_count == 20 ) {
104118 mw.log( 'Could not get vid object after 20 tries re-run: getEmbedObj() ?' ) ;
105119 } else {
106120 setTimeout( function() {
107121 _this.postEmbedJS();
108 - }, 200 );
 122+ }, 150 );
109123 }
110124
111125 }
112 - },
 126+ },
113127
114128 /**
115129 * Issue a seeking request.
@@ -219,6 +233,7 @@
220234 */
221235 monitor: function() {
222236 this.getPlayerElement(); // make sure we have .vid obj
 237+
223238 if ( !this.playerElement ) {
224239 mw.log( 'could not find video embed: ' + this.id + ' stop monitor' );
225240 return false;
@@ -226,7 +241,8 @@
227242
228243 // update currentTime
229244 this.currentTime = this.playerElement.currentTime;
230 -
 245+
 246+ //mw.log( 'ns: ' + this.playerElement.networkState + ' error:' + this.playerElement.error);
231247 //mw.log('currentTime:' + this.currentTime);
232248 // once currentTime is updated call parent_monitor
233249 this.parent_monitor();
@@ -294,8 +310,9 @@
295311 */
296312 updateVolumen: function( percentage ) {
297313 this.getPlayerElement();
298 - if ( this.playerElement )
 314+ if ( this.playerElement ) {
299315 this.playerElement.volume = percentage;
 316+ }
300317 },
301318
302319 /**
@@ -342,7 +359,7 @@
343360 /**
344361 * Get /update the playerElement value
345362 */
346 - getPlayerElement : function () {
 363+ getPlayerElement: function () {
347364 this.playerElement = $j( '#' + this.pid ).get( 0 );
348365 return this.playerElement;
349366 },
@@ -377,8 +394,9 @@
378395 oncanplaythrough: function() {
379396 mw.log('f:oncanplaythrough');
380397 this.getPlayerElement();
381 - if ( ! this.paused )
382 - this.playerElement.play();
 398+ if ( ! this.paused ) {
 399+ this.playerElement.play();
 400+ }
383401 },
384402
385403 /**
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js
@@ -26,7 +26,6 @@
2727 "mwe-please-login" : "The request failed. Are you logged in on $1 ? Please $2 and try again",
2828 "mwe-log-in-link" : "log in",
2929 "mwe-remember-loging" : "General security reminder: Only login to web sites when your address bar displays that site's address."
30 -
3130 } );
3231
3332
@@ -406,8 +405,7 @@
407406 nestedServerFrame = getServerFrame( {
408407 'apiUrl' : mw.getLocalApiUrl(),
409408 'pageName' : 'ApiProxyNestedCb'
410 - } );
411 -
 409+ } );
412410 // Update the context to include the nestedCallbackFlag flag in the request
413411 return nestedServerFrame;
414412 }
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js
@@ -463,8 +463,9 @@
464464 * @param {Function} hookFunction Function to be called at hook time
465465 */
466466 targetObj.addHook = function( hookName, hookFunction ) {
467 - if( ! this.hooks[ hookName ] )
 467+ if( ! this.hooks[ hookName ] ) {
468468 this.hooks[ hookName ] = [ ];
 469+ }
469470 this.hooks[ hookName ].push( hookFunction )
470471 }
471472
@@ -775,8 +776,8 @@
776777 scriptRequest = baseClassPath;
777778 }
778779 if( ! scriptRequest ) {
779 - mw.log( "Could not get url for class " + className );
780 - return ;
 780+ mw.log( "Error Could not get url for class " + className );
 781+ return false;
781782 }
782783 }
783784
@@ -785,15 +786,23 @@
786787
787788 // Set the top level load done to the callback
788789 mw.setLoadDoneCB( className, callback );
 790+
789791
790792 // Issue the request to load the class (include class name in result callback:
791793 mw.getScript( scriptRequest, function( scriptRequest ) {
 794+ // If its a "syle sheet" manually set its class to true
 795+ if( scriptRequest.substr( scriptRequest.lastIndexOf( '.' ), 4 ).toLowerCase() == 'css' &&
 796+ className.substr(0,8) == 'mw.style' ){
 797+ window [ className ] = true;
 798+ }
 799+
792800 // Debug output
793801 if(! mw.isset( className )
794802 && mwLoadDoneCB[ className ] != 'done' ) {
795803 mw.log( 'Possible Error: ' + className +' not set in time, or not defined in:' + "\n" + _this.getClassPath( className ) );
796804 }
797805 // Call load done (incase the script did not include a loadDone callback )
 806+ // if the script loader (did call loadDone this loadDone will be ignored
798807 mw.loadDone( className );
799808 } );
800809 //mw.log( 'done with running getScript request ' );
@@ -852,7 +861,7 @@
853862 if( this.classPaths[ className ] )
854863 return this.classPaths[ className ]
855864 return false;
856 - }
 865+ }
857866 }
858867 /**
859868 * Load done callback for script loader
@@ -1541,10 +1550,11 @@
15421551 * @param {Function} callback Function to call once script is loaded
15431552 */
15441553 mw.getScript = function( scriptRequest, callback ) {
1545 - // Setup the local callback
 1554+ // Setup the local scope callback instace
15461555 var myCallback = function(){
1547 - if( callback )
 1556+ if( callback ) {
15481557 callback( scriptRequest );
 1558+ }
15491559 }
15501560 // Set the base url based scriptLoader availability & type of scriptRequest
15511561 // ( presently script loader only handles "classes" not relative urls:
@@ -1552,7 +1562,7 @@
15531563
15541564 // Check if its a class name, ( ie does not start with "/" and does not include ://
15551565 var isClassName = ( scriptRequest.indexOf('://') == -1 && scriptRequest.indexOf('/') !== 0 )? true : false;
1556 -
 1566+
15571567 var ext = scriptRequest.substr( scriptRequest.lastIndexOf( '.' ), 4 ).toLowerCase();
15581568 var isCssFile = ( ext == '.css') ? true : false ;
15591569
Index: branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js
@@ -182,6 +182,7 @@
183183 'kskinConfig',
184184 'mw.style.kskin',
185185 '$j.fn.menu',
 186+ 'mw.style.jquerymenu',
186187 'mw.TimedText'
187188 ];
188189 // Quick sniff use java if IE and native if firefox

Status & tagging log