xBookUtils.printDebugStatements = "on";
/*
This is the standard template you should add to your book JS file before
customizing.
Uncomment any of the configuration options to change the default behavior (see
https://macmillanhighered.atlassian.net/wiki/display/MP/Player+Configuration+Options
for descriptions of the options).
*/
/**************************************
Set this to the DF book ID (Subtype)
**************************************/
xBookUtils.bookID = "bsmtest2";
/*
You only need to set the disciplines if you are using the HTML Quiz
question delivery method, which only BSM ebooks are at this time
(in other words, if this is a FW ebook then you don't need to do a thing).
Change the zeros to the discipline number for each tier on PX.
Discipline numbers:
History: 6696 (all tiers)
Composition: 6698 (all tiers)
Communication: 6700 (all tiers)
College Success: 6704 (all tiers)
*/
xBookUtils.discipline = {
dev: 0,
qa: 0,
pr: 0,
www: 0
}
var Player_subtype = Player_manuscript_type.extend({
//cfg_removeRawHtmlDivs: "on",
//cfg_showAnswer: "on",
//cfg_showAnswerAutoWrapThis: "off",
//cfg_Box_moveTitle: "all",
//cfg_Box_moveTitleExclude: "",
//cfg_Figures_targetDefault: "_blank",
//cfg_Figures_resizeDivWidth: "off",
//cfg_Figures_autoHtml: "on",
//cfg_LH_autoHtml: "on",
//cfg_LH_externalTargetDefault: "_pop",
//cfg_LH_internalTargetDefault: "_pop",
//cfg_LH_ebookTargetDefault: "_pop",
//cfg_LH_imageTargetDefault: "_blank",
//cfg_LH_useLinksFile: "on",
//cfg_Glossary_hoverTerms: "on",
//cfg_Glossary_useStickyDiv: "on",
//cfg_Glossary_hoverTermsNoClick: "",
show_student_help: function(){
$("#student_help_modal").modal("show");
},
initialize_sections: function() {
// Do not delete this
this._super();
// Anything that needs to be done before the page displays
// should be done here.
/*
var html = "";
html+="
";
html+=""
html+="
";
$("#manuscript").prepend(html);
*/
}, // end initialize_sections
/*
You will most likely not make any changes to the initialize
method unless you know exactly what you are doing :-)
*/
initialize: function(id) {
// Do not delete this
this._super(id);
this.xrefs = new XRefs_manuscript_subtype();
this.glossary = new Glossary_manuscript_subtype();
this.figures = new Figures_manuscript_subtype();
this.tables = new Tables_manuscript_subtype();
}, // end initialize
initialize2: function() {
// Do not delete this
this._super();
// You will most likely not want to delete this
var link_handler = new LinkHandler();
$('[data-block_type="editable"]').each(function() {
$(this).attr('contenteditable', 'true');
});
// Anything that can be done after the page displays
// should be done here.
if (xBookUtils.getChapter() == 8) {
$("#manuscript").delegate('[data-block_type="crunchit"]','click', function(event) {
var $this = $(this);
var bookID = $this.attr('data-bookid');
if (xBookUtils.emptyValue(bookID)) {
bookID = xBookUtils.getBookId();
}
var dataset = $this.attr('data-dataset');
if (xBookUtils.emptyValue(dataset)) {
safe_log("Can't find dataset");
return;
}
safe_log("bookID: " + bookID + ", dataset: " + dataset);
if (xBookUtils.inPX()) {
top.PxPage.OpenSupp("crunchit", bookID, dataset);
}
else {
var url = "https://crunchit3.bfwpub.com/" + bookID + "?dataset=" + dataset;
top.window.open(url, dataset);
}
});
$("#manuscript").delegate('[data-block_type="dataset"]','click', function(event) {
var $this = $(this);
var file = $this.attr('data-file');
if (xBookUtils.emptyValue(file)) {
safe_log("DataSet: no file specified");
return;
}
var url = $this.attr('data-url');
if (xBookUtils.emptyValue(url)) {
safe_log("DataSet: no url specified");
return;
}
var offset = $this.offset();
ShowDataSets(file, url, offset);
});
}
//$('#test-table-1 table').alignColumn(0, {center: '.'});
//$('#test-table-1 table').alignColumn(1, {center: '*'});
//$('#test-table-1 table').alignColumn(2, {center: ','});
$("#psbe4e-ch01-untab-001 tbody tr td:nth-child(3)").attr("char", " x ");
$("#psbe4e-ch01-untab-001 tbody tr td:nth-child(4)").attr("char", " → ");
this.tables.align_columns();
} // end initialize2
}); // end Player_subtype
// Do not delete this
player = new Player_subtype();
function ShowDataSets(title, url, offset) {
safe_log("ShowDataSets");
// add dataset pop-in div if needed
if ($('#datasetpopin').length == 0) {
var $popin = $('
X
');
$('#manuscript').append($popin);
$popin.draggable({
cancel: ".dataset-content, .dataset-close",
handle: ".dataset-header"//,
//containment: "#manuscript"
});
$('#manuscript #datasetpopin .dataset-close').click(function() {
$('#datasetpopin').removeClass('show');
});
}
// the 'title' arg is either the file name of the TI-Calc dataset or the base
// name of all datasets (no extension)
// add a '/' to end of url if needed
if (url.charAt(url.length-1) != "/") {
url = url + "/";
}
var file_name = title;
//we need chapter number because of chapter subfolders.
var chapter = file_name.charAt(2) + file_name.charAt(3);
if (chapter[0] == '0') {
chapter = chapter.substr(1);
}
var ti_calc_ext = "8XM"; // default file extension for TI-Calc
// if the title passed in has an extension, then we need to grab the file name and ext
// brb - if the 'title' has an extension then it is the TI-Calc file name
if (title.match(/(.*)\.(.*)/)) {
file_name = RegExp.$1;
ti_calc_ext = RegExp.$2;
}
var dsbody = '