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();
// чтобы ссылка в тексте feedback читалась корректно
if (platform.ios) {
$('.question_feedback_part').each(function (i, val) {
$(this).find('a').prepend("");
$(this).find('a').append(" link");
});
}
// для multiple choice, если пользователь не выбрал вариант ответа, feedback не отображаем
if(isNaN(query.user_answer_index) && query.query_source.indexOf("MC:") == 0) {
$questionAction.find('.question_feedback_part').remove();
}
// insert word 'link' after in live-region
var feedbackText = 'Your answer has been provisionally accepted. You will receive full credit at this time, but your instructor may update your grade later after evaluating your answer.';
feedbackText += $questionAction.html().replace('', ' link');
// html to txt
feedbackText = feedbackText.replace(/<(?:.|\n)*?>/gm, '');
// Add space after period
feedbackText = feedbackText.replace(/\./g, '. ');
// FF + NVDA, IE + JAWS doesn't read text in focused div automatically*
// * for Android and iOS we use attribute aria-live = 'polite'
// for
//if (!platform.android && !platform.ios) {
player.shadow_speech.talk(feedbackText.replace('Feedback', 'Feedback. '));
//}
},
submit_question: function(question_index) {
this._super(question_index);
var curQuestion = $(this).closest('[data-type=question]');
var provisional = curQuestion.find('.points_awarded_div a');
$('.points_awarded_div a')
.attr('tabindex', '0')
.attr('aria-label', 'provisional')
.attr('role', 'link')
.keydown(function(e) {
if ((e.keyCode || e.which) === 32) {
e.preventDefault();
}
})
.keyup(function(e) {
if ((e.keyCode || e.which) === 32) {
e.preventDefault();
player.activity.explain_provisional(provisional);
}
})
.click(function(e) {
e.preventDefault();
player.activity.explain_provisional(provisional);
});
// 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 question = player.activity.questions[question_index];
//var $question_feedback = $("#question_action_div_" + question_index);
var $essay_question_evaluation_feedback = $('#essay_question_evaulation_feedback_' + (question_index - 1));
$essay_question_evaluation_feedback.attr('aria-hidden', 'true');
//var beforeFeedbackText = $essay_question_evaluation_feedback.text();
// // TODO: need to find more clear way of doing it
// $question_feedback.find('.visually-hidden').remove();
//
// $question_feedback.prepend($('' + beforeFeedbackText + ''));
if (player.activity.answered_all_queries) {
Standard_Dialog.open('Congratulations! You’ve completed this activity.', { title: 'Alert' });
//$('.ui-dialog-content').prepend($('' + $question_feedback.text() + ''));
setTimeout(function() {
var $feedback = player.get_current_section_jq().find('#essay_question_evaulation_feedback_0');
var common_feedback = player.get_current_section_jq().find('.question_action_div').text();
var feedback = $feedback.text() + common_feedback;
if (platform.ios) {
player.shadow_speech.talk(feedback.replace('Feedback', 'Feedback.') + ". Congratulations! You’ve completed this activity.");
}
else if (platform.mac || platform.firefox) {
$feedback = player.sections[player.section_currently_showing].jq.find('.essay_question_evaulation_feedback');
player.shadow_speech.talk($feedback.text() + feedback.replace('Feedback', 'Feedback.'));
}
else if (!platform.ie) {
player.shadow_speech.talk( feedback.replace('Feedback', 'Feedback.'));
}
//liveMessage(feedback.replace('Feedback', 'Feedback.'));
}, 10);
// if (!platform.firefox) {
// readElement($('.ui-dialog-content'));
// }
return; //if we finish the activity read only congratulations dialog content
}
//readElement($question_feedback);
/**
* crossreaders element reading
* @param $element
*/
function readElement($element) {
$element.attr('tabindex', '-1');
$element.blur(function() {
$(this).removeAttr('tabindex');
});
if (platform.ios) {
// Prevents iOS VO from reading 'Feedback' two times
// it needs because VO automatically focuses on the nearest element
// after we hide submit button
var feedbackText;
if ($element.text().indexOf('Feedback') !== -1) {
feedbackText = $element.text().split('Feedback')[1];
} else {
feedbackText = $element.text();
}
player.shadow_speech.talk(feedbackText);
//liveMessage(feedbackText);
}
else if (platform.firefox) {
// FF+NVDA doesn't read text in focused div automatically
//liveMessage($element.text());
player.shadow_speech.talk($element.text());
$element.focus();
}
else {
// For common usecase we just focus a feedback div
$element.focus();
}
}
},
show_completion_dialog: function() {
var html = "Congratulations! You have completed this activity.";
Standard_Dialog.open(html, { title: "", width: 400 }, 'alert-dialog');
},
explain_provisional: function() {
var fromElem = $('.points_awarded_div').find('a');
Standard_Dialog.open("This grade may be changed by your instructor after reviewing your answer.", {
title: 'Provisional',
from: fromElem
});
}
});
module.exports = project_activity;
/***/ }),
/***/ 43:
/***/ (function(module, exports, __webpack_require__) {
/**
* Created by Lupachev on 13.09.2017.
*/
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 40 );
var project_es_query = Essay_Query.extend({
// standard way to get the query text for a query
// this often won't be used.
query_text_html: function() {
if (this.query_text != "" && this.md._hide_query_text != "true") {
// replace newlines with
var qt = jQuery.trim(this.query_text).replace(/\n/g, " ");
return "
" + qt + "
";
}
else {
return "";
}
},
getHTML: function(mode) {
// start with the query text, if there
var html = this.query_text_html();
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;
// convert breaks to newlines
val = val.replace(/ /g, "\n");
// also disable the input if we're not in review_correct_incorrect mode
if (mode != "review_correct_incorrect") {
disabled = "disabled";
}
}
html += "";
// if answer was just entered and grade is 100, also show the "provisional" message
// (unless for this question it isn't provisional)
if (this.answer_was_just_entered && this.grade == 100 && this.md.points_are_provisional == "true") {
html += "
Your answer has been provisionally accepted. You will receive full credit at this time, but your instructor may update your grade later after evaluating your answer.
";
}
return html;
},
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") {
if (platform.ios) {
this.set_evaluation_feedback("You must enter an answer.");
setTimeout(function() {
player.shadow_speech.talk("You must enter an answer." + Auxiliary.emptySymbols());
}, 0);
this.focus_user_input();
}
else if (platform.firefox) {
this.focus_user_input();
var that = this;
setTimeout(function() {
that.set_evaluation_feedback("You must enter an answer.");
}, 100);
}
else if (platform.android) {
this.set_evaluation_feedback("You must enter an answer.");
this.focus_user_input();
setTimeout(function() {
player.shadow_speech.talk("You must enter an answer." + Auxiliary.emptySymbols());
}, 100);
}
else {
this.focus_user_input();
this.set_evaluation_feedback("You must enter an answer.");
}
// return false, to say that we can't yet evaluate the answer.
return false;
// else check with MAVE if specified
} else 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...
} else {
// 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;
}
},
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.ios && !platform.android) {
if ( platform.ie ) {
Auxiliary.setFeedbackAndClearAttr('assertive', 500, htmlLive);
} else if ( platform.mac ) {
player.shadow_speech.talk(htmlLive + Auxiliary.emptySymbols());
} else {
player.shadow_speech.talk(htmlLive);
}
}
}
});
module.exports = project_es_query;
/***/ }),
/***/ 44:
/***/ (function(module, exports) {
/**
* Created by Lupachev on 13.09.2017.
*/
var project_mc_query = MC_Query.extend({
query_text_html: function() {
if (this.query_text != "" && this.md._hide_query_text != "true") {
// replace newlines with
var qt = jQuery.trim(this.query_text).replace(/\n/g, " ");
var underlines = qt.match(/_{2,20}/g);
if (underlines) {
$(underlines).each(function(i, value) {
var newAriaString = '' + value + 'blank';
qt = qt.replace(value, newAriaString);
});
}
return "";
}
else {
return "";
}
},
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;
}
// wrap answers in a p tag
var html = "";
return html;
}
});
module.exports = project_mc_query;
/***/ }),
/***/ 45:
/***/ (function(module, exports, __webpack_require__) {
/**
* Created by Lupachev on 13.09.2017.
*/
var ShadowSpeech = __webpack_require__(51);
var platform = __webpack_require__(0).run_on;
function liveMessage(msg) {
setTimeout(function() {
$('#liveFeedback').text(msg);
}, 400);
};
var removeEmpties = function() {
//remove all empty headers
$('h1, h2, h3, h4').each(function() {
var $header = $(this);
if (!$header.text() || !$header.text().replace(/(\r\n|\n|\r|\s)/gm, "")) {
$header.remove();
}
});
//remove empty ids
$('img').each(function() {
var $img = $(this);
if (!$img.attr('id')) {
$img.removeAttr('id');
}
});
};
var createFootnotes = __webpack_require__(41);
var project_activity = __webpack_require__(42);
var project_player = Player_manuscript_type.extend({
toc_show_section: function(section_to_show) {
player.show_section(section_to_show);
if (section_to_show <= this.last_available_section) {
Standard_Dialog.close();
}
player.shadow_speech.talk($('#digfir_section_' + section_to_show).find('.slide_title').text() + '. Slide ' + (section_to_show + 1) + ' of ' + player.sections.length);
},
show_section_animate: function(section_to_show, direction) {
// make sure modal window is closed
$("#step_button").blur();
$("#toc_dialog").dialog("close");
// slide in using parent function
//this._super(section_to_show, direction);
// hide currently showing section
if (this.section_currently_showing != null) {
this.get_current_section_jq().hide();
}
this.section_currently_showing = section_to_show;
this.get_current_section_jq().fadeIn(300);
// update slide_number and title
var s = this.get_current_section_jq();
var sTitle = s.find('[data-block_type="slide-title"] p');
if (sTitle.length > 0) {
$(".slide_title").html(sTitle.html());
sTitle.hide();
} else {
$(".slide_title").html(this.get_current_section().title);
}
$("#slide_number").html('' + (section_to_show + 1) + '/' + this.sections.length);
var $prevBtn = $(".prev_button");
var $nextBtn = $(".next_button");
// if this is the first/last section, dim the previous/next button
if (this.section_currently_showing == 0) {
$prevBtn
.attr('disabled', 'disabled')
.addClass("disabled")
.attr('tabindex', '-1')
.attr('aria-label', 'back disabled');
}
else if (this.section_currently_showing === this.sections.length - 1) {
$nextBtn.attr('disabled', 'disabled')
.addClass("disabled")
.attr('tabindex', '-1')
.attr('aria-label', 'next disabled');
}
else {
$prevBtn.removeAttr('disabled')
.removeClass("disabled")
.attr('tabindex', '0')
.attr('aria-label', 'back');
$nextBtn.removeAttr('disabled')
.removeClass("disabled")
.attr('tabindex', '0')
.attr('aria-label', 'next');
}
// Set color of some elements from activity metadata
var colors = {
brightgreen: '#227A2D',
magenta: '#AC46A4',
lightblue: '#1E73A8',
red: '#CF1D20',
green: '#1D4C21',
deeppurple: '#6D1C68'
};
var activityColor = player.md.activity_color;
var color = colors[activityColor];
$('.slide_title').css('color', color);
$('#banner_activity_type').css('background', color);
$('[data-type="section"]').css('border-color', color);
$('[data-block_type="activity_title"]').css('color', color);
// scroll to top
window.scrollTo(0, 0);
var $next_button = $('#overlay-right');
var $prev_button = $('#overlay-left');
if (player.section_currently_showing === 0) {
$next_button.removeAttr('disabled');
$next_button.attr('class', 'next_button');
$next_button.attr('aria-label', 'next');
$next_button.attr('tabIndex', '0');
}
else if (player.section_currently_showing === (player.sections.length - 1)) {
$prev_button.removeAttr('disabled');
$prev_button.attr('class', 'prev_button');
$prev_button.attr('aria-label', 'back');
$prev_button.attr('tabIndex', '0');
}
else {
$prev_button.removeAttr('disabled');
$prev_button.attr('class', 'prev_button');
$prev_button.attr('aria-label', 'back');
$prev_button.attr('tabIndex', '0');
$next_button.removeAttr('disabled');
$next_button.attr('class', 'next_button');
$next_button.attr('aria-label', 'next');
$next_button.attr('tabIndex', '0');
}
},
show_section: function(section_to_show) {
//window.alert(section_to_show);
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 user has to view sections in sequence and hasn't gotten up to this one, don't allow it
if (this.md.sequenced_sections == "true" && section_to_show > this.last_available_section) {
// but let instructors through
if (player.activity.is_instructor()) {
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); // iframes
}
this.update_section_status();
this.update_navigation();
var curSection = this.section_currently_showing + 1;
var sectionsCount = this.sections.length;
var sectionTitle = this.get_current_section().title;
var msg = sectionTitle + '. Slide ' + curSection + ' of ' + sectionsCount;
if (platform.ios) {
Standard_Dialog.alert('' + msg + ' 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: 'Alert' });
} else {
player.shadow_speech.talk(msg);
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: 'Alert' });
}
} 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); // iframes
}
this.update_section_status();
this.update_navigation();
var curSection = this.section_currently_showing + 1;
var sectionsCount = this.sections.length;
var sectionTitle = this.get_current_section().title;
$('#menu-button').focus();
setTimeout(function() {
player.shadow_speech.talk(sectionTitle + '. Slide ' + curSection + ' of ' + sectionsCount);
}, 500);
},
show_navigation: function() {
//$("[data-type=chapter]").html('' + $("[data-type=chapter]").html() + '');
var style = "";
if (platform.android || platform.ios) {
style = 'style="background-color: #26466D;"';
}
var html = ""
+ "
').text('Select a slide to view it. Note: Grey slides are not accessible until preceding slides have been viewed or completed.')
);
var $menuList = $('
');
var feedback_text = "Select a slide to view it. Note: Grey slides are not accessible until preceding slides have been viewed or completed. ";
for (var i = 0; i < this.sections.length; ++i) {
var s = this.sections[i];
feedback_text += (i + 1) + '. ' + s.title + '. ';
var extra_style = "";
var isLinkEnabled = true;
if (this.md.sequenced_sections == "true" && i > this.last_available_section) {
extra_style = "toc_section_not_available";
isLinkEnabled = false;
}
var $menuItem = $('