Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js |
— | — | @@ -68,7 +68,6 @@ |
69 | 69 | * @param {Object} embedPlayer EmbedPlayer interface |
70 | 70 | */ |
71 | 71 | init: function( embedPlayer ) { |
72 | | - var _this = this; |
73 | 72 | this.embedPlayer = embedPlayer; |
74 | 73 | |
75 | 74 | // Check for skin overrides for controlBuilder |
— | — | @@ -139,7 +138,7 @@ |
140 | 139 | |
141 | 140 | |
142 | 141 | // Make room for audio controls in the interface: |
143 | | - if( embedPlayer.isAudio() && embedPlayer.$interface.height() == 0 ){ |
| 142 | + if( embedPlayer.isAudio() && embedPlayer.$interface.height() === 0 ){ |
144 | 143 | embedPlayer.$interface.css( { |
145 | 144 | 'height' : this.height |
146 | 145 | } ); |
— | — | @@ -296,9 +295,9 @@ |
297 | 296 | */ |
298 | 297 | getIntrinsicSize: function(){ |
299 | 298 | var size = {}; |
300 | | - var vid = this.embedPlayer.getPlayerElement() |
| 299 | + var vid = this.embedPlayer.getPlayerElement(); |
301 | 300 | // Check for embedVideo size: |
302 | | - if( vid ){ |
| 301 | + if( vid ) { |
303 | 302 | size.width = vid.videoWidth; |
304 | 303 | size.height = vid.videoHeight; |
305 | 304 | } |
— | — | @@ -327,11 +326,11 @@ |
328 | 327 | var _this = this; |
329 | 328 | // Set the offset depending if controls are hidden or displayed: |
330 | 329 | var pheight = this.getComponentHeight( 'playButtonLarge' ); |
331 | | - var topCompoentOffset = ( this.isOverlayControls() ) ? pheight : pheight / 2; |
| 330 | + var topComponentOffset = ( this.isOverlayControls() ) ? pheight : pheight / 2; |
332 | 331 | return { |
333 | 332 | 'position' : 'absolute', |
334 | 333 | 'left' : ( ( parseInt( size.width ) - this.getComponentWidth( 'playButtonLarge' ) ) / 2 ), |
335 | | - 'top' : ( ( parseInt( size.height ) - topCompoentOffset ) / 2 ) |
| 334 | + 'top' : ( ( parseInt( size.height ) - topComponentOffset ) / 2 ) |
336 | 335 | }; |
337 | 336 | }, |
338 | 337 | |
— | — | @@ -386,8 +385,9 @@ |
387 | 386 | $( document ).bind( 'touchend.fullscreen', function(e){ |
388 | 387 | $( embedPlayer ).trigger( 'onTouchEnd' ); |
389 | 388 | }); |
390 | | - if( triggerOnOpenFullScreen ) |
| 389 | + if( triggerOnOpenFullScreen ) { |
391 | 390 | $( embedPlayer ).trigger( 'onOpenFullScreen' ); |
| 391 | + } |
392 | 392 | }, |
393 | 393 | doFullScreenPlayerDom: function(){ |
394 | 394 | var _this = this; |
— | — | @@ -413,10 +413,12 @@ |
414 | 414 | ); |
415 | 415 | |
416 | 416 | // get the original interface to absolute positioned: |
417 | | - if( ! this.windowPositionStyle ) |
| 417 | + if( ! this.windowPositionStyle ) { |
418 | 418 | this.windowPositionStyle = $interface.css( 'position' ); |
419 | | - if( !this.windowZindex ) |
| 419 | + } |
| 420 | + if( !this.windowZindex ) { |
420 | 421 | this.windowZindex = $interface.css( 'z-index' ); |
| 422 | + } |
421 | 423 | |
422 | 424 | // Get the base offset: |
423 | 425 | this.windowOffset = this.getWindowOffset(); |
— | — | @@ -464,7 +466,7 @@ |
465 | 467 | $interface.css( 'overlow', 'hidden' ); |
466 | 468 | |
467 | 469 | // only animate if we are not inside an iframe |
468 | | - var aninmate = !mw.getConfig( 'EmbedPlayer.IsIframeServer' ); |
| 470 | + var animate = !mw.getConfig( 'EmbedPlayer.IsIframeServer' ); |
469 | 471 | |
470 | 472 | // Resize the player keeping aspect and with the widow scroll offset: |
471 | 473 | embedPlayer.resizePlayer({ |
— | — | @@ -472,7 +474,7 @@ |
473 | 475 | 'left' : leftOffset, |
474 | 476 | 'width' : $( window ).width(), |
475 | 477 | 'height' : $( window ).height() |
476 | | - }, aninmate, function(){ |
| 478 | + }, animate, function(){ |
477 | 479 | _this.displayFullscreenTip(); |
478 | 480 | }); |
479 | 481 | |
— | — | @@ -507,13 +509,13 @@ |
508 | 510 | setTimeout(checkMovedMouse, 250 ); |
509 | 511 | } |
510 | 512 | } |
511 | | - }; |
| 513 | + } |
512 | 514 | checkMovedMouse(); |
513 | 515 | } |
514 | 516 | |
515 | 517 | // Bind Scroll position update |
516 | 518 | |
517 | | - // Bind resize resize window to resize window |
| 519 | + // Bind resize window to resize embed player, if in fullscreen mode |
518 | 520 | $( window ).resize( function() { |
519 | 521 | if( _this.fullscreenMode ){ |
520 | 522 | embedPlayer.resizePlayer({ |
— | — | @@ -666,7 +668,7 @@ |
667 | 669 | : embedPlayer.getHeight() + _this.getHeight(); |
668 | 670 | |
669 | 671 | // only animate if we are not inside an iframe |
670 | | - var aninmate = !mw.getConfig( 'EmbedPlayer.IsIframeServer' ); |
| 672 | + var animate = !mw.getConfig( 'EmbedPlayer.IsIframeServer' ); |
671 | 673 | |
672 | 674 | mw.log( 'restoreWindowPlayer:: h:' + interfaceHeight + ' w:' + embedPlayer.getWidth()); |
673 | 675 | $('.mw-fullscreen-overlay').fadeOut( 'slow' ); |
— | — | @@ -678,7 +680,7 @@ |
679 | 681 | 'left' : _this.windowOffset.left + 'px', |
680 | 682 | 'width' : embedPlayer.getWidth(), |
681 | 683 | 'height' : embedPlayer.getHeight() |
682 | | - }, aninmate, function(){ |
| 684 | + }, animate, function(){ |
683 | 685 | var topPos = { |
684 | 686 | 'position' : _this.windowPositionStyle, |
685 | 687 | 'z-index' : _this.windowZindex, |
— | — | @@ -749,7 +751,7 @@ |
750 | 752 | var lastClickTime = 0; |
751 | 753 | var didDblClick = false; |
752 | 754 | // add right click binding again ( in case the player got swaped ) |
753 | | - _this.addRightClickBinding() |
| 755 | + _this.addRightClickBinding(); |
754 | 756 | |
755 | 757 | // Remove parent dbl click ( so we can handle play clicks ) |
756 | 758 | $( embedPlayer ).unbind( "click.onplayer" ).bind( "click.onplayer", function() { |
— | — | @@ -929,8 +931,9 @@ |
930 | 932 | */ |
931 | 933 | showControlBar: function( keepOnScreen ){ |
932 | 934 | var animateDuration = 'fast'; |
933 | | - if(! this.embedPlayer ) |
934 | | - return ; |
| 935 | + if(! this.embedPlayer ) { |
| 936 | + return; |
| 937 | + } |
935 | 938 | |
936 | 939 | if( this.embedPlayer.getPlayerElement && ! this.embedPlayer.isPersistentNativePlayer() ){ |
937 | 940 | $( this.embedPlayer.getPlayerElement() ).css( 'z-index', '1' ); |
— | — | @@ -1747,7 +1750,7 @@ |
1748 | 1751 | ); |
1749 | 1752 | } |
1750 | 1753 | }, |
1751 | | - getSwichSourceMenu: function(){ |
| 1754 | + getSwitchSourceMenu: function(){ |
1752 | 1755 | var _this = this; |
1753 | 1756 | var embedPlayer = this.embedPlayer; |
1754 | 1757 | // for each source with "native playback" |
— | — | @@ -1759,13 +1762,13 @@ |
1760 | 1763 | var icon = ( source.getSrc() == embedPlayer.mediaElement.selectedSource.getSrc() ) ? 'bullet' : 'radio-on'; |
1761 | 1764 | $sourceMenu.append( |
1762 | 1765 | $.getLineItem( source.getShortTitle() , icon, function(){ |
1763 | | - mw.log( 'PlayerControlBuilder::SwichSourceMenu: ' + source.getSrc() ); |
| 1766 | + mw.log( 'PlayerControlBuilder::SwitchSourceMenu: ' + source.getSrc() ); |
1764 | 1767 | // TODO this logic should be in mw.EmbedPlayer |
1765 | 1768 | embedPlayer.mediaElement.setSource( source ); |
1766 | 1769 | if( ! _this.embedPlayer.isStopped() ){ |
1767 | 1770 | // Get the exact play time from the video element ( instead of parent embed Player ) |
1768 | 1771 | var oldMediaTime = _this.embedPlayer.getPlayerElement().currentTime; |
1769 | | - var oldPaused = _this.embedPlayer.paused |
| 1772 | + var oldPaused = _this.embedPlayer.paused; |
1770 | 1773 | // Do a live switch |
1771 | 1774 | embedPlayer.switchPlaySrc(source.getSrc(), function( vid ){ |
1772 | 1775 | // issue a seek |
— | — | @@ -1879,11 +1882,12 @@ |
1880 | 1883 | 'o' : function( ctrlObj ){ |
1881 | 1884 | var buttonConfig = mw.getConfig( 'EmbedPlayer.AttributionButton'); |
1882 | 1885 | // Check for source ( by configuration convention this is a 16x16 image |
| 1886 | + var $icon; |
1883 | 1887 | if( buttonConfig.iconurl ){ |
1884 | | - var $icon = $('<img />') |
| 1888 | + $icon = $('<img />') |
1885 | 1889 | .attr('src', buttonConfig.iconurl ); |
1886 | 1890 | } else { |
1887 | | - var $icon = $('<span />') |
| 1891 | + $icon = $('<span />') |
1888 | 1892 | .addClass( 'ui-icon' ); |
1889 | 1893 | if( buttonConfig['class'] ){ |
1890 | 1894 | $icon.addClass( buttonConfig['class'] ); |
— | — | @@ -1960,7 +1964,7 @@ |
1961 | 1965 | ctrlObj.embedPlayer.fullscreen(); |
1962 | 1966 | }); |
1963 | 1967 | |
1964 | | - $btn = $( '<div />' ) |
| 1968 | + var $btn = $( '<div />' ) |
1965 | 1969 | .attr( 'title', gM( 'mwe-embedplayer-player_fullscreen' ) ) |
1966 | 1970 | .addClass( "ui-state-default ui-corner-all ui-icon_link rButton fullscreen-btn" ) |
1967 | 1971 | .append( |
— | — | @@ -2100,7 +2104,7 @@ |
2101 | 2105 | .append( |
2102 | 2106 | ctrlObj.embedPlayer.mediaElement.selectedSource.getShortTitle() |
2103 | 2107 | ).menu( { |
2104 | | - 'content' : ctrlObj.getSwichSourceMenu(), |
| 2108 | + 'content' : ctrlObj.getSwitchSourceMenu(), |
2105 | 2109 | 'zindex' : mw.getConfig( 'EmbedPlayer.FullScreenZIndex' ) + 2, |
2106 | 2110 | 'width' : 115, |
2107 | 2111 | 'positionOpts' : { |
— | — | @@ -2192,13 +2196,13 @@ |
2193 | 2197 | if( $playHead.length ){ |
2194 | 2198 | $playHead.slider( "option", "disabled", true ); |
2195 | 2199 | } |
2196 | | - } |
| 2200 | + }; |
2197 | 2201 | ctrlObj.enableSeekBar = function(){ |
2198 | 2202 | var $playHead = ctrlObj.embedPlayer.$interface.find( ".play_head" ); |
2199 | 2203 | if( $playHead.length ){ |
2200 | 2204 | $playHead.slider( "option", "disabled", false); |
2201 | 2205 | } |
2202 | | - } |
| 2206 | + }; |
2203 | 2207 | |
2204 | 2208 | var embedPlayer = ctrlObj.embedPlayer; |
2205 | 2209 | var _this = this; |