r62990 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62989‎ | r62990 | r62991 >
Date:02:08, 26 February 2010
Author:dale
Status:deferred
Tags:
Comment:
* minor style updates
* flash embed fixes
* IE source reading fixes
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/mwEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/common/common.css (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/mvpcf/EmbedPlayer.css (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/tests/Player_Themable.html (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/tests/Player_Themable.html
@@ -31,7 +31,6 @@
3232 durationHint="60" >
3333 </video>
3434
35 -
3635 <video
3736 style="width:208px;height:160px;float:left"
3837 src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg"
Index: branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js
@@ -117,9 +117,10 @@
118118 'height' : parseInt( embedPlayer.height ) + parseInt( this.height ) + 2
119119 } );
120120 // update the control bar display to "block"
121 - $controlBar.css('display', 'block')
 121+ $controlBar.css( 'display', 'block' );
122122 }
123 - // add the controls to the interface
 123+
 124+ // Add the controls to the interface
124125 embedPlayer.$interface.append( $controlBar );
125126
126127 // Add the Controls with their bindings
@@ -131,7 +132,7 @@
132133
133134 /**
134135 * Builds the interface controls
135 - * @returns the interface html string
 136+ * @return the interface html string
136137 */
137138 addControlComponents: function( ) {
138139 var _this = this;
@@ -162,7 +163,7 @@
163164
164165 // Output components
165166 for ( var component_id in this.components ) {
166 -
 167+ mw.log(' on componet: ' + component_id );
167168 // Check for (component === false ) and skip
168169 if( this.components[ component_id ] === false ){
169170 continue;
@@ -357,21 +358,23 @@
358359
359360 // Bind resize resize window to resize window
360361 $j( window ).resize( function() {
361 - // UPdate interface container:
362 - $interface.css( {
363 - 'top' : '0px',
364 - 'left' : '0px',
365 - 'width' : $j( window ).width(),
366 - 'height' : $j( window ).height()
367 - } )
368 - // Update player size
369 - $j( embedPlayer ).css( _this.getFullscreenPlayerCss() );
370 -
371 - // Update play button pos
372 - $interface.find('.play-btn-large').css( _this.getFullscreenPlayButtonCss() );
373 -
374 - // Update the timed text size
375 - $interface.find( '.itext' ).css( _this.getFullscreenTextCss() );
 362+ if( _this.fullscreenMode ){
 363+ // Update interface container:
 364+ $interface.css( {
 365+ 'top' : '0px',
 366+ 'left' : '0px',
 367+ 'width' : $j( window ).width(),
 368+ 'height' : $j( window ).height()
 369+ } )
 370+ // Update player size
 371+ $j( embedPlayer ).css( _this.getFullscreenPlayerCss() );
 372+
 373+ // Update play button pos
 374+ $interface.find('.play-btn-large').css( _this.getFullscreenPlayButtonCss() );
 375+
 376+ // Update the timed text size
 377+ $interface.find( '.itext' ).css( _this.getFullscreenTextCss() );
 378+ }
376379 });
377380
378381 // Bind escape to restore clip resolution
@@ -859,7 +862,8 @@
860863 .addClass( 'ui-widget-overlay' )
861864 .css( {
862865 'height' : '100%',
863 - 'width' : '100%'
 866+ 'width' : '100%',
 867+ 'z-index' : 2
864868 } )
865869 );
866870
@@ -885,7 +889,7 @@
886890 'top': '15px',
887891 'overflow' : 'auto',
888892 'padding' : '4px',
889 - 'z-index' : 2
 893+ 'z-index' : 3
890894 };
891895 $overlayMenu = $j('<div />')
892896 .addClass( 'overlay-win ui-state-default ui-widget-header ui-corner-all' )
@@ -901,7 +905,7 @@
902906 var shadowCss = jQuery.extend( true, {}, overlayMenuCss );
903907 shadowCss['height' ] = 210;
904908 shadowCss['width' ] = 260;
905 - shadowCss[ 'z-index' ] = 1;
 909+ shadowCss[ 'z-index' ] = 2;
906910 $overlayShadow = $j( '<div />' )
907911 .addClass('ui-widget-shadow ui-corner-all')
908912 .css( shadowCss );
@@ -1296,7 +1300,7 @@
12971301 'zindex' : mw.getConfig( 'fullScreenIndex' ),
12981302 'positionOpts': {
12991303 'directionV' : 'up',
1300 - 'offsetY' : 32,
 1304+ 'offsetY' : 30,
13011305 'directionH' : 'left',
13021306 'offsetX' : -28
13031307 }
@@ -1385,6 +1389,7 @@
13861390 'volumeControl': {
13871391 'w' : 28,
13881392 'o' : function( ctrlObj ) {
 1393+ mw.log(' set up volume out');
13891394 $volumeOut = $j( '<span />' );
13901395 if ( ctrlObj.volume_layout == 'horizontal' ) {
13911396 $volumeOut.append(
@@ -1392,6 +1397,7 @@
13931398 .addClass( "ui-slider ui-slider-horizontal rButton volume-slider" )
13941399 );
13951400 }
 1401+ mw.log(' add up volume control icon');
13961402 // Add the volume control icon
13971403 $volumeOut.append(
13981404 $j('<div />')
@@ -1402,22 +1408,23 @@
14031409 .addClass( "ui-icon ui-icon-volume-on" )
14041410 )
14051411 );
1406 -
 1412+ mw.log(' if verticle add container ');
14071413 if ( ctrlObj.volume_layout == 'vertical' ) {
14081414 $volumeOut.find('.volume_control').append(
14091415 $j( '<div />' )
14101416 .css( {
1411 - 'position' : 'absolute',
1412 - 'display' : 'none',
1413 - 'left' : '0px;'
 1417+ 'position' : 'absolute',
 1418+ 'left' : '0px'
14141419 })
 1420+ .hide()
14151421 .addClass( "vol_container ui-corner-all" )
14161422 .append(
14171423 $j( '<div />' )
14181424 .addClass ( "volume-slider" )
14191425 )
14201426 );
1421 - }
 1427+ }
 1428+ mw.log('get inner volume html');
14221429 //Return the inner html
14231430 return $volumeOut.html();
14241431 }
Index: branches/js2-work/phase3/js/mwEmbed/skins/common/common.css
@@ -495,4 +495,9 @@
496496 -moz-background-clip: border;
497497 -moz-background-origin: padding;
498498 -moz-background-inline-policy: continuous;
 499+}
 500+
 501+.fg-menu .ui-icon{
 502+ position:relative;
 503+ top:-1px;
499504 }
\ No newline at end of file
Index: branches/js2-work/phase3/js/mwEmbed/skins/mvpcf/EmbedPlayer.css
@@ -195,5 +195,3 @@
196196 .mv-player .overlay-win ul{
197197 padding-left: 15px;
198198 }
199 -
200 -
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js
@@ -23,26 +23,33 @@
2424 doEmbedHTML : function () {
2525 var _this = this;
2626 var playerPath = mw.getMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/kaltura-player';
 27+
 28+
2729 $j( this ).html(
28 - '<object width="' + this.getWidth() + '" height="' + this.getHeight() + '" '+
29 - 'data="' + playerPath + '/wrapper.swf" allowfullscreen="true" '+
30 - 'allownetworking="all" allowscriptaccess="always" '+
31 - 'type="application/x-shockwave-flash" '+
32 - 'id="' + this.pid + '" name="' + this.pid + '">'+
33 - '<param value="always" name="allowScriptAccess"/>'+
34 - '<param value="all" name="allowNetworking"/>'+
35 - '<param value="true" name="allowFullScreen"/>'+
36 - '<param value="#000000" name="bgcolor"/>'+
37 - '<param value="wrapper.swf" name="movie"/>'+
38 - '<param value="' +
 30+ '<object width="' + this.getWidth() + '" height="' + this.getHeight() + '" ' +
 31+ 'data="' + playerPath + '/wrapper.swf" allowfullscreen="true" ' +
 32+ 'allownetworking="all" allowscriptaccess="always" ' +
 33+ 'type="application/x-shockwave-flash" ' +
 34+ 'flashVars="kdpUrl=' + playerPath + '/kdp.swf' +
 35+ '&ks=dummy&partner_id=0&subp_id=0' +
 36+ '&uid=0&emptyF=onKdpEmpty&readyF=onKdpReady' +
 37+ '" '+
 38+ 'wmode="opaque" ' +
 39+ 'id="' + this.pid + '" name="' + this.pid + '">' +
 40+ '<param value="always" name="allowScriptAccess"/>' +
 41+ '<param value="all" name="allowNetworking"/>' +
 42+ '<param value="true" name="allowFullScreen"/>' +
 43+ '<param value="#000000" name="bgcolor"/>' +
 44+ '<param value="wrapper.swf" name="movie"/>' +
 45+ '<param value="' +
3946 'kdpUrl=' + playerPath + '/kdp.swf' +
4047 '&ks=dummy&partner_id=0&subp_id=0' +
4148 '&uid=0&emptyF=onKdpEmpty&readyF=onKdpReady' +
42 - '" ' +
43 - 'name="flashVars"/>'+
44 - '<param value="opaque" name="wmode"/>'+
 49+ '" ' +
 50+ 'name="flashVars"/>' +
 51+ '<param value="opaque" name="wmode"/>' +
4552 '</object>'
46 - )
 53+ )
4754 setTimeout(function() {
4855 _this.postEmbedJS();
4956 }, 50);
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -672,7 +672,7 @@
673673 },
674674
675675 /**
676 - * MIME type accessor function.
 676+ * MIME type accessors function.
677677 * @return {String} the MIME type of the source.
678678 */
679679 getMIMEType: function() {
@@ -871,19 +871,38 @@
872872 }
873873
874874 // Set by default thumb value if not found
875 - if( ! this.thumbnail )
 875+ if( ! this.thumbnail ){
876876 this.thumbnail = mw.getConfig( 'images_path' ) + 'vid_default_thumb.jpg' ;
 877+ }
877878
878879 // Process the video_element as a source element:
879880 if ( $j( video_element ).attr( "src" ) ) {
880881 this.tryAddSource( video_element );
881882 }
882883
883 - // Process all inner <source>, & <itext> elements
884 - $j( video_element ).find( 'source,itext' ).each( function( ) {
885 - mw.log( 'pcat: ' + $j(this).parent().attr( 'category' ) + ' tagName:' + $j(this).parent().get(0).tagName );
886 - _this.tryAddSource( this );
887 - } );
 884+ if( ! $j.browser.msie ){
 885+ // Most browsers are oky with inner unknown element selectors:
 886+ $j( video_element ).find( 'source,itext' ).each( function( ) {
 887+ _this.tryAddSource( this );
 888+ } );
 889+ } else {
 890+ // IE on the other hand is not.
 891+
 892+ // IE apperntly has the source tags floating in DOM space but not
 893+ // as child of the unknown video tag element rather as its "sibling"
 894+
 895+ // Add the video element with an identifiable div
 896+
 897+ // NOTE this fails for multiple video tags in a given div
 898+ // but if we $j( video_element ).wrap ( $j('<div />' ) ) it fails all together
 899+ $j( $j( video_element ).parent().get(0).getElementsByTagName('source') ).each( function(){
 900+ _this.tryAddSource( this );
 901+ });
 902+
 903+ $j( $j( video_element ).parent().get(0).getElementsByTagName( 'itext' ) ).each( function(){
 904+ _this.tryAddSource( this );
 905+ });
 906+ }
888907 },
889908
890909 /**
@@ -908,9 +927,11 @@
909928 textSourceExists: function() {
910929 for ( var i = 0; i < this.sources.length; i++ ) {
911930 mw.log( this.sources[i].mime_type );
912 - if ( this.sources[i].mime_type == 'text/cmml' ||
913 - this.sources[i].mime_type == 'text/x-srt' )
 931+ if ( this.sources[i].mime_type == 'text/cmml'
 932+ || this.sources[i].mime_type == 'text/x-srt' )
 933+ {
914934 return true;
 935+ }
915936 };
916937 return false;
917938 },
@@ -923,9 +944,10 @@
924945 * @type Array
925946 */
926947 getSources: function( mime_filter ) {
927 - if ( !mime_filter )
 948+ if ( !mime_filter ) {
928949 return this.sources;
929 - // apply mime filter:
 950+ }
 951+ // Apply mime filter:
930952 var source_set = new Array();
931953 for ( var i = 0; i < this.sources.length ; i++ ) {
932954 if ( this.sources[i].mime_type &&
@@ -1451,9 +1473,8 @@
14521474 return ;
14531475 }
14541476 _this.setupSourcePlayer();
1455 - },
 1477+ },
14561478
1457 -
14581479 /**
14591480 * Set up the select source player
14601481 *
@@ -1463,8 +1484,8 @@
14641485 */
14651486 setupSourcePlayer: function() {
14661487 mw.log("setupSourcePlayer: " + this.id );
1467 - // Autoseletct the media source
1468 - this.mediaElement.autoSelectSource();
 1488+ // Autoseletct the media source
 1489+ this.mediaElement.autoSelectSource();
14691490 // Auto select player based on default order
14701491 if ( !this.mediaElement.selected_source ) {
14711492 // check for parent clip:
@@ -1480,6 +1501,7 @@
14811502 } else {
14821503 this.selected_player = mw.EmbedTypes.players.defaultPlayer( this.mediaElement.selected_source.mime_type );
14831504 }
 1505+
14841506 if ( this.selected_player ) {
14851507 mw.log( "Playback system: " + this.selected_player.library );
14861508
@@ -1487,18 +1509,19 @@
14881510 this.inheritEmbedPlayer();
14891511 } else {
14901512 // No source's playable
1491 - var missing_type = '';
 1513+ var missingType = '';
14921514 var or = '';
14931515 for ( var i = 0; i < this.mediaElement.sources.length; i++ ) {
14941516 missing_type += or + this.mediaElement.sources[i].mime_type;
14951517 or = ' or ';
14961518 }
14971519 // Get from parent playlist if set:
1498 - if ( this.pc )
1499 - var missing_type = this.pc.type;
 1520+ if ( this.pc ){
 1521+ missingType = this.pc.type;
 1522+ }
15001523
1501 - mw.log( 'No player found for given source type ' + missing_type );
1502 - this.showPluginMissingHTML( missing_type );
 1524+ mw.log( 'No player found for given source type ' + missingType );
 1525+ this.showPluginMissingHTML( missingType );
15031526 }
15041527 },
15051528
@@ -2058,10 +2081,10 @@
20592082 $j( this )
20602083 .wrap(
20612084 $j('<div>')
2062 - .addClass('interface_wrap ' + this.ctrlBuilder.playerClass)
 2085+ .addClass( 'interface_wrap ' + this.ctrlBuilder.playerClass )
20632086 .css({
2064 - 'width' : parseInt( this.width ),
2065 - 'height' : parseInt( this.height ),
 2087+ 'width' : parseInt( this.width ) + 'px',
 2088+ 'height' : parseInt( this.height ) + 'px',
20662089 'position' : 'relative',
20672090 'overflow' : 'hidden'
20682091 })
@@ -2101,7 +2124,7 @@
21022125 }
21032126 $j( this ).html(
21042127 $j('<div />').append(
2105 - gM( 'mwe-generic_missing_plugin', missing_type ),
 2128+ gM( 'mwe-generic_missing_plugin', misssingType ),
21062129 $j( '<br />' ),
21072130 $j( '<a />' )
21082131 .attr( {
@@ -2844,7 +2867,10 @@
28452868 * @return src url
28462869 */
28472870 getSrc: function() {
2848 - return this.mediaElement.selected_source.getSrc( this.seek_time_sec );
 2871+ if( this.mediaElement.selected_source ){
 2872+ return this.mediaElement.selected_source.getSrc( this.seek_time_sec );
 2873+ }
 2874+ return false;
28492875 },
28502876
28512877 /**
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js
@@ -1820,7 +1820,7 @@
18211821 * In debug mode inject the script instead of doing an XHR eval
18221822 */
18231823 // Load and bind manually: ( copied from jQuery ajax function )
1824 - var head = document.getElementsByTagName("head")[0];
 1824+ var head = document.getElementsByTagName("head")[ 0 ];
18251825 var script = document.createElement("script");
18261826 script.setAttribute( 'src', url );
18271827

Status & tagging log