webpackJsonp([0],{
/***/ 112:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 3 );
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;
/***/ }),
/***/ 113:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__( 1 );
var dom = __webpack_require__( 2 );
var UtilsShuffle = __webpack_require__( 117 );
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 3 );
var Query = MC_Query.extend( {
parseSource: function() {
this._super.apply( this, arguments );
if ( UtilsShuffle.currentQuestionIsRandomize() ) {
var shuffleArr = UtilsShuffle.shuffleArrays( this.choices, this.choices_fb, function( choices, choices_fb ) {
this.choices = choices;
this.choices_fb = choices_fb;
}.bind( this ) );
this.correct_answer_index = shuffleArr.indexOf( this.correct_answer_index );
}
},
/**
* Get correct HTML for query text and set id for following use
* @returns {string} Html for query text
*/
query_text_html: function() {
if ( this.query_text != '' && this.md._hide_query_text !== 'true' ) {
var text = jQuery.trim( this.query_text );
text = Auxiliary.underlinedText(text);
// Replace newlines with
text = text.replace( /\n/g, ' ' );
// Set id for use it to associate query text with input radios
if ( platform.ios ) {
// iOS doesn't see legend
return '
' + text + '
';
}
else {
return '';
}
}
else {
if ( this.query_text == '' ) {
return '';
}
else {
return '';
}
}
},
getHTML: function( mode ) {
// Initialize image map elements
if ( this.imagemap_initialized === false ) {
var question_jq = this.jq.parent();
this.im_init( question_jq );
this.imagemap_initialized = true;
}
// Wrap answers in radio group
var html = '";
html = dom.createHTML( html );
common.parseMathExpresions( html );
return html;
},
/**
* If we have individual feedback for each mc option
* @returns {string} Html for the feedback
*/
correct_incorrect_feedback: function() {
// Try get individual feedback for option
var index = this.choice_order[this.user_answer_index]; // Get correct index, if choices are scrambled
var html = this.choices_fb[index] || '';
// If we got any feedback, enclose it in a div
if (html) {
html = '
' + html + '
';
}
return html;
}
} );
module.exports = Query;
/***/ }),
/***/ 115:
/***/ (function(module, exports) {
/**
* Created by Lupachev on 06.06.2017.
*/
var Question = Class.extend({
extract_metadata: function() {
if (this.jq == null) {
return;
}
this.md.add_from_jq(this.jq.find("[data-type=metadata]"));
},
// return whether or not metadata with the given key is set
md_set: function(key) {
return (this.md[key] != null);
},
is_complete: function() {
for (var i = 0; i < this.queries.length; ++i) {
if (!this.queries[i].userHasAnswered()) {
return false;
}
}
return true;
},
is_correct: function() {
for (var i = 0; i < this.queries.length; ++i) {
if (!this.queries[i].isCorrect()) {
return false;
}
}
return true;
},
get_weight: function() {
return Math.round(this.points_possible / player.activity.total_points_possible * 100);
},
check_conditional: function(condition) {
return "";
// condition will be, e.g.:
// ({1}=9) No, that's the intercept.
// meaning that if the first query is equal to 9, condition is met
if (condition.search(/\((.*?)\)\s*(.*)/) > -1) {
var test = RegExp.$1;
var s = RegExp.$2;
// prepare for eval: first convert "=" to "==" (but allow == too)
test = test.replace(/=/g, "==");
test = test.replace(/====/g, "==");
// now convert {1} to this.queries[0].user_answer;
while (test.search(/\{(\d+)\}/) > -1) {
var i = RegExp.$1 * 1 - 1;
test = test.replace(/\{(\d+)\}/, "this.queries[" + i + "].user_answer");
}
// and test
} else {
safe_log("error with feedback_conditional: " + condition);
return "";
}
},
init: function(atts) {
for (var j in atts) {
this[j] = atts[j];
}
this.queries = new Array();
this.tries = 0;
this.gave_up = false;
// extract question metadata
this.md = new Metadata({lowercase_keys:true});
// define any md items that need to be arrays
this.md.feedback_conditional = [];
this.md.next_step_conditional = [];
this.md.model_update_conditional = [];
this.extract_metadata();
}
});
module.exports = Question;
/***/ }),
/***/ 116:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Created by Abdulnasyrova on 19.04.2017.
*/
var runOn = __webpack_require__(0).run_on;
var KEY_CODES = __webpack_require__(1).KEYCODES;
var Standard_Dialog = function() {
var $manuscript = $('#manuscript');
var $body = $('body');
var $dialog, $content;
var options = {};
return {
open: function(html, opt) {
// Extend default options
options = $.extend(true, (opt || {}), {
width: 450,
modal: true,
draggable: false,
resizable: false
});
// Set buttons
if (options.buttons === 'none') {
options.buttons = null;
}
else if (options.buttons === 'OK' || !options.buttons) {
options.buttons = [ { text: 'OK', click: Standard_Dialog.close } ];
}
// Remove previous dialog
$('#standard_dialog_div').dialog('close').remove();
if (options.modal) {
$body.css('overflow', 'hidden');
}
// Hide other content from reader for mobile devices
$manuscript.attr('aria-hidden', 'true');
$dialog = $('');
$content = $('
' + (html || '') + '
');
$dialog.append($content);
$dialog.dialog(options);
// If we open toc we use as description only instruction in the top of dialog and not links
var isMenu = $content.find('#toc_head').length;
var labelledBy = isMenu ? 'toc_head' : 'standard_dialog_div';
var $parentDialog = $dialog.parent().attr({
'tabindex': '0',
'role': 'dialog',
'aria-labelledby': 'ui-dialog-title-standard_dialog_div ' + labelledBy
});
$parentDialog.find('#ui-dialog-title-standard_dialog_div').attr({
'role': 'heading',
'aria-level': '1'
});
// Remove close btn
$('.ui-dialog-titlebar-close').remove();
var $lastBtn = $parentDialog.find('button').last();
var $firstBtn = $parentDialog.find('button').first();
// Attach events
$parentDialog.bind('keydown', function(e) {
var code = e.keyCode || e.which;
if (code === KEY_CODES.ESC) {
Standard_Dialog.close(true);
}
if (e.target === this && e.shiftKey && code === KEY_CODES.TAB) {
e.preventDefault();
$lastBtn.focus();
}
});
$lastBtn.bind('keydown', function(e) {
var code = e.keyCode || e.which;
if (!e.shiftKey && code === KEY_CODES.TAB) {
$parentDialog.focus();
e.preventDefault();
}
});
if (runOn.mobile) {
// For android we set focus on dialog in any cases
$parentDialog.focus();
}
else if (isMenu) {
// If it is menu put focus on first link
$parentDialog.find('a').first().focus();
}
else {
// For other platform we set focus on first button
$firstBtn.focus();
}
},
// for now alert is just like any other dialog; we could change that later.
wait: function(html, opt) {
options = opt || {};
options.buttons = 'none';
Standard_Dialog.open(html, options);
},
alert: function(html, opt) {
Standard_Dialog.open(html, opt);
},
close: function() {
// Show other content
$manuscript.removeAttr('aria-hidden');
if ($dialog) {
$dialog.dialog('close').remove();
}
else {
$("#standard_dialog_div").remove();
}
if (options.from) {
options.from.focus();
}
if (options.modal) {
$body.css('overflow', 'auto');
}
}
};
}();
module.exports = Standard_Dialog;
/***/ }),
/***/ 117:
/***/ (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;
/***/ }),
/***/ 121:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Essay_Query = __webpack_require__(112);
var Auxiliary = __webpack_require__( 3 );
var platform = __webpack_require__(0).run_on;
var isMobile = platform.ios || platform.android;
var Local_es = Essay_Query.extend({
query_text_html: function () {
if (this.query_text !== '' && this.md._hide_query_text !== 'true') {
var text = jQuery.trim( this.query_text ),
initText = text,
isIE = platform.ie;
text = Auxiliary.underlinedText(text);
// Replace newlines with
text = jQuery.trim(text).replace(/\n/g, ' ');
text = text.replace(/__+_?/ig, function (replacedString, initString) {
if (platform.firefox) {
return ''
+ replacedString + '';
}
return 'blank'
+ replacedString + '';
});
if (isIE) {
initText = initText.replace(/__+_?/ig, 'blank');
}
// add hidden list item number in query text
var $question = this.jq.closest('[data-type="question"]');
if ($question.parent().is('li')) {
var isAriaHidden = platform.ie || platform.ios ? '' : 'aria-hidden="true"';
text = '' + $question.attr('data-question_index')
+ '. ' + text;
}
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 !== '_') {
var ariaHidden = isMobile ? ' aria-hidden="true"' : '';
if (isIE) {
return '
' + text + '' + initText + '
';
}
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 = '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;
}
});
module.exports = Local_es;
/***/ }),
/***/ 122:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__( 1 );
var platform = __webpack_require__(0).run_on;
var dom = __webpack_require__( 2 );
var MC_Query = __webpack_require__(113);
var Local_mc = MC_Query.extend({
user_has_answered: function () {
if (typeof $('input:radio[name=query_answer_' + this.query_index + ']:checked').val() != 'undefined') {
return true;
}
else {
return false;
}
},
query_text_html: function () {
if (this.jq.find('.query_text').length) {
var elemName = platform.mac ? 'span' : 'legend';
return '<' + elemName +' class="query_text">' + this.jq.find('.query_text').html() + '' + elemName + '>';
}
if ( this.query_text != '' && this.md._hide_query_text !== 'true' ) {
var text = jQuery.trim( this.query_text );
text = text.replace(/__+_?/ig, function (replacedString) {
if (platform.firefox) {
return ''
+ replacedString + '';
}
return 'blank'
+ replacedString + '';
});
// Set id for use it to associate query text with input radios
return this.getDeviceQueryText(text);
}
else {
if ( this.query_text == '' ) {
return this.getDeviceQueryText('');
}
else {
return '';
}
}
},
getDeviceQueryText: function (text) {
if ( platform.ios || platform.mac) {
// iOS doesn't see legend
return '' + text + '';
}
else {
return '';
}
},
getHTML: function ( mode ) {
// Initialize image map elements
if ( this.imagemap_initialized === false ) {
var question_jq = this.jq.parent();
this.im_init( question_jq );
this.imagemap_initialized = true;
}
var alphabet = ['A.', 'B.', 'C.', 'D.', 'E.'];
// Wrap answers in radio group
var html = '';
html = dom.createHTML( html );
common.parseMathExpresions( html );
return html;
},
correct_incorrect_feedback: function (mode, is_correct) {
var html = '';
// get correct answer as presented to user
for (var i = 0; i < this.choices.length; ++i) {
if (this.choice_order[i] == this.correct_answer_index) {
break;
}
}
// if the question explicitly defines feedback for the user's answer, use it as the feedback
if (this.user_answer_index != null && this.choices_fb[this.user_answer_index] != null) {
html += this.choices_fb[this.user_answer_index];
}
// the correct answer will be highlighted in green, so there's no reason to say anything more.
// now, if we got any feedback, enclose it in a div
if (html != '') {
html = '