// Detect platform with https://github.com/bestiejs/platform.js
var iOS = platform.os.family === 'iOS'; //detect iOS (VoiceOver)
var isMac = platform.os.family === 'OS X'; //detect MacOS (VoiceOver)
var isAndroid = platform.os.family === 'Android'; //detect Android (TalkBack)
var isFirefox = platform.name === 'Firefox'; //detect Firefox (NVDA)
var isIE = platform.name === 'IE'; //detect IE (Jaws)
webpackJsonp([0],{
/***/ 25:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(3);
MC_Query = __webpack_require__(52);
Essay_Query = __webpack_require__(51);
var ConcretePlayer = __webpack_require__(53);
window.player = new ConcretePlayer();
/***/ }),
/***/ 50:
/***/ (function(module, exports) {
var project_activity = Activity_manuscript.extend( {
// brb: Override this method so it doesn't show the dialog completion
// pop-up
show_grade_saved_message: function() {
// if the user has answered all queries AND the user hasn't been told this already,
// tell them now
if (player.activity.answered_all_queries && !player.user_has_received_completion_alert) {
//setTimeout('Standard_Dialog.alert("You have completed the activity, and your grade has been submitted.");', 20);
player.user_has_received_completion_alert = true;
}
},
// brb: Override this method to remove grade percentage from pop-up
// and to use Standard_Dialog correctly
ARGA_initialization_alert: function() {
// This overrides the standard ARGA initialization message, which doesn't
// tell the user he/she can resubmit (or tell him his grade)
var grade = Get_ARGA_Grade();
var due_date_passed = (Get_ARGA_Data("due_date_has_passed") == "1");
var msg = "";
var buttons;
due_date_passed = false;
if (grade != "" && grade != null && grade >= 0) {
// if resubmissions are allowed...
if (player.md.allow_resubmission == "true") {
// if due date has not passed, give the student the option of resubmitting or reviewing
if (!due_date_passed) {
msg = "
You have completed this activity, and your grade (" + grade + "%) has been submitted. Would you like to:
"
+ "
Keep your current grade and review your previous answers
"
+ "
Or reset your submission and try the activity again?
You have completed this activity, and your grade (" + grade + "%) has been submitted. Since the due date for the activity has now passed, you cannot re-submit answers to the activity questions.
You have completed this activity, and your grade has been submitted.
";
buttons = [ {text:"OK", click: player.activity.ARGA_initialization_final} ];
}
// grade has not been submitted
} else {
// if due date has passed, tell the user "tough luck". Otherwise show nothing.
if (due_date_passed) {
msg = "
The due date for this activity has passed. You can still review the activity, but no answers will be submitted and no grade will be recorded.
"
;
buttons = [ {text:"OK", click: player.activity.ARGA_initialization_final} ];
}
}
// if we need a message, show it in a jquery UI dialog
if (msg != "") {
msg = "
" + msg + "
";
//$("body").append(msg);
//$("#arga_init_dialog").dialog({title:"Please Note", width:450, modal:true, buttons: buttons});
Standard_Dialog.open(msg, {title: 'Please note', buttons: buttons});
} else {
player.activity.ARGA_initialization_final();
}
},
// brb: Overriding this method to make sure we close the dialog
ARGA_initialization_final: function(decision) {
// close dialog if open
//$("#arga_init_dialog").dialog('close');
Standard_Dialog.close();
// if user chose to reset the activity, reset all submitted answers and grade
if (decision == "reset") {
// PW: ARGA should really provide a function for resetting all data; for now I'll hack it
ARGA_API.data = new Array();
Set_ARGA_Grade(-1);
player.user_has_received_completion_alert = false;
Save_ARGA_Data({"show_progress":false});
// start on section 0
player.show_section(0);
// else if user is here for the first time...
} else if (player.ARGA_submission_initialized == false) {
// initialize the questions
player.activity.ARGA_Initialize_Questions();
// and show the first questions
player.show_section(0);
// otherwise normal re-initialization
} else {
// if md.restore_previous_submissions is "true" (this is the default value),
// restore all saved answers
if (player.md.restore_previous_submissions == "true") {
player.activity.restore_saved_answers();
}
// grade the activity
player.activity.grade_activity();
// set user_has_received_completion_alert to true
// if the user has already completed the activity
if (Get_ARGA_Data("complete") == "yes") {
player.user_has_received_completion_alert = true;
}
// restore to previously-viewed section if appropriate
if (player.md.restore_last_viewed_section == "true") {
player.restore_section();
// otherwise show section 0
} else {
player.show_section(0);
}
}
},
update_question_action_div: function (question_index) {
var question = this.questions[question_index];
// hide submit button
var jq = $('#question_action_div_' + question.index);
// brb: also remove click handler
jq.find('.question_submit_button').attr({'aria-disabled': 'true'}).addClass('disabled').unbind();
setTimeout(function () {
var feedbackText = jq.find('.question_feedback').text().replace(/\./g, '. ').replace('Feedback', '');
if (player.showing_last_section() && player.activity.answered_all_queries) {
feedbackText += $('[data-block_type="activity_report"]').text();
}
if ($('[data-question_index=' + question_index + ']').hasClass('submitted')) {
player.shadow_speech.talk('');
player.shadow_speech.talk(feedbackText);
}
}, 0);
},
submit_question: function (question_index) {
var qIndex = question_index.data.question_index;
var question = player.activity.questions[qIndex];
$('[data-question_index=' + qIndex + ']').addClass('submitted');
// Remove submission error feedback
$('[data-question_index=' + qIndex + '] .eval_fb').remove();
this._super(question_index);
if (question.tries === 0) {
return;
}
if (player.showing_last_section() && player.activity.answered_all_queries) {
var instructionText = ( player.activity.grade_percent === 100
? '' : ' Go through the quiz to find out the correct answers.');
$('[data-block_type="activity_report"]')
.append($('' + instructionText + ''));
}
},
question_submit_button: function (q) {
// define question_submit_button_label as a variable so it can be overridden
var button_html = '';
return button_html;
},
show_question_feedback: function (question, is_correct, try_again) {
// remove prior feedback if there
$('#question_feedback_' + question.index).remove();
// if we don't have any feedback at all, return
if (question.md.feedback == null && question.md.feedback_correct == null
&& question.md.feedback_incorrect == null && question.md.feedback_hint == null) {
return;
}
var html = '
'
+ '
' + this.feedbackTitle + '
';
// include general feedback if there
if (question.md.feedback != null) {
html += '
ANSWER: ' + question.md.feedback + '
';
}
// include correct feedback if there and the answer is correct
if (is_correct && question.md.feedback_correct != null) {
html += '
ANSWER: ' + question.md.feedback_correct + '
';
}
// include 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) {
if (question.md.feedback_conditional.hasOwnProperty(i)) {
var fbc = question.check_conditional(question.md.feedback_conditional[i]);
if (fbc != '') {
html += '
ANSWER: ' + fbc + '
';
found_feedback_string = true;
break;
}
}
}
}
// if we didn't find a feedback string to use above, check for feedback_hint
if (!found_feedback_string && question.md.feedback_hint != null) {
html += '
ANSWER: ' + question.md.feedback_hint + '
';
found_feedback_string = true;
}
}
// if we didn't find a feedback string to use above, check for feedback_incorrect
if (!found_feedback_string && question.md.feedback_incorrect != null) {
html += '
ANSWER: ' + question.md.feedback_incorrect + '
';
}
}
// close question_feedback div
html += '
';
// append the div, then fade it in
$('#question_action_div_' + question.index).prepend(html);
$('#question_feedback_' + question.index).fadeIn('fast', function () {
// What I'd like to do here is check to make sure the feedback is all showing on the screen,
// and scroll if necessary so that the feedback is all visible. But just doing "scrollTo"
// isn't working properly in all situations.
// $(window).scrollTo($(this), 0);
});
}
});
module.exports = project_activity;
/***/ }),
/***/ 51:
/***/ (function(module, exports, __webpack_require__) {
var platform = __webpack_require__(0).run_on;
var SubtypeEssayQuery = __webpack_require__(56);
project_essay = SubtypeEssayQuery.extend({
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, ' ');
// hide query_text, which would be hidden
var queryHiddenTextRegExp = new RegExp('(.*?)<\/span>');
text = text.replace(queryHiddenTextRegExp, function (replacedString, queryText) {
queryText = queryText || '';
var isAriaHidden = platform.mac ? '' : 'aria-hidden="true"';
return '' + queryText + '';
});
text = '' + this.parent_question.index + ' ' + text;
var id = 'query_text_' + this.query_index;
// add aria-hidden = true and role = presentation for disabling tablet's screenreaders focus
var ariaDisabled = platform.ios || platform.android ? 'aria-hidden="true" role="presentation"' : '';
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;
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="' + queryTextId + '"';
html += '';
return html;
},
set_evaluation_feedback: function (html) {
var feedbackID = 'essay_question_evaluation_feedback_' + this.query_index;
// Set message below the textarea
html = '
' + html + '
';
$('#' + feedbackID).remove();
var $currentTextArea = $('#query_answer_' + this.query_index);
$('#question_action_div_' + (this.query_index + 1)).after(html);
var labelledbyAttrValue = $currentTextArea.attr('aria-labelledby');
if (labelledbyAttrValue.search(feedbackID) === -1) {
$currentTextArea.attr('aria-labelledby', feedbackID + ' ' + labelledbyAttrValue);
}
},
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') {
this.set_evaluation_feedback('Submission error. '
+ 'You must answer the question before submitting. Please try again.');
this.focus_user_input();
// return false, to say that we can't yet evaluate the answer.
return false;
// else check with MAVE if specified
}
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...
}
// 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;
}
});
module.exports = project_essay;
/***/ }),
/***/ 52:
/***/ (function(module, exports, __webpack_require__) {
var SubtypeMCQuery = __webpack_require__(57);
var platform = __webpack_require__(0).run_on;
var common = __webpack_require__(2);
var dom = __webpack_require__( 1 );
project_mc = SubtypeMCQuery.extend({
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 queryHiddenTextRegExp = new RegExp('(.*?)<\/span>');
text = text.replace(queryHiddenTextRegExp, function (replacedString, queryText) {
queryText = queryText || '';
return '' + queryText + '';
});
text = '' + this.parent_question.index + ' ' + text;
// 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 '';
}
},
getQueryTextForARGA: function () {
//var question_text = '';
var cleaned_text;
if (this.query_text_for_ARGA != null && this.query_text_for_ARGA != '') {
// return this.query_text_for_ARGA;
cleaned_text = player.clean_query_text(this.query_text_for_ARGA);
return cleaned_text;
}
else if (this.query_text != null && this.query_text != '') {
// safe_log("getQueryTextForARGA (2)");
// return this.query_text;
//question_text = this.query_text;
cleaned_text = player.clean_query_text(this.query_text);
return cleaned_text;
}
else {
// safe_log("getQueryTextForARGA (3)");
return 'see page for question context';
}
/*
question_text = question_text.replace(/]+>/g, '');
question_text = question_text.replace(/]+>/g, '');
question_text = question_text.replace(/<\/span>/g, '');
question_text = question_text.replace(//g, '');
question_text = question_text.replace(/<\/em>/g, '');
question_text = question_text.replace(//g, '');
question_text = question_text.replace(/<\/strong>/g, '');
question_text = question_text.replace(/“/g, '"');
question_text = question_text.replace(/â€/g, '"');
question_text = question_text.replace(/’/g, '\'');
question_text = question_text.replace(/&/g, '&');
return question_text;
*/
},
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;
}
if (player.section_currently_showing === 11) {
player.user_answered_section11 = this.choices[this.user_answer_index];
}
// Wrap answers in radio group
var html = '';
html = dom.createHTML( html );
common.parseMathExpresions( html );
return html;
},
evaluateAnswer: function () {
if ( $( 'input:radio[name=query_answer_' + this.query_index + ']:checked' ).val() !== undefined ) {
// get the user's selected answer, which will be 0-based
this.user_answer_index = $( 'input:radio[name=query_answer_' + this.query_index + ']:checked' ).val() * 1;
// set grade accordingly (if this.md.no_correct_answer is true, any answer is correct)
if ( this.user_answer_index == this.correct_answer_index || this.md.no_correct_answer == 'true' ) {
this.setGrade( 100 );
}
else {
this.setGrade( 0 );
}
return true;
}
else {
var text = 'Submission error. '
+ 'You must answer the question before submitting. Please try again.';
$('#question_action_div_' + (this.query_index + 1)).
after('
' + text + '
');
player.shadow_speech.talk('');
player.shadow_speech.talk(text);
return false;
}
}
});
module.exports = project_mc;
/***/ }),
/***/ 53:
/***/ (function(module, exports, __webpack_require__) {
var platform = __webpack_require__(0).run_on;
var ShadowSpeech = __webpack_require__(58);
projectActivity = __webpack_require__(50);
var project_player = Player_manuscript.extend( {
ACTIVITY_COMPLETED: false,
DUE_DATE_HAS_PASSED: false,
clean_query_text: function(query_text) {
query_text = query_text.replace(/blank<\/strong>/g, "");
query_text = query_text.replace(/]+>/g, "");
query_text = query_text.replace(/<\/span>/g, "");
query_text = query_text.replace(//g, "");
query_text = query_text.replace(/<\/em>/g, "");
query_text = query_text.replace(/ /g, "");
query_text = query_text.replace(/ /g, "");
query_text = query_text.replace(/<\/strong>/g, "");
query_text = query_text.replace(//g, "");
query_text = query_text.replace(/]+>/g, '');
query_text = query_text.replace(/’/g, "'");
query_text = query_text.replace(/“/g, "\"");
query_text = query_text.replace(/”/g, "\"");
query_text = query_text.replace(/—/g, "--");
query_text = query_text.replace(/&/g, '&');
return query_text;
},
// brb: Overriding this method so that the grade won't change back
// to original if the instructor has changed it in the grade book.
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;
}
}
this.fill_in_previous_query_responses();
// if ARGA is initialized and we need to restore the user to his last position when he returns,
if (this.ARGA_running && player.md.restore_last_viewed_section == "true") {
// if we're viewing a page other than the one currently saved as LVS (last-viewed section)
var lvs = Get_ARGA_Data("LVSX");
if (this.section_currently_showing != null && this.section_currently_showing != lvs) {
// store LVS/LAS to register the last-viewed/last-available page,
// and save ARGA so it gets registered
Set_ARGA_Data("LVSX", this.section_currently_showing);
Set_ARGA_Data("LASX", this.last_available_section);
/* brb: If the activity has NOT been completed then save LVSX,
but if it has been completed then do not save LVSX because
that will also send the grade to the PX grade book again,
overwriting any manual grade changes the instructor may
have made. */
/* brb: also don't want to do this if the due date has
passed */
if (!this.ACTIVITY_COMPLETED && !this.DUE_DATE_HAS_PASSED) {
this.activity.ARGA_submit_data(false);
}
else {
//safe_log("Not updating grade in grade book!");
}
}
}
}, // end update_section_status
// Make currently showing section visible after 100ms
fade_in_section: function (id) {
var $sec = $('#' + id);
$sec.removeAttr('aria-hidden').css({display: 'block', visibility: 'visible'});
setTimeout(function () {
$sec.css('opacity', '1');
}, 100);
},
// Make previously showing section invisible
fade_out_section: function (id) {
var $sec = $('#' + id);
$sec.attr('aria-hidden', 'true').css({display: 'none', visibility: 'hidden', opacity: '0'});
},
show_section: function (section_to_show) {
var initial_section_to_show = section_to_show;
// When 'previous' button pressed
if (section_to_show == 'previous') {
section_to_show = this.section_currently_showing - 1;
}
// When 'next' button pressed
else if (section_to_show == 'next') {
section_to_show = this.section_currently_showing + 1;
}
// When no section to show
if (section_to_show == null || isNaN(section_to_show)
|| section_to_show < 0 || section_to_show >= this.sections.length) {
return;
}
// Calling jquery ui's tabs() here will call tab_selected method,
// which will take care of calling update_section_status and updating the navigation
player.tab_jq.tabs( 'select', section_to_show );
// but for some reason tab_selected isn't running properly when we first start,
// so make sure player.section_currently_showing got updated
if (player.section_currently_showing != section_to_show && !this.nextSetionIsNotAvailable) {
player.section_currently_showing = section_to_show;
// and call update_section_status in this case too
player.update_section_status();
}
//
if ( this.section_currently_showing !== null && !this.nextSetionIsNotAvailable) {
var jq = player.get_current_section_jq();
jq && jq[0].focus();
}
// Fade in current section, fade out other sections
var curr_id = 'digfir_section_' + this.section_currently_showing;
if (initial_section_to_show === 'previous' || initial_section_to_show === 'next') {
$('.ui-tabs-nav li').each(function (index) {
var $this = $(this);
if (index === player.section_currently_showing) {
$this.attr({
'tabindex': '0',
'aria-selected': 'true',
'aria-controls': $this.find('a').attr('href').replace('#', '')
});
$this.addClass('currentTab');
if (platform.ie) {
$this.attr('aria-controls', $this.find('a').attr('href').replace('#', ''));
}
setTimeout(function () {
$this.focus();
}, 0);
}
else {
$this.attr({
'tabindex': '-1',
'aria-selected': 'false'
});
$this.removeClass('currentTab');
if (!platform.ie) {
$this.attr('aria-controls', $this.find('a').attr('href').replace('#', ''));
}
}
});
}
$('[data-type="section"]').each(function () {
var $this = $(this);
var id = $this.attr('id');
if (id === curr_id) {
player.fade_in_section(id);
}
else {
player.fade_out_section(id);
}
});
},
show_navigation: function () {
// header
var html = '';
if (platform.ios || platform.ie) {
html = '
';
}
for ( var i = 0; i < this.sections.length; ++i ) {
var s = this.sections[i];
// add a11y attributes to each section
s.jq.attr({'role': 'region', 'tabindex': 0});
// add tablist item for each section
html += '
';
// add footer to each section
s.jq.append('');
// if not first section, add 'back' button with previous section title
if ( i !== 0 ) {
var prevSectionTitle = this.sections[i-1].title;
s.jq.find('.footer')
.append( '' );
}
// if not last section, add 'next' button with next section title
if ( i < this.sections.length - 1 ) {
var nextSectionTitle = this.sections[i+1].title;
s.jq.find('.footer').append( '' );
}
// brb: Not sure why this was here?
//s.jq.append( '
'
+ 'Your answer has been provisionally accepted. You\'ll get full credit for now, '
+'but your instructor may update your grade later after evaluating it.
';
// $('[data-block_type=activity_report]' ).attr({'tabindex': 0});
// section should have a block_type=activity_report paragraph to receive this info
$('[data-block_type=activity_report]').html(html).show();
// show the grade submitted message if user_has_received_completion_alert is true
if (player.user_has_received_completion_alert == true) {
$('#grade_submitted_message').show();
}
},
initialize_sections: function () {
this._super();
$('[data-type="section"]').attr('role', 'tabpanel');
$('h1, h2, h3').remove();
$('[data-block_type="activity_title"] p').each(function () {
var $this = $(this);
$this.replaceWith($('
' + $this.html() + '
'));
});
},
initialize: function () {
this._super();
this.activity = new projectActivity();
this.shadow_speech = new ShadowSpeech();
},
initialize2: function () {
this._super();
if (player.ARGA_running) {
try {
var dejs_arr = ARGA_API.dejs_data;
for (var i=0; i');
var tabMenu = $('ul.ui-tabs-nav');
mainElem.append($('[data-type="section"]')).insertAfter(tabMenu).prepend(tabMenu);
}
// Set title to new tab with image
$('[data-type="caption"] a strong').each(function () {
var $this = $(this);
var text = $this.text();
var $link = $this.parent();
$this.remove();
var href = $link.attr('href');
$link.click(function (e) {
e.preventDefault();
var newWin = window.open(href, '_blank');
if (platform.ie) {
$(newWin.document).ready(function () {
newWin.document.title = text;
});
}
else {
newWin.onload = function () {
newWin.document.title = text;
};
}
});
});
$('[data-type="caption"] a').each(function () {
$(this).append($('. Will be opened in a new tab. '));
});
$('[data-type="box_inner"] h3').remove();
window.scrollTo(0, 0);
}
} );
module.exports = project_player;
/***/ }),
/***/ 55:
/***/ (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;
/***/ }),
/***/ 56:
/***/ (function(module, exports, __webpack_require__) {
/**
* Created by Abdulnasyrova on 20.04.2017.
*/
var platform = __webpack_require__(0).run_on;
var Query = Essay_Query.extend({
getQueryTextForARGA: function() {
var cleaned_text;
if (this.query_text_for_ARGA != null && this.query_text_for_ARGA != "") {
//return this.query_text_for_ARGA;
cleaned_text = player.clean_query_text(this.query_text_for_ARGA);
return cleaned_text;
}
else if (this.query_text != null && this.query_text != "") {
//return this.query_text;
cleaned_text = player.clean_query_text(this.query_text);
return cleaned_text;
}
else {
return "see page for question context";
}
},
/**
* 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;
/***/ }),
/***/ 57:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__( 2 );
var dom = __webpack_require__( 1 );
var UtilsShuffle = __webpack_require__( 55 );
var platform = __webpack_require__(0).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 = '