webpackJsonp([0],{
/***/ 20:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__(1);
// Dialog
window.Standard_Dialog = __webpack_require__(43);
// Question
Question = __webpack_require__(50);
// MC
MC_Query = __webpack_require__(45);
Essay_Query = __webpack_require__(44);
// Player
var ConcretePlayer = __webpack_require__(46);
window.player = new ConcretePlayer();
common.initForceNextSection();
/***/ }),
/***/ 40:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// -----{ Public: }--------->
/**
* Underlines
* @param {string} txt
* @return {*}
*/
function underlinedText (txt) {
var uText = txt.match(/(\__)([a-zA-Z0-9\s\-\’\+\[\]]+)(\__)/g);
if (uText) {
uText.forEach(function (value, i) {
txt = txt.replace(uText[i], '' +
uText[i].substr(2, uText[i].length - 4) + '');
});
}
return txt;
}
/**
* Set live-feedback
* @param {string} type
* @param {string} delay
* @param {string} html
*/
function setFeedbackAndClearAttr (type, delay, html) {
$('.ada-shadow-speech').attr('aria-live', type);
player.shadow_speech.talk(html);
setTimeout('player.shadow_speech.talk("");', delay);
setTimeout('$(".ada-shadow-speech").attr("aria-live", "off");', delay);
}
/**
* creating title
* @param {string} title
* @return {*}
*/
function createTitle (title) {
if (title) {
if (title.indexOf('<') > -1) {
return title.substring(title.indexOf('>') + 1, 0) +
title[title.indexOf('>') + 1].toUpperCase() +
title.substring(title.indexOf('>') + 2);
}
else {
if (title !== '') {
return title[0].toUpperCase() + title.substring(1);
}
else {
return '';
}
}
}
else {
return '';
}
}
var stringWithEmptySymbols = '';
/**
* Adding empty symbols to aria-live fjr mac
* @return {string}
*/
function emptySymbols () {
stringWithEmptySymbols += '\u00A0';
return stringWithEmptySymbols;
}
module.exports = {
underlinedText: underlinedText,
setFeedbackAndClearAttr: setFeedbackAndClearAttr,
emptySymbols: emptySymbols,
createTitle: createTitle
};
/***/ }),
/***/ 41:
/***/ (function(module, exports) {
/**
* Created by Lupachev on 13.09.2017.
*/
module.exports = function createFootnotes () {
var footnotes = {};
var KEY_CODES = {
ENTER: 13,
TAB: 9,
ESC: 27,
SPACE: 32
};
console.log('footnotes init');
// find all terms
$('[data-type="footnotes-entry"]').each(function (index, element) {
var jq = $(element);
var footnoteId = jq.find('[data-type="footnote-id"]').html();
var definition = jq.find('[data-type="definition"]').html();
footnotes[footnoteId] = {
'footnote-id': footnoteId,
'definition': definition
};
});
$('[data-fnote]')
.each(function () {
var $sup = $('')
.addClass('reference')
.text('[' + $(this).text() + ']')
.css({
cursor: 'pointer',
padding: '2px',
color: 'blue'
})
.attr({
'tabindex': 0,
'role': 'button',
'data-fnote': $(this).attr('data-fnote'),
'aria-label': 'Footnote ' + $(this).text()
})
.click(function () {
showDefinition(this);
})
.keydown(function (e) {
var code = e.keyCode || e.which;
if (code && (code === KEY_CODES.ENTER || code === KEY_CODES.SPACE)) {
showDefinition(this);
e.preventDefault();
}
});
$sup.insertBefore($(this));
$(this).remove();
});
$('[data-type=footnotes]').hide();
/**
* Dunno what this function does
* @param {something} el
*/
function showDefinition (el) {
console.log('footnotes show_definition');
var jq = $(el);
var index = jq.attr('data-fnote');
if (index) {
index = index.toLowerCase();
var footnote = footnotes[index];
var definition;
if (!footnote) {
definition = 'No footnote found for ' + index;
}
else {
definition = '' + index + ': ' + footnote.definition;
}
Standard_Dialog.open(definition, {
'title': 'Footnotes',
'modal': false,
'draggable': true,
'buttons': 'OK',
'from': $(el)
});
}
}
};
/***/ }),
/***/ 42:
/***/ (function(module, exports, __webpack_require__) {
/**
* Created by Lupachev on 13.09.2017.
*/
var platform = __webpack_require__(0).run_on;
var project_activity = Activity.extend({
update_question_action_div: 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()) {
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;
// by subtypes), but show points earned
// we need to be able to focus on the feedback container, so add tabindex
var $questionAction = question.jq.find(
'#question_action_div_' + question.index);
// Add information about points
var pointsAwarded = '
Points awarded: '
+ points_awarded + ' out of ' + points_possible;
if (points_provisional) {
pointsAwarded += '';
}
pointsAwarded += '
';
var $button = $questionAction.find('.question_submit_button');
$button.attr({
'tabindex': '-1',
'aria-disabled': 'true'
}).addClass('disabled').unbind('click');
// 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, '. ');
if (player.activity.answered_all_queries && !platform.ie) {
return;
}
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', 'provisionally')
.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 $essay_question_evaluation_feedback = $(
'#essay_question_evaulation_feedback_' + (question_index - 1));
$essay_question_evaluation_feedback.attr('aria-hidden', 'true');
// TODO: need to find more clear way of doing it
if (player.activity.answered_all_queries) {
var currentSection = player.get_current_section_jq();
var queries = player.activity.questions[question_index].queries;
var queryIndex = queries[queries.length - 1].query_index;
var feedbackPart1 = currentSection.find(
'#essay_question_evaulation_feedback_' + queryIndex).text();
var feedbackPart2 = currentSection.find(
'#question_action_div_' + question_index).text().replace('Feedback', 'Feedback.');
var feedback = feedbackPart1 + feedbackPart2 + '. ';
player.completion_message_shown = true;
var html = 'Congratulations! You’ve completed this activity.';
if (!platform.ie) {
html = '' + feedback + '' + html;
}
setTimeout(function () {
Standard_Dialog.open(html, { title: 'Alert' });
}, platform.ie ? 1000 : 100);
return; // if we finish the activity read only congratulations dialog
}
},
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
});
},
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 = '' + window.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, saved_grade;
// get saved answer and grade out of the
// questionData for question_report_text questions
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 = window.Get_ARGA_LearnerResponse(ARGA_question_number);
// we stored the original grade in questionData
saved_grade = window.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) {
// Show appropriate feedback. If the question responses were submitted,
// the student must have finished the question, so
// we don't have to worry
// about hints.
this.show_question_feedback(question, all_answers_correct, false);
// update the submit div for the question
this.update_question_action_div(i);
// 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
// If the question is in a sequence and the
// sequence is complete, call show_closing_material
var qs = question.question_sequence;
if (qs != null && qs.sequence_complete == 'partial') {
this.show_closing_material(qs.index);
}
// update section status
player.update_section_status();
}
}
}
});
module.exports = project_activity;
/***/ }),
/***/ 43:
/***/ (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, {
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');
var dialogTitleId = 'ui-dialog-title-standard_dialog_div';
var dialogBodyId = 'standard_dialog_div';
$dialog = $('');
$content = $('
' + (html || '') + '
');
$dialog.append($content);
$dialog.dialog(options);
// $('main').append($('.ui-dialog.ui-widget'+
// '.ui-widget-content.ui-corner-all'));
// 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' : dialogBodyId;
var labelledBy = options.ariaLabelledby === null ?
dialogTitleId + ' ' + 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 ? null : runOn.firefox ? dialogTitleId : labelledBy;
var _descrBy = runOn.firefox ? dialogBodyId : null;
_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);
}
var target = document.querySelector('.ui-dialog'+
'.ui-widget.ui-widget-content.ui-corner-all');
if (e.target === target && 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');
$('main').attr('aria-hidden', true);
$('body').attr('role', 'main');
},
// 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');
$('main').removeAttr('aria-hidden', true);
$('body').removeAttr('role', 'main');
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;
/***/ }),
/***/ 44:
/***/ (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, ' ');
var questions = this.jq.closest('[data-type="section"]')
.find('[data-type="question"]').toArray();
var number;
if (questions.length > 1) {
number = (questions.indexOf(this.jq.parent()[0]) + 1) + '. ';
}
else {
number = '';
}
var ariaHidden = (platform.ios || platform.android)
? 'aria-hidden="true"' : '';
return '
' + number + 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.ie) {
this.set_evaluation_feedback('You must enter an answer.');
var $textarea = this.jq.find('textarea');
var evalFeedbackID = 'essay_question_evaluation_feedback_'
+ this.query_index;
var aria_label = $textarea.attr('aria-labelledby');
if (aria_label.indexOf(evalFeedbackID) < 0) {
$textarea.attr('aria-labelledby', evalFeedbackID + ' ' + aria_label);
}
this.focus_user_input();
setTimeout(function () {
player.shadow_speech.talk(
'You must enter an answer.' + Auxiliary.emptySymbols());
}, 1000);
}
else {
this.focus_user_input();
this.set_evaluation_feedback("You must enter an answer.");
}
setTimeout(function () {
player.shadow_speech.talk('');
}, 1000);
// 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.mac) {
player.shadow_speech.talk(htmlLive + Auxiliary.emptySymbols());
}
else {
player.shadow_speech.talk(htmlLive);
}
}
}
});
module.exports = project_es_query;
/***/ }),
/***/ 45:
/***/ (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;
/***/ }),
/***/ 46:
/***/ (function(module, exports, __webpack_require__) {
/**
* Created by Lupachev on 13.09.2017.
*/
var ShadowSpeech = __webpack_require__(51);
var platform = __webpack_require__(0).run_on;
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();
}
/* if (!platform.ios) {
$('.ada-shadow-speech').attr('aria-hidden', false);
player.shadow_speech.talk(
$('#digfir_section_' + section_to_show).find('.slide_title').text()
+ '. Slide ' + (section_to_show + 1) + ' of ' + player.sections.length);
if (platform.android || platform.ie) {
setTimeout(function () {
$('.ada-shadow-speech').attr('aria-hidden', true);
}, 1000);
}
}*/
},
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
// 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');
}
else if (this.section_currently_showing === this.sections.length - 1) {
$nextBtn.attr('disabled', 'disabled')
.addClass('disabled')
.attr('tabindex', '-1')
.attr('aria-label', 'next');
}
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',
white: '#FFFFFF'
};
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) {
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);
}
setTimeout(function () {
$('div.ui-dialog.ui-widget.ui-widget-content.ui-corner-all').bind(
'DOMNodeRemoved', function (e) {
$('nav.nav.top_nav').focus();
});
}, 100);
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;
if (platform.android) {
setTimeout(function () {
$('nav.nav.top_nav').focus();
}, 1000);
}
else {
$('nav.nav.top_nav').focus();
}
setTimeout(function () {
player.shadow_speech.talk(
sectionTitle + '. Slide ' + curSection + ' of ' + sectionsCount);
}, 500);
if (platform.android || platform.ie || platform.ios) {
setTimeout(function () {
player.shadow_speech.talk('');
}, 1000);
}
if (player.section_currently_showing === player.sections.length - 1) {
if (!player.completion_message_shown) {
if (player.sections[player.section_currently_showing].jq
.find('[data-type="question"]').length === 0) {
if (player.activity.answered_all_queries) {
if ($('#bsm_slide_template-sec21-p3').length === 0) {
if (!(player.sections.length === 0)) {
player.append_completion_message();
}
}
}
}
}
}
},
append_completion_message: function () {
player.sections[player.section_currently_showing].jq
.append('
'
+ '
Congratulations! You have'
+ ' completed this activity.
'
+ '
');
},
show_navigation: function () {
var style = '';
if (platform.android || platform.ios) {
style = 'style="background-color: #26466D;"';
}
if (player.sections.length !== 1) {
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 = $('
');
$menuList.css('list-style-type', 'none');
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 linkLabel = s.title;
if (!platform.ie) {
linkLabel += isLinkEnabled ? '' : ' unavailable';
}
var $menuItem = $('