webpackJsonp([0],{
/***/ 177:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__(1);
// Dialog
window.Standard_Dialog = __webpack_require__(359);
// Question
Question = __webpack_require__(358);
// MC_Query
MC_Query = __webpack_require__(351);
// Player
var ConcretePlayer = __webpack_require__(353);
window.player = new ConcretePlayer();
common.initForceNextSection();
/***/ }),
/***/ 3:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// Common css
/*
require('./assets/css/common');
require('./initialize');
var dom = require('lib/dom');
var jq_utils = require('lib/utils/jq_utils');*/
//-----{ Public: }------------------------------------------------------------->
function underlinedText(txt) {
var uText = txt.match(/(\__)([a-zA-Z0-9\s\-\’\+\[\]]+)(\__)/g);
if (uText) {
uText.forEach(function (value, i) {
txt = txt.replace(uText[i], '' + uText[i].substr(2, uText[i].length - 4) + '');
});
}
return txt;
}
function setFeedbackAndClearAttr(type, delay, html) {
$('#live-feedback').attr('aria-live', type);
$('#live-feedback').html(html);
setTimeout("$('#live-feedback').html('');", delay);
setTimeout("$('#live-feedback').attr('aria-live', 'off');", delay);
}
function createTitle(title) {
if (title) {
if (title.indexOf("<") > -1) {
return title.substring(title.indexOf(">") + 1, 0) +
title[title.indexOf(">") + 1].toUpperCase() +
title.substring(title.indexOf(">") + 2);
}
else {
if (title !== "") {
return title[0].toUpperCase() + title.substring(1);
}
else {
return "";
}
}
} else {
return "";
}
}
var stringWithEmptySymbols = '';
function emptySymbols() {
stringWithEmptySymbols += '\u00A0';
return stringWithEmptySymbols;
}
module.exports = {
underlinedText: underlinedText,
setFeedbackAndClearAttr: setFeedbackAndClearAttr,
emptySymbols: emptySymbols,
createTitle: createTitle
};
/***/ }),
/***/ 351:
/***/ (function(module, exports, __webpack_require__) {
var common = __webpack_require__( 1 );
var platform = __webpack_require__(0).run_on;
var dom = __webpack_require__( 2 );
var MC_Query = __webpack_require__(356);
var local_mc = MC_Query.extend({
user_has_answered: function () {
if (typeof $('input:radio[name=query_answer_' + this.query_index + ']:checked').val() != 'undefined') {
return true;
}
else {
return false;
}
},
query_text_html: function () {
if ( this.query_text != '' && this.md._hide_query_text !== 'true' ) {
var text = jQuery.trim( this.query_text );
/*
text = text.replace(
/(.*?)<\/span>.*?(.*?)
<\/span>/,
function (replacedString, altText, formulaText) {
altText = altText || '';
formulaText = formulaText || '';
return '' + altText + ''
+ '' + formulaText + '';
}); */
var queryTextAltRegExp = new RegExp('(.*?)<\/span>'
+ '(.*?)<\/span>');
text = text.replace(queryTextAltRegExp,
function (replacedString, altText, formulaText) {
altText = altText || '';
formulaText = formulaText || '';
return platform.ios || platform.ie ?
'' + altText + ''
+ '' + formulaText + '' :
'' + formulaText + '';
});
text = text.replace(/_+_?/ig, function (replacedString) {
return 'blank' + replacedString + '';
});
var questonNumberLabel = 'Question ' + (this.query_index + 1) + '. ';
// Set id for use it to associate query text with input radios
if ( platform.ios || platform.mac) {
// iOS doesn't see legend
return '';
}
else {
if (platform.firefox) {
var customHeadingID = 'ff-query-heading-' + (this.query_index + 1);
var ffCustomAriaHeading = $('#' + customHeadingID).length ?
'' :
'' + questonNumberLabel + text + '';
return ffCustomAriaHeading + '';
}
return '';
}
}
else {
if ( this.query_text == '' ) {
return '';
}
else {
return '';
}
}
},
getHTML: function ( mode ) {
// Initialize image map elements
if ( this.imagemap_initialized === false ) {
var question_jq = this.jq.parent();
this.im_init( question_jq );
this.imagemap_initialized = true;
}
var alphabet = ['A.', 'B.', 'C.', 'D.', 'E.'];
// Wrap answers in radio group
var html = '';
html = dom.createHTML( html );
common.parseMathExpresions( html );
return html;
},
correct_incorrect_feedback: function (mode, is_correct) {
var html = '';
// get correct answer as presented to user
for (var i = 0; i < this.choices.length; ++i) {
if (this.choice_order[i] == this.correct_answer_index) {
break;
}
}
// if the question explicitly defines feedback for the user's answer, use it as the feedback
if (this.user_answer_index != null && this.choices_fb[this.user_answer_index] != null) {
html += this.choices_fb[this.user_answer_index];
}
// the correct answer will be highlighted in green, so there's no reason to say anything more.
// now, if we got any feedback, enclose it in a div
if (html != '') {
html = '
' + html + '
';
}
return html;
}
});
module.exports = local_mc;
/***/ }),
/***/ 352:
/***/ (function(module, exports, __webpack_require__) {
var platform = __webpack_require__(0).run_on;
var Activity_work_it_out = __webpack_require__(5);
var project_activity = Activity_work_it_out.extend({
update_question_action_div: function (question_index) {
var question = this.questions[question_index];
// Calculate points_awarded and points_possible
var points_awarded = 0;
var points_possible = 0;
var points_provisional = false;
for (var i = 0; i < question.queries.length; ++i) {
var query = question.queries[i];
points_awarded += query.getPointsAwarded();
points_possible += query.getPointsPossible();
if (query.pointsAreProvisional()) {
points_provisional = true;
}
}
// Round to at most two decimal places
points_awarded = Math.round(points_awarded * 100) / 100;
points_possible = Math.round(points_possible * 100) / 100;
// Hide submit button (and any other similar buttons that might be added by subtypes), but show points earned
// we need to be able to focus on the feedback container, so add tabindex
var $questionAction = question.jq.find('#question_action_div_' + question.index),
$warningMessage = $questionAction.find('.answer-warning'),
emptyAnswerWasDone = false;
if ($warningMessage.length) {
$warningMessage.remove();
emptyAnswerWasDone = true;
}
// we don't need text that begins with "For more help..."
var tmpA = $($questionAction).find('.question_feedback_part').html();
if (tmpA !== null) {
if ( tmpA.indexOf('For more help') > -1 ) {
var tmpB = tmpA.substr(tmpA.indexOf('For more help'), tmpA.length);
}
else if (tmpA.indexOf('For help with') > -1) {
var tmpB = tmpA.substr(tmpA.indexOf('For help with'), tmpA.length);
}
tmpA = tmpA.replace(tmpB, '');
}
$($questionAction).find('.question_feedback_part').html(tmpA);
var $legend = $($questionAction).find('.question_feedback_part').find('[data-block_type="legend_alt"]');
if ($legend.length) {
$legend.siblings('[data-block_type="text"]').each(function (index) {
var $this = $(this).eq(0);
if ($this.length) {
$legend.addClass('visually-hidden');
$this.html('' + $this.html() + '');
}
});
}
// Add information about points
var pointsAwarded = '
Points awarded: ' + points_awarded +
' out of ' + points_possible;
if (points_provisional) {
pointsAwarded += ' (provisional)';
}
pointsAwarded += '
';
if (query.answer_was_just_entered && points_provisional) {
pointsAwarded +=
'
Your answer has been provisionally accepted. You\'ll'
+ ' get full credit for now, but your instructor may update your grade later after evaluating it.
';
}
var $button = $questionAction.find('.question_submit_button');
$button.attr({
'tabindex': '-1',
'aria-disabled': 'true'
}).addClass('disabled');
// Add points awarded
var $questionFeedback = $questionAction.find('.question_feedback');
$questionAction.find('.points_awarded_div').remove();
/** the customer requested to remove point_awarded_div, so we don't show this
if ($questionFeedback.length > 0) {
$questionFeedback.append(pointsAwarded);
}
else {
$questionAction.append(pointsAwarded);
} */
// lint stub
if (false) {
console.log(pointsAwarded );
}
$questionFeedback.show();
// чтобы ссылка в тексте feedback читалась корректно
if (platform.ios) {
$('.question_feedback_part').each(function (i, val) {
$(this).find('a').prepend('');
$(this).find('a').append(' link');
});
}
else if ( platform.android) {
$('.question_feedback_part').find('a').each(function (i, val) {
$(this).after('' + Auxiliary.emptySymbols() + 'link');
});
}
else if ( platform.mac ) {
var count = 0;
$('#question_feedback_' + question_index + ' .question_feedback_part').find('a').each(function (i, val) {
if (count++ > 0) {
$(this).after('' + Auxiliary.emptySymbols() + 'link');
}
});
}
// для multiple choice, если пользователь не выбрал вариант ответа, feedback не отображаем
if (isNaN(query.user_answer_index) && query.query_source.indexOf('MC:') == 0) {
$questionAction.find('.question_feedback_part').remove();
}
var question = this.questions[question_index];
var $questionAction = question.jq.find('#question_action_div_' + question.index);
var $feedback = question.jq.find('.question_feedback');
if (platform.ios) {
$feedback.removeAttr('aria-live');
var $feedbackTextDiv = $feedback.find('.question_feedback_part').attr('aria-hidden', 'true');
var $pointsDiv = $feedback.find('.points_awarded_div').attr('aria-hidden', 'true');
$feedback.prepend(
'' + $feedbackTextDiv.text() +
' ' + $pointsDiv.text() + ''
);
}
// fix in IE + Jaws for B or A hotkeys behavior
if (platform.ie) {
var $ieHotKeyFix = $('');
$feedback.parent().prepend($ieHotKeyFix);
$ieHotKeyFix.focus();
}
else {
$feedback.attr('tabindex', '-1');
$feedback.focus();
}
if (platform.firefox && emptyAnswerWasDone) {
player.liveFeedback.html('');
player.liveFeedback.html($feedback.find('.question_feedback_part').text());
}
$questionAction.find('.question_submit_button').remove();
},
submit_question: function (question_index) {
var $answerdQuestion = $(question_index.target).closest('[data-type="question"]'),
questionWasAnswered = $answerdQuestion.find('input:checked'),
commonWarningMessage = 'You must choose an answer before submitting';
warningString = commonWarningMessage;
// we show warning message, if student doesn't chooses the answer before submitting
if (!questionWasAnswered.length) {
if (!$answerdQuestion.find('.answer-warning').length) {
$answerdQuestion.find('.question_action_div').prepend('
'
+ warningString + '
');
}
player.liveFeedback.html('');
player.liveFeedback.html(warningString);
return;
}
this._super(question_index);
var currentQuestionNumber = +question_index.currentTarget.id.match(/\d+/) - 1,
$currentQuestion = $('[data-type="query"]').eq(currentQuestionNumber);
window.player.disableNVDAMisterReading($currentQuestion);
window.player.setFormulasAlts($currentQuestion);
},
});
module.exports = project_activity;
/***/ }),
/***/ 353:
/***/ (function(module, exports, __webpack_require__) {
var Player_work_it_our = __webpack_require__(357);
var ConcreteActivity = __webpack_require__(352);
var platform = __webpack_require__(0).run_on;
var project_player = Player_work_it_our.extend({
initialize: function () {
this._super();
this.activity = new ConcreteActivity();
this.initOldThirdPartyDesign();
this.makeValidIframeURL();
},
initOldThirdPartyDesign: function () {
this.$questionsBlock = $('');
this.$questions = $('[data-type="question"]');
this.$questionsBlock.append(this.$questions);
this.$questions.each(function (index, item) {
$(item).before(
'
' + (index + 1)
+ '.
');
});
$('[data-block_type="instruction"]').after(this.$questionsBlock);
},
initialize2: function () {
this._super();
$('h1').addClass('visually-hidden');
$('img').attr({
'aria-hidden': true,
'role': 'presentation'
});
this.liveFeedback = $('#live-feedback');
this.initFormulasAndMR();
this.replaceFFHiddenQuestionsHeadings();
},
show_section_animate: function (section_to_show) {
this._super(section_to_show);
UI_Elements.update_button_label('slide_number', '');
},
makeValidIframeURL: function () {
var $iframe = $('iframe');
var iframeURL = $iframe.attr('src').replace('watch?v=', 'embed/');
iframeURL = iframeURL.replace(/&index.*$/gi, '');
$iframe.attr('src', iframeURL);
},
setFormulasAlts: function ($container) {
var $label = $container.find('fieldset').find('label'),
$arrows = $label.find('[data-block_type="arrows"]'),
$legendAlts = $label.find('[data-block_type="legend_alt"]');
if ($arrows.length) {
/*
$arrows.before('right arrow');
$arrows.attr({
'aria-hidden': true,
'role': 'presentation'
});*/
$arrows.attr('aria-label', 'right arrow');
$arrows.html('' + $arrows.html() + '');
}
if ($legendAlts.length) {
// old formulas alt solution
/*
$legendAlts.addClass('visually-hidden');
$label.find('[data-block_type="text"], [data-block_type="text"] *').attr({
'aria-hidden': true,
'role': 'presentation'
}); */
$legendAlts.siblings('[data-block_type="text"]').each(function (index) {
var $this = $(this).eq(0),
$currentLabel = $this.parent();
if ($this.length) {
// fix formulas reading for IE when we navigate with JAWS by arrows-buttons
if (platform.ie) {
$this.html(''
+ $currentLabel.html().replace(/.*?<\/span>/, '') + '');
$currentLabel.before($this);
$currentLabel.addClass('visually-hidden').html($currentLabel.text().replace(/<.*?>/, ''));
$this.click(function () {
$currentLabel.click();
});
}
else {
$this.attr('aria-label', $legendAlts.eq(index).text());
$this.html('' + $this.html() + '');
$legendAlts.eq(index).remove();
}
}
});
}
},
disableNVDAMisterReading: function ($container) {
/* if (platform.firefox || platform.android) {
$container.each(function (index) {
var $this = $(this);
$this.html($this.html().replace(/MR/gm, ''
+ 'MR'));
});
}*/
if (this.mRFailReadingDevices) {
$container.html($container.html().replace(/MR/gm, ''
+ 'MR'));
}
},
initFormulasAndMR: function () {
this.mRFailReadingDevices = platform.firefox || platform.android || platform.ios || platform.mac;
$('[data-type="query"]').each(function (index, item) {
var $item = $(item);
this.disableNVDAMisterReading($item);
this.setFormulasAlts($item);
}.bind(this));
},
initLiveFeedback: function () {
var live = platform.ie ? 'assertive' : 'polite';
this.liveFeedback = $('');
$('body').prepend(this.liveFeedback);
},
replaceFFHiddenQuestionsHeadings: function () {
if (platform.firefox) {
$('[data-type="question"]').each(function () {
var $this = $(this);
$this.prepend($this.find('.ff-hidden-query-heading'));
});
}
}
});
module.exports = project_player;
/***/ }),
/***/ 355:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var AYS_Figures = Figures.extend({
// If your altsrc points to an image and you want it to automatically open the
// corresponding html file instead (same file path/name as the image except
// extension ends in .html) set this to "on"
autoHtml: "off",
// By default images will pop in the supp window. Set this to "_blank" to
// have them open in a new browser window instead
targetDefault: "_pop",
// By default the imagesLoaded plugin is attached to each figure in order
// to shrink the figure
to the same width as the . Set this
// to "off" to turn this behavior off:
resizeDivWidth: "on",
// Set this to "on" if you want all internal image links to open
// using supp_win.html (which will allow you to set the width)
// NOTE: this is turned on with the global cfg_displayImagesInSuppHtml setting
displayImagesInSuppHtml: "off",
expand: function(image_ref) {
// don't call _super, we are overriding this method
var $parentDiv; // figure
around image
// If image_ref is a string then assume it is the image ID
if (typeof image_ref === "string") {
$parentDiv = $("[data-type=figure][data-figure-id='" + image_ref + "']");
}
else {
$parentDiv = $(image_ref).parents('[data-type=figure]').first();
}
if ($parentDiv.length < 1) {
safe_log("Figures_manuscript_subtype.expand: Can't find parent div for image");
return false;
}
var $image = $parentDiv.children('img');
// If the img is not directly under the figure div then check if it has been
// converted by captionjs
if ($image.length == 0) {
$image = $parentDiv.children('figure').children('div').children('img');
}
if ($image.length == 0) {
safe_log("Figures_manuscript_subtype.expand: Can't find image div for image");
return false;
}
// By default, if no altsrc is defined in the xml then the player
// should have set it to the image src path. But if for some reason
// altsrc doesn't exist then set it to the img src anyway.
var altsrc = ($parentDiv.attr('data-altsrc') || $image.attr('src'));
if (xBookUtils.emptyValue(altsrc)) {
safe_log("Figures_manuscript_subtype.expand: Can't find altsrc for figure");
return false;
}
// If we are in brainhoney, then we need to make sure the altsrc
// has the proper absolute path
if (xBookUtils.inBrainhoneyPlayer() && !xBookUtils.externalUrl(altsrc)) {
if (!/^\/brainhoney\//.test(altsrc)) {
altsrc = xBookUtils.getBaseUrl() + altsrc;
}
}
// Target can be passed in through data-target attribute in xml. If
// not present then use default.
var target = ($parentDiv.attr('data-target') || this.targetDefault);
// special checks for internal altsrc urls
if (!xBookUtils.externalUrl(altsrc)) {
// We don't want to open a million different windows for the same figure
if (target === "_blank") {
target = "fig_win"; // this matches Player default
}
// Are we auto converting image file to html file?
if (this.autoHtml === "on") {
altsrc = altsrc.replace(/\.(jpg|gif|png|tiff)$/, ".html");
}
// Or do we want to use supp_win.html to open internal image links?
else if (this.displayImagesInSuppHtml === "on") {
var width = $parentDiv.attr('data-htmlwidth');
if (!xBookUtils.emptyValue(width) && /^\d+$/.test(width)) {
width = "&imgwidth=" + width;
}
else {
width = "";
}
altsrc = "asset/supp_win.html?bookid=" + xBookUtils.getBookId() + "&image=" + altsrc + width + "&baseurl=" + xBookUtils.getBaseUrl();
}
}
if (target === "_pop") {
xBookUtils.openSuppWin({url: altsrc});
}
else {
window.open(altsrc, target);
}
},
// end expand
process_media: function() {
// we're not currently using this (jwplayer is not being included)
$("[data-mmtype='mp3']").each(function(index, element) {
var jq = $(element);
var id = jq.attr("data-figure-id");
var mmsrc = jq.attr("data-mmsrc");
// http://www.longtailvideo.com/jw/upload/bunny.mp3
// http://www.youtube.com/embed/CsGYh8AacgY
var src = jq.attr("src");
var attr = jq.attr("data-attr");
if (attr == null) {
attr = "";
}
attr = attr.split(/\s*,\s*/);
var params = new Object();
params.width = jq.width();
params.height = jq.height() + 24; // 24 is for the controler at the bottom
params.file = mmsrc;
params.image = src;
params.controlbar = "bottom";
params.screencolor = "ffffff";
params["viral.allowmenu"] = "false";
params["viral.onpause"] = "false";
params["viral.oncomplete"] = "false";
// determine url of flashplayer based on whether we're published or not
if (UI_Elements.in_preview_mode()) {
params.flashplayer = "/js/preview/player.swf";
}
else {
params.flashplayer = "js/player.swf";
}
safe_log(params.flashplayer);
for (var i = 0; i < attr.length; ++i) {
var a = attr[i].split(/\s*=\s*/);
params[a[0]] = a[1];
}
jwplayer(id).setup(params);
});
//AF: this is less than ideal, but i had to make this a global variable so it can be accessed by the video players when they fire the templateloaded event.
// we should look into changing it.
videos.templateReady = function(figureObjectID) {
var KEY_CODES = {
SPACE: 32,
ENTER: 13
};
var vidplayer = brightcove.api.getExperience(figureObjectID);
// var experienceModule = vidplayer.getModule(brightcove.api.modules.APIModules.EXPERIENCE);
var playerModule = vidplayer.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER);
var el = document.querySelector("[data-figure-id=" + figureObjectID + "]");
$(el).find('object').attr('aria-hidden', true);
$(el).find('iframe.BrightcoveExperience').attr('aria-hidden', true); // Fix for android
el.setAttribute("tabindex", "0");
el.setAttribute("role", "application");
el.setAttribute('aria-label',
'Press enter to start or pause video. Press the transcript button to see the content of the video');
el.addEventListener("keydown", (function(isPlay) {
return function(evt) {
var keyCode = evt.keyCode || evt.which;
if (keyCode === KEY_CODES.SPACE || keyCode === KEY_CODES.ENTER) {
if (isPlay) {
playerModule.pause();
isPlay = false;
return;
}
playerModule.play();
isPlay = true;
}
};
})(false));
var questionSequence = $("#" + figureObjectID).closest('[data-type="figure"]').nextAll(
'[data-block_type="question_sequence"], [data-block_type="question_sequence_one_at_a_time"]');
questionSequence.each(function(index, element) {
if ($(element).attr("data-block_type") == "figure") {
if ($(element).find(".BrightcoveExperience").size() > 0) { //we have found another video following the current one, so stop
return false;
}
}
var questionSequenceIndex = $(element).attr("question_sequence_index");
var questionSequenceMetaData = $(element).find('[data-type="box_inner"]').children(
'[data-type="metadata"]').find('[key="cuepoint"]').html();
$(element).hide();
if (questionSequenceMetaData != null) {
var cuePointsModule = vidplayer.getModule(brightcove.api.modules.APIModules.CUE_POINTS);
var CuePointType = brightcove.api.modules.CuePointsModule.CuePointType;
var cuePoints = [ {
name: figureObjectID,
metadata: questionSequenceIndex,
time: questionSequenceMetaData,
type: CuePointType.CODE
} ];
cuePointsModule.addCuePoints(videos[figureObjectID], cuePoints);
videos.question_sequence_to_video_map[questionSequenceIndex] = figureObjectID;
}
});
playerModule.addEventListener(brightcove.api.events.CuePointEvent.CUE, videos.cuePointEvent);
};
videos.cuePointEvent = function(e) {
//get the player - the name property of the cuePoint is set to the ID of the Brightcove experience
//so we can find the player here.
var vidplayer = brightcove.api.getExperience(e.cuePoint.name);
//var globalPlayer = brightcove.api.getExperience(e.cuePoint.name);
safe_log("got vid player");
var playerModule = vidplayer.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER);
safe_log("got module");
playerModule.pause(true);
safe_log("paused");
player.show_question_sequence(e.cuePoint.metadata, false);
};
$("[data-mmtype='mov']").each(function(index, element) {
var jq = $(element);
var id = jq.attr("data-figure-id");
var mmsrc = jq.attr("data-mmsrc");
// var src = jq.attr("src");
var attr = jq.attr("data-attr");
if (attr == null) {
attr = "";
}
attr = attr.split(/\s*,\s*/);
var params = new Object();
for (var i = 0; i < attr.length; ++i) {
var a = attr[i].split(/\s*=\s*/);
params[a[0]] = a[1];
safe_log("added param " + a[0] + ": " + a[1]);
}
params.autoStart = jq.attr("data-autoplay");
var videoPlayerID = "";
var videoPlayerKey = "";
//if(params.showVideoControls == 'true'){
//AF: This is the video player with playback controls. We are only using this one for right now.
videoPlayerID = "1513003547001";
if (jq.attr("data-playerid")) {
videoPlayerID = jq.attr("data-playerid");
}
videoPlayerKey = "AQ~~,AAABXVHBMdE~,bnY9CM55Z1MLPZuidy4KYEC_16wi-U8Q";
//}else{
// videoPlayerID = "1504927982001";
// videoPlayerKey = "AQ~~,AAABXVHBMdE~,bnY9CM55Z1PiqOYprq-NHmUPG2yKZ4U-";
//}
videos[id] = mmsrc;
var BCL = {};
BCL.markup = function(html, data) {
var m;
var i = 0;
var match = html.match(data instanceof Array ? /{{\d+}}/g : /{{\w+}}/g) || [];
// eslint-disable-next-line no-cond-assign
while (m = match[i++]) {
html = html.replace(m, data[m.substr(2, m.length - 4)]);
}
return html;
};
videos.templateLoad = function(e) {
//AF: For now, we are not using captions.
var vidplayer = brightcove.api.getExperience(e);
// var CuePointType = brightcove.api.modules.CuePointsModule.CuePointType;
var modExp = vidplayer.getModule(brightcove.api.modules.APIModules.EXPERIENCE);
modExp.addEventListener(brightcove.api.events.ExperienceEvent.TEMPLATE_READY,
function(_evt) {
videos.templateReady(e);
});
//captionsModule.loadDFXP(player.md.video_caption_url + videos[e] + ".xml", videos[e]);
//if needed, we can use these events to trigger code upon the success or error of loading captions.
//if there is an error, it fails silently and just doesn't show captions.
//captionsModule.addEventListener(brightcove.api.events.CaptionsEvent.DFXP_LOAD_SUCCESS, onDFXPLoadSuccess);
//captionsModule.addEventListener(brightcove.api.events.CaptionsEvent.DFXP_LOAD_ERROR, onDFXPLoadError);
};
BCL.playerData = {
"playerID": videoPlayerID,
"playerKey": videoPlayerKey,
"width": jq.width(),
"height": jq.height(),
"videoID": mmsrc,
"autoStart": params.autoStart
};
BCL.playerTemplate =
"";
// console.log(BCL.playerTemplate);
var playerHTML = "";
playerHTML = BCL.markup(BCL.playerTemplate, BCL.playerData); //replaces placeholders with values
jq.replaceWith(playerHTML);
brightcove.createExperiences();
});
}
});
module.exports = AYS_Figures;
/***/ }),
/***/ 356:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__( 1 );
var dom = __webpack_require__( 2 );
var UtilsShuffle = __webpack_require__( 360 );
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 3 );
var Query = MC_Query.extend( {
parseSource: function() {
this._super.apply( this, arguments );
if ( UtilsShuffle.currentQuestionIsRandomize() ) {
var shuffleArr = UtilsShuffle.shuffleArrays( this.choices, this.choices_fb, function( choices, choices_fb ) {
this.choices = choices;
this.choices_fb = choices_fb;
}.bind( this ) );
this.correct_answer_index = shuffleArr.indexOf( this.correct_answer_index );
}
},
/**
* Get correct HTML for query text and set id for following use
* @returns {string} Html for query text
*/
query_text_html: function() {
if ( this.query_text != '' && this.md._hide_query_text !== 'true' ) {
var text = jQuery.trim( this.query_text );
text = Auxiliary.underlinedText(text);
// Replace newlines with
text = text.replace( /\n/g, ' ' );
// Set id for use it to associate query text with input radios
if ( platform.ios ) {
// iOS doesn't see legend
return '
' + text + '
';
}
else {
return '';
}
}
else {
if ( this.query_text == '' ) {
return '';
}
else {
return '';
}
}
},
getHTML: function( mode ) {
// Initialize image map elements
if ( this.imagemap_initialized === false ) {
var question_jq = this.jq.parent();
this.im_init( question_jq );
this.imagemap_initialized = true;
}
// Wrap answers in radio group
var html = '";
html = dom.createHTML( html );
common.parseMathExpresions( html );
return html;
},
/**
* If we have individual feedback for each mc option
* @returns {string} Html for the feedback
*/
correct_incorrect_feedback: function() {
// Try get individual feedback for option
var index = this.choice_order[this.user_answer_index]; // Get correct index, if choices are scrambled
var html = this.choices_fb[index] || '';
// If we got any feedback, enclose it in a div
if (html) {
html = '
' + html + '
';
}
return html;
}
} );
module.exports = Query;
/***/ }),
/***/ 357:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__( 1 );
var ConcreteActivity = __webpack_require__( 5 );
var ConcreteFigures = __webpack_require__( 355 );
var KEY_CODES = __webpack_require__( 1 ).KEYCODES;
var ShadowSpeech = __webpack_require__(361);
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 3 );
var Player_work_it_out = Player.extend( {
activity_title: null,
activity_type: null,
liveFeedback: null,
question_numbering: null,
// it is supposed to be only one video for section
init_video: function( section ) {
var video = section.jq[ 0 ].querySelector( "[data-class=video]" );
if ( video ) {
section.hasVideo = true;
section.video = {
jq: $( video ),
id: $( video ).data( 'figure-id' ),
isViewed: false,
hasTranscription: false
};
$( video ).attr( 'tabindex', '0' );
$( video ).find( 'object' ).attr( 'tabindex', '-1' );
this.init_video_transcription( section );
this.video_add_events( section.video );
this.hide_video( section );
}
},
init_video_transcription: function( section ) {
var video_transcription = section.jq[ 0 ].querySelector( "[data-block_type=video_transcription]" );
if ( video_transcription ) {
section.video.hasTranscription = true;
section.video.transcription = {
jq: $( video_transcription ),
text: '\n' + $( video_transcription ).find( '.transcript-text' ).html() + ''
};
}
},
video_add_events: function( video ) {
if ( video.hasTranscription ) {
video.transcription.jq.find( '.transcript-button' ).click( function() {
var transcriptWindow = window.open( "", "_blank" );
transcriptWindow.document.write( video.transcription.text );
} );
}
},
show_video: function( section ) {
if ( section.hasVideo ) {
section.video.jq.show();
section.video.hasTranscription && section.video.transcription.jq.show();
}
},
hide_video: function( section ) {
if ( section.hasVideo ) {
section.video.jq.hide();
section.video.hasTranscription && section.video.transcription.jq.hide();
}
},
update_section_status: function() {
if ( this.section_currently_showing != null && this.last_available_section <= this.section_currently_showing ) {
var s = this.get_current_section();
s.all_questions_answered = true;
// if the current section has any questions, see if they've all been answered
var qs_to_check = [];
s.jq.find( "[data-type=question]" ).each( function( index, element ) {
var q_index = $( element ).attr( "data-question_index" );
var question = player.activity.questions[ q_index ];
s.all_questions_answered = s.all_questions_answered && question.is_complete();
if ( question.question_sequence != null ) {
for ( var i = 0; i < qs_to_check.length; ++i ) {
if ( qs_to_check[ i ] == question.question_sequence ) {
break;
}
}
if ( i == qs_to_check.length ) {
qs_to_check.push( question.question_sequence );
}
}
} );
// now check question sequences to make sure they're done too
s.all_question_sequences_completed = true;
for ( var i = 0; i < qs_to_check.length; ++i ) {
s.all_question_sequences_completed = s.all_question_sequences_completed && (qs_to_check[ i ].sequence_complete == "complete");
}
if ( s.all_questions_answered && s.all_question_sequences_completed ) {
this.last_available_section = this.section_currently_showing + 1;
s.isComplete = true;
}
}
},
show_completion_dialog: function() {
var html = "Congratulations! You have completed this activity.";
Standard_Dialog.alert( html, { title: "", width: 400 } );
},
show_video_dialog: function() {
var html = "Please note: You must watch the video in order to move on to the next slide.";
Standard_Dialog.alert( html, { title: "", width: 400 } );
},
show_incompleteness_dialog: function() {
var html = "You must complete every questions on the slide to move on to the next slide.";
Standard_Dialog.alert( html, { title: "Message", width: 400 } );
},
show_next_section: function() {
var section = this.get_current_section();
if ( section.isComplete || window.__force_next_section ) {
this.show_section( this.section_currently_showing + 1 );
}
else {
var questionsIsAnswered = section.all_questions_answered && section.all_question_sequences_completed;
questionsIsAnswered ? this.show_video_dialog() : this.show_incompleteness_dialog();
}
},
show_prev_section: function() {
this.show_section( this.section_currently_showing - 1 );
},
show_section: function(section_to_show) {
if (this.section_currently_showing === section_to_show) {
return;
}
var direction = 'right';
if (section_to_show === 'previous') {
section_to_show = this.section_currently_showing - 1;
direction = 'left';
} else if (section_to_show == 'next') {
section_to_show = this.section_currently_showing + 1;
}
if (section_to_show == null || isNaN(section_to_show) || section_to_show < 0 || section_to_show >= this.sections.length) {
return;
}
if (this.md.sequenced_sections === 'true' && section_to_show > this.last_available_section) {
//var $tab = player.tabs.eq(section_to_show);
// Let instructors through
if (player.activity.is_instructor()) {
Standard_Dialog.alert('Please note: Students need to read and complete each section of the activity before moving on to the next section. ' +
'Instructors, however, can skip around between sections as they choose.', { title: "Warning", width: 400 });
} else {
Standard_Dialog.alert(this.md.section_sequence_message, {});
return;
}
}
this.show_section_animate(section_to_show, direction);
// Process iframes for the section, unless all were preloaded
if (player.md.preload_all_iframes !== 'true') {
this.figures.process_iframes(this.get_current_section().jq);
}
this.update_section_status();
this.update_navigation();
},
show_section_from_toc: function( section_to_show ) {
// set focus on content button
window.Standard_Dialog.activeElement = $( '#content_button' );
window.Standard_Dialog.close( true );
if ( this.section_currently_showing != section_to_show ) {
this.show_section( section_to_show );
}
},
hide_section: function( section ) {
'use strict';
if ( section && section.md.section_type && window.mheContpract[ section.md.section_type ] ) {
if ( window.mheContpract[ section.md.section_type ].hide ) {
window.mheContpract[ section.md.section_type ].hide( section );
}
}
},
set_video: function( playerID, videoID, pauseAfterLoad ) {
//highlight the button
$( ".select_video_button" ).removeClass( "ui-state-focus" );
$( "#" + playerID + "_" + videoID ).addClass( "ui-state-focus" );
if ( !player.videoIsReady[ playerID ] ) {
//safe_log("video not ready.. going to settimeout");
setTimeout( function() {
player.set_video( playerID, videoID, pauseAfterLoad );
}, 100 );
return false;
}
//safe_log("inside load video");
var vidplayer = brightcove.api.getExperience( playerID );
var playerModule = vidplayer.getModule( brightcove.api.modules.APIModules.VIDEO_PLAYER );
//safe_log("got player module");
if ( pauseAfterLoad ) {
playerModule.cueVideoByID( videoID );
}
else {
playerModule.loadVideoByID( videoID );
}
},
show_section_animate: function( section_to_show ) {
if ( this.section_currently_showing != null ) {
this.get_current_section_jq().hide();
}
this.section_currently_showing = section_to_show;
var section = this.sections[ section_to_show ];
section.jq.fadeIn( 300 );
UI_Elements.update_button_label( "slide_number", "Page " + (section_to_show + 1) + " of " + this.sections.length + " " );
if ( this.section_currently_showing == 0 ) {
$( "#previous_button" ).hide();
}
else {
$( "#previous_button" ).show();
}
if ( this.section_currently_showing == (this.sections.length - 1) ) {
$( "#next_button" ).hide();
}
else {
$( "#next_button" ).show();
}
//apply click handler to termref items in the section - the global call done on init doesn't get the content in queries
player.glossary.set_click_event_for_terms_in_section( this.get_current_section_jq() );
// scroll to top
window.scrollTo( 0, 0 );
},
show_navigation: function() {
var toc_icon = "";
var $manuscriptNode = $( '#manuscript' );
// don't show link "Example"
$('a').filter(function( i ) {
if ( $(this).text() === "Example" ) {
$(this).addClass("element-hidden");
}
});
// Header
var html =
"
";
// удалим название секции
$manuscriptNode.find('h1').remove();
$manuscriptNode.prepend( html );
html = "";
$manuscriptNode.append( html );
},
show_toc: function() {
var html = '';
for ( var i = 0; i < this.sections.length; i++ ) {
var title = this.sections[ i ].title;
// Check whether it is available
var disabled = (this.md.sequenced_sections === 'true' && i > this.last_available_section);
var className = disabled ? 'toc_section_not_available' : '';
// Check action on disabled only if it is instructor
var action = (!disabled || player.activity.is_instructor()) ? 'onclick="player.toc_show_section(' + i + ')"' : '';
html += '
Click on a slide to view it. Note: Gray slides are not accessible until preceding slides have' +
' been viewed or completed.
' +
'
' + html + '
';
Standard_Dialog.open( html, {
from: $( '.top-banner button' ),
title: 'Table of Contents'
} );
$( '.toc_section_title' ).each( function() {
// Add action on disabled only if it is instructor
if ( !disabled || player.activity.is_instructor() ) {
$( this ).keyup( function( e ) {
var key = e.keyCode || e.which;
if ( key === KEY_CODES.SPACE ) {
$( this ).click();
}
} );
$( this ).keydown( function( e ) {
var key = e.keyCode || e.which;
if ( key === KEY_CODES.SPACE ) {
e.preventDefault();
}
if ( key === KEY_CODES.ENTER ) {
e.preventDefault();
$( this ).click();
}
} );
}
} );
},
/**
* Hide menu after click on link
* @param {number} section_to_show
*/
toc_show_section: function( section_to_show ) {
// Close dialog
Standard_Dialog.close();
// Show section
player.show_section( section_to_show );
},
initialize: function() {
this._super();
var fontHTML = '';
$( "body" ).append( fontHTML );
this.activity_type = $( "[key=activity_type]" ).html();
this.activity_title = $( "[key=activity_title]" ).html();
this.question_numbering = $( "[key=question_numbering]" ).html();
this.activity = new ConcreteActivity();
this.figures = new ConcreteFigures();
this.initImageDescriptions();
player.glossary.set_click_event_for_terms_in_section = function( sectionjq ) {
$( sectionjq ).find( "[data-type='termref']" ).each( function( index, element ) {
var jq = $( element );
jq.unbind( "click" );
jq.click( function() {
player.glossary.show_definition( this );
} );
} );
};
// brb: Accessibility - set document title
if (this.activity_type) {
document.title = this.activity_type + " " + this.activity_title.replace(/<(?:.|\n)*?>/gm, '');
}
$( '[data-type=question]' ).attr( 'role', 'document' );
// Return question titles for each section
var i= 0, j = 0, countQ;
$('[data-type=section]').each(function() {
i=0;
countQ = $($('[data-type="section"]')[j++]).find('[data-type=question] h3');
$(countQ).each(function() {
$(this).html((i++ + 1) + ' of ' + $(countQ).length);
});
});
/**
* adding role=application for all rawhtml after data-type=figure
* to prevent partially reading of the previous paragraph
*/
$( '[data-type=figure]' ).each( function() {
$( this ).next( '[data-type=rawhtml]' ).attr( 'role', 'application' );
} );
// Add live feedback for readers
if (!platform.mobile) {
this.initLiveFeedback();
}
},
initialize_questions: function() {
var questions = this.activity.questions;
questions.forEach( function( question, index ) {
if ( index > 0 ) {
var $questionTitleNode = $( question.jq ).find( 'h3' );
// defaults we remove question's title h3
// if there is parametr 'question_numbering', then we remain this title
if(player.question_numbering != "true") {
$questionTitleNode.remove();
}
}
common.addAriaForDDFields( question.jq );
} );
},
initLiveFeedback: function() {
var live = platform.ie ? 'assertive' : 'polite';
this.liveFeedback = $('');
$('body').prepend(this.liveFeedback);
},
setLiveText: function(text) {
if ( platform.ie ) {
Auxiliary.setFeedbackAndClearAttr('assertive', 5000, text);
} else if ( platform.mac ) {
$('#live-feedback').html(text + Auxiliary.emptySymbols());
} else {
$('#live-feedback').html(text);
}
},
initImageDescriptions: function() {
$('.image-description').each(function() {
var html = $(this).html();
$(this).parent().css('text-align', 'center');
var $btn = $('');
$(this).replaceWith($btn);
$btn.click(function() {
Standard_Dialog.open(html, { title: 'Image Description', from: $btn });
});
});
},
initialize2: function() {
this._super();
this.initialize_questions();
// If ARGA is running, note here whether or not *any* data has been saved for the user
// that is, whether a submission has been initialized
if ( window.player.ARGA_running ) {
// We know something has been stored if "complete" is not an empty string
if ( window.Get_ARGA_Data( "complete" ) !== "" ) {
this.ARGA_submission_initialized = true;
}
}
common.parseMathExpresions();
common.parseMetaClasses();
this.shadow_speech = new ShadowSpeech();
},
initialize_sections: function() {
'use strict';
this._super();
var section;
// Extract metadata for section, for conditional steps
for ( var j = 0; j < this.sections.length; ++j ) {
section = this.sections[ j ];
section.isComplete = false;
section.jq.find( 'h2.section-title').remove();
section.hasVideo = false;
this.init_video( section );
section.md = new window.Metadata( { lowercase_keys: true } );
section.md.add_from_jq( section.jq.children( '[data-type=metadata]' ) );
section.jq.attr( 'role', 'main' );
}
// Disable default drag
common.disableDefaultDrag();
common.activateAriaCheckUncheck();
},
} );
module.exports = Player_work_it_out;
/***/ }),
/***/ 358:
/***/ (function(module, exports) {
/**
* Created by Lupachev on 06.06.2017.
*/
var Question = Class.extend({
extract_metadata: function() {
if (this.jq == null) {
return;
}
this.md.add_from_jq(this.jq.find("[data-type=metadata]"));
},
// return whether or not metadata with the given key is set
md_set: function(key) {
return (this.md[key] != null);
},
is_complete: function() {
for (var i = 0; i < this.queries.length; ++i) {
if (!this.queries[i].userHasAnswered()) {
return false;
}
}
return true;
},
is_correct: function() {
for (var i = 0; i < this.queries.length; ++i) {
if (!this.queries[i].isCorrect()) {
return false;
}
}
return true;
},
get_weight: function() {
return Math.round(this.points_possible / player.activity.total_points_possible * 100);
},
check_conditional: function(condition) {
return "";
// condition will be, e.g.:
// ({1}=9) No, that's the intercept.
// meaning that if the first query is equal to 9, condition is met
if (condition.search(/\((.*?)\)\s*(.*)/) > -1) {
var test = RegExp.$1;
var s = RegExp.$2;
// prepare for eval: first convert "=" to "==" (but allow == too)
test = test.replace(/=/g, "==");
test = test.replace(/====/g, "==");
// now convert {1} to this.queries[0].user_answer;
while (test.search(/\{(\d+)\}/) > -1) {
var i = RegExp.$1 * 1 - 1;
test = test.replace(/\{(\d+)\}/, "this.queries[" + i + "].user_answer");
}
// and test
} else {
safe_log("error with feedback_conditional: " + condition);
return "";
}
},
init: function(atts) {
for (var j in atts) {
this[j] = atts[j];
}
this.queries = new Array();
this.tries = 0;
this.gave_up = false;
// extract question metadata
this.md = new Metadata({lowercase_keys:true});
// define any md items that need to be arrays
this.md.feedback_conditional = [];
this.md.next_step_conditional = [];
this.md.model_update_conditional = [];
this.extract_metadata();
}
});
module.exports = Question;
/***/ }),
/***/ 359:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Created by Abdulnasyrova on 19.04.2017.
*/
var runOn = __webpack_require__(0).run_on;
var KEY_CODES = __webpack_require__(1).KEYCODES;
var Standard_Dialog = function() {
var $manuscript = $('#manuscript');
var $body = $('body');
var $dialog, $content;
var options = {};
return {
open: function(html, opt) {
// Extend default options
options = $.extend(true, (opt || {}), {
width: 450,
modal: true,
draggable: false,
resizable: false
});
// Set buttons
if (options.buttons === 'none') {
options.buttons = null;
}
else if (options.buttons === 'OK' || !options.buttons) {
options.buttons = [ { text: 'OK', click: Standard_Dialog.close } ];
}
// Remove previous dialog
$('#standard_dialog_div').dialog('close').remove();
if (options.modal) {
$body.css('overflow', 'hidden');
}
// Hide other content from reader for mobile devices
$manuscript.attr('aria-hidden', 'true');
$dialog = $('');
$content = $('
' + (html || '') + '
');
$dialog.append($content);
$dialog.dialog(options);
// If we open toc we use as description only instruction in the top of dialog and not links
var isMenu = $content.find('#toc_head').length;
var labelledBy = isMenu ? 'toc_head' : 'standard_dialog_div';
var $parentDialog = $dialog.parent().attr({
'tabindex': '0',
'role': 'dialog',
'aria-labelledby': 'ui-dialog-title-standard_dialog_div ' + labelledBy
});
$parentDialog.find('#ui-dialog-title-standard_dialog_div').attr({
'role': 'heading',
'aria-level': '1'
});
// Remove close btn
$('.ui-dialog-titlebar-close').remove();
var $lastBtn = $parentDialog.find('button').last();
var $firstBtn = $parentDialog.find('button').first();
// Attach events
$parentDialog.bind('keydown', function(e) {
var code = e.keyCode || e.which;
if (code === KEY_CODES.ESC) {
Standard_Dialog.close(true);
}
if (e.target === this && e.shiftKey && code === KEY_CODES.TAB) {
e.preventDefault();
$lastBtn.focus();
}
});
$lastBtn.bind('keydown', function(e) {
var code = e.keyCode || e.which;
if (!e.shiftKey && code === KEY_CODES.TAB) {
$parentDialog.focus();
e.preventDefault();
}
});
if (runOn.mobile) {
// For android we set focus on dialog in any cases
$parentDialog.focus();
}
else if (isMenu) {
// If it is menu put focus on first link
$parentDialog.find('a').first().focus();
}
else {
// For other platform we set focus on first button
$firstBtn.focus();
}
},
// for now alert is just like any other dialog; we could change that later.
wait: function(html, opt) {
options = opt || {};
options.buttons = 'none';
Standard_Dialog.open(html, options);
},
alert: function(html, opt) {
Standard_Dialog.open(html, opt);
},
close: function() {
// Show other content
$manuscript.removeAttr('aria-hidden');
if ($dialog) {
$dialog.dialog('close').remove();
}
else {
$("#standard_dialog_div").remove();
}
if (options.from) {
options.from.focus();
}
if (options.modal) {
$body.css('overflow', 'auto');
}
}
};
}();
module.exports = Standard_Dialog;
/***/ }),
/***/ 360:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var UtilsShuffle = {};
UtilsShuffle.currentQuestionIsRandomize = function() {
return Boolean(player.activity.question_being_initialized.md["randomize-choices"]);
};
UtilsShuffle.getFilledArr = function(maxValue) {
var arr = [];
for (var i = 0; i < maxValue; i++) {
arr[i] = i;
}
arr.shuffle();
return arr;
};
UtilsShuffle.shuffleArrays = function() {
var arrs = [];
var length = arguments[0].length;
var shuffleArr = UtilsShuffle.getFilledArr(length);
var lengthArguments = arguments.length;
var callBackFunctions = null;
if (typeof arguments[lengthArguments - 1] === 'function') {
lengthArguments--;
callBackFunctions = arguments[lengthArguments];
}
// create new example of arrays
for (var i = 0; i < lengthArguments; i++) {
arrs[i] = [];
}
// shuffle of this arrays
for (var index = 0; index < length; index++) {
var el = shuffleArr[index];
for (var countArrFirst = 0; countArrFirst < lengthArguments; countArrFirst++) {
arrs[countArrFirst].push(arguments[countArrFirst][el]);
}
}
// return this arrays example
if (callBackFunctions) {
callBackFunctions.apply(null, arrs);
}
else {
for (var countArrSecond = 0; countArrSecond < lengthArguments; countArrSecond++) {
arguments[countArrSecond] = arrs[countArrSecond];
}
}
// return array of shuffle index
return shuffleArr;
};
module.exports = UtilsShuffle;
/***/ }),
/***/ 361:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var dom = __webpack_require__(2);
var platform = __webpack_require__( 0 ).run_on;
function ShadowSpeech(aria_live, role, atomic, root) {
var frag;
root = root || document.body;
this.live = aria_live || (platform.ie ? 'assertive' : 'polite');
this.role = role ? 'role = "' + role + '"' : '';
this.atomic = atomic ? 'aria-atomic = "' + atomic + '"' : '';
frag = dom.createHTML('');
this._el = frag.firstChild;
dom.append(frag, root);
}
ShadowSpeech.prototype.talk = function(some, clone) {
if (clone && some instanceof Node) {
some = some.cloneNode(true);
}
dom.clear(this._el);
dom.setHtml(some, this._el);
};
module.exports = ShadowSpeech;
/***/ }),
/***/ 5:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__(1);
var dom = __webpack_require__(2);
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 3 );
var Activity_work_it_out = Activity.extend({
submit_question: function(question_index) {
this._super(question_index);
var section = player.get_current_section();
var qID = section.jq.find("[data-type=question]").attr("data-question_index");
player.activity.qID = qID;
player.show_video(section);
var $figure_text = section.jq.find("[data-type=figure_text]");
if ($figure_text.text().trim() == '') {
$figure_text.hide();
}
if (section.hasVideo) {
setTimeout(function() {
var videoPlayer = brightcove.api && brightcove.api.getExperience(section.video.id);
if (videoPlayer) {
var playerModule = videoPlayer.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER);
playerModule.seek(0);
playerModule.addEventListener(brightcove.api.events.MediaEvent.COMPLETE, function() {
section.video.isViewed = true;
player.update_section_status();
player.showing_last_section() && player.show_completion_dialog();
});
}
}, 5000);
}
},
update_question_action_div: function(question_index) {
var question = this.questions[question_index];
// Calculate points_awarded and points_possible
var points_awarded = 0;
var points_possible = 0;
var points_provisional = false;
for (var i = 0; i < question.queries.length; ++i) {
var query = question.queries[i];
points_awarded += query.getPointsAwarded();
points_possible += query.getPointsPossible();
if (query.pointsAreProvisional()) {
points_provisional = true;
}
}
// Round to at most two decimal places
points_awarded = Math.round(points_awarded * 100) / 100;
points_possible = Math.round(points_possible * 100) / 100;
// Hide submit button (and any other similar buttons that might be added by subtypes), but show points earned
// we need to be able to focus on the feedback container, so add tabindex
var $questionAction = question.jq.find('#question_action_div_' + question.index);
// we don't need text that begins with "For more help..."
var tmpA = $($questionAction).find(".question_feedback_part").html();
if (tmpA !== null) {
if( tmpA.indexOf('For more help') > -1 ) {
var tmpB = tmpA.substr(tmpA.indexOf('For more help'), tmpA.length);
} else if (tmpA.indexOf('For help with') > -1) {
var tmpB = tmpA.substr(tmpA.indexOf('For help with'), tmpA.length);
}
tmpA = tmpA.replace(tmpB, '');
}
$($questionAction).find(".question_feedback_part").html(tmpA);
// Add information about points
var pointsAwarded = '
Points awarded: ' + points_awarded + ' out of ' + points_possible;
if (points_provisional) {
pointsAwarded += ' (provisional)';
}
pointsAwarded += '
';
if (query.answer_was_just_entered && points_provisional) {
pointsAwarded +=
'
Your answer has been provisionally accepted. You\'ll get full credit for now,' +
' but your instructor may update your grade later after evaluating it.
';
}
var $button = $questionAction.find('.question_submit_button');
$button.attr({
'tabindex': '-1',
'aria-disabled': 'true'
}).addClass('disabled');
// Add points awarded
var $questionFeedback = $questionAction.find('.question_feedback');
$questionAction.find('.points_awarded_div').remove();
if ($questionFeedback.length > 0) {
$questionFeedback.append(pointsAwarded);
} else {
$questionAction.append(pointsAwarded);
}
$questionFeedback.show();
// чтобы ссылка в тексте feedback читалась корректно
if (platform.ios) {
$('.question_feedback_part').each(function (i, val) {
$(this).find('a').prepend("");
$(this).find('a').append(" link");
});
} else if ( platform.android) {
$('.question_feedback_part').find('a').each(function (i, val) {
$(this).after("" + Auxiliary.emptySymbols() + "link");
});
} else if ( platform.mac ) {
var count = 0;
$('#question_feedback_' + question_index + ' .question_feedback_part').find('a').each(function (i, val) {
if (count++ > 0) {
$(this).after("" + Auxiliary.emptySymbols() + "link");
}
});
}
// для multiple choice, если пользователь не выбрал вариант ответа, feedback не отображаем
if(isNaN(query.user_answer_index) && query.query_source.indexOf("MC:") == 0) {
$questionAction.find('.question_feedback_part').remove();
}
// insert word 'link' after in live-region
var feedbackText = $questionAction.html().replace('', ' link');
// html to txt
feedbackText = feedbackText.replace(/<(?:.|\n)*?>/gm, '');
// Add space after period
feedbackText = feedbackText.replace(/\./g, '. ');
// FF + NVDA, IE + JAWS doesn't read text in focused div automatically*
// * for Android and iOS we use attribute aria-live = 'polite'
// for
if (!platform.android && !platform.ios) {
player.setLiveText(feedbackText.replace('Feedback', 'Feedback. '));
}
},
show_question_feedback: function(question, is_correct, try_again) {
// Remove previous feedback if there
$('#question_feedback_' + question.index).remove();
// Remove previous aria-live attributes
if ( platform.android || platform.ios ) {
$('.question_feedback').removeAttr('aria-live');
}
// making good links
var qLink = question.jq.find('.query_mc_feedback_correct_incorrect span[data-type="link"]');
qLink.replaceWith( "" + qLink.html() + "" );
// Get individual feedback for each choice, and add it after general feedback
var feedback_correct_incorrect = question.jq.find('.query_mc_feedback_correct_incorrect').html();
if (feedback_correct_incorrect === null) {
feedback_correct_incorrect = "";
}
// for Android and iOS we use attribute aria-live = 'polite'
// for
var aria_live = (platform.android || platform.ios) ? ' aria-live="polite" ' : '';
var role = (platform.android) ? ' role="presentation" ' : '';
var html = '
' +
'
' + this.feedbackTitle + '
';
var feedback = '';
// GENERAL feedback if there
if (question.md.feedback) {
feedback += '
' + question.md.feedback + '
';
}
// CORRECT feedback if there and the answer is correct
if (is_correct && question.md.feedback_correct) {
feedback += '
';
}
// INCORRECT or HINT feedback if there and the answer is incorrect
if (!is_correct) {
var found_feedback_string = false;
// If user gets to try again
if (try_again) {
// Check for feedback_conditional's
if (question.md.feedback_conditional.length > 0) {
for (var i in question.md.feedback_conditional) {
var fbc = question.check_conditional(question.md.feedback_conditional[i]);
if (fbc) {
feedback += '
' + fbc + '
';
found_feedback_string = true;
break;
}
}
}
// Check for feedback HINT
if (!found_feedback_string && question.md.feedback_hint) {
feedback += '
' + question.md.feedback_hint + '
';
found_feedback_string = true;
}
}
// Check for feedback INCORRECT
if (!found_feedback_string && question.md.feedback_incorrect) {
feedback += '
';
html = dom.createHTML(html);
common.parseMathExpresions(html);
// append the div, then fade it in
$("#question_action_div_" + question.index).prepend(html);
},
restore_saved_answers: function() {
// skip page queries (questions[0])
for (var i = 1; i < this.questions.length; ++i) {
var question = this.questions[i];
// prepare for question_report_text questions
var query_responses;
if (question.md_set("question_report_text")) {
query_responses = "" + Get_ARGA_QuestionData(this.get_question_number(question))
query_responses = query_responses.split(this.query_responses_separator);
}
var restored_all_answers = true;
var all_answers_correct = true;
for (var j = 0; j < question.queries.length; ++j) {
var query = question.queries[j];
var saved_answer, saved_grade;
// get saved answer and grade out of the questionData for question_report_text questions
if (question.md_set("question_report_text")) {
if (query_responses[j] != null) {
var arr = query_responses[j].split(this.query_responses_grade_separator);
saved_answer = arr[0];
saved_grade = arr[1];
} else {
saved_grade = saved_answer = "";
}
// or out of learnerResponse / questionData for single-query questions
} else {
var ARGA_question_number = this.get_query_number(question, j);
saved_answer = Get_ARGA_LearnerResponse(ARGA_question_number);
// we stored the original grade in questionData
saved_grade = Get_ARGA_QuestionData(ARGA_question_number)
}
// if we found a grade...
if (saved_grade !== "" && saved_grade >= 0) {
// restore the answer
query.restoreAnswerFromARGA(saved_answer);
query.setGrade(saved_grade);
// then re-render the query in review mode
query.jq.html(query.getHTML("review"));
if (query.isCorrect() == false) {
all_answers_correct = false;
}
} else {
restored_all_answers = false;
}
}
if (restored_all_answers) {
// fix for feedback showing, when student will reenter the activity in LP
this.show_question_feedback(question, all_answers_correct, false);
this.update_question_action_div(i);
// if the item is in a sequence, show the next question
this.show_next_question(question);
// NEED TO CHECK TO MAKE SURE THIS IS WORKING PROPERLY
// If the question is in a sequence and the sequence is complete, call show_closing_material
var qs = question.question_sequence;
if (qs != null && qs.sequence_complete == "partial") {
this.show_closing_material(qs.index);
}
// update section status
player.update_section_status();
}
}
}
});
module.exports = Activity_work_it_out;
/***/ }),
/***/ 532:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(177);
/***/ })
},[532]);
//# sourceMappingURL=cowen4e_mru_video_activities.js.map