Skip to content
Browse files

Fixed layout menu not marking active layout after change

  • Loading branch information...
1 parent fdc8d51 commit 4cadc0144d08360cd685fd5e22a294e169667a70 @avivais avivais committed May 14, 2012
Showing with 30 additions and 9 deletions.
  1. +30 −9 modules/TimedText/mw.TimedText.js
View
39 modules/TimedText/mw.TimedText.js
@@ -684,23 +684,36 @@ mw.includeAllModuleMessages();
* Marks the active captions in the menu
*/
markActive: function( source ) {
- var _this = this;
- var embedPlayer = _this.embedPlayer;
var $menu = $( '#textMenuContainer_' + this.embedPlayer.id );
if ( $menu.length ) {
var $captionRows = $menu.find( '.captionRow' );
if ( $captionRows.length ) {
$captionRows.each( function() {
- $( this ).removeClass( 'ui-icon-bullet ui-icon-radio-on');
- var iconClass = ( $( this ).data( 'caption-id') === source.id ) ? 'ui-icon-bullet' : 'ui-icon-radio-on';
+ $( this ).removeClass( 'ui-icon-bullet ui-icon-radio-on' );
+ var iconClass = ( $( this ).data( 'caption-id' ) === source.id ) ? 'ui-icon-bullet' : 'ui-icon-radio-on';
+ $( this ).addClass( iconClass );
+ } );
+ }
+ }
+ },
+
+ /**
+ * Marks the active layout mode in the menu
+ */
+ markLayoutActive: function ( layoutMode ) {
+ var $menu = $( '#textMenuContainer_' + this.embedPlayer.id );
+ if ( $menu.length ) {
+ var $layoutRows = $menu.find( '.layoutRow' );
+ if ( $layoutRows.length ) {
+ $layoutRows.each( function() {
+ $( this ).removeClass( 'ui-icon-bullet ui-icon-radio-on' );
+ var iconClass = ( $( this ).data( 'layoutMode' ) === layoutMode ) ? 'ui-icon-bullet' : 'ui-icon-radio-on';
$( this ).addClass( iconClass );
} );
}
}
-
},
-
/**
* Get a source object by language, returns "false" if not found
* @param {string} langKey The language key filter for selected source
@@ -861,10 +874,13 @@ mw.includeAllModuleMessages();
$.getLineItem(
gM( 'mwe-timedtext-layout-' + layoutMode),
icon,
- function(){
+ function() {
_this.setLayoutMode( layoutMode );
- })
- );
+ },
+ 'layoutRow',
+ { 'layoutMode' : layoutMode }
+ )
+ );
});
return $ul;
},
@@ -882,7 +898,9 @@ mw.includeAllModuleMessages();
// Update the display:
_this.updateLayout();
}
+ _this.markLayoutActive( layoutMode );
},
+
toggleCaptions: function(){
mw.log( "TimedText:: toggleCaptions was:" + this.config.layout );
if( this.config.layout == 'off' ){
@@ -1145,6 +1163,9 @@ mw.includeAllModuleMessages();
$textTarget.fadeIn('fast');
},
displayTextTarget: function( $textTarget ){
+ if( this.getLayoutMode() == 'off' ){
+ return;
+ }
if( this.getLayoutMode() == 'ontop' ){
this.addTextOverlay(
$textTarget

0 comments on commit 4cadc01

Please sign in to comment.
Something went wrong with that request. Please try again.