webpackJsonp([0],{
/***/ 100:
/***/ (function(module, exports, __webpack_require__) {
var subtype_activity = __webpack_require__(6);
var Auxiliary = __webpack_require__( 2 );
var platform = __webpack_require__(0).run_on;
var project_activity = subtype_activity.extend({
submit_question: function (question_index) {
if (player.activity.questions[question_index.data.question_index].queries[0].choice_order) {
var $qad = $(this).parent();
$qad.find('.alert').remove();
var $checkedRadio = player.activity.questions[question_index.data.question_index]
.jq.find('input[type="radio"]:checked');
if ($checkedRadio.length > 0) {
this._super(question_index);
if (platform.firefox) {
var $question = player.activity.questions[question_index.data.question_index].jq;
$question.find('input[type="radio"]').each(function () {
var $input = $(this);
var $label = $('#' + $input.attr('aria-labelledby'));
$input.removeAttr('aria-labelledby');
$label.removeAttr('aria-hidden');
});
}
}
else {
// 'You must choose an answer before submitting.'
$qad.prepend('
You must choose an answer before submitting.
');
player.liveFeedback.html('');
player.liveFeedback.html('You must choose an answer before submitting.');
return;
}
}
else {
this._super(question_index);
}
},
update_question_action_div: function (question_index) {
var question = this.questions[question_index];
// 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);
var $button = $questionAction.find('.question_submit_button');
$button.attr({
'tabindex': '-1',
'aria-disabled': 'true'
}).addClass('disabled');
var $questionFeedback = $questionAction.find('.question_feedback');
$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');
}
});
}
var query = question.queries[0];
// для 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
var $unorderedList = $questionAction.find('[data-type="unordered"]');
if ($unorderedList.length > 0) {
var $list = $('
');
var listItems = $unorderedList.html().split(' ');
for (var i = 0; i < listItems.length - 1; i++) {
$list.append($('
' + listItems[i] + '
'));
}
$unorderedList.replaceWith($list);
}
if (!platform.ios) {
player.setLiveText(feedbackText.replace('Feedback', 'Feedback. '));
}
}
});
module.exports = project_activity;
/***/ }),
/***/ 101:
/***/ (function(module, exports, __webpack_require__) {
var Subtype_Es = __webpack_require__(94);
var Auxiliary = __webpack_require__( 2 );
var platform = __webpack_require__(0).run_on;
project_es = Subtype_Es.extend({
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 = jQuery.trim(text).replace(/\n/g, ' ');
var id = 'query_text_' + this.query_index;
// Old comment in sciam project by someone:
// "I don't know why question for textarea was changed by _
// and actual question is placed before textarea just in
,
// but we don't need this label"
var ariaHidden = (platform.ios || platform.android) ? 'aria-hidden="true"' : '';
if (text !== '_') {
return '
' + text + '
';
}
else {
return '';
}
}
},
getHTML: function (mode) {
// Start with the query text, if there
var html = this.query_text_html();
var val = '';
var disabled = '';
if (this.userHasAnswered() && mode !== 'preview') {
// Make sure we convert double quotes to " for placement in 'value="xxx"' attributes
// Convert breaks to newlines
val = this.user_answer.replace(/ /g, '\n');
// Also disable the input if we're not in review_correct_incorrect mode
disabled = (mode !== 'review_correct_incorrect') ? 'disabled' : '';
}
var queryTextId = 'query_text_' + this.query_index;
// for Android and iOS we use advanced feedback
// feedbackId contains:
// essay_question_evaluation_feedback - id for div with text 'You must enter an answer'
// question_feedback - id for div with full feedback
var feedbackId = ' question_feedback_' + (this.query_index + 1);
var labelledBy = (platform.android || platform.ios) ? ' aria-labelledby="'
+ feedbackId + ' ' + queryTextId + '"' : ' aria-labelledby="' + queryTextId + '"';
html += '';
return html;
},
evaluateAnswer: function (question_index) {
// if user_answer_is_submittable is true, we're already ready to proceed
if (this.user_answer_is_submittable == true) {
return true;
}
// otherwise, get the user's answer
var raw_answer = $.trim($('#query_answer_' + this.query_index).val());
// replace newlines with breaks in recorded answer
this.user_answer = raw_answer.replace(/\n/g, ' ');
// if answer is blank and author didn't explicitly say to accept answers, make them enter something.
if (raw_answer == '' && this.md.accept_blank_answers != 'true') {
var ariaLabel = this.jq.find('textarea').attr('aria-labelledby');
if (ariaLabel.indexOf('essay_question_evaluation_feedback_') < 0) {
this.jq.find('textarea').attr('aria-labelledby', 'essay_question_evaluation_feedback_'
+ this.query_index + ' ' + this.jq.find('textarea').attr('aria-labelledby'));
}
this.set_evaluation_feedback('You must enter an answer.');
this.focus_user_input();
// return false, to say that we can't yet evaluate the answer.
return false;
// else check with MAVE if specified
}
else if (this.md.mave_question_id != null) {
var t = this;
MAVE.validate_answer(this.md.mave_question_id, raw_answer, {
callback_fn: function (x) {
t.MAVE_callback(x);
},
max_similarity_score: this.md.max_similarity_score,
min_valid_score: this.md.min_valid_score,
max_question_text_score: this.md.max_question_text_score,
validity_criterion: this.md.validity_criterion,
plagiarism_criterion: this.md.plagiarism_criterion
});
// store the question_index, so we'll be able to re-call player.submit_question on callback
this.question_index = question_index;
// return false, to say that we can't yet evaluate the answer.
return false;
// otherwise evaluate here...
}
else {
// if we have a min word count, compare to it
if (this.md.min_word_count != null) {
// If the answer has fewer than x unique words, it's not submittable
var word_count = this.unique_word_count(this.user_answer);
if (word_count < this.md.min_word_count * 1) {
this.set_evaluation_feedback('Your answer is not long enough. Please elaborate and resubmit.');
this.focus_user_input();
// return false, to say that we can't yet evaluate the answer.
return false;
}
}
// If we make it to here, assume anything is OK.
this.setGrade(100);
this.answer_was_just_entered = true;
this.user_answer_is_submittable = true;
return true;
}
},
set_evaluation_feedback: function (html) {
// var htmlLive = html;
// Set message below the textarea
html = '
' + html + '
';
$('#essay_question_evaluation_feedback_' + this.query_index).remove();
$('#query_answer_' + this.query_index).after(html);
// no need for #live-feedback for iOS and android
// if (!platform.android && !platform.firefox && !platform.iOS) {
// if ( platform.ie ) {
// Auxiliary.setFeedbackAndClearAttr('assertive', 5000, htmlLive);
// }
// else if ( platform.mac ) {
// $('#live-feedback').html(htmlLive + Auxiliary.emptySymbols());
// }
// else {
// $('#live-feedback').html(htmlLive);
// }
// }
}
});
module.exports = project_es;
/***/ }),
/***/ 140:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(47);
/***/ }),
/***/ 2:
/***/ (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
};
/***/ }),
/***/ 47:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__(1);
// Dialog
window.Standard_Dialog = __webpack_require__(7);
// Question
// Question = require('subtype/digfir/Question');
// MC
// MC_Query = require('subtype/digfir/MC_Query');
MC_Query = __webpack_require__(91);
// DD
// DD_Query = require('subtype/digfir/DD_Query');
// FB
// FB_Query = require('subtype/digfir/FB_Query');
// Essay
Essay_Query = __webpack_require__(101);
// Player
var ChangedPlayer = __webpack_require__(92);
window.player = new ChangedPlayer();
// Auxiliary
// Auxiliary = require('subtype/digfir/Auxiliary');
common.initForceNextSection();
/***/ }),
/***/ 5:
/***/ (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": "false"
};
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;
/***/ }),
/***/ 6:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__(1);
var dom = __webpack_require__(3);
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 2 );
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) {
// update the submit div for the question
this.update_question_action_div(i);
// Show appropriate feedback. If the question responses were submitted,
// the student must have finished the question, so we don't have to worry
// about hints.
this.show_question_feedback(question, all_answers_correct, false);
// 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;
/***/ }),
/***/ 7:
/***/ (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': !runOn.android ? '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;
/***/ }),
/***/ 90:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Created by Myagkova on 28.07.2017.
*/
var Standard_Dialog = __webpack_require__( 7 );
var AYS_Figures = __webpack_require__( 5 );
var Figures_writersref = AYS_Figures.extend({
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();
}
}
var alttext = $image.attr('alt');
var $caption = $parentDiv.find('[data-type=caption]').first().html();
if (!$caption) {
$caption = $parentDiv.siblings('[data-type=metadata]').first().children('[key=img_caption]').first().html();
}
var html = '';
Standard_Dialog.open(html, {
title: 'IMAGE'
});
}
});
module.exports = Figures_writersref;
/***/ }),
/***/ 91:
/***/ (function(module, exports, __webpack_require__) {
/**
* Created by Lupachev on 20.06.2017.
*/
var common = __webpack_require__( 1 );
var platform = __webpack_require__(0).run_on;
var dom = __webpack_require__( 3 );
var Query = __webpack_require__(95);
var Auxiliary = __webpack_require__( 2 );
var mc_query_writersref = Query.extend({
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, ' ' );
// text = '
' + text;
text = text.split('____')
.join(' blank ');
// 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;
},
correct_incorrect_feedback: function () {
// Try get individual feedback for option
var index = 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 = mc_query_writersref;
/***/ }),
/***/ 92:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Figures_writersref = __webpack_require__( 90 );
var ConcreteActivity = __webpack_require__( 100 );
var ConcretePlayer = __webpack_require__( 96 );
var platform = __webpack_require__(0).run_on;
// ChangedPlayer
var ChangedPlayer = ConcretePlayer.extend({
initialize: function () {
Player.prototype.initialize.call(this);
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 Figures_writersref();
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
document.title = this.activity_type + ' ' + this.activity_title.replace(/<(?:.|\n)*?>/gm, '');
$( '[data-type=question]' ).attr( 'role', 'document' );
// Return question titles for each section
/**
* 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.ios) {
this.initLiveFeedback();
// }
},
initLiveFeedback: function () {
var live = platform.ie ? 'assertive' : 'polite';
var role = platform.android ? '' : 'role="log"';
this.liveFeedback = $('');
$('#manuscript').prepend(this.liveFeedback);
},
initialize2: function () {
this._super();
$('a[target="_blank"]').each(function () {
var $this = $(this);
if ($this.attr('aria-label')) {
$this.attr('aria-label', $this.attr('aria-label') + ' opens in new tab.');
}
else {
$this.attr('aria-label', 'opens in new tab.');
}
});
$('[data-type="underline"]').each(function () {
var $this = $(this);
$(' blank ').insertBefore($this);
$this.replaceWith('');
});
$('[role="main"]').removeAttr('role');
$('#manuscript').attr('role', 'main');
var i = 0, j = 0, countQ;
$('[data-type=section]').each(function () {
i = 0;
countQ = $($('[data-type="section"]')[j++]).find('[data-type=question]');
$(countQ).each(function () {
$(this).prepend($('
' + (i++ + 1) + ' of ' + $(countQ).length + '
'));
});
});
// last paragraph about web links
$('[data-type="section"]').find('p:last-of-type').each(function() {
var $this = $(this);
$this.html("Note: Web links in this activity lead you to external sites. Some URLs change frequently and may appear as broken links. If you encounter a broken link, visit our Web Links page to see if a replacement link is provided or try searching for the article or organization in your Web browser. To report a broken link, contact technical support through the help option in LaunchPad.");
});
}
});
module.exports = ChangedPlayer;
/***/ }),
/***/ 94:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 2 );
var ES_Query = Essay_Query.extend({
/**
* Get correct HTML for query text and set id for following use
* @returns {string} Html for query text
*/
focus_user_input: function() {
var delay = ( platform.ie || platform.mac ) ? 2500 : 1200;
setTimeout('$("#query_answer_' + this.query_index + '").select();', delay);
},
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 = jQuery.trim(text).replace(/\n/g, ' ');
var id = 'query_text_' + this.query_index;
// Old comment in sciam project by someone:
// "I don't know why question for textarea was changed by _
// and actual question is placed before textarea just in
,
// but we don't need this label"
if (text !== '_') {
return '
' + text + '
';
} else {
return '';
}
}
},
/**
* Add aria-labelledby for textarea
* @param {string} mode
* @returns {string} Html for the question
*/
getHTML: function(mode) {
// Start with the query text, if there
var html = this.query_text_html();
var val = '';
var disabled = '';
if (this.userHasAnswered() && mode !== 'preview') {
// Make sure we convert double quotes to " for placement in 'value="xxx"' attributes
// Convert breaks to newlines
val = this.user_answer.replace(/ /g, '\n');
// Also disable the input if we're not in review_correct_incorrect mode
disabled = (mode !== 'review_correct_incorrect') ? 'disabled' : '';
}
var queryTextId = 'query_text_' + this.query_index;
// for Android and iOS we use advanced feedback
// feedbackId contains:
// essay_question_evaluation_feedback - id for div with text 'You must enter an answer'
// question_feedback - id for div with full feedback
var feedbackId = 'essay_question_evaluation_feedback_' + this.query_index + ' question_feedback_' + (this.query_index + 1);
var labelledBy = (platform.android || platform.ios) ? ' aria-labelledby="' + feedbackId + ' ' + queryTextId + '"' : ' aria-labelledby="' + queryTextId + '"';
html += '';
return html;
},
/**
* Fix typo evaluation
* @param {string} html
*/
set_evaluation_feedback: function(html) {
var htmlLive = html;
// Set message below the textarea
html = '
' + html + '
';
$('#essay_question_evaluation_feedback_' + this.query_index).remove();
$('#query_answer_' + this.query_index).after(html);
// no need for #live-feedback for iOS and android
if(!platform.android && !platform.ios) {
if ( platform.ie ) {
Auxiliary.setFeedbackAndClearAttr('assertive', 5000, htmlLive);
} else if ( platform.mac ) {
$('#live-feedback').html(htmlLive + Auxiliary.emptySymbols());
} else {
$('#live-feedback').html(htmlLive);
}
}
}
});
module.exports = ES_Query;
/***/ }),
/***/ 95:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__( 1 );
var dom = __webpack_require__( 3 );
var UtilsShuffle = __webpack_require__( 97 );
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 2 );
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;
/***/ }),
/***/ 96:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__( 1 );
var ConcreteActivity = __webpack_require__( 6 );
var ConcreteFigures = __webpack_require__( 5 );
var KEY_CODES = __webpack_require__( 1 ).KEYCODES;
var ShadowSpeech = __webpack_require__(98);
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 2 );
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 += '