webpackJsonp([0],{
/***/ 21:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__(1);
// MC
//MC_Query = require('subtype/digfir/MC_Query');
//MC_Query = require('MC_Query');
// Essay
Essay_Query = __webpack_require__(42);
// Player
var ChangedPlayer = __webpack_require__(40);
window.player = new ChangedPlayer();
// Auxiliary
var Auxiliary = __webpack_require__(3);
common.initForceNextSection();
/***/ }),
/***/ 3:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// Common css
/*
require('./assets/css/common');
require('./initialize');
var dom = require('lib/dom');
var jq_utils = require('lib/utils/jq_utils');*/
//-----{ Public: }------------------------------------------------------------->
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;
}
function setFeedbackAndClearAttr(type, delay, html) {
$('#live-feedback').attr('aria-live', type);
$('#live-feedback').html(html);
setTimeout("$('#live-feedback').html('');", delay);
setTimeout("$('#live-feedback').attr('aria-live', 'off');", delay);
}
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 = '';
function emptySymbols() {
stringWithEmptySymbols += '\u00A0';
return stringWithEmptySymbols;
}
module.exports = {
underlinedText: underlinedText,
setFeedbackAndClearAttr: setFeedbackAndClearAttr,
emptySymbols: emptySymbols,
createTitle: createTitle
};
/***/ }),
/***/ 39:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__(1);
var dom = __webpack_require__(2);
var platform = __webpack_require__(0).run_on;
var Activity_work_it_out = __webpack_require__( 6 );
var localActivity = Activity_work_it_out.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;
// Hide submit button (and any other similar buttons that might be added 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 += ' (provisional)';
}
pointsAwarded += '
';
if (query.answer_was_just_entered && points_provisional) {
pointsAwarded +=
'
If your instructor has assigned the activity, you have received provisional credit, and your response has been submitted to your instructor for grading.
';
}
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");
});
} else if ( platform.android) {
$('.question_feedback_part').find('a').each(function (i, val) {
$(this).after("" + Auxiliary.emptySymbols() + "link");
});
} else if ( platform.mac ) {
var count = 0;
$('#question_feedback_' + question_index + ' .question_feedback_part').find('a').each(function (i, val) {
if (count++ > 0) {
$(this).after("" + Auxiliary.emptySymbols() + "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 = $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.setLiveText(feedbackText.replace('Feedback', 'Feedback. '));
}
},
});
module.exports = localActivity;
/***/ }),
/***/ 40:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ConcreteFigures = __webpack_require__( 5 );
var platform = __webpack_require__(0).run_on;
var Player_work_it_out = __webpack_require__(43);
var LocalActivity = __webpack_require__( 39 );
var local_player = Player_work_it_out.extend( {
initialize: function() {
this._super();
var fontHTML = '';
$( "body" ).append( fontHTML );
this.activity_type = $( "[key=activity_type]" ).html();
this.activity_title = $( "[key=activity_title]" ).html();
this.activity = new LocalActivity();
this.figures = new ConcreteFigures();
this.initImageDescriptions();
player.glossary.set_click_event_for_terms_in_section = function( sectionjq ) {
$( sectionjq ).find( "[data-type='termref']" ).each( function( index, element ) {
var jq = $( element );
jq.unbind( "click" );
jq.click( function() {
player.glossary.show_definition( this );
} );
} );
};
// brb: Accessibility - set document title
document.title = this.activity_type.replace(/<(?:.|\n)*?>/gm, '') + " " + this.activity_title.replace(/<(?:.|\n)*?>/gm, '');
$( '[data-type=question]' ).attr( 'role', 'document' );
// Return question titles for each section
var i= 0, j = 0, countQ;
$('[data-type=section]').each(function() {
i=0;
countQ = $($('[data-type="section"]')[j++]).find('[data-type=question] h3');
$(countQ).each(function() {
$(this).html((i++ + 1) + ' of ' + $(countQ).length);
});
});
/**
* adding role=application for all rawhtml after data-type=figure
* to prevent partially reading of the previous paragraph
*/
$( '[data-type=figure]' ).each( function() {
$( this ).next( '[data-type=rawhtml]' ).attr( 'role', 'application' );
} );
// Add live feedback for readers
/* if (!platform.mobile) {
this.initLiveFeedback();
}*/
},
} );
module.exports = local_player;
/***/ }),
/***/ 42:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 3 );
var ES_Query = Essay_Query.extend({
/**
* Get correct HTML for query text and set id for following use
* @returns {string} Html for query text
*/
focus_user_input: function() {
var delay = ( platform.ie || platform.mac ) ? 2500 : 1200;
setTimeout('$("#query_answer_' + this.query_index + '").select();', delay);
},
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 '';
}
}
},
/**
* 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;
// for Android and iOS we use advanced feedback
// feedbackId contains:
// essay_question_evaluation_feedback - id for div with text 'You must enter an answer'
// question_feedback - id for div with full feedback
var feedbackId = 'essay_question_evaluation_feedback_' + this.query_index + ' question_feedback_' + (this.query_index + 1);
var labelledBy = (platform.android || platform.ios) ? ' aria-labelledby="' + feedbackId + ' ' + queryTextId + '"' : ' aria-labelledby="' + queryTextId + '"';
html += '';
return html;
},
/**
* Fix typo evaluation
* @param {string} html
*/
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.android && !platform.ios) {
if ( platform.ie ) {
Auxiliary.setFeedbackAndClearAttr('assertive', 5000, htmlLive);
} else if ( platform.mac ) {
$('#live-feedback').html(htmlLive + Auxiliary.emptySymbols());
} else {
$('#live-feedback').html(htmlLive);
}
}
}
});
module.exports = ES_Query;
/***/ }),
/***/ 43:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__( 1 );
var ConcreteActivity = __webpack_require__( 6 );
var ConcreteFigures = __webpack_require__( 5 );
var KEY_CODES = __webpack_require__( 1 ).KEYCODES;
var ShadowSpeech = __webpack_require__(44);
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 3 );
var Player_work_it_out = Player.extend( {
activity_title: null,
activity_type: null,
liveFeedback: null,
question_numbering: null,
// it is supposed to be only one video for section
init_video: function( section ) {
var video = section.jq[ 0 ].querySelector( "[data-class=video]" );
if ( video ) {
section.hasVideo = true;
section.video = {
jq: $( video ),
id: $( video ).data( 'figure-id' ),
isViewed: false,
hasTranscription: false
};
$( video ).attr( 'tabindex', '0' );
$( video ).find( 'object' ).attr( 'tabindex', '-1' );
this.init_video_transcription( section );
this.video_add_events( section.video );
this.hide_video( section );
}
},
init_video_transcription: function( section ) {
var video_transcription = section.jq[ 0 ].querySelector( "[data-block_type=video_transcription]" );
if ( video_transcription ) {
section.video.hasTranscription = true;
section.video.transcription = {
jq: $( video_transcription ),
text: '\n' + $( video_transcription ).find( '.transcript-text' ).html() + ''
};
}
},
video_add_events: function( video ) {
if ( video.hasTranscription ) {
video.transcription.jq.find( '.transcript-button' ).click( function() {
var transcriptWindow = window.open( "", "_blank" );
transcriptWindow.document.write( video.transcription.text );
} );
}
},
show_video: function( section ) {
if ( section.hasVideo ) {
section.video.jq.show();
section.video.hasTranscription && section.video.transcription.jq.show();
}
},
hide_video: function( section ) {
if ( section.hasVideo ) {
section.video.jq.hide();
section.video.hasTranscription && section.video.transcription.jq.hide();
}
},
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;
s.isComplete = true;
}
}
},
show_completion_dialog: function() {
var html = "Congratulations! You have completed this activity.";
Standard_Dialog.alert( html, { title: "", width: 400 } );
},
show_video_dialog: function() {
var html = "Please note: You must watch the video in order to move on to the next slide.";
Standard_Dialog.alert( html, { title: "", width: 400 } );
},
show_incompleteness_dialog: function() {
var html = "You must complete every questions on the slide to move on to the next slide.";
Standard_Dialog.alert( html, { title: "Message", width: 400 } );
},
show_next_section: function() {
var section = this.get_current_section();
if ( section.isComplete || window.__force_next_section ) {
this.show_section( this.section_currently_showing + 1 );
}
else {
var questionsIsAnswered = section.all_questions_answered && section.all_question_sequences_completed;
questionsIsAnswered ? this.show_video_dialog() : this.show_incompleteness_dialog();
}
},
show_prev_section: function() {
this.show_section( this.section_currently_showing - 1 );
},
show_section: function(section_to_show) {
if (this.section_currently_showing === section_to_show) {
return;
}
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 (this.md.sequenced_sections === 'true' && section_to_show > this.last_available_section) {
//var $tab = player.tabs.eq(section_to_show);
// Let instructors through
if (player.activity.is_instructor()) {
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: "Warning", width: 400 });
} 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);
}
this.update_section_status();
this.update_navigation();
},
show_section_from_toc: function( section_to_show ) {
// set focus on content button
window.Standard_Dialog.activeElement = $( '#content_button' );
window.Standard_Dialog.close( true );
if ( this.section_currently_showing != section_to_show ) {
this.show_section( section_to_show );
}
},
hide_section: function( section ) {
'use strict';
if ( section && section.md.section_type && window.mheContpract[ section.md.section_type ] ) {
if ( window.mheContpract[ section.md.section_type ].hide ) {
window.mheContpract[ section.md.section_type ].hide( section );
}
}
},
set_video: function( playerID, videoID, pauseAfterLoad ) {
//highlight the button
$( ".select_video_button" ).removeClass( "ui-state-focus" );
$( "#" + playerID + "_" + videoID ).addClass( "ui-state-focus" );
if ( !player.videoIsReady[ playerID ] ) {
//safe_log("video not ready.. going to settimeout");
setTimeout( function() {
player.set_video( playerID, videoID, pauseAfterLoad );
}, 100 );
return false;
}
//safe_log("inside load video");
var vidplayer = brightcove.api.getExperience( playerID );
var playerModule = vidplayer.getModule( brightcove.api.modules.APIModules.VIDEO_PLAYER );
//safe_log("got player module");
if ( pauseAfterLoad ) {
playerModule.cueVideoByID( videoID );
}
else {
playerModule.loadVideoByID( videoID );
}
},
show_section_animate: function( section_to_show ) {
if ( this.section_currently_showing != null ) {
this.get_current_section_jq().hide();
}
this.section_currently_showing = section_to_show;
var section = this.sections[ section_to_show ];
section.jq.fadeIn( 300 );
UI_Elements.update_button_label( "slide_number", "Page " + (section_to_show + 1) + " of " + this.sections.length + " " );
if ( this.section_currently_showing == 0 ) {
$( "#previous_button" ).hide();
}
else {
$( "#previous_button" ).show();
}
if ( this.section_currently_showing == (this.sections.length - 1) ) {
$( "#next_button" ).hide();
}
else {
$( "#next_button" ).show();
}
//apply click handler to termref items in the section - the global call done on init doesn't get the content in queries
player.glossary.set_click_event_for_terms_in_section( this.get_current_section_jq() );
// scroll to top
window.scrollTo( 0, 0 );
},
show_navigation: function() {
var toc_icon = "";
var $manuscriptNode = $( '#manuscript' );
// don't show link "Example"
$('a').filter(function( i ) {
if ( $(this).text() === "Example" ) {
$(this).addClass("element-hidden");
}
});
// Header
var html =
"
";
// удалим название секции
$manuscriptNode.find('h1').remove();
$manuscriptNode.prepend( html );
html = "";
$manuscriptNode.append( html );
},
show_toc: function() {
var html = '';
for ( var i = 0; i < this.sections.length; i++ ) {
var title = this.sections[ i ].title;
// Check whether it is available
var disabled = (this.md.sequenced_sections === 'true' && i > this.last_available_section);
var className = disabled ? 'toc_section_not_available' : '';
// Check action on disabled only if it is instructor
var action = (!disabled || player.activity.is_instructor()) ? 'onclick="player.toc_show_section(' + i + ')"' : '';
html += '
Click on a slide to view it. Note: Gray slides are not accessible until preceding slides have' +
' been viewed or completed.
' +
'
' + html + '
';
Standard_Dialog.open( html, {
from: $( '.top-banner button' ),
title: 'Table of Contents'
} );
$( '.toc_section_title' ).each( function() {
// Add action on disabled only if it is instructor
if ( !disabled || player.activity.is_instructor() ) {
$( this ).keyup( function( e ) {
var key = e.keyCode || e.which;
if ( key === KEY_CODES.SPACE ) {
$( this ).click();
}
} );
$( this ).keydown( function( e ) {
var key = e.keyCode || e.which;
if ( key === KEY_CODES.SPACE ) {
e.preventDefault();
}
if ( key === KEY_CODES.ENTER ) {
e.preventDefault();
$( this ).click();
}
} );
}
} );
},
/**
* Hide menu after click on link
* @param {number} section_to_show
*/
toc_show_section: function( section_to_show ) {
// Close dialog
Standard_Dialog.close();
// Show section
player.show_section( section_to_show );
},
initialize: function() {
this._super();
var fontHTML = '';
$( "body" ).append( fontHTML );
this.activity_type = $( "[key=activity_type]" ).html();
this.activity_title = $( "[key=activity_title]" ).html();
this.question_numbering = $( "[key=question_numbering]" ).html();
this.activity = new ConcreteActivity();
this.figures = new ConcreteFigures();
this.initImageDescriptions();
player.glossary.set_click_event_for_terms_in_section = function( sectionjq ) {
$( sectionjq ).find( "[data-type='termref']" ).each( function( index, element ) {
var jq = $( element );
jq.unbind( "click" );
jq.click( function() {
player.glossary.show_definition( this );
} );
} );
};
// brb: Accessibility - set document title
document.title = this.activity_type + " " + this.activity_title.replace(/<(?:.|\n)*?>/gm, '');
$( '[data-type=question]' ).attr( 'role', 'document' );
// Return question titles for each section
var i= 0, j = 0, countQ;
$('[data-type=section]').each(function() {
i=0;
countQ = $($('[data-type="section"]')[j++]).find('[data-type=question] h3');
$(countQ).each(function() {
$(this).html((i++ + 1) + ' of ' + $(countQ).length);
});
});
/**
* adding role=application for all rawhtml after data-type=figure
* to prevent partially reading of the previous paragraph
*/
$( '[data-type=figure]' ).each( function() {
$( this ).next( '[data-type=rawhtml]' ).attr( 'role', 'application' );
} );
// Add live feedback for readers
if (!platform.mobile) {
this.initLiveFeedback();
}
},
initialize_questions: function() {
var questions = this.activity.questions;
questions.forEach( function( question, index ) {
if ( index > 0 ) {
var $questionTitleNode = $( question.jq ).find( 'h3' );
// defaults we remove question's title h3
// if there is parametr 'question_numbering', then we remain this title
if(player.question_numbering != "true") {
$questionTitleNode.remove();
}
}
common.addAriaForDDFields( question.jq );
} );
},
initLiveFeedback: function() {
var live = platform.ie ? 'assertive' : 'polite';
this.liveFeedback = $('');
$('body').prepend(this.liveFeedback);
},
setLiveText: function(text) {
if ( platform.ie ) {
Auxiliary.setFeedbackAndClearAttr('assertive', 5000, text);
} else if ( platform.mac ) {
$('#live-feedback').html(text + Auxiliary.emptySymbols());
} else {
$('#live-feedback').html(text);
}
},
initImageDescriptions: function() {
$('.image-description').each(function() {
var html = $(this).html();
$(this).parent().css('text-align', 'center');
var $btn = $('');
$(this).replaceWith($btn);
$btn.click(function() {
Standard_Dialog.open(html, { title: 'Image Description', from: $btn });
});
});
},
initialize2: function() {
this._super();
this.initialize_questions();
// If ARGA is running, note here whether or not *any* data has been saved for the user
// that is, whether a submission has been initialized
if ( window.player.ARGA_running ) {
// We know something has been stored if "complete" is not an empty string
if ( window.Get_ARGA_Data( "complete" ) !== "" ) {
this.ARGA_submission_initialized = true;
}
}
common.parseMathExpresions();
common.parseMetaClasses();
this.shadow_speech = new ShadowSpeech();
},
initialize_sections: function() {
'use strict';
this._super();
var section;
// Extract metadata for section, for conditional steps
for ( var j = 0; j < this.sections.length; ++j ) {
section = this.sections[ j ];
section.isComplete = false;
section.jq.find( 'h2.section-title').remove();
section.hasVideo = false;
this.init_video( section );
section.md = new window.Metadata( { lowercase_keys: true } );
section.md.add_from_jq( section.jq.children( '[data-type=metadata]' ) );
section.jq.attr( 'role', 'main' );
}
// Disable default drag
common.disableDefaultDrag();
common.activateAriaCheckUncheck();
},
} );
module.exports = Player_work_it_out;
/***/ }),
/***/ 44:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var dom = __webpack_require__(2);
var platform = __webpack_require__( 0 ).run_on;
function ShadowSpeech(aria_live, role, atomic, root) {
var frag;
root = root || document.body;
this.live = aria_live || (platform.ie ? 'assertive' : 'polite');
this.role = role ? 'role = "' + role + '"' : '';
this.atomic = atomic ? 'aria-atomic = "' + atomic + '"' : '';
frag = dom.createHTML('');
this._el = frag.firstChild;
dom.append(frag, root);
}
ShadowSpeech.prototype.talk = function(some, clone) {
if (clone && some instanceof Node) {
some = some.cloneNode(true);
}
dom.clear(this._el);
dom.setHtml(some, this._el);
};
module.exports = ShadowSpeech;
/***/ }),
/***/ 5:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var AYS_Figures = Figures.extend({
// If your altsrc points to an image and you want it to automatically open the
// corresponding html file instead (same file path/name as the image except
// extension ends in .html) set this to "on"
autoHtml: "off",
// By default images will pop in the supp window. Set this to "_blank" to
// have them open in a new browser window instead
targetDefault: "_pop",
// By default the imagesLoaded plugin is attached to each figure in order
// to shrink the figure
to the same width as the . Set this
// to "off" to turn this behavior off:
resizeDivWidth: "on",
// Set this to "on" if you want all internal image links to open
// using supp_win.html (which will allow you to set the width)
// NOTE: this is turned on with the global cfg_displayImagesInSuppHtml setting
displayImagesInSuppHtml: "off",
expand: function(image_ref) {
// don't call _super, we are overriding this method
var $parentDiv; // figure
around image
// If image_ref is a string then assume it is the image ID
if (typeof image_ref === "string") {
$parentDiv = $("[data-type=figure][data-figure-id='" + image_ref + "']");
}
else {
$parentDiv = $(image_ref).parents('[data-type=figure]').first();
}
if ($parentDiv.length < 1) {
safe_log("Figures_manuscript_subtype.expand: Can't find parent div for image");
return false;
}
var $image = $parentDiv.children('img');
// If the img is not directly under the figure div then check if it has been
// converted by captionjs
if ($image.length == 0) {
$image = $parentDiv.children('figure').children('div').children('img');
}
if ($image.length == 0) {
safe_log("Figures_manuscript_subtype.expand: Can't find image div for image");
return false;
}
// By default, if no altsrc is defined in the xml then the player
// should have set it to the image src path. But if for some reason
// altsrc doesn't exist then set it to the img src anyway.
var altsrc = ($parentDiv.attr('data-altsrc') || $image.attr('src'));
if (xBookUtils.emptyValue(altsrc)) {
safe_log("Figures_manuscript_subtype.expand: Can't find altsrc for figure");
return false;
}
// If we are in brainhoney, then we need to make sure the altsrc
// has the proper absolute path
if (xBookUtils.inBrainhoneyPlayer() && !xBookUtils.externalUrl(altsrc)) {
if (!/^\/brainhoney\//.test(altsrc)) {
altsrc = xBookUtils.getBaseUrl() + altsrc;
}
}
// Target can be passed in through data-target attribute in xml. If
// not present then use default.
var target = ($parentDiv.attr('data-target') || this.targetDefault);
// special checks for internal altsrc urls
if (!xBookUtils.externalUrl(altsrc)) {
// We don't want to open a million different windows for the same figure
if (target === "_blank") {
target = "fig_win"; // this matches Player default
}
// Are we auto converting image file to html file?
if (this.autoHtml === "on") {
altsrc = altsrc.replace(/\.(jpg|gif|png|tiff)$/, ".html");
}
// Or do we want to use supp_win.html to open internal image links?
else if (this.displayImagesInSuppHtml === "on") {
var width = $parentDiv.attr('data-htmlwidth');
if (!xBookUtils.emptyValue(width) && /^\d+$/.test(width)) {
width = "&imgwidth=" + width;
}
else {
width = "";
}
altsrc = "asset/supp_win.html?bookid=" + xBookUtils.getBookId() + "&image=" + altsrc + width + "&baseurl=" + xBookUtils.getBaseUrl();
}
}
if (target === "_pop") {
xBookUtils.openSuppWin({url: altsrc});
}
else {
window.open(altsrc, target);
}
},
// end expand
process_media: function() {
// we're not currently using this (jwplayer is not being included)
$("[data-mmtype='mp3']").each(function(index, element) {
var jq = $(element);
var id = jq.attr("data-figure-id");
var mmsrc = jq.attr("data-mmsrc");
// http://www.longtailvideo.com/jw/upload/bunny.mp3
// http://www.youtube.com/embed/CsGYh8AacgY
var src = jq.attr("src");
var attr = jq.attr("data-attr");
if (attr == null) {
attr = "";
}
attr = attr.split(/\s*,\s*/);
var params = new Object();
params.width = jq.width();
params.height = jq.height() + 24; // 24 is for the controler at the bottom
params.file = mmsrc;
params.image = src;
params.controlbar = "bottom";
params.screencolor = "ffffff";
params["viral.allowmenu"] = "false";
params["viral.onpause"] = "false";
params["viral.oncomplete"] = "false";
// determine url of flashplayer based on whether we're published or not
if (UI_Elements.in_preview_mode()) {
params.flashplayer = "/js/preview/player.swf";
}
else {
params.flashplayer = "js/player.swf";
}
safe_log(params.flashplayer);
for (var i = 0; i < attr.length; ++i) {
var a = attr[i].split(/\s*=\s*/);
params[a[0]] = a[1];
}
jwplayer(id).setup(params);
});
//AF: this is less than ideal, but i had to make this a global variable so it can be accessed by the video players when they fire the templateloaded event.
// we should look into changing it.
videos.templateReady = function(figureObjectID) {
var KEY_CODES = {
SPACE: 32,
ENTER: 13
};
var vidplayer = brightcove.api.getExperience(figureObjectID);
// var experienceModule = vidplayer.getModule(brightcove.api.modules.APIModules.EXPERIENCE);
var playerModule = vidplayer.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER);
var el = document.querySelector("[data-figure-id=" + figureObjectID + "]");
$(el).find('object').attr('aria-hidden', true);
$(el).find('iframe.BrightcoveExperience').attr('aria-hidden', true); // Fix for android
el.setAttribute("tabindex", "0");
el.setAttribute("role", "application");
el.setAttribute('aria-label',
'Press enter to start or pause video. Press the transcript button to see the content of the video');
el.addEventListener("keydown", (function(isPlay) {
return function(evt) {
var keyCode = evt.keyCode || evt.which;
if (keyCode === KEY_CODES.SPACE || keyCode === KEY_CODES.ENTER) {
if (isPlay) {
playerModule.pause();
isPlay = false;
return;
}
playerModule.play();
isPlay = true;
}
};
})(false));
var questionSequence = $("#" + figureObjectID).closest('[data-type="figure"]').nextAll(
'[data-block_type="question_sequence"], [data-block_type="question_sequence_one_at_a_time"]');
questionSequence.each(function(index, element) {
if ($(element).attr("data-block_type") == "figure") {
if ($(element).find(".BrightcoveExperience").size() > 0) { //we have found another video following the current one, so stop
return false;
}
}
var questionSequenceIndex = $(element).attr("question_sequence_index");
var questionSequenceMetaData = $(element).find('[data-type="box_inner"]').children(
'[data-type="metadata"]').find('[key="cuepoint"]').html();
$(element).hide();
if (questionSequenceMetaData != null) {
var cuePointsModule = vidplayer.getModule(brightcove.api.modules.APIModules.CUE_POINTS);
var CuePointType = brightcove.api.modules.CuePointsModule.CuePointType;
var cuePoints = [ {
name: figureObjectID,
metadata: questionSequenceIndex,
time: questionSequenceMetaData,
type: CuePointType.CODE
} ];
cuePointsModule.addCuePoints(videos[figureObjectID], cuePoints);
videos.question_sequence_to_video_map[questionSequenceIndex] = figureObjectID;
}
});
playerModule.addEventListener(brightcove.api.events.CuePointEvent.CUE, videos.cuePointEvent);
};
videos.cuePointEvent = function(e) {
//get the player - the name property of the cuePoint is set to the ID of the Brightcove experience
//so we can find the player here.
var vidplayer = brightcove.api.getExperience(e.cuePoint.name);
//var globalPlayer = brightcove.api.getExperience(e.cuePoint.name);
safe_log("got vid player");
var playerModule = vidplayer.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER);
safe_log("got module");
playerModule.pause(true);
safe_log("paused");
player.show_question_sequence(e.cuePoint.metadata, false);
};
$("[data-mmtype='mov']").each(function(index, element) {
var jq = $(element);
var id = jq.attr("data-figure-id");
var mmsrc = jq.attr("data-mmsrc");
// var src = jq.attr("src");
var attr = jq.attr("data-attr");
if (attr == null) {
attr = "";
}
attr = attr.split(/\s*,\s*/);
var params = new Object();
for (var i = 0; i < attr.length; ++i) {
var a = attr[i].split(/\s*=\s*/);
params[a[0]] = a[1];
safe_log("added param " + a[0] + ": " + a[1]);
}
params.autoStart = jq.attr("data-autoplay");
var videoPlayerID = "";
var videoPlayerKey = "";
//if(params.showVideoControls == 'true'){
//AF: This is the video player with playback controls. We are only using this one for right now.
videoPlayerID = "1513003547001";
if (jq.attr("data-playerid")) {
videoPlayerID = jq.attr("data-playerid");
}
videoPlayerKey = "AQ~~,AAABXVHBMdE~,bnY9CM55Z1MLPZuidy4KYEC_16wi-U8Q";
//}else{
// videoPlayerID = "1504927982001";
// videoPlayerKey = "AQ~~,AAABXVHBMdE~,bnY9CM55Z1PiqOYprq-NHmUPG2yKZ4U-";
//}
videos[id] = mmsrc;
var BCL = {};
BCL.markup = function(html, data) {
var m;
var i = 0;
var match = html.match(data instanceof Array ? /{{\d+}}/g : /{{\w+}}/g) || [];
// eslint-disable-next-line no-cond-assign
while (m = match[i++]) {
html = html.replace(m, data[m.substr(2, m.length - 4)]);
}
return html;
};
videos.templateLoad = function(e) {
//AF: For now, we are not using captions.
var vidplayer = brightcove.api.getExperience(e);
// var CuePointType = brightcove.api.modules.CuePointsModule.CuePointType;
var modExp = vidplayer.getModule(brightcove.api.modules.APIModules.EXPERIENCE);
modExp.addEventListener(brightcove.api.events.ExperienceEvent.TEMPLATE_READY,
function(_evt) {
videos.templateReady(e);
});
//captionsModule.loadDFXP(player.md.video_caption_url + videos[e] + ".xml", videos[e]);
//if needed, we can use these events to trigger code upon the success or error of loading captions.
//if there is an error, it fails silently and just doesn't show captions.
//captionsModule.addEventListener(brightcove.api.events.CaptionsEvent.DFXP_LOAD_SUCCESS, onDFXPLoadSuccess);
//captionsModule.addEventListener(brightcove.api.events.CaptionsEvent.DFXP_LOAD_ERROR, onDFXPLoadError);
};
BCL.playerData = {
"playerID": videoPlayerID,
"playerKey": videoPlayerKey,
"width": jq.width(),
"height": jq.height(),
"videoID": mmsrc,
"autoStart": params.autoStart
};
BCL.playerTemplate =
"";
// console.log(BCL.playerTemplate);
var playerHTML = "";
playerHTML = BCL.markup(BCL.playerTemplate, BCL.playerData); //replaces placeholders with values
jq.replaceWith(playerHTML);
brightcove.createExperiences();
});
}
});
module.exports = AYS_Figures;
/***/ }),
/***/ 59:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(21);
/***/ }),
/***/ 6:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__(1);
var dom = __webpack_require__(2);
var platform = __webpack_require__(0).run_on;
var Auxiliary = __webpack_require__( 3 );
var Activity_work_it_out = Activity.extend({
submit_question: function(question_index) {
this._super(question_index);
var section = player.get_current_section();
var qID = section.jq.find("[data-type=question]").attr("data-question_index");
player.activity.qID = qID;
player.show_video(section);
var $figure_text = section.jq.find("[data-type=figure_text]");
if ($figure_text.text().trim() == '') {
$figure_text.hide();
}
if (section.hasVideo) {
setTimeout(function() {
var videoPlayer = brightcove.api && brightcove.api.getExperience(section.video.id);
if (videoPlayer) {
var playerModule = videoPlayer.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER);
playerModule.seek(0);
playerModule.addEventListener(brightcove.api.events.MediaEvent.COMPLETE, function() {
section.video.isViewed = true;
player.update_section_status();
player.showing_last_section() && player.show_completion_dialog();
});
}
}, 5000);
}
},
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;
// Hide submit button (and any other similar buttons that might be added 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);
// we don't need text that begins with "For more help..."
var tmpA = $($questionAction).find(".question_feedback_part").html();
if (tmpA !== null) {
if( tmpA.indexOf('For more help') > -1 ) {
var tmpB = tmpA.substr(tmpA.indexOf('For more help'), tmpA.length);
} else if (tmpA.indexOf('For help with') > -1) {
var tmpB = tmpA.substr(tmpA.indexOf('For help with'), tmpA.length);
}
tmpA = tmpA.replace(tmpB, '');
}
$($questionAction).find(".question_feedback_part").html(tmpA);
// Add information about points
var pointsAwarded = '
Points awarded: ' + points_awarded + ' out of ' + points_possible;
if (points_provisional) {
pointsAwarded += ' (provisional)';
}
pointsAwarded += '
';
if (query.answer_was_just_entered && points_provisional) {
pointsAwarded +=
'
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");
});
} else if ( platform.android) {
$('.question_feedback_part').find('a').each(function (i, val) {
$(this).after("" + Auxiliary.emptySymbols() + "link");
});
} else if ( platform.mac ) {
var count = 0;
$('#question_feedback_' + question_index + ' .question_feedback_part').find('a').each(function (i, val) {
if (count++ > 0) {
$(this).after("" + Auxiliary.emptySymbols() + "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 = $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.setLiveText(feedbackText.replace('Feedback', 'Feedback. '));
}
},
show_question_feedback: function(question, is_correct, try_again) {
// Remove previous feedback if there
$('#question_feedback_' + question.index).remove();
// Remove previous aria-live attributes
if ( platform.android || platform.ios ) {
$('.question_feedback').removeAttr('aria-live');
}
// making good links
var qLink = question.jq.find('.query_mc_feedback_correct_incorrect span[data-type="link"]');
qLink.replaceWith( "" + qLink.html() + "" );
// Get individual feedback for each choice, and add it after general feedback
var feedback_correct_incorrect = question.jq.find('.query_mc_feedback_correct_incorrect').html();
if (feedback_correct_incorrect === null) {
feedback_correct_incorrect = "";
}
// for Android and iOS we use attribute aria-live = 'polite'
// for
var aria_live = (platform.android || platform.ios) ? ' aria-live="polite" ' : '';
var role = (platform.android) ? ' role="presentation" ' : '';
var html = '
' +
'
' + this.feedbackTitle + '
';
var feedback = '';
// GENERAL feedback if there
if (question.md.feedback) {
feedback += '
' + question.md.feedback + '
';
}
// CORRECT feedback if there and the answer is correct
if (is_correct && question.md.feedback_correct) {
feedback += '
';
}
// 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) {
var fbc = question.check_conditional(question.md.feedback_conditional[i]);
if (fbc) {
feedback += '
' + fbc + '
';
found_feedback_string = true;
break;
}
}
}
// Check for feedback HINT
if (!found_feedback_string && question.md.feedback_hint) {
feedback += '
' + question.md.feedback_hint + '
';
found_feedback_string = true;
}
}
// Check for feedback INCORRECT
if (!found_feedback_string && question.md.feedback_incorrect) {
feedback += '