Merge pull request #12198 from edx/clrux/ac-383
AC-383 language menu events only when menu opens
This commit is contained in:
@@ -130,7 +130,8 @@
|
||||
state.el.trigger('language_menu:hide');
|
||||
expect(Logger.log).toHaveBeenCalledWith('video_hide_cc_menu', {
|
||||
id: 'id',
|
||||
code: 'html5'
|
||||
code: 'html5',
|
||||
language: 'en'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ define('video/09_events_plugin.js', [], function() {
|
||||
},
|
||||
|
||||
onHideLanguageMenu: function () {
|
||||
this.log('video_hide_cc_menu');
|
||||
this.log('video_hide_cc_menu', { language: this.getCurrentLanguage() });
|
||||
},
|
||||
|
||||
onShowCaptions: function () {
|
||||
@@ -121,6 +121,11 @@ define('video/09_events_plugin.js', [], function() {
|
||||
return player ? player.currentTime : 0;
|
||||
},
|
||||
|
||||
getCurrentLanguage: function() {
|
||||
var language = this.state.lang;
|
||||
return language;
|
||||
},
|
||||
|
||||
log: function (eventName, data) {
|
||||
var logInfo = _.extend({
|
||||
id: this.state.id,
|
||||
|
||||
@@ -325,9 +325,6 @@
|
||||
var button = this.languageChooserEl,
|
||||
menu = button.parent().find('.menu');
|
||||
|
||||
|
||||
this.state.el.trigger('language_menu:show');
|
||||
|
||||
button
|
||||
.addClass('is-opened');
|
||||
|
||||
@@ -341,8 +338,6 @@
|
||||
|
||||
var button = this.languageChooserEl;
|
||||
|
||||
this.state.el.trigger('language_menu:hide');
|
||||
|
||||
button
|
||||
.removeClass('is-opened')
|
||||
.find('.language-menu')
|
||||
@@ -381,7 +376,13 @@
|
||||
onContainerMouseEnter: function (event) {
|
||||
event.preventDefault();
|
||||
$(event.currentTarget).find('.lang').addClass('is-opened');
|
||||
this.state.el.trigger('language_menu:show');
|
||||
|
||||
// We only want to fire the analytics event if a menu is
|
||||
// present instead of on the container hover, since it wraps
|
||||
// the "CC" and "Transcript" buttons as well.
|
||||
if ($(event.currentTarget).find('.lang').length) {
|
||||
this.state.el.trigger('language_menu:show');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -392,7 +393,13 @@
|
||||
onContainerMouseLeave: function (event) {
|
||||
event.preventDefault();
|
||||
$(event.currentTarget).find('.lang').removeClass('is-opened');
|
||||
this.state.el.trigger('language_menu:hide');
|
||||
|
||||
// We only want to fire the analytics event if a menu is
|
||||
// present instead of on the container hover, since it wraps
|
||||
// the "CC" and "Transcript" buttons as well.
|
||||
if ($(event.currentTarget).find('.lang').length) {
|
||||
this.state.el.trigger('language_menu:show');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user