Commit 55d84d34 by Chris Rodriguez

AC-454 adding visual clarify for selected menu options

parent faa7f544
...@@ -535,6 +535,8 @@ ...@@ -535,6 +535,8 @@
.speed-option, .speed-option,
.control-lang { .control-lang {
@include border-left($baseline/10 solid rgb(14, 166, 236));
font-weight: $font-bold;
color: rgb(14, 166, 236); // UXPL primary accent color: rgb(14, 166, 236); // UXPL primary accent
} }
} }
......
...@@ -55,8 +55,9 @@ ...@@ -55,8 +55,9 @@
</div> </div>
</section> </section>
</article> </article>
<div class="subtitles">
<ol class="subtitles"><li></li></ol> <ol class="subtitles-menu"><li></li></ol>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -108,7 +109,9 @@ ...@@ -108,7 +109,9 @@
</section> </section>
</article> </article>
<ol class="subtitles"><li></li></ol> <div class="subtitles">
<ol class="subtitles-menu"><li></li></ol>
</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -20,12 +20,10 @@ var options = { ...@@ -20,12 +20,10 @@ var options = {
libraryFilesToInclude: [ libraryFilesToInclude: [
{pattern: 'common_static/js/vendor/requirejs/require.js', included: true}, {pattern: 'common_static/js/vendor/requirejs/require.js', included: true},
{pattern: 'RequireJS-namespace-undefine.js', included: true}, {pattern: 'RequireJS-namespace-undefine.js', included: true},
{pattern: 'spec/main_requirejs.js', included: true},
{pattern: 'common_static/coffee/src/ajax_prefix.js', included: true}, {pattern: 'common_static/coffee/src/ajax_prefix.js', included: true},
{pattern: 'common_static/common/js/vendor/underscore.js', included: true}, {pattern: 'common_static/common/js/vendor/underscore.js', included: true},
{pattern: 'common_static/common/js/vendor/backbone.js', included: true}, {pattern: 'common_static/common/js/vendor/backbone.js', included: true},
{pattern: 'common_static/edx-ui-toolkit/js/utils/global-loader.js', included: true},
{pattern: 'common_static/js/vendor/CodeMirror/codemirror.js', included: true}, {pattern: 'common_static/js/vendor/CodeMirror/codemirror.js', included: true},
{pattern: 'common_static/js/vendor/draggabilly.js'}, {pattern: 'common_static/js/vendor/draggabilly.js'},
{pattern: 'common_static/common/js/vendor/jquery.js', included: true}, {pattern: 'common_static/common/js/vendor/jquery.js', included: true},
...@@ -50,11 +48,14 @@ var options = { ...@@ -50,11 +48,14 @@ var options = {
{pattern: 'common_static/js/vendor/jasmine-imagediff.js', included: true}, {pattern: 'common_static/js/vendor/jasmine-imagediff.js', included: true},
{pattern: 'common_static/common/js/spec_helpers/jasmine-waituntil.js', included: true}, {pattern: 'common_static/common/js/spec_helpers/jasmine-waituntil.js', included: true},
{pattern: 'common_static/common/js/spec_helpers/jasmine-extensions.js', included: true}, {pattern: 'common_static/common/js/spec_helpers/jasmine-extensions.js', included: true},
{pattern: 'common_static/js/vendor/sinon-1.17.0.js', included: true} {pattern: 'common_static/js/vendor/sinon-1.17.0.js', included: true},
{pattern: 'spec/main_requirejs.js', included: true},
], ],
libraryFiles: [ libraryFiles: [
{pattern: 'common_static/edx-pattern-library/js/**/*.js'} {pattern: 'common_static/edx-pattern-library/js/**/*.js'},
{pattern: 'common_static/edx-ui-toolkit/js/**/*.js'}
], ],
// Make sure the patterns in sourceFiles and specFiles do not match the same file. // Make sure the patterns in sourceFiles and specFiles do not match the same file.
......
(function(requirejs) { (function(requirejs, define) {
'use strict';
// We do not wish to bundle common libraries (that may also be used by non-RequireJS code on the page
// into the optimized files. Therefore load these libraries through script tags and explicitly define them.
// Note that when the optimizer executes this code, window will not be defined.
if (window) {
var defineDependency = function (globalName, name, noShim) {
var getGlobalValue = function(name) {
var globalNamePath = name.split('.'),
result = window,
i;
for (i = 0; i < globalNamePath.length; i++) {
result = result[globalNamePath[i]];
}
return result;
},
globalValue = getGlobalValue(globalName);
if (globalValue) {
if (noShim) {
define(name, {});
}
else {
define(name, [], function() { return globalValue; });
}
}
else {
console.error("Expected library to be included on page, but not found on window object: " + name);
}
};
defineDependency("jQuery", "jquery");
defineDependency("jQuery", "jquery-migrate");
defineDependency("_", "underscore");
}
requirejs.config({ requirejs.config({
baseUrl: '/base/', baseUrl: '/base/',
paths: { paths: {
...@@ -6,7 +38,8 @@ ...@@ -6,7 +38,8 @@
"modernizr": "common_static/edx-pattern-library/js/modernizr-custom", "modernizr": "common_static/edx-pattern-library/js/modernizr-custom",
"afontgarde": "common_static/edx-pattern-library/js/afontgarde", "afontgarde": "common_static/edx-pattern-library/js/afontgarde",
"edxicons": "common_static/edx-pattern-library/js/edx-icons", "edxicons": "common_static/edx-pattern-library/js/edx-icons",
"draggabilly": "common_static/js/vendor/draggabilly" "draggabilly": "common_static/js/vendor/draggabilly",
'edx-ui-toolkit': 'common_static/edx-ui-toolkit'
}, },
"moment": { "moment": {
exports: "moment" exports: "moment"
...@@ -18,5 +51,4 @@ ...@@ -18,5 +51,4 @@
exports: "AFontGarde" exports: "AFontGarde"
} }
}); });
}).call(this, RequireJS.requirejs, RequireJS.define);
}).call(this, RequireJS.requirejs);
...@@ -266,6 +266,7 @@ ...@@ -266,6 +266,7 @@
expect($('.closed-captions')).toHaveAttrs({ expect($('.closed-captions')).toHaveAttrs({
'lang': 'de' 'lang': 'de'
}); });
expect(link).toHaveAttr('aria-pressed', 'true');
}); });
it('when clicking on link with current language', function () { it('when clicking on link with current language', function () {
...@@ -284,6 +285,7 @@ ...@@ -284,6 +285,7 @@
expect(state.storage.setItem) expect(state.storage.setItem)
.not.toHaveBeenCalledWith('language', 'en'); .not.toHaveBeenCalledWith('language', 'en');
expect($('.langs-list li.is-active').length).toBe(1); expect($('.langs-list li.is-active').length).toBe(1);
expect(link).toHaveAttr('aria-pressed', 'true');
}); });
it('open the language toggle on hover', function () { it('open the language toggle on hover', function () {
...@@ -413,7 +415,7 @@ ...@@ -413,7 +415,7 @@
}); });
it('show explanation message', function () { it('show explanation message', function () {
expect($('.subtitles-menu li')).toHaveText( expect($('.subtitles .subtitles-menu li')).toHaveText(
'Transcript will be displayed when you start playing the video.' 'Transcript will be displayed when you start playing the video.'
); );
}); });
......
...@@ -203,16 +203,18 @@ ...@@ -203,16 +203,18 @@
describe('onSpeedChange', function () { describe('onSpeedChange', function () {
beforeEach(function () { beforeEach(function () {
state = jasmine.initializePlayer(); state = jasmine.initializePlayer();
$('li[data-speed="1.0"]').addClass('is-active'); $('li[data-speed="1.0"]').addClass('is-active').attr('aria-pressed', 'true');
state.videoSpeedControl.setSpeed(0.75); state.videoSpeedControl.setSpeed(0.75);
}); });
it('set the new speed as active', function () { it('set the new speed as active', function () {
expect($('.video-speeds li[data-speed="1.0"]')) expect($('li[data-speed="1.0"]')).not.toHaveClass('is-active');
.not.toHaveClass('is-active'); expect($('li[data-speed="1.0"] .speed-option').attr('aria-pressed')).not.toEqual('true');
expect($('.video-speeds li[data-speed="0.75"]'))
.toHaveClass('is-active'); expect($('li[data-speed="0.75"]')).toHaveClass('is-active');
expect($('.speeds .value')).toHaveHtml('0.75x'); expect($('li[data-speed="0.75"] .speed-option').attr('aria-pressed')).toEqual('true');
expect($('.speeds .speed-button .value')).toHaveHtml('0.75x');
}); });
}); });
......
(function (requirejs, require, define) { (function (requirejs, require, define) {
"use strict"; "use strict";
define( define(
'video/08_video_speed_control.js', 'video/08_video_speed_control.js', [
['video/00_iterator.js'], 'video/00_iterator.js',
function (Iterator) { 'edx-ui-toolkit/js/utils/html-utils'
], function (Iterator, HtmlUtils) {
/** /**
* Video speed control module. * Video speed control module.
* @exports video/08_video_speed_control.js * @exports video/08_video_speed_control.js
...@@ -95,23 +96,37 @@ function (Iterator) { ...@@ -95,23 +96,37 @@ function (Iterator) {
* Creates any necessary DOM elements, attach them, and set their, * Creates any necessary DOM elements, attach them, and set their,
* initial configuration. * initial configuration.
* @param {array} speeds List of speeds available for the player. * @param {array} speeds List of speeds available for the player.
* @param {string} currentSpeed The current speed set to the player.
*/ */
render: function (speeds) { render: function (speeds, currentSpeed) {
var speedsContainer = this.speedsContainer, var speedsContainer = this.speedsContainer,
reversedSpeeds = speeds.concat().reverse(), reversedSpeeds = speeds.concat().reverse(),
speedsList = $.map(reversedSpeeds, function (speed) { speedsList = $.map(reversedSpeeds, function (speed) {
return [ return HtmlUtils.interpolateHtml(
'<li data-speed="', speed, '">', HtmlUtils.joinHtml(
'<button class="control speed-option" tabindex="-1">', HtmlUtils.HTML('<li data-speed="{speed}">'),
speed, 'x', HtmlUtils.HTML('<button class="control speed-option" tabindex="-1" aria-pressed="false">'),
'</button>', HtmlUtils.HTML(speed),
'</li>' HtmlUtils.HTML('x'),
].join(''); HtmlUtils.HTML('</button>'),
HtmlUtils.HTML('</li>')
),
{
speed: speed
}
).toString();
}); });
speedsContainer.html(speedsList.join('')); HtmlUtils.setHtml(
speedsContainer,
HtmlUtils.HTML(speedsList)
);
this.speedLinks = new Iterator(speedsContainer.find('.speed-option')); this.speedLinks = new Iterator(speedsContainer.find('.speed-option'));
this.state.el.find('.secondary-controls').prepend(this.el); HtmlUtils.prepend(
this.state.el.find('.secondary-controls'),
HtmlUtils.HTML(this.el)
);
this.setActiveSpeed(currentSpeed);
}, },
/** /**
...@@ -216,17 +231,38 @@ function (Iterator) { ...@@ -216,17 +231,38 @@ function (Iterator) {
if (speed !== this.currentSpeed || forceUpdate) { if (speed !== this.currentSpeed || forceUpdate) {
this.speedsContainer this.speedsContainer
.find('li') .find('li')
.removeClass('is-active') .siblings("li[data-speed='" + speed + "']");
.siblings("li[data-speed='" + speed + "']")
.addClass('is-active');
this.speedButton.find('.value').html(speed + 'x'); this.speedButton.find('.value').text(speed + 'x');
this.currentSpeed = speed; this.currentSpeed = speed;
if (!silent) { if (!silent) {
this.el.trigger('speedchange', [speed, this.state.speed]); this.el.trigger('speedchange', [speed, this.state.speed]);
} }
} }
this.resetActiveSpeed();
this.setActiveSpeed(speed);
},
resetActiveSpeed: function() {
var speedOptions = this.speedsContainer.find('li');
$(speedOptions).each(function(index, el) {
$(el).removeClass('is-active')
.find('.speed-option')
.attr('aria-pressed', 'false');
});
},
setActiveSpeed: function(speed) {
var speedOption = this.speedsContainer.find('li[data-speed="' + speed + '"]');
speedOption.addClass('is-active')
.find('.speed-option')
.attr('aria-pressed', 'true');
this.speedButton.attr('title', gettext('Video speed: ') + speed + 'x');
}, },
/** /**
...@@ -244,10 +280,13 @@ function (Iterator) { ...@@ -244,10 +280,13 @@ function (Iterator) {
* @param {jquery Event} event * @param {jquery Event} event
*/ */
clickLinkHandler: function (event) { clickLinkHandler: function (event) {
var speed = $(event.currentTarget).parent().data('speed'); var el = $(event.currentTarget).parent(),
speed = $(el).data('speed');
this.closeMenu(); this.resetActiveSpeed();
this.setActiveSpeed(speed);
this.state.videoCommands.execute('speed', speed); this.state.videoCommands.execute('speed', speed);
this.closeMenu(true);
return false; return false;
}, },
......
...@@ -5,11 +5,12 @@ ...@@ -5,11 +5,12 @@
define('video/09_video_caption.js',[ define('video/09_video_caption.js',[
'video/00_sjson.js', 'video/00_sjson.js',
'video/00_async_process.js', 'video/00_async_process.js',
'edx-ui-toolkit/js/utils/html-utils',
'draggabilly', 'draggabilly',
'modernizr', 'modernizr',
'afontgarde', 'afontgarde',
'edxicons' 'edxicons'
], function (Sjson, AsyncProcess, Draggabilly) { ], function (Sjson, AsyncProcess, HtmlUtils, Draggabilly) {
/** /**
* @desc VideoCaption module exports a function. * @desc VideoCaption module exports a function.
...@@ -80,47 +81,53 @@ ...@@ -80,47 +81,53 @@
renderElements: function () { renderElements: function () {
var languages = this.state.config.transcriptLanguages; var languages = this.state.config.transcriptLanguages;
var langTemplate = [ var langHtml = HtmlUtils.joinHtml(
'<div class="grouped-controls">', HtmlUtils.HTML('<div class="grouped-controls">'),
'<button class="control toggle-captions" aria-disabled="false">', HtmlUtils.HTML('<button class="control toggle-captions" aria-disabled="false">'),
'<span class="icon-fallback-img">', HtmlUtils.HTML('<span class="icon-fallback-img">'),
'<span class="icon fa fa-cc" aria-hidden="true"></span>', HtmlUtils.HTML('<span class="icon fa fa-cc" aria-hidden="true"></span>'),
'<span class="sr control-text"></span>', HtmlUtils.HTML('<span class="sr control-text"></span>'),
'</span>', HtmlUtils.HTML('</span>'),
'</button>', HtmlUtils.HTML('</button>'),
'<button class="control toggle-transcript" aria-disabled="false">', HtmlUtils.HTML('<button class="control toggle-transcript" aria-disabled="false">'),
'<span class="icon-fallback-img">', HtmlUtils.HTML('<span class="icon-fallback-img">'),
'<span class="icon fa fa-quote-left" aria-hidden="true"></span>', HtmlUtils.HTML('<span class="icon fa fa-quote-left" aria-hidden="true"></span>'),
'<span class="sr control-text"></span>', HtmlUtils.HTML('<span class="sr control-text"></span>'),
'</span>', HtmlUtils.HTML('</span>'),
'</button>', HtmlUtils.HTML('</button>'),
'<div class="lang menu-container" role="application">', HtmlUtils.HTML('<div class="lang menu-container" role="application">'),
'<p class="sr instructions" id="lang-instructions"></p>', HtmlUtils.HTML('<p class="sr instructions" id="lang-instructions"></p>'),
'<button class="control language-menu" aria-disabled="false"', HtmlUtils.HTML('<button class="control language-menu" aria-disabled="false"'),
'aria-describedby="lang-instructions" ', HtmlUtils.HTML('aria-describedby="lang-instructions" '),
'title="', HtmlUtils.HTML('title="'),
gettext('Open language menu'), gettext('Open language menu'),
'">', HtmlUtils.HTML('">'),
'<span class="icon-fallback-img">', HtmlUtils.HTML('<span class="icon-fallback-img">'),
'<span class="icon fa fa-caret-left" aria-hidden="true"></span>', HtmlUtils.HTML('<span class="icon fa fa-caret-left" aria-hidden="true"></span>'),
'<span class="sr control-text"></span>', HtmlUtils.HTML('<span class="sr control-text"></span>'),
'</span>', HtmlUtils.HTML('</span>'),
'</button>', HtmlUtils.HTML('</button>'),
'</div>', HtmlUtils.HTML('</div>'),
'</div>' HtmlUtils.HTML('</div>)')
].join(''); );
var template = [ var subtitlesHtml = HtmlUtils.interpolateHtml(
'<div class="subtitles" role="region" id="transcript-' + this.state.id + '">', HtmlUtils.joinHtml(
'<h3 id="transcript-label-' + this.state.id + '" class="transcript-title sr"></h3>', HtmlUtils.HTML('<div class="subtitles" role="region" id="transcript-{courseId}">'),
'<ol id="transcript-captions" class="subtitles-menu" lang="' + this.state.lang + '"></ol>', HtmlUtils.HTML('<h3 id="transcript-label-{courseId}" class="transcript-title sr"></h3>'),
'</div>' HtmlUtils.HTML('<ol id="transcript-captions" class="subtitles-menu" lang="{courseLang}"></ol>'),
].join(''); HtmlUtils.HTML('</div>')
),
{
courseId: this.state.id,
courseLang: this.state.lang
}
);
this.loaded = false; this.loaded = false;
this.subtitlesEl = $(template); this.subtitlesEl = $(HtmlUtils.ensureHtml(subtitlesHtml).toString());
this.subtitlesMenuEl = this.subtitlesEl.find('.subtitles-menu'); this.subtitlesMenuEl = this.subtitlesEl.find('.subtitles-menu');
this.container = $(langTemplate); this.container = $(HtmlUtils.ensureHtml(langHtml).toString());
this.captionControlEl = this.container.find('.toggle-captions'); this.captionControlEl = this.container.find('.toggle-captions');
this.captionDisplayEl = this.state.el.find('.closed-captions'); this.captionDisplayEl = this.state.el.find('.closed-captions');
this.transcriptControlEl = this.container.find('.toggle-transcript'); this.transcriptControlEl = this.container.find('.toggle-transcript');
...@@ -542,15 +549,26 @@ ...@@ -542,15 +549,26 @@
} }
} else { } else {
if (state.isTouch) { if (state.isTouch) {
self.subtitlesEl.find('.subtitles-menu') HtmlUtils.setHtml(
.text(gettext('Transcript will be displayed when you start playing the video.')) // jshint ignore: line self.subtitlesEl.find('.subtitles-menu'),
.wrapInner('<li></li>'); HtmlUtils.joinHtml(
HtmlUtils.HTML('<li>'),
gettext('Transcript will be displayed when you start playing the video.'),
HtmlUtils.HTML('</li>')
)
);
} else { } else {
self.renderCaption(start, captions); self.renderCaption(start, captions);
} }
self.hideCaptions(state.hide_captions, false); self.hideCaptions(state.hide_captions, false);
self.state.el.find('.video-wrapper').after(self.subtitlesEl); HtmlUtils.append(
self.state.el.find('.secondary-controls').append(self.container); self.state.el.find('.video-wrapper').parent(),
HtmlUtils.HTML(self.subtitlesEl)
);
HtmlUtils.append(
self.state.el.find('.secondary-controls'),
HtmlUtils.HTML(self.container)
);
self.bindHandlers(); self.bindHandlers();
} }
...@@ -630,7 +648,9 @@ ...@@ -630,7 +648,9 @@
onResize: function () { onResize: function () {
this.subtitlesEl this.subtitlesEl
.find('.spacing').first() .find('.spacing').first()
.height(this.topSpacingHeight()).end() .height(this.topSpacingHeight());
this.subtitlesEl
.find('.spacing').last() .find('.spacing').last()
.height(this.bottomSpacingHeight()); .height(this.bottomSpacingHeight());
...@@ -649,8 +669,9 @@ ...@@ -649,8 +669,9 @@
renderLanguageMenu: function (languages) { renderLanguageMenu: function (languages) {
var self = this, var self = this,
state = this.state, state = this.state,
menu = $('<ol class="langs-list menu">'), $menu = $('<ol class="langs-list menu">'),
currentLang = state.getCurrentLanguage(); currentLang = state.getCurrentLanguage(),
$li, $link, linkHtml;
if (_.keys(languages).length < 2) { if (_.keys(languages).length < 2) {
// Remove the menu toggle button // Remove the menu toggle button
...@@ -661,20 +682,29 @@ ...@@ -661,20 +682,29 @@
this.showLanguageMenu = true; this.showLanguageMenu = true;
$.each(languages, function(code, label) { $.each(languages, function(code, label) {
var li = $('<li data-lang-code="' + code + '" />'), $li = $('<li />', { 'data-lang-code': code });
link = $('<button class="control control-lang">' + label + '</button>'); linkHtml = HtmlUtils.joinHtml(
HtmlUtils.HTML('<button class="control control-lang">'),
label,
HtmlUtils.HTML('</button>')
);
$link = $(linkHtml.toString());
if (currentLang === code) { if (currentLang === code) {
li.addClass('is-active'); $li.addClass('is-active');
$link.attr('aria-pressed', 'true');
} }
li.append(link); $li.append($link);
menu.append(li); $menu.append($li);
}); });
this.languageChooserEl.append(menu); HtmlUtils.append(
this.languageChooserEl,
HtmlUtils.HTML($menu)
);
menu.on('click', '.control-lang', function (e) { $menu.on('click', '.control-lang', function (e) {
var el = $(e.currentTarget).parent(), var el = $(e.currentTarget).parent(),
state = self.state, state = self.state,
langCode = el.data('lang-code'); langCode = el.data('lang-code');
...@@ -683,7 +713,11 @@ ...@@ -683,7 +713,11 @@
state.lang = langCode; state.lang = langCode;
el .addClass('is-active') el .addClass('is-active')
.siblings('li') .siblings('li')
.removeClass('is-active'); .removeClass('is-active')
.find('.control-lang')
.attr('aria-pressed', 'false');
$(e.currentTarget).attr('aria-pressed', 'true');
state.el.trigger('language_menu:change', [langCode]); state.el.trigger('language_menu:change', [langCode]);
self.fetchCaption(); self.fetchCaption();
...@@ -693,6 +727,7 @@ ...@@ -693,6 +727,7 @@
// update the transcript lang attribute // update the transcript lang attribute
self.subtitlesMenuEl.attr('lang', langCode); self.subtitlesMenuEl.attr('lang', langCode);
self.closeLanguageMenu(e);
} }
}); });
}, },
...@@ -715,13 +750,18 @@ ...@@ -715,13 +750,18 @@
'data-index': index, 'data-index': index,
'data-start': start[index], 'data-start': start[index],
'tabindex': 0 'tabindex': 0
}).html(text); });
$(liEl).text(text);
return liEl[0]; return liEl[0];
}; };
return AsyncProcess.array(captions, process).done(function (list) { return AsyncProcess.array(captions, process).done(function (list) {
container.append(list); HtmlUtils.append(
container,
HtmlUtils.HTML(list)
);
}); });
}, },
...@@ -790,16 +830,39 @@ ...@@ -790,16 +830,39 @@
* out of the tabbing order. * out of the tabbing order.
* *
*/ */
addPaddings: function () { addPaddings: function() {
var topSpacer = HtmlUtils.interpolateHtml(
HtmlUtils.HTML([
'<li class="spacing" style="height: {height}px">',
'<a href="#transcript-end-{id}" id="transcript-start-{id}" class="transcript-start"></a>', // jshint ignore:line
'</li>'
].join('')),
{
id: this.state.id,
height: this.topSpacingHeight()
}
);
this.subtitlesMenuEl var bottomSpacer = HtmlUtils.interpolateHtml(
.prepend( HtmlUtils.HTML([
$('<li class="spacing"><a href="#transcript-end-' + this.state.id + '" id="transcript-start-' + this.state.id + '" class="transcript-start"></a>') // jshint ignore: line '<li class="spacing" style="height: {height}px">',
.height(this.topSpacingHeight()) '<a href="#transcript-start-{id}" id="transcript-end-{id}" class="transcript-end"></a>', // jshint ignore:line
) '</li>'
.append( ].join('')),
$('<li class="spacing"><a href="#transcript-start-' + this.state.id + '" id="transcript-end-' + this.state.id + '" class="transcript-end"></a>') // jshint ignore: line {
.height(this.bottomSpacingHeight()) id: this.state.id,
height: this.bottomSpacingHeight()
}
);
HtmlUtils.prepend(
this.subtitlesMenuEl,
topSpacer
);
HtmlUtils.append(
this.subtitlesMenuEl,
bottomSpacer
); );
}, },
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/* jshint node: true */ /* jshint node: true */
/*jshint -W079 */ /*jshint -W079 */
'use strict'; 'use strict';
var path = require('path'); var path = require('path');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js')); var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));
...@@ -16,23 +15,27 @@ var options = { ...@@ -16,23 +15,27 @@ var options = {
// Avoid adding files to this list. Use RequireJS. // Avoid adding files to this list. Use RequireJS.
libraryFilesToInclude: [ libraryFilesToInclude: [
{pattern: 'xmodule_js/common_static/js/vendor/requirejs/require.js', included: true}, {pattern: 'xmodule_js/common_static/js/vendor/requirejs/require.js', included: true},
{pattern: 'lms/js/spec/main_requirejs_coffee.js', included: true},
{pattern: 'js/RequireJS-namespace-undefine.js', included: true}, {pattern: 'js/RequireJS-namespace-undefine.js', included: true},
{pattern: 'common/js/vendor/jquery.js', included: true},
{pattern: 'common/js/vendor/jquery-migrate.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/jquery.event.drag-2.2.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/slick.core.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/slick.grid.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/requirejs/require.js', included: true},
{pattern: 'xmodule_js/common_static/coffee/src/ajax_prefix.js', included: true}, {pattern: 'xmodule_js/common_static/coffee/src/ajax_prefix.js', included: true},
{pattern: 'common/js/vendor/jquery.js', included: true},
{pattern: 'common/js/vendor/jquery-migrate.js', included: true},
{pattern: 'common/js/vendor/underscore.js', included: true}, {pattern: 'common/js/vendor/underscore.js', included: true},
{pattern: 'edx-ui-toolkit/js/utils/global-loader.js', included: true},
{pattern: 'xmodule_js/common_static/js/src/logger.js', included: true}, {pattern: 'xmodule_js/common_static/js/src/logger.js', included: true},
{pattern: 'xmodule_js/common_static/js/test/i18n.js', included: true}, {pattern: 'xmodule_js/common_static/js/test/i18n.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/CodeMirror/codemirror.js', included: true}, {pattern: 'xmodule_js/common_static/js/vendor/CodeMirror/codemirror.js', included: true},
{pattern: 'common/js/vendor/jquery.js', included: true},
{pattern: 'common/js/vendor/jquery-migrate.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/jquery.cookie.js', included: true}, {pattern: 'xmodule_js/common_static/js/vendor/jquery.cookie.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/flot/jquery.flot.js', included: true}, {pattern: 'xmodule_js/common_static/js/vendor/flot/jquery.flot.js', included: true},
{pattern: 'xmodule_js/common_static/coffee/src/jquery.immediateDescendents.js', included: true}, {pattern: 'xmodule_js/common_static/coffee/src/jquery.immediateDescendents.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/jquery-ui.min.js', included: true}, {pattern: 'xmodule_js/common_static/js/vendor/jquery-ui.min.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/moment.min.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/moment-with-locales.min.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/URI.min.js', included: true}, {pattern: 'xmodule_js/common_static/js/vendor/URI.min.js', included: true},
{pattern: 'xmodule_js/common_static/js/xblock/*.js', included: true}, {pattern: 'xmodule_js/common_static/js/xblock/*.js', included: true},
...@@ -42,7 +45,9 @@ var options = { ...@@ -42,7 +45,9 @@ var options = {
{pattern: 'xmodule_js/src/xmodule.js', included: true}, {pattern: 'xmodule_js/src/xmodule.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/jasmine-imagediff.js', included: true}, {pattern: 'xmodule_js/common_static/js/vendor/jasmine-imagediff.js', included: true},
{pattern: 'common/js/spec_helpers/jasmine-extensions.js', included: true} {pattern: 'common/js/spec_helpers/jasmine-extensions.js', included: true},
{pattern: 'lms/js/spec/main_requirejs_coffee.js', included: true}
], ],
libraryFiles: [ libraryFiles: [
......
(function(requirejs) { (function(requirejs, define) {
'use strict'; 'use strict';
// We do not wish to bundle common libraries (that may also be used by non-RequireJS code on the page
// into the optimized files. Therefore load these libraries through script tags and explicitly define them.
// Note that when the optimizer executes this code, window will not be defined.
if (window) {
var defineDependency = function (globalName, name, noShim) {
var getGlobalValue = function(name) {
var globalNamePath = name.split('.'),
result = window,
i;
for (i = 0; i < globalNamePath.length; i++) {
result = result[globalNamePath[i]];
}
return result;
},
globalValue = getGlobalValue(globalName);
if (globalValue) {
if (noShim) {
define(name, {});
}
else {
define(name, [], function() { return globalValue; });
}
}
else {
console.error("Expected library to be included on page, but not found on window object: " + name);
}
};
defineDependency("jQuery", "jquery");
defineDependency("jQuery", "jquery-migrate");
defineDependency("_", "underscore");
}
requirejs.config({ requirejs.config({
baseUrl: '/base/', baseUrl: '/base/',
paths: { paths: {
...@@ -7,7 +38,8 @@ ...@@ -7,7 +38,8 @@
"modernizr": "edx-pattern-library/js/modernizr-custom", "modernizr": "edx-pattern-library/js/modernizr-custom",
"afontgarde": "edx-pattern-library/js/afontgarde", "afontgarde": "edx-pattern-library/js/afontgarde",
"edxicons": "edx-pattern-library/js/edx-icons", "edxicons": "edx-pattern-library/js/edx-icons",
"draggabilly": "xmodule_js/common_static/js/vendor/draggabilly" "draggabilly": "xmodule_js/common_static/js/vendor/draggabilly",
'edx-ui-toolkit': 'edx-ui-toolkit'
}, },
"moment": { "moment": {
exports: "moment" exports: "moment"
...@@ -20,4 +52,4 @@ ...@@ -20,4 +52,4 @@
} }
}); });
}).call(this, requirejs, define); // jshint ignore:line }).call(this, RequireJS.requirejs, RequireJS.define);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment