webpackJsonp([0],[
/* 0 */,
/* 1 */,
/* 2 */,
/* 3 */,
/* 4 */
/***/ (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;
/***/ }),
/* 5 */,
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Created by Abdulnasyrova on 19.04.2017.
*/
var runOn = __webpack_require__(1).run_on;
var KEY_CODES = __webpack_require__(0).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;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var AYS_Figures = Figures.extend({
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;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__(0);
var dom = __webpack_require__(2);
var jq_utils = __webpack_require__(3);
var Activity_work_it_out = Activity.extend({
submit_question: function(question_index) {
this._super(question_index);
player.initImageDescriptions();
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);
// 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();
// Add space after period
var feedbackText = $questionAction.text().replace(/\./g, '. ');
// FF + NVDA doesn't read text in focused div automatically
player.shadow_speech.talk('');
player.shadow_speech.talk(feedbackText.replace('Feedback', 'Feedback. '));
},
show_question_feedback: function(question, is_correct, try_again) {
// Remove previous feedback if there
$('#question_feedback_' + question.index).remove();
// Get individual feedback for each choice, and add it after general feedback
var feedback_correct_incorrect = question.jq.find('.query_mc_feedback_correct_incorrect').text();
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 += '
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();
// Add space after period
var feedbackText = $questionAction.text().replace(/\./g, '. ');
// FF + NVDA doesn't read text in focused div automatically
player.shadow_speech.talk('');
player.shadow_speech.talk(feedbackText.replace('Feedback', 'Feedback. '));
}
});
module.exports = ChangedActivity;
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Created by Zorin on 31.05.2017.
*/
var platform = __webpack_require__(5);
var ConcretePlayer = __webpack_require__(29);
var ConcreteFigures = __webpack_require__(7);
var ChangedActivity = __webpack_require__(20);
var common = __webpack_require__(0);
var Standard_Dialog = __webpack_require__(6);
var ChangedPlayer = ConcretePlayer.extend( {
deleteHiddenHeaders: function () {
var headers = $('h1.section-title')
for (var i = 0; i < headers.length; i++){
headers.eq(i).detach();
}
},
initialize: function() {
//call method of ConcretePlayer's parent
Player.prototype.initialize.call(this);
this.deleteHiddenHeaders();
var fontHTML = '';
$( "body" ).append( fontHTML );
this.activity_type = $( "[key=activity_type]" ).html();
this.activity_title = $( "[key=activity_title]" ).html();
this.activity = new ChangedActivity();
this.figures = new ConcreteFigures();
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_title;
$( '[data-type=question]' ).attr( 'role', 'document' );
/**
* 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' );
} );
},
initialize_sections: function() {
'use strict';
//call method of ConcretePlayer's parent
Player.prototype.initialize_sections.call(this);
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;
var $sectionTitleNode = section.jq.find( 'h2.section-title' );
//section.title = "Question " + (j + 1) + " of " + this.sections.length;
$sectionTitleNode.replaceWith( "
" + section.title + "
" );
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();
},
show_navigation: function() {
var toc_icon = "";
var $manuscriptNode = $( '#manuscript' );
html = "";
$manuscriptNode.prepend( html );
html = "
" +
"" +
"
";
$manuscriptNode.prepend( html );
// Header
var html = "" +
"
" +
"
" + this.activity_title + "
" +
"
" +
"" +
"";
$manuscriptNode.prepend( html );
},
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 );
// update slide_number and title
$("#slide_number").html("Slide " + (section_to_show+1) + " of " + this.sections.length + " ");
player.shadow_speech.talk('');
player.shadow_speech.talk("Slide " + (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_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();
}
} );
}
} );
},
show_incompleteness_dialog: function() {
var html = "You must complete every question on the slide to move on to the next slide.";
if (platform.os.family == 'Android'){
$('.ada-shadow-speech').html(html);
}
Standard_Dialog.alert( html, { title: "Message", width: 400 } );
}
});
module.exports = ChangedPlayer;
/***/ }),
/* 22 */,
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var UtilsShuffle = __webpack_require__(4);
var CB_Shuffle = {};
CB_Shuffle._getCBContainer = function(jq) {
var cbContainer = jq.find('[data-block_type="cb-question"]');
if (cbContainer.length > 0) {
return cbContainer;
}
return null;
};
CB_Shuffle._shuffleChoices = function($container) {
var labels = $container.find('label').remove();
UtilsShuffle.shuffleArrays(labels, function(shuffArr) {
labels = shuffArr;
});
$container.find('fieldset').append(labels);
};
CB_Shuffle.shuffle = function(jq) {
if (!jq) {
return false;
}
var containerCB = this._getCBContainer(jq);
if (containerCB) {
this._shuffleChoices(containerCB);
}
};
module.exports = CB_Shuffle;
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function QueryMixin() {}
QueryMixin.prototype.finish_inline_query = function(correct_answer, mode) {
// if mode is "delivery" (default) or this.md.no_correct_answer is true,
// don't show this at all
if (mode == 'delivery' || mode == '' || mode == null || this.md.no_correct_answer == "true") {
return "";
}
var s = "";
// image that indicates if the query is correct or incorrect
if (mode == 'review' || mode == 'review_correct_incorrect') {
var fbclass, alt;
if (this.isCorrect()) {
fbclass = 'query_correct_feedback_span';
alt = 'Correct';
}
else {
fbclass = 'query_incorrect_feedback_span';
alt = 'Incorrect';
}
s += "" + alt + " ";
//s += "";
}
// correct answer -- we show this in both review and preview mode,
// but not in review_correct_incorrect mode
// also don't show it if there *is* no correct answer
if (mode != 'review_correct_incorrect' && this.md.no_correct_answer != "true") {
s += '' + correct_answer + '';
}
s += "";
return s;
};
module.exports = QueryMixin;
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__(0);
var dom = __webpack_require__(2);
var UtilsShuffle = __webpack_require__( 4 );
var aria = __webpack_require__(17);
var QueryMixin = __webpack_require__(24),
Query;
// NOTE: Replace methods of parent Query object
DD_Query.mixin([ QueryMixin ]);
Query = DD_Query.extend({
parseSource: function() {
this._super.apply(this, arguments);
if (UtilsShuffle.currentQuestionIsRandomize()) {
var shuffleArr = UtilsShuffle.shuffleArrays(this.choices, function(choices) {
this.choices = choices;
}.bind(this));
this.correct_answer_index = shuffleArr.indexOf(this.correct_answer_index);
}
},
getHTML: function(mode) {
var html = "", attrs;
// DD's never have query text
// Start a nobr tag for the item
// html = '';
// if we're in preview mode or
// (a student answer has been given and we're not in review_correct_incorrect mode),
// or the student got it correct
// disable the select
var disabled = "";
if (mode == 'preview' || (mode != 'review_correct_incorrect' && this.user_answer_index != null) || this.isCorrect()) {
disabled = "disabled";
}
// If we are in the table make different label
var $parent = this.jq.parent();
var labelledBy = '';
if ( $parent.get( 0 ).nodeName.toLowerCase() === 'td' ) {
var question_index = this.parent_question.index;
labelledBy = ' aria-labelledby="fb_' + question_index + '_header_label_' + $parent.index() +
' fb_' + question_index + '_label_' + this.jq.parents( 'tr' ).index() + '"';
}
else {
if (this.query_text.length == 0) {
html += '';
}
else {
html += ' ';
}
}
html += '';
html += this.finish_inline_query(this.choices[this.correct_answer_index], mode);
// Close off the nobr tag for the item
// html += '';
attrs = common.extractMetadataAttrs(this.md);
html = dom.createHTML(html);
common.setAdditionalAttrs(attrs, 'select', html);
return html;
},
/**
* It is used only if we are in the table, rare case
*/
postInit: function() {
// If we are in the table make correct structure
var $parent = this.jq.parent();
var question_index = this.parent_question.index;
if ( $parent.get( 0 ).nodeName.toLowerCase() === 'td' ) {
var tr = $parent.parent();
var firstChild = tr.children().eq(0);
if ( firstChild[ 0 ] !== $parent[ 0 ] ) {
firstChild.attr( {
id: 'fb_' + question_index + '_label_' + this.jq.parents( 'tr' ).index()
} );
}
var th = this.jq.parents( 'table' ).find( 'tr' ).eq( 0 ).find( 'th' );
th.each( function( i ) {
$( this ).attr( {
id: 'fb_' + question_index + '_header_label_' + i,
scope: 'col'
} );
} );
}
}
});
module.exports = Query;
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Created by Abdulnasyrova on 20.04.2017.
*/
var platform = __webpack_require__(1).run_on;
var Query = Essay_Query.extend({
/**
* 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') {
// Replace newlines with
var text = jQuery.trim(this.query_text).replace(/\n/g, ' ');
var id = 'query_text_' + this.query_index;
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;
var feedbackId = 'essay_question_evaluation_feedback_' + this.query_index;
// Add short label for mobile devices
var labelledBy = platform.mobile ? ' aria-label="Enter your answer for the question" aria-labelledby="' + feedbackId + '"' :
' aria-labelledby="' + feedbackId + ' ' + queryTextId + '"';
html += '';
return html;
},
/**
* Fix typo evaluation
* @param {string} html
*/
set_evaluation_feedback: function(html) {
// Set message below the textarea
html = '
' + html + '
';
$('#essay_question_evaluation_feedback_' + this.query_index).remove();
$('#query_answer_' + this.query_index).after(html);
if (platform.ios) {
player.shadow_speech.talk('');
player.shadow_speech.talk($(html).text());
}
}
});
module.exports = Query;
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var platform = __webpack_require__( 1 ).run_on;
var dom = __webpack_require__(2);
var common = __webpack_require__(0);
/**
* Created by Abdulnasyrova on 21.04.2017.
*/
var Query = FB_Query.extend( {
/**
* 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' ) {
// Replace newlines with
var text = jQuery.trim( this.query_text ).replace( /\n/g, ' ' );
var id = 'query_text_' + this.query_index;
// Set id for use it to associate query text with input radios
return '
' + text + '
';
}
else {
return '';
}
},
getHTML: function( mode ) {
// Add the query text, if there is any
var html = this.query_text_html(),
attrs;
// Determine how big the response blank should be, unless one was specified
var blank_size = this.md.blank_size;
if ( !blank_size || isNaN( blank_size * 1 ) ) {
blank_size = (('' + this.correct_answer).length + 2);
}
// If student hasn't answered or we're in preview mode, use an empty string for the input value
var val, disabled;
if ( !this.userHasAnswered() || mode == 'preview' ) {
val = '';
disabled = '';
}
else {
// Convert double quotes to "
val = this.user_answer.replace( /\"/g, '"' );
// Disable the input in this case, if we're not in review_correct_incorrect mode or if the user got it right
if ( mode !== 'review_correct_incorrect' || this.isCorrect() ) {
disabled = 'disabled';
}
}
var textId = 'query_text_' + this.query_index;
var labelledBy = '';
// If we are in the table make different label
var $parent = this.jq.parent();
if ( $parent.get( 0 ).nodeName.toLowerCase() === 'td' ) {
var question_index = this.parent_question.index;
labelledBy = ' aria-labelledby="fb_' + question_index + '_header_label_' + $parent.index() +
' fb_' + question_index + '_label_' + this.jq.parents( 'tr' ).index() + '"';
}
else {
// Add short label for mobile devices
labelledBy = platform.mobile ? ' aria-label="Enter your answer for the question"' : ' aria-labelledby="' + textId + '"';
}
html += '' +
'';
html += this.finish_inline_query( this.correct_answer, mode );
html += '';
attrs = common.extractMetadataAttrs(this.md);
html = dom.createHTML(html);
common.setAdditionalAttrs(attrs, 'input', html);
return html;
},
/**
* It is used only if we are in the table, rare case
*/
postInit: function() {
// If we are in the table make correct structure
var $parent = this.jq.parent();
var question_index = this.parent_question.index;
if ( $parent.get( 0 ).nodeName.toLowerCase() === 'td' ) {
var tr = $parent.parent();
var firstChild = tr.children().eq(0);
if ( firstChild[ 0 ] !== $parent[ 0 ] ) {
firstChild.attr( {
id: 'fb_' + question_index + '_label_' + this.jq.parents( 'tr' ).index()
} );
}
var th = this.jq.parents( 'table' ).find( 'tr' ).eq( 0 ).find( 'th' );
th.each( function( i ) {
$( this ).attr( {
id: 'fb_' + question_index + '_header_label_' + i,
scope: 'col'
} );
} );
}
}
} );
module.exports = Query;
/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__( 0 );
var dom = __webpack_require__( 2 );
var UtilsShuffle = __webpack_require__( 4 );
var platform = __webpack_require__(1).run_on;
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' ) {
// Replace newlines with
var text = jQuery.trim( this.query_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 {
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;
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__( 0 );
var ConcreteActivity = __webpack_require__( 8 );
var ConcreteFigures = __webpack_require__( 7 );
var KEY_CODES = __webpack_require__( 0 ).KEYCODES;
var ShadowSpeech = __webpack_require__(31);
var Player_work_it_out = Player.extend( {
activity_title: null,
activity_type: 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 question 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 );
player.shadow_speech.talk('');
player.shadow_speech.talk("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' );
// Header
var html = "" +
"
" +
"
" + this.activity_type + "
" +
"
" + this.activity_title + "
" +
"
" +
"" +
"";
$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 += '