s around rawhtml
removeRawHtmlDivs: "off",
// set to "on" to enable 'show answer' button
showAnswer: "off",
// set to "off" to turn off auto wrapping of answers embedded in xml
showAnswerWrapThis: "on",
// set to "on" to automatically move box title (h3) out of inner box
Box_moveTitle: "off",
// block_types (separated by commas)
Box_moveTitleExclude: "",
show_section_animate: function(section_to_show, direction) {
// make sure modal window is closed
$("#toc_dialog").dialog("close");
// slide in using parent function
this._super(section_to_show, direction);
// update slide_number and title
$(".slide_title").html(this.get_current_section().title);
$(".slide_number").find("span").html((section_to_show+1) + " of " + this.sections.length + " ");
// if this is the first/last section, dim the previous/next button
if (this.section_currently_showing == 0) {
$(".previous_button").addClass("button_dimmed");
} else {
$(".previous_button").removeClass("button_dimmed");
}
if (this.section_currently_showing == (this.sections.length - 1)) {
$(".next_button").addClass("button_dimmed");
} else {
$(".next_button").removeClass("button_dimmed");
}
$(document).trigger('df-content-rendered'); //added as DF-57
},
show_navigation: function() {
// if there are no subsections, there's no navigation to show
if (this.sections.length == 1) {
return;
}
var table = "
"
+ ""+ UI_Elements.get_button_html({
extra_class: "toolbar_button prev_next_buttons previous_button",
label: this.md.previous_page_button,
fn: 'player.show_section("previous")'
}) + " | "
+ ""+ UI_Elements.get_button_html({
extra_class: "toolbar_button slide_number",
label: "1 of " + this.sections.length,
fn: 'player.show_toc()'
}) + " | "
+ ""+ UI_Elements.get_button_html({
extra_class: "toolbar_button prev_next_buttons next_button",
label: this.md.next_page_button,
fn: 'player.show_section("next")'
}) + " | "
+ "
"
$("#manuscript").prepend("
" + table + "
");
$("#manuscript").append("
" + table + "
");
$("#toolbar").show();
// icons for toolbar and next buttons...
$('.previous_button').button({
icons: {
primary: "ui-icon-circle-triangle-w"
}
});
$('.next_button').button({
icons: {
secondary: "ui-icon-circle-triangle-e"
}
});
$('.slide_number').button({
icons: {
secondary: "ui-icon-circle-triangle-s"
}
});
// activate all other buttons
UI_Elements.activate_buttons();
},
show_toc: function() {
$("#toc_dialog").remove();
var html = "";
for (var i = 0; i < this.sections.length; ++i) {
var s = this.sections[i];
var extra_style = "";
if (this.md.sequenced_sections == "true" && i > this.last_available_section) {
extra_style = "toc_section_not_available";
}
html += ""
;
}
if (this.md.sequenced_sections == "true") {
html = "
Click on a slide to view it. Note: Grey slides are not accessible until preceding slides have been viewed or completed.
" + html;
}
html = "
" + html + "
";
$("body").append(html);
$("#toc_dialog").dialog({title:"Jump To...", width:450, modal:true, buttons: [ {text:"OK", click: function() {$("#toc_dialog").dialog("close");}}]});
},
extract_activity_metadata: function() {
this._super();
this.required_metadata_val("next_page_button", "Read on!", true);
this.required_metadata_val("previous_page_button", "Back up", true);
// by default we do not require students to go through slides in order,
// and we restore them to their last-viewed slide when they return.
this.required_metadata_val("sequenced_sections", "false");
this.required_metadata_val("restore_last_viewed_section", "true");
this.required_metadata_val("section_sequence_message", "You must read each page, and complete any questions on the page, in sequence.");
},
initialize_sections: function() {
// Added by Bruce 11/03/2013
// Save original ID on each section to data-sec-id before _super replaces it.
$('[data-type="section"]').each(function() {
var $this = $(this);
$this.attr('data-sec-id', $this.attr('id'));
});
this._super();
// Add class to body if we are viewing page in supp window
(function() {
try {
var $supp_iframe = $('#xBookSuppWinNavPageFrame', window.parent.document);
if ($supp_iframe.length != 0) {
$("body").addClass("xBookSuppWinNavPage");
}
}
catch(err) { }
})();
if (this.removeRawHtmlDivs === "on") {
$('[data-type="rawhtml"]').each(function() {
var $this = $(this);
var raw_content = $this.contents();
$this.replaceWith(raw_content);
});
}
var boxMoveTitle = this.Box_moveTitle;
if (boxMoveTitle === "all") {
var excludes_array = this.Box_moveTitleExclude.split(",");
$('[data-type="box"]').each(function() {
$this = $(this);
var block_type = $this.attr('data-block_type');
if (!xBookUtils.emptyValue(block_type)) {
if ($.inArray(block_type, excludes_array) >= 0) {
return;
}
}
$this.each(xBookUtils.moveBoxTitle);
});
}
else if (boxMoveTitle !== "off") {
var includes_array = this.Box_moveTitle.split(",");
$('[data-type="box"]').each(function() {
$this = $(this);
var block_type = $this.attr('data-block_type');
if (!xBookUtils.emptyValue(block_type)) {
if ($.inArray(block_type, includes_array) >= 0) {
$this.each(xBookUtils.moveBoxTitle);
}
}
});
}
if (this.showAnswer === "on") {
// Add click handler for show answer buttons
$('.show_answer_button').live("click", function() {
$this = $(this);
// Show Answer button must have a target (this should
// always be the case but we'll check anyway)
var target_id = $this.attr('data-target');
if (xBookUtils.emptyValue(target_id)) {
safe_log("showAnswer: no target set on button");
return;
}
// Make sure target(answer) container exists
var $container = $("#" + target_id);
if ($container.length < 1) {
safe_log("showAnswer: target #" + target_id + " does not exist");
return;
}
// Toggle the 'show_answer_button_on' class for both the
// button and the answer container
$this.toggleClass('show_answer_button_on');
$container.toggleClass('show_answer_button_on');
});
// Look for any elements with data-show-answer
var wrap_answer = this.showAnswerWrapThis;
$('[data-show-answer]').each(function() {
var $this = $(this);
// If we've already found an answer for this element we are done
if ($this.attr('data-found-show-answer') === "true") {
return;
}
var answer_id = $this.attr('id');
var type = $this.attr('data-show-answer');
if (type === "this") {
var this_wrap = $this.attr('data-show-answer-wrap');
$this.attr('data-found-show-answer', "true");
// Do we need to wrap this answer in a box?
if ((wrap_answer === "on" && this_wrap !== "false") ||
this_wrap === "true") {
$this.before("
");
$this.wrap(function() {
return "
";
});
$this.before("
");
}
else {
$this.before("
");
$this.addClass('show_answer_container');
}
}
else if (type === "array") {
// Check if answer is stored in xBookUtils.showAnswers array
$this.each(xBookUtils.checkShowAnswer);
}
});
} // end showAnswer === "on"
}, // end initialize_sections
initialize: function(id) {
var $body = $('body');
if (xBookUtils.inBrainhoneyPlayer()) {
$body.addClass('bh_html_quiz_ebook');
}
// We need to do this before _super because the original XRefs.create_links
// will wipe out any custom data-attributes we have set on the link spans
// and it won't honor the target set in the XML.
//
// Really, we should change XRefs.create_links do everything that
// xBookUtils.create_links is doing and then it wouldn't be necessary
// to call this here or even extend XRefs in the first place.
xBookUtils.create_links($body);
this._super(id);
// set some global config variables
this.removeRawHtmlDivs = this.cfg_removeRawHtmlDivs || this.removeRawHtmlDivs;
this.showAnswer = this.cfg_showAnswer || this.showAnswer;
this.showAnswerWrapThis = this.cfg_showAnswerWrapThis || this.showAnswerWrapThis;
this.Box_moveTitle = this.cfg_Box_moveTitle || this.Box_moveTitle;
this.Box_moveTitleExclude = this.cfg_Box_moveTitleExclude || this.Box_moveTitleExclude;
// after we call this.super, re-initialize the activity to the custom
// activity type for this manuscript
this.activity = new Activity_manuscript_type();
},
initialize2: function() {
this._super();
// get brightcove videos using