xBookUtils.turnQuestionIdCheckOff = "cowenmac3e";
/*
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).
*/
var Player_subtype = Player_manuscript_type.extend({
//cfg_removeRawHtmlDivs: "on",
cfg_displayImagesInSuppHtml: "on",
cfg_suppWinWidth: 700,
//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_Glossary_hoverTerms: "on",
cfg_Glossary_useStickyDiv: "on",
/*************************************************************************************/
/******************** Start Code for Instructor Notes and Outlines ***************/
/*************************************************************************************/
initialize_IR_popouts: function () {
$("[data-block_type=IR_content_popout]").each(function (index, element) {
var title = $(element).find("h3").html();
var id = $(element).attr("id");
var buttonHTML = "";
$(element).before(buttonHTML);
$("#button_for_" + id).button();
});
},
show_IR_popout: function (boxID) {
$("#" + boxID).dialog();
},
add_IR_toggle_button: function () {
if ($('[data-block_type="IR_content"]').length > 0 || $('[data-block_type="OL_content"]').length > 0) {
var html = "
Click to expand notes
";
$("#manuscript").append(html);
}
if ($('[data-block_type="IR_content"]').length > 0) {
var html = "
IN
Instructor Notes
";
$("#manuscript").append(html);
}
if ($('[data-block_type="OL_content"]').length > 0) {
var html = "
OL
Outline
";
$("#manuscript").append(html);
}
},
toggle_IR: function (type) {
var IR_class = "IR_content_" + type;
$('#manuscript').toggleClass(IR_class);
},
/*************************************************************************************/
/******************** End Code for Instructor Notes and Outlines ***************/
/*************************************************************************************/
/*************************************************************************************/
/*************************************************************************************/
/*************************************************************************************/
initialize_sections: function() {
// Do not delete this
this._super();
// Anything that needs to be done before the page displays
// should be done here.
var block_type = $("[data-type='section']").attr('data-block_type');
if (block_type=="appendix") {
$("h2").each(function(){
var $this = $(this);
var this_html = $this.html();
this_html = this_html.replace(/CHAPTER (\d+) APPENDIX (.*)/, "CHAPTER $1 APPENDIX$2");
$this.html(this_html);
})
}else if(block_type=="intro") {
$("h2").each(function(){
var $this = $(this);
var this_html = $this.html();
this_html = this_html.replace(/(\d+) (.*)/, "$1 $2");
$this.html(this_html);
})
}else if (block_type="appendix_ques_title") {
$("h2").each(function(){
var $this = $(this);
var this_html = $this.html();
this_html = this_html.replace(/CHAPTER (\d+) APPENDIX QUESTIONS/, "CHAPTER $1 APPENDIX QUESTIONS");
$this.html(this_html);
})
}
if (block_type="takeaway") {
$("h2").each(function(){
var $this = $(this);
var this_html = $this.html();
this_html = this_html.replace(/Takeaway/, "Takeaway");
$this.html(this_html);
})
}
if (block_type="chapter_review") {
$("h2").each(function(){
var $this = $(this);
var this_html = $this.html();
this_html = this_html.replace(/CHAPTER REVIEW/, "CHAPTER REVIEW");
$this.html(this_html);
})
}
if (block_type="key_concepts") {
$("h3").each(function(){
var $this = $(this);
var this_html = $this.html();
this_html = this_html.replace(/KEY CONCEPTS/, "KEY CONCEPTS");
$this.html(this_html);
})
}
if (block_type="facts_and_tools") {
$("h2").each(function(){
var $this = $(this);
var this_html = $this.html();
this_html = this_html.replace(/FACTS AND TOOLS/, "FACTS AND TOOLS");
$this.html(this_html);
})
}
if (block_type="thinking") {
$("h2").each(function(){
var $this = $(this);
var this_html = $this.html();
this_html = this_html.replace(/THINKING AND PROBLEM SOLVING/, "THINKING AND PROBLEM SOLVING");
$this.html(this_html);
})
}
if (block_type="challenges") {
$("h2").each(function(){
var $this = $(this);
var this_html = $this.html();
this_html = this_html.replace(/CHALLENGES/, "CHALLENGES");
$this.html(this_html);
})
}
if (block_type="check") {
$("h3").each(function(){
var $this = $(this);
var this_html = $this.html();
this_html = this_html.replace(/CHECK YOURSELF/, "CHECK YOURSELF");
$this.html(this_html);
})
}
if (block_type="work_it_out") {
$("h3").each(function(){
var $this = $(this);
var this_html = $this.html();
this_html = this_html.replace(/\!launch\! WORK IT OUT/, "WORK IT OUT");
$this.html(this_html);
})
}
//Figures
// Find every figure on the page and add the figure title header if defined
// also check for pixel width
$("[data-type='figure']").each(function(index, element) {
// save the figure div in $fig
var $fig = $(element);
// get title for this image
var img_title = $fig.find("img").attr('title');
// if we have a title then add the header
if (img_title != "") {
// add the necessary spans for styling
img_title = img_title.replace(/(FIGURE) (\d+A.\d+) (.*)/, "$1$2$3");
img_title = img_title.replace(/(FIGURE) (\d+.\d+) (.*)/, "$1$2$3");
img_title = img_title.replace(/(TABLE) (\d+.\d+) (.*)/, "$1$2$3");
img_title = img_title.replace(/(.*)/, "$1");
// add header as
tag immediately before the figure div
$fig.prepend("
" + img_title + "
");
}
/*var width = $fig.data('layout-width') + "x";
var match = width.match(/(\d+)/);
if (match !== null) {
$fig.attr('style',"width:" + match[1] + "px");
var $img = $fig.children("img");
$img.attr('style',"width:" + match[1] + "px");
}*/
});
}, // end initialize_sections
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();
}, // end initialize
initialize2: function() {
//*****************************************************************************//
//**This code added to support Instructor Notes and Outlines**//
//*****************************************************************************//
if (this.ARGA_running) {
if (Get_ARGA_Data("user_rights") == "3_instructor") {
this.initialize_IR_popouts();
this.add_IR_toggle_button();
}
} else {
this.initialize_IR_popouts();
this.add_IR_toggle_button();
}
/* set up click handler for IR list items */
$('[data-IR-type="IN"] p [data-block_type="item"]').click(function() {
var $this = $(this);
var $p_parent = $this.parent('p');
$p_parent.toggleClass("show");
});
/* set up click handler for OL list items */
$('[data-IR-type="OL"] p [data-block_type="item"]').click(function() {
var $this = $(this);
var $p_parent = $this.parent('p');
$p_parent.toggleClass("show");
});
//*****************************************************************************//
//*****************************************************************************//
//*****************************************************************************//
// Do not delete this
this._super();
var link_handler = new LinkHandler();
// Anything that can be done after the page displays
// should be done here.
} // end initialize2
}); // end Player_subtype
// Do not delete this
player = new Player_subtype();