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.
';
buttons = [{
text: 'OK',
click: player.activity.ARGA_initialization_final
}];
}
// resubmissions are not allowed
}
else {
// Don't show grade percentage in this message since the
// instructor may have manually changed the grade in the grade
// book and we currently have no way of knowing what it is.
msg = '
You have completed this activity.
';
//+ '
Total Score: ' + this.grade_percent + '%.
';
buttons = [{
text: 'OK',
click: player.activity.ARGA_initialization_final
}];
}
// grade has not been submitted
}
else {
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 != '') {
Standard_Dialog.alert(msg, {title: 'Please Note', buttons: buttons});
}
else {
player.activity.ARGA_initialization_final();
}
},
// Redefine this so that the dialog will close (if opened)
ARGA_initialization_final: function (decision) {
// close dialog if open
$('#standard_dialog_div').dialog('close');
if (decision == 'reset') {
ARGA_API.data = [];
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 {
// 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);
}
}
},
question_submit_button: function (q) {
var button_html = '';
return button_html;
},
get_points_awarded_html: 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() == true) {
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;
var points_html = 'Points awarded: '
+ points_awarded + ' out of ' + points_possible;
if (points_provisional) {
points_html += ' '
+ '('
+ 'provisional)';
}
points_html += '';
return points_html;
},
show_question_feedback: function (question, is_correct, try_again) {
// remove prior feedback if there
$('#question_feedback_' + question.index).remove();
// if question is not answered correctly and they get to try again, show
// hint above question
if (!is_correct && try_again) {
var hint_mesg = '';
if (question.queries[0].getQueryTypeForARGA() === 'multiple choice'
&& question.queries[0].choices_hint[question.queries[0].
user_answer_index]) {
hint_mesg += question.queries[0].choices_hint[question.
queries[0].user_answer_index]
+ ' ';
}
else if (question.md.feedback_hint) {
hint_mesg += question.md.feedback_hint + ' ';
}
question.display_alert_msg(hint_mesg, 'hint');
return;
}
// if this is an MC question then get specific feeback for answer
var mc_fb = '';
if (question.queries[0].getQueryTypeForARGA() == 'multiple choice') {
mc_fb = question.queries[0].correct_incorrect_feedback(null, is_correct);
}
// if we don't have any feedback at all, return
if (!question.md.feedback && !question.md.feedback_correct
&& !question.md.feedback_incorrect && !question.md.feedback_hint && mc_fb
=== '') {
// return;
if (is_correct) {
question.md.feedback_correct = CORRECT_FEEDBACKS[question.queries[0].getQueryTypeForARGA()];
}
else {
question.md.feedback_incorrect = 'Incorrect.';
}
}
var html = 'Question '
+ question.index + ' ' + this.feedbackTitle + '';
// if this is an MC question then get specific feeback for answer
if (question.queries[0].getQueryTypeForARGA() == 'multiple choice') {
html += question.queries[0].correct_incorrect_feedback(null, is_correct);
}
// include correct feedback if there and the answer is correct
if (is_correct && question.md.feedback_correct) {
if (question.queries[0].getQueryTypeForARGA() == 'multiple choice') {
html += '
'
+ question.md.feedback_correct + ' The answer is '
+ question.queries[0].choice_ids[question.queries[0].
feedback_correct_answer_index]
+ '.
';
}
else {
html += '
'
+ 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) {
for (var i = 0; i < question.md.feedback_conditional.length; i++) {
var fbc = question.check_conditional(
question.md.feedback_conditional[i]);
if (fbc != '') {
html += '
' + fbc + '
';
found_feedback_string = true;
break;
}
}
}
}
// if we didn't find a feedback string to use above, check for
// feedback_incorrect
if (!found_feedback_string && question.md.feedback_incorrect) {
if (question.queries[0].getQueryTypeForARGA() == 'multiple choice') {
html += '
'
+ question.md.feedback_incorrect
+ ' The correct answer is '
+ question.queries[0].choice_ids[question.queries[0].
feedback_correct_answer_index]
+ '.
';
}
else {
html += '
'
+ question.md.feedback_incorrect + '
';
}
}
}
// include general feedback if there
if (question.md.feedback) {
html += '
' + question.md.feedback
+ '
';
}
// not displaying points
// html += player.activity.get_points_awarded_html(question.index);
// close question_feedback div
html += '';
// use display_feedback_mesg to add feedback to question
question.display_feedback_mesg(html);
},
restore_saved_answers: function () {
// skip page queries (questions[0])
for (var i = 1; i < this.questions.length; ++i) {
var question = this.questions[i];
// prepare for question_report_text questions
var query_responses;
if (question.md_set('question_report_text')) {
query_responses = '' + Get_ARGA_QuestionData(
this.get_question_number(question));
query_responses = query_responses.split(this.query_responses_separator);
}
var restored_all_answers = true;
var all_answers_correct = true;
for (var j = 0; j < question.queries.length; ++j) {
var query = question.queries[j];
var saved_answer;
var saved_grade;
if (question.md_set('question_report_text')) {
if (query_responses[j] != null) {
var arr = query_responses[j].split(
this.query_responses_grade_separator);
saved_answer = arr[0];
saved_grade = arr[1];
}
else {
saved_grade = saved_answer = '';
}
// or out of learnerResponse / questionData for single-query questions
}
else {
var ARGA_question_number = this.get_query_number(question, j);
saved_answer = Get_ARGA_LearnerResponse(ARGA_question_number);
// we stored the original grade in questionData
saved_grade = Get_ARGA_QuestionData(ARGA_question_number);
}
// if we found a grade...
if (saved_grade !== '' && saved_grade >= 0) {
// restore the answer
query.restoreAnswerFromARGA(saved_answer);
query.setGrade(saved_grade);
// then re-render the query in review mode
query.jq.html(query.getHTML('review'));
if (query.isCorrect() == false) {
all_answers_correct = false;
}
}
else {
restored_all_answers = false;
}
}
if (restored_all_answers) {
// update the submit div for the question
this.update_question_action_div(i);
// Show appropriate feedback. If the question responses were submitted,
// the student must have finished the question, so we don't have to worr
// y
// about hints.
this.show_question_feedback(question, all_answers_correct, false);
// if the item is in a sequence, show the next question
this.show_next_question(question);
// NEED TO CHECK TO MAKE SURE THIS IS WORKING PROPERLY
var qs = question.question_sequence;
if (qs != null && qs.sequence_complete == 'partial') {
this.show_closing_material(qs.index);
}
var $submit_button = $('#question_submit_button_' + i);
$submit_button.hide();
} // end restored_all_answers
} // end for loop
},
// We are not going to show this message but rather the message in
// show_completion_message
show_grade_saved_message: function () {
return;
// if the user has answered all queries AND the user hasn't been
// told this already, tell them now
},
submit_question: function (question_index) {
// the arg may be a number or an event object; in the latter case...
if (typeof question_index == 'object') {
// extract the question_index from the object
question_index = question_index.data.question_index;
}
var t = player.activity;
var question = t.questions[question_index];
if (!question.$alert) {
question.$alert = null;
}
// Force all queries to be answered before doing anything
for (var i = 0; i < question.queries.length; i++) {
var query = question.queries[i];
if (query.jq[0].children[0].tagName == 'FIELDSET') {
var answered = query.user_has_answered();
}
else {
var answered = query.user_has_answered(query.jq[0].children[1].value);
}
if (!answered) {
var queryMatch = query.query_source.match(/^(.*)?:/);
var isEssayQuery = queryMatch && queryMatch[1] === 'ES';
var alertId = 'question-' + question_index + '-alert';
question.$alert = question.display_alert_msg('You must answer the question before submitting.', 'error', !isEssayQuery, alertId);
if (query.jq[0].children[1] !== undefined) {
if (isEssayQuery) {
query.focus_user_input(alertId);
}
}
return false;
}
else if (question.$alert) {
question.$alert.remove();
}
}
player.activity.disable_submit_button(question_index);
// if we made it here then remove any alert messages
question.remove_alert_mesg();
var all_answers_correct = true;
// for each query in the question...
for (var i = 0; i < question.queries.length; ++i) {
var query = question.queries[i];
var answer_submittable = query.evaluateAnswer(question_index);
if (answer_submittable === false) {
return;
}
/* for (var i=0; i<4; i++) {
if (question.queries[0].choice_order[i]==question.queries[0].
correct_answer_index) {
question.queries[0].correct_answer_index=i;
}
}*/
all_answers_correct = all_answers_correct && query.isCorrect();
}
for (var i = 0; i < question.queries.length; ++i) {
var query = question.queries[i];
query.jq.html(query.getHTML('review_correct_incorrect'));
}
// update question tries
++question.tries;
if ((!all_answers_correct && question.md.max_tries != null && question.tries
< question.md.max_tries) && question.gave_up != true) {
// tell user he can try again
t.show_question_feedback(question, false, true);
return;
}
else {
t.show_question_feedback(question, all_answers_correct, false);
}
$('[data-question_index="' + question_index + '"]').addClass('answered');
var query_correct_answers = '';
var query_responses = '';
var query_responses_for_questionData = '';
var query_grade_sum = 0;
// for each query in the question...
for (var i = 0; i < question.queries.length; ++i) {
var query = question.queries[i];
// establish a question number to use
var query_number = t.get_query_number(question, i);
// get a query weight
var query_weight = question.get_weight();
// if the question has more than one query, divide weight accordingly
if (question.queries.length > 1) {
query_weight = Math.round(query_weight / question.queries.length);
}
if (question.md.credit_after_max_tries != null) {
var query_grade = query.getGradeForARGA();
if (query_grade >= 0 && query_grade
< question.md.credit_after_max_tries) {
query.overrideGrade(question.md.credit_after_max_tries * 1);
}
}
if (!question.md_set('question_report_text')) {
t.ARGA_set_query_response(query, query_number, query_weight);
// otherwise compose query roll-ups
}
else {
if (query_correct_answers != '') {
query_correct_answers += ' / ';
query_responses += ' / ';
query_responses_for_questionData += t.query_responses_separator;
}
query_correct_answers += query.getCorrectAnswerForARGA();
query_responses += query.getUserAnswerForARGA();
// see restore_saved_answers for how this is used later
query_responses_for_questionData += query.getUserAnswerForARGA()
+ t.query_responses_grade_separator
+ query.getOriginalGrade();
query_grade_sum += query.getGradeForARGA() * 1;
}
if (question.md.show_correct_answers != 'false') {
query.jq.html(query.getHTML('review'));
}
}
// if we're saving one response for the whole question, save here
if (question.md_set('question_report_text')) {
var question_grade = Math.round(query_grade_sum
/ question.queries.length);
t.ARGA_set_question_response(question, query_correct_answers,
query_responses, question_grade, query_responses_for_questionData);
}
// grade the activity
t.grade_activity();
if (player.ARGA_running) {
t.ARGA_submit_data();
}
// update the question_action_div
t.update_question_action_div(question_index);
// if the item is in a sequence, show the next question
t.show_next_question(question);
// update section status
player.update_section_status();
// if we're on the last page and user has answered all queries,
// show completion message
var feedback_string = $('#question_' + question_index + '_fb_mesg').html();
if (player.showing_last_section() && player.activity.answered_all_queries) {
player.activity.show_completion_message(feedback_string);
}
else {
player.update_live_feedback(feedback_string);
}
},
show_completion_message: function (pre_text) {
var completion_text = 'You have completed this activity. Total Score: '
+ this.grade_percent + '%.';
var html = pre_text + ' ' + completion_text;
$('#manuscript').append('
Activity Completed
'
+ completion_text + '
');
player.update_live_feedback(html);
},
disable_submit_button: function (q_idx) {
var $submit_button = $('#question_submit_button_' + q_idx);
$submit_button.attr({
'tabindex': '-1',
'aria-disabled': 'true'
}).addClass('disabled');
$submit_button.unbind('click');
},
// we aren't going to use this one any more
update_question_action_div: function (question_index) {
return;
}
});
module.exports = ProjectActivity;
/***/ }),
/***/ 78:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var KEY_CODES = __webpack_require__(1).KEYCODES;
var Standard_Dialog = function () {
var $manuscript = $('#manuscript');
var $body = $('body');
var $dialog;
var $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);
var $parentDialog = $dialog.parent().attr({
'tabindex': '0',
'role': 'alertdialog',
'aria-labelledby': 'ui-dialog-title-standard_dialog_div',
'aria-describedby': 'standard_dialog_div'
});
$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) {
if (typeof options.buttons[0].click === 'function') {
options.buttons[0].click();
$('#manuscript').click();
}
else {
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();
}
});
$firstBtn.focus();
},
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');
$dialog.dialog('close').remove();
if (options.from) {
options.from.focus();
}
if (options.modal) {
$body.css('overflow', 'auto');
}
}
};
}();
module.exports = Standard_Dialog;
/***/ }),
/***/ 79:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ES_Query = __webpack_require__(88);
var Auxiliary = __webpack_require__(3);
var platform = __webpack_require__(0).run_on;
var ProjectEssay = ES_Query.extend({
focus_user_input: function (alertId, delay) {
alertId = alertId || '';
delay = delay || 2000;
var $textArea = $('#query_answer_' + this.query_index);
var ariaLabelledBy = $textArea.attr('aria-labelledby') || '';
$textArea.attr('aria-labelledby', alertId + ' ' + ariaLabelledBy);
// TalkBack doesn't set focus own focus to the textarea, when the keyboard is already visible, and then textarea's label doesn't read
// So we set focus via 0 delay
if (platform.android) {
setTimeout(function () {
$textArea.focus();
}, 0);
}
else {
$textArea.focus();
}
if (platform.firefox) {
$textArea.bind('blur', function () {
setTimeout(function () {
$textArea.attr('aria-labelledby', ariaLabelledBy);
$textArea.unbind('blur');
}, 0);
});
}
else {
setTimeout(function () {
$textArea.attr('aria-labelledby', ariaLabelledBy);
}, delay);
}
},
user_has_answered: function (text) {
return (text != '' && text != null);
},
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') {
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';
// var feedbackId = 'essay_question_evaluation_feedback_' +
// this.query_index + ' question_feedback_' + (this.query_index + 1);
var labelledBy=' aria-labelledby=query_text_' + this.query_index;
/* var labelledBy = (platform.android || platform.ios) ?
' aria-labelledby="' + feedbackId + ' ' + queryTextId +
'"' : ' aria-labelledby="' + queryTextId + '"'; */
html += '';
if (this.answer_was_just_entered && this.grade == 100 &&
this.md.points_are_provisional == 'true') {
/* html += '
Your answer'
+ ' has been provisionally accepted. You will get full credit for now, '
+ 'but your instructor may update your grade later after evaluating '
+ 'it.
';*/
}
return html;
},
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 '';
}
}
}
});
module.exports = ProjectEssay;
/***/ }),
/***/ 80:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Figures = __webpack_require__(86);
var ProjectFigures = Figures.extend({
bcVideo: {}, // holds all of the video players (by ID)
bcPlayerData: {'accountId': '1500315202001', 'playerId': 'B1AhVYg4l'},
process_media: function () {
var context = this; // safe off 'this'
// Process each video
$('[data-mmtype="mov"]').each(function () {
var $this = $(this);
var $parent = $this.parent('[data-type="figure"]');
var video_mmsrc = $this.attr('data-mmsrc');
var video_id = $parent.attr('data-figure-id');
// Replace the current figure HTML with the new HTML5 video HTML
var playerHTML = '
'
+ '
'
+ '
';
$parent.before(playerHTML);
$parent.remove();
bc(document.getElementById(video_id));
videojs(video_id).ready(function () {
context.bcVideo[video_id] = this;
/*
// reset the video to the beginning after it ends
context.bcVideo[video_id].on('ended', function() {
context.bcVideo[video_id].currentTime(0);
context.bcVideo[video_id].pause();
$('#' + video_id).removeClass('vjs-has-started');
});
context.bcVideo[video_id].on('play', function() {
$('#' + video_id).addClass('vjs-has-started');
});
*/
}); // end ready
});
}
});
module.exports = ProjectFigures;
/***/ }),
/***/ 81:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var MC_Query = __webpack_require__(89);
var platform = __webpack_require__(0).run_on;
var utils = __webpack_require__(84);
/**
* clean_query_text.
* @param {object} query_text .
* @return {object} .
*/
function clean_query_text (query_text) {
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(/’/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(/<a .*?>/g, '');
query_text = query_text.replace(/<\/a>/g, '');
return query_text;
}
var ProjectMC = MC_Query.extend({
getQueryTextForARGA: function () {
if (this.query_text_for_ARGA != null &&
this.query_text_for_ARGA != '') {
return this.query_text_for_ARGA;
}
else if (this.query_text != null && this.query_text != '') {
var cleaned_text = clean_query_text(this.query_text);
return cleaned_text;
}
else {
return 'see page for question context';
}
},
user_has_answered: function () {
if ($('input:radio[name=query_answer_' + this.query_index
+ ']:checked').val() !== undefined) {
return true;
}
else {
return false;
}
},
parseSource: function () {
// initialize vars
this.choices = [];
this.choices_fb = [];
this.choices_hint = [];
this.choice_ids = [];
this.correct_answer_index = null;
this.user_answer_index = null;
this.queryId = 'mc-query-' + this.query_index;
// lines might start with 'MC:'; if so, strip it out
var s = this.query_source.replace(/^MC:\s*/, '');
// split and go through the lines
var lines = s.split(this.line_separator);
this.query_text = '';
// the first choice has to be 'a' or 'A'
var choice_re = /^[\*]?([aA])[\.:\)]/;
for (var i = 0; i < lines.length; ++i) {
// get line and trim whitespace
var l = $.trim(lines[i]);
// choice
if (l.search(choice_re) > -1) {
var ident = RegExp.$1;
var choice_text = l.replace(/^[\*]?\w[\.:\)]\s*/, '');
ident = ident.toUpperCase();
// extract feedback for the choice, if there
var choice_fb = null;
if (/\[\[/.test(choice_text)) {
choice_text = choice_text.replace(/\s*\[\[(.*?)\]\]\s*/, '');
choice_fb = RegExp.$1;
// if feedback is simply 'correct' or 'incorrect', ignore it.
if (choice_fb.toLowerCase() == 'correct' || choice_fb.toLowerCase()
== 'incorrect') {
choice_fb = null;
}
}
// extract choice hint
var choice_hint = null;
if (/{{/.test(choice_text)) {
choice_text = choice_text.replace(/\s*{{(.*?)}}\s*/, '');
choice_hint = RegExp.$1;
}
this.choices.push(choice_text);
this.choices_fb.push(choice_fb);
this.choices_hint.push(choice_hint);
this.choice_ids.push(ident);
// if line started with *, it's the correct answer
if (l.search(/^[\*]/) > -1) {
// correct_choice = ident;
this.correct_answer_index = this.choice_ids.length - 1;
}
// update choice_re so that any letter is OK from here on
choice_re = /^[\*]?(\w)[\.:\)]/;
// points_possible
}
else if (l.search(/^_points:\s*(\d+)/i) > -1) {
this.points_possible = RegExp.$1;
// metadata -- starts with '_[a-zA-Z]'
}
else if (l.search(/^\_[a-zA-Z]/) > -1) {
this.extractMetadata(l);
// by default add it to the query text
}
else {
this.query_text += l + '\n';
}
}
// now we should be done with the query text. Strip trailing white space
this.query_text = this.query_text.replace(/\s*$/, '');
// shuffle choices, unless md.never_scramble is true
this.choice_order = [];
for (var j = 0; j < this.choices.length; ++j) {
this.choice_order[j] = j;
}
if (this.md.never_scramble != 'true') {
this.choice_order.shuffle();
}
// if no correct answer was given, we need to explicitly note that.
if (this.correct_answer_index == null) {
this.md.no_correct_answer = 'true';
}
this.feedback_correct_answer_index = 0;
this.choice_order.forEach(function (item, index) {
if (!item) {
this.feedback_correct_answer_index = index;
}
}.bind(this));
// replace any remaining \n's with
// NO: we're doing this in getHTML instead now
// this.query_text = this.query_text.replace(/\n/g, '
');
},
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 (this.user_answer_index != null
&& this.choices_fb[this.user_answer_index] != null) {
html += this.choices_fb[this.user_answer_index];
}
// now, if we got any feedback, enclose it in a div
if (html != '') {
html = '' + html
+ '';
}
return html;
},
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.choice_ids[z] + '.
'
+ '<' + label_elem + ' class="label" id="query_answer_label_'
+ this.query_index + '_' + index + '"';
html += ' for="query_answer_' + this.query_index + '_' + index + '"';
html += '>'
+ '' + letters[z] + ' '
+ ''
+ choiceText
+ mc_answer_info
+ '' + label_elem + '> ';
}
}
html += '';
if (fieldset_disabled) {
html = '