";
// удалим название секции
$manuscriptNode.find('h1.section-title').remove();
$manuscriptNode.prepend( html );
html = "";
$(html).insertAfter('.top-banner');
$('title').html(this.replacer($('title').html(), '<em>', ''));
$('title').html(this.replacer($('title').html(), '</em>', ''));
//$('.top-banner').append( html );
},
replacer: function(string, symbol_to_replace, symbol_to_replace_with) {
return string.split(symbol_to_replace).join(symbol_to_replace_with);
},
initialize2: function() {
this._super();
var $notes = $('p[data-block_type="note"]');
for (var i = 0; i < $notes.length; i++) {
var note_text = $notes[i].innerHTML;
$notes[i].innerHTML = 'Marginal note. ' + note_text;
}
var $h1 = $('h1');
for (var i = 0; i < $h1.length; i++) {
if ($h1[i].innerHTML === '') {
$($h1[i]).remove();
}
}
}
});
module.exports = project_player;
/***/ }),
/* 17 */,
/* 18 */
/***/ (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;
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var common = __webpack_require__(0);
var dom = __webpack_require__(2);
var platform = __webpack_require__(1).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 += '
";
// удалим название секции
$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 += '