webpackJsonp([0],{
/***/ 13:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Standard_Dialog = __webpack_require__(40);
var project_player = __webpack_require__(1);
window.player = new project_player();
Question = __webpack_require__(38);
CB_Query = __webpack_require__(32);
DD_Query = __webpack_require__(33);
Essay_Query = __webpack_require__(34);
FB_Query = __webpack_require__(35);
MC_Query = __webpack_require__(37);
/***/ }),
/***/ 32:
/***/ (function(module, exports) {
var project_cb = CB_Query.extend({
user_has_answered: function () {
return (jQuery.trim($('#query_answer_' + this.query_index).val()) != '');
},
getHTML: function (mode) {
var html = '';
// CB's never have query text
// 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 checkbox
var disabled = '';
if (mode == 'preview' || (mode != 'review_correct_incorrect'
&& this.user_answer_index != null) || this.isCorrect()) {
disabled = 'disabled';
}
// if user has answered with choice 0, it should be checked, unless we're in preview mode
var checked = '';
if (this.user_answer_index === 0 && mode != 'preview') {
checked = 'checked';
}
html += '';
html += this.finish_inline_query(this.choices[this.correct_answer_index], mode);
$('.query_cb').each(function () {
var label = $(this).parent().parent().next('td');
$(this).attr('aria-label', label.text());
});
return html;
}
});
module.exports = project_cb;
/***/ }),
/***/ 33:
/***/ (function(module, exports) {
var project_dd = DD_Query.extend({
user_has_answered: function () {
var x = $('#query_answer_' + this.query_index).val();
return x != -1;
},
getHTML: function (mode) {
var html = this.query_text_html();
var ariaLabel = $(html).text();
if (this.userHasAnswered() || mode == 'review' || mode == 'review_correct_incorrect' || mode == 'preview') {
ariaLabel += ' You already answered this question.';
}
else {
ariaLabel += ' Answer the question and click Submit button.';
}
ariaLabel = ariaLabel.replace(/\"/g, '');
html = html.replace('>', 'aria-label="' + ariaLabel + '" tabindex="0"> ');
// 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';
}
html = this.query_text_html();
ariaLabel = $(html).text();
if (this.userHasAnswered() || mode == 'review' || mode == 'review_correct_incorrect' || mode == 'preview') {
ariaLabel += ' You already answered this question.';
}
else {
ariaLabel += ' Answer the question and click Submit button.';
}
ariaLabel = ariaLabel.replace(/\"/g, '');
html = html.replace('>', 'aria-label="' + ariaLabel + '" tabindex="0"> ');
html += '';
html += this.finish_inline_query(this.choices[this.correct_answer_index], mode);
// Close off the nobr tag for the item
html += '';
return html;
}
});
module.exports = project_dd;
/***/ }),
/***/ 34:
/***/ (function(module, exports) {
var project_es = Essay_Query.extend({
user_has_answered: function () {
if ($.trim($('#query_answer_' + this.query_index).val() != '')) {
return true;
}
else {
return false;
}
}
});
module.exports = project_es;
/***/ }),
/***/ 35:
/***/ (function(module, exports) {
var project_fb = FB_Query.extend({
user_has_answered: function () {
if (jQuery.trim($('#query_answer_' + this.query_index).val()) != '') {
return true;
}
else {
return false;
}
},
getHTML: function (mode) {
var html = '';
// start with the query text, if there is any
html += this.query_text_html();
// determine how big the response blank should be, unless one was specified
var blank_size = this.md.blank_size;
if (blank_size == '' || blank_size == null || isNaN(blank_size * 1)) {
var s = '' + this.correct_answer;
blank_size = (s.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 = '';
// otherwise we have an answer, so fill it in
}
else {
// make sure we convert double quotes to " for placement in 'value="xxx"' attributes
val = this.user_answer.replace(/\"/g, '"');
// also 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';
}
}
html += '' +
'';
html += this.finish_inline_query(this.correct_answer, mode);
html += '';
$('.query_fb_input').keypress(function (e) {
if (!(e.charCode >= 65 && e.charCode <= 90 || e.charCode >= 97 && e.charCode <= 122) &&
e.charCode) {
return false;
}
});
return html;
}
});
module.exports = project_fb;
/***/ }),
/***/ 37:
/***/ (function(module, exports, __webpack_require__) {
var platform = __webpack_require__(0).run_on;
var project_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;
}
},
getHTML: function (mode) {
// initialize imagemap elements
if (this.imagemap_initialized === false) {
var question_jq = this.jq.parent();
this.im_init(question_jq);
this.imagemap_initialized = true;
}
// start with the query text, if there
var html = this.query_text_html();
var oldAriaString = html.match(/_{2,20}/g);
if ( oldAriaString ) {
$(oldAriaString).each( function (i, value) {
var newAriaString = '' + value + 'blank';
html = html.replace(value, newAriaString);
} );
}
var ariaLabel = $(html).text();
ariaLabel = ariaLabel.replace(/_{2,20}/g, '');
if (this.userHasAnswered() || mode == 'review' || mode == 'review_correct_incorrect' || mode == 'preview') {
ariaLabel += ' You already answered this question.';
}
else {
ariaLabel += ' Answer the question and click Submit button.';
}
ariaLabel = ariaLabel.replace(/\"/g, '');
html = html.replace('>', 'aria-label="' + ariaLabel + '" tabindex="0"> ');
var legendText = this.jq.closest('td').prev('td').text();
// wrap answers in a p tag
html += '
';
return html;
},
correct_incorrect_feedback: function (mode, is_correct) {
var html = '';
// get correct answer as presented to user
for (var i = 0; i < this.choices.length; ++i) {
if (this.choice_order[i] == this.correct_answer_index) {
break;
}
}
// if the question explicitly defines feedback for the user's answer, use it as the feedback
if (this.user_answer_index != null && this.choices_fb[this.user_answer_index] != null) {
html += this.choices_fb[this.user_answer_index];
}
// the correct answer will be highlighted in green, so there's no reason to say anything more.
// now, if we got any feedback, enclose it in a div
if (html != '') {
html = '
' + html + '
';
}
return html;
}
});
module.exports = project_mc;
/***/ }),
/***/ 38:
/***/ (function(module, exports) {
var project_question = Question.extend({
extract_metadata: function () {
if (this.jq == null) {
return;
}
this.md.add_from_jq(this.jq.children('[data-type=metadata]'));
player.processNextStepConditionals(this);
player.processModelUpdateConditionals(this);
},
checkModelUpdateConditionals: function (question_index) {
var q_string = 'player.activity.questions[' + question_index + ']';
for (var i = 0; i < player.activity.questions[question_index].md.model_update_conditional.length; ++i) {
var c = player.activity.questions[question_index].md.model_update_conditional[i];
var condition = c.condition.replace(/qq/g, q_string);
condition = condition.replace(/model/g, 'player.model');
var updateStatement = c.updateStatement.replace(/setModel/g, 'player.setModel');
updateStatement = updateStatement.replace(/model/g, 'player.model');
updateStatement = updateStatement.replace(/qq/g, q_string);
updateStatement = unescape(updateStatement);
condition = unescape(condition);
condition = condition.replace(/&/g, '&');
if (condition == 'else' || eval(condition) == true) {
// if section_to_show is "done", we're done!
eval(updateStatement);
}
}
return null;
}
});
module.exports = project_question;
/***/ }),
/***/ 40:
/***/ (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__(3).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, {
width: 450,
modal: true,
draggable: false,
resizable: false,
ariaLabelledby: null,
ariaDescribedby: ''
}, (opt || {}));
// 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 labelledByPart = isMenu ? 'toc_head' : 'standard_dialog_div';
var labelledBy = options.ariaLabelledby === null ? 'ui-dialog-title-standard_dialog_div ' + labelledByPart : options.ariaLabelledby;
// set so ugly, that don't break current functionality with aria-labelledby
var $parentDialog = $dialog.parent().attr({
'tabindex': '0',
'role': 'dialog'
});
var _labeledBy = !runOn.android ? labelledBy : null;
var _descrBy = options.ariaDescribedby;
_labeledBy && $parentDialog.attr('aria-labelledby', _labeledBy);
_descrBy && $parentDialog.attr('aria-describedby', _descrBy);
$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.android) {
// 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();
}
$(document.head).parent().css('overflow', 'hidden');
},
// 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');
}
$(document.head).parent().css('overflow', 'auto');
}
};
}();
module.exports = Standard_Dialog;
/***/ }),
/***/ 50:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(13);
/***/ })
},[50]);
//# sourceMappingURL=cyha_mods_new.js.map