r104536 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104535‎ | r104536 | r104537 >
Date:01:55, 29 November 2011
Author:neilk
Status:ok
Tags:
Comment:
minor errors fixed, spelling mistakes.
Modified paths:
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
@@ -68,7 +68,6 @@
6969 * @param {Object} embedPlayer EmbedPlayer interface
7070 */
7171 init: function( embedPlayer ) {
72 - var _this = this;
7372 this.embedPlayer = embedPlayer;
7473
7574 // Check for skin overrides for controlBuilder
@@ -139,7 +138,7 @@
140139
141140
142141 // Make room for audio controls in the interface:
143 - if( embedPlayer.isAudio() && embedPlayer.$interface.height() == 0 ){
 142+ if( embedPlayer.isAudio() && embedPlayer.$interface.height() === 0 ){
144143 embedPlayer.$interface.css( {
145144 'height' : this.height
146145 } );
@@ -296,9 +295,9 @@
297296 */
298297 getIntrinsicSize: function(){
299298 var size = {};
300 - var vid = this.embedPlayer.getPlayerElement()
 299+ var vid = this.embedPlayer.getPlayerElement();
301300 // Check for embedVideo size:
302 - if( vid ){
 301+ if( vid ) {
303302 size.width = vid.videoWidth;
304303 size.height = vid.videoHeight;
305304 }
@@ -327,11 +326,11 @@
328327 var _this = this;
329328 // Set the offset depending if controls are hidden or displayed:
330329 var pheight = this.getComponentHeight( 'playButtonLarge' );
331 - var topCompoentOffset = ( this.isOverlayControls() ) ? pheight : pheight / 2;
 330+ var topComponentOffset = ( this.isOverlayControls() ) ? pheight : pheight / 2;
332331 return {
333332 'position' : 'absolute',
334333 'left' : ( ( parseInt( size.width ) - this.getComponentWidth( 'playButtonLarge' ) ) / 2 ),
335 - 'top' : ( ( parseInt( size.height ) - topCompoentOffset ) / 2 )
 334+ 'top' : ( ( parseInt( size.height ) - topComponentOffset ) / 2 )
336335 };
337336 },
338337
@@ -386,8 +385,9 @@
387386 $( document ).bind( 'touchend.fullscreen', function(e){
388387 $( embedPlayer ).trigger( 'onTouchEnd' );
389388 });
390 - if( triggerOnOpenFullScreen )
 389+ if( triggerOnOpenFullScreen ) {
391390 $( embedPlayer ).trigger( 'onOpenFullScreen' );
 391+ }
392392 },
393393 doFullScreenPlayerDom: function(){
394394 var _this = this;
@@ -413,10 +413,12 @@
414414 );
415415
416416 // get the original interface to absolute positioned:
417 - if( ! this.windowPositionStyle )
 417+ if( ! this.windowPositionStyle ) {
418418 this.windowPositionStyle = $interface.css( 'position' );
419 - if( !this.windowZindex )
 419+ }
 420+ if( !this.windowZindex ) {
420421 this.windowZindex = $interface.css( 'z-index' );
 422+ }
421423
422424 // Get the base offset:
423425 this.windowOffset = this.getWindowOffset();
@@ -464,7 +466,7 @@
465467 $interface.css( 'overlow', 'hidden' );
466468
467469 // only animate if we are not inside an iframe
468 - var aninmate = !mw.getConfig( 'EmbedPlayer.IsIframeServer' );
 470+ var animate = !mw.getConfig( 'EmbedPlayer.IsIframeServer' );
469471
470472 // Resize the player keeping aspect and with the widow scroll offset:
471473 embedPlayer.resizePlayer({
@@ -472,7 +474,7 @@
473475 'left' : leftOffset,
474476 'width' : $( window ).width(),
475477 'height' : $( window ).height()
476 - }, aninmate, function(){
 478+ }, animate, function(){
477479 _this.displayFullscreenTip();
478480 });
479481
@@ -507,13 +509,13 @@
508510 setTimeout(checkMovedMouse, 250 );
509511 }
510512 }
511 - };
 513+ }
512514 checkMovedMouse();
513515 }
514516
515517 // Bind Scroll position update
516518
517 - // Bind resize resize window to resize window
 519+ // Bind resize window to resize embed player, if in fullscreen mode
518520 $( window ).resize( function() {
519521 if( _this.fullscreenMode ){
520522 embedPlayer.resizePlayer({
@@ -666,7 +668,7 @@
667669 : embedPlayer.getHeight() + _this.getHeight();
668670
669671 // only animate if we are not inside an iframe
670 - var aninmate = !mw.getConfig( 'EmbedPlayer.IsIframeServer' );
 672+ var animate = !mw.getConfig( 'EmbedPlayer.IsIframeServer' );
671673
672674 mw.log( 'restoreWindowPlayer:: h:' + interfaceHeight + ' w:' + embedPlayer.getWidth());
673675 $('.mw-fullscreen-overlay').fadeOut( 'slow' );
@@ -678,7 +680,7 @@
679681 'left' : _this.windowOffset.left + 'px',
680682 'width' : embedPlayer.getWidth(),
681683 'height' : embedPlayer.getHeight()
682 - }, aninmate, function(){
 684+ }, animate, function(){
683685 var topPos = {
684686 'position' : _this.windowPositionStyle,
685687 'z-index' : _this.windowZindex,
@@ -749,7 +751,7 @@
750752 var lastClickTime = 0;
751753 var didDblClick = false;
752754 // add right click binding again ( in case the player got swaped )
753 - _this.addRightClickBinding()
 755+ _this.addRightClickBinding();
754756
755757 // Remove parent dbl click ( so we can handle play clicks )
756758 $( embedPlayer ).unbind( "click.onplayer" ).bind( "click.onplayer", function() {
@@ -929,8 +931,9 @@
930932 */
931933 showControlBar: function( keepOnScreen ){
932934 var animateDuration = 'fast';
933 - if(! this.embedPlayer )
934 - return ;
 935+ if(! this.embedPlayer ) {
 936+ return;
 937+ }
935938
936939 if( this.embedPlayer.getPlayerElement && ! this.embedPlayer.isPersistentNativePlayer() ){
937940 $( this.embedPlayer.getPlayerElement() ).css( 'z-index', '1' );
@@ -1747,7 +1750,7 @@
17481751 );
17491752 }
17501753 },
1751 - getSwichSourceMenu: function(){
 1754+ getSwitchSourceMenu: function(){
17521755 var _this = this;
17531756 var embedPlayer = this.embedPlayer;
17541757 // for each source with "native playback"
@@ -1759,13 +1762,13 @@
17601763 var icon = ( source.getSrc() == embedPlayer.mediaElement.selectedSource.getSrc() ) ? 'bullet' : 'radio-on';
17611764 $sourceMenu.append(
17621765 $.getLineItem( source.getShortTitle() , icon, function(){
1763 - mw.log( 'PlayerControlBuilder::SwichSourceMenu: ' + source.getSrc() );
 1766+ mw.log( 'PlayerControlBuilder::SwitchSourceMenu: ' + source.getSrc() );
17641767 // TODO this logic should be in mw.EmbedPlayer
17651768 embedPlayer.mediaElement.setSource( source );
17661769 if( ! _this.embedPlayer.isStopped() ){
17671770 // Get the exact play time from the video element ( instead of parent embed Player )
17681771 var oldMediaTime = _this.embedPlayer.getPlayerElement().currentTime;
1769 - var oldPaused = _this.embedPlayer.paused
 1772+ var oldPaused = _this.embedPlayer.paused;
17701773 // Do a live switch
17711774 embedPlayer.switchPlaySrc(source.getSrc(), function( vid ){
17721775 // issue a seek
@@ -1879,11 +1882,12 @@
18801883 'o' : function( ctrlObj ){
18811884 var buttonConfig = mw.getConfig( 'EmbedPlayer.AttributionButton');
18821885 // Check for source ( by configuration convention this is a 16x16 image
 1886+ var $icon;
18831887 if( buttonConfig.iconurl ){
1884 - var $icon = $('<img />')
 1888+ $icon = $('<img />')
18851889 .attr('src', buttonConfig.iconurl );
18861890 } else {
1887 - var $icon = $('<span />')
 1891+ $icon = $('<span />')
18881892 .addClass( 'ui-icon' );
18891893 if( buttonConfig['class'] ){
18901894 $icon.addClass( buttonConfig['class'] );
@@ -1960,7 +1964,7 @@
19611965 ctrlObj.embedPlayer.fullscreen();
19621966 });
19631967
1964 - $btn = $( '<div />' )
 1968+ var $btn = $( '<div />' )
19651969 .attr( 'title', gM( 'mwe-embedplayer-player_fullscreen' ) )
19661970 .addClass( "ui-state-default ui-corner-all ui-icon_link rButton fullscreen-btn" )
19671971 .append(
@@ -2100,7 +2104,7 @@
21012105 .append(
21022106 ctrlObj.embedPlayer.mediaElement.selectedSource.getShortTitle()
21032107 ).menu( {
2104 - 'content' : ctrlObj.getSwichSourceMenu(),
 2108+ 'content' : ctrlObj.getSwitchSourceMenu(),
21052109 'zindex' : mw.getConfig( 'EmbedPlayer.FullScreenZIndex' ) + 2,
21062110 'width' : 115,
21072111 'positionOpts' : {
@@ -2192,13 +2196,13 @@
21932197 if( $playHead.length ){
21942198 $playHead.slider( "option", "disabled", true );
21952199 }
2196 - }
 2200+ };
21972201 ctrlObj.enableSeekBar = function(){
21982202 var $playHead = ctrlObj.embedPlayer.$interface.find( ".play_head" );
21992203 if( $playHead.length ){
22002204 $playHead.slider( "option", "disabled", false);
22012205 }
2202 - }
 2206+ };
22032207
22042208 var embedPlayer = ctrlObj.embedPlayer;
22052209 var _this = this;

Status & tagging log