var Player_subtype = Player_manuscript_type.extend({
cfg_LH_ebookTargetDefault: "_pop",
cfg_LH_internalTargetDefault: "_pop",
internalTargetDefault: "_pop",
option_RemoveRawHTMLDivs: true,
initialize_sections: function() {
this._super();
var ch_num = $("#manuscript").data("chapter-number");
$("[data-type='section']").each(function(index, element) {
var jq = $(element);
$("[data-type='section']").prepend("
");
var page = jq.data('print_page');
if (page !== undefined) {
if (match = page.match(/([^-]+)-([^"]+)/)) {
$(".page_num").prepend("A History of Western Society: Printed Page " + match[1] + "
A History of Western Society, Value Edition: Printed Page " + match[2] + "
");
}
}
});
var $fullp = $(".fullp");
var fullp_text = $fullp.text();
var $valuep = $(".valuep");
var valuep_text = $valuep.text();
if (fullp_text.match(/A History of Western Society: Printed Page 0/)) {
$fullp.remove();
}
if (match = valuep_text.match(/A History of Western Society, Value Edition: Printed Page 0/)) {
$valuep.remove();
}
/* add open supp to tables */
$('[data-mmsrc^="tables/"]').each(function() {
var jq = $(this);
var start = jq.attr("data-mmsrc");
var match = start.match(/(tables)\/(table\d+_\d+\.html)/);
jq.click(function() {
return xBookUtils.openSuppWin({url: "asset/" + match[1] + "/" + match[2]});
}).css("cursor", "pointer");
});
if ($('[data-block_type="sect_intro_ap"]').length > 0) {
$('body').addClass('sect_intro_ap');
$('div.page_num').remove();
}
if ($('[data-block_type="ap_fm"]').length > 0) {
$('body').addClass('ap_fm');
$('div.page_num').remove();
}
if ($('[data-block_type="ap_fm2"]').length > 0) {
$('body').addClass('ap_fm2');
$('div.page_num').remove();
}
if ($('[data-block_type="ch_intro"]').length > 0) {
$('body').addClass('intro');
$("h2").remove();
var $title = $('[data-block_type="title"]');
var title_text = $title.text();
if (match = title_text.match(/(\d+) (.*)/)) {
$title.html(match[1]);
$title.after("" + match[2] + "
");
}
}
if ($('[data-block_type="src_intro"]').length > 0) {
$('body').addClass('intro src');
var chapter = $('#manuscript').attr('data-chapter-number');
//$("h2").remove();
//var $title = $('[data-block_type="title"]');
//var title_text = $title.text();
/*if (match = title_text.match(/(\d+) (.*)/)) {
$title.html(match[1]);
$title.after("" + match[2] + "
");
}*/
$("h2").before('Documents from
Sources for Western Society
Chapter ' + chapter + '
');
var $fullp = $(".fullp");
var fullp_text = $fullp.text();
if (match = fullp_text.match(/A History of Western Society: Printed Page (\d+)/)) {
$fullp.text("Sources for a History of Western Society: Printed Page " + match[1]);
}
$(".valuep").remove();
$(".chrono_link").remove();
$('div[data-block_type="c_st"]').remove();
}
if ($('[data-block_type="src_convo"]').length > 0) {
$('body').addClass('src_convo sources_convo');
var $h2 = $("h2");
var h2_text = $h2.text();
if (match = h2_text.match(/(Sources in Conversation): (The Great Depression in) (Great Britain and Germany)/)) {
var title = match[1].toUpperCase();
$h2.html(title);
$h2.after("" + match[2] + "
" + match[3] + "
");
}
else if (match = h2_text.match(/(Sources in Conversation): (.*)/)) {
var title = match[1].toUpperCase();
$h2.html(title);
$h2.after("" + match[2] + "
");
}
var $fullp = $(".fullp");
var fullp_text = $fullp.text();
if (match = fullp_text.match(/A History of Western Society: Printed Page (\d+)/)) {
$fullp.text("Sources for a History of Western Society: Printed Page " + match[1]);
}
$(".valuep").remove();
$(".chrono_link").remove();
}
if ($('[data-block_type="sources"][level="1"]').length > 0) {
$('body').addClass('sources');
var $fullp = $(".fullp");
var fullp_text = $fullp.text();
if (match = fullp_text.match(/A History of Western Society: Printed Page (\d+)/)) {
$fullp.text("Sources for a History of Western Society: Printed Page " + match[1]);
}
$(".valuep").remove();
$(".chrono_link").remove();
}
if ($('[data-block_type="sources"][level="2"]').length > 0) {
$('body').addClass('sources');
var $h2 = $("h2");
var h2_text = $h2.text();
var $title = $('[data-block_type="sel_au_t_dtv1"] p');
var title_html = $title.html();
var $sub_title = $('[data-block_type="sel_subt"] p');
var sub_title_html = $sub_title.html();
if (match = h2_text.match(/Document (\d+-\d+): (.*)/)) {
$h2.after('' + match[1] + ' | | ' + sub_title_html + ' |
| ' + title_html + ' |
');
$h2.remove();
$title.remove();
$sub_title.remove();
} else if (match = h2_text.match(/(Comparative and Discussion Questions)/)) {
var title = match[1].toUpperCase();
$h2.html('■ ' + title + ' ■').addClass('center');
}
var $fullp = $(".fullp");
var fullp_text = $fullp.text();
if (match = fullp_text.match(/A History of Western Society: Printed Page (\d+)/)) {
$fullp.text("Sources for a History of Western Society: Printed Page " + match[1]);
}
$(".valuep").remove();
$(".chrono_link").remove();
}
if ($('[data-block_type="sources"][level="3"]').length > 0) {
$('body').addClass('sources_convo');
$('[data-block_type="sources"]').prepend("SOURCES IN CONVERSATION
");
var $h2 = $("h2");
var h2_text = $h2.text();
var $title = $('[data-block_type="sel_au_t_dtv1"] p');
var title_html = $title.html();
if (title_html !== null) {
if (match = h2_text.match(/Document (\d+-\d+): (.*?), (.*)/)) {
var author = match[2].toUpperCase();
$h2.after('' + match[1] + ' | | ' + author + ', ' + title_html + ' |
');
$h2.remove();
$title.remove();
}
else if (match = h2_text.match(/Document (\d+-\d+): (.*?: )(.*)/)) {
$h2.after('' + match[1] + ' | | ' + match[2] + match[3] + ' |
');
$h2.remove();
$title.remove();
}
else if (match = h2_text.match(/Document (\d+-\d+): (.*)/)) {
$h2.after('' + match[1] + ' | | ' + title_html + ' |
');
$h2.remove();
$title.remove();
}
}
else if (match = h2_text.match(/Document (\d+-\d+): (.*)/)) {
$h2.after('' + match[1] + ' | | ' + match[2] + ' |
');
$h2.remove();
}
var $fullp = $(".fullp");
var fullp_text = $fullp.text();
if (match = fullp_text.match(/A History of Western Society: Printed Page (\d+)/)) {
$fullp.text("Sources for a History of Western Society: Printed Page " + match[1]);
}
$(".valuep").remove();
$(".chrono_link").remove();
}
if ($('[data-block_type="prim_src"]').length > 0) {
$("body").addClass('prim_src');
var $h2 = $("h2");
var h2_text = $h2.text();
if (match = h2_text.match(/Primary Source (\d+\.\d+): (.*)/)) {
$h2.html('PRIMARY SOURCE ' + match[1]);
$h2.after("" + match[2] + "
");
$h2.before('');
}
$('div[data-block_type="bx_v2_fn_v0"]').eq(0).css('margin-top', '2em');
}
if ($('[data-block_type="litp"]').length > 0) {
$('body').addClass('living_past');
var $h2 = $("h2");
var h2_text = $h2.text();
if (match = h2_text.match(/(Living in the Past): (.*)/)) {
$h2.html('LIVING IN THE PAST');
$h2.after("" + match[2] + "
");
}
$('div[data-block_type="bx_v3_fn_v0"]').eq(0).css('margin-top', '2em');
}
if ($('[data-block_type="pln"]').length > 0) {
$('body').addClass('living_now');
var $h2 = $("h2");
var h2_text = $h2.text();
if (match = h2_text.match(/(The Past Living Now): (.*)/)) {
$h2.html('THE PAST LIVING NOW');
$h2.after("" + match[2] + "
");
}
$('div[data-block_type="bx_v5_fn_v0"]').eq(0).css('margin-top', '2em');
}
if ($('[data-block_type="map_past"]').length > 0) {
$('body').addClass('map_past');
$('[data-type="figure_text"]').wrapAll('');
var $h2 = $("h2");
var h2_text = $h2.text();
var $img = $("img");
if (match = h2_text.match(/(Mapping the Past)/)) {
$h2.remove();
$(".ft_container").prepend("MAPPING THE PAST
");
}
}
if ($('[data-block_type="quiz"]').length > 0) {
$('body').addClass('quiz');
}
//if ($('[data-block_type="mp_box"]').length > 0) {
$('[data-block_type="mp_box"] [data-type="figure_text"]').wrapAll('');
var $h3 = $('[data-block_type="mp_box"] h3');
var h3_text = $h3.text();
var $img = $("img");
if (match = h3_text.match(/(MAPPING THE PAST)/)) {
$h3.remove();
$(".ft_container").prepend("MAPPING THE PAST
");
}
//}
if ($('[data-block_type="ind_soc"]').length > 0) {
$('body').addClass('ind_soc');
var $h2 = $("h2");
var h2_text = $h2.text();
if (match = h2_text.match(/(Individuals in Society): (.*)/)) {
$h2.html('INDIVIDUALS IN SOCIETY');
$h2.after("" + match[2] + "
");
}
$('div[data-block_type="bx_v2_fn_v0"]').eq(0).css('margin-top', '2em');
$('div[data-block_type="bx_v1_fn_v0"]').eq(0).css('margin-top', '2em');
}
if ($('[data-block_type="oda"]').length > 0) {
$('[data-block_type="oda"]').addClass('oda');
var $oda_title = $('[data-block_type="bx_v1_h2"]');
var oda_title_text = $('[data-block_type="bx_v1_h2"] p').html();
var $oda_ques = $('[data-block_type="h2_txt"]');
var oda_ques_text = $('[data-block_type="h2_txt"] p').html();
$('.oda [data-type="box_inner"]').prepend(' | ' + oda_title_text + ' |
' + oda_ques_text + ' |
');
$oda_title.remove();
$oda_ques.remove();
}
if ($('#supp_win').length > 0) {
$(".page_num").remove();
}
if ($('[data-block_type="vol_intro"]').length > 0) {
$('body').addClass('vol_intro');
var $h2 = $("h2");
var h2_text = $h2.text();
if (match = h2_text.match(/(Introduction): (The Origins of Modern Western Society)/)) {
$h2.html(match[1]);
$h2.after("" + match[2] + "
");
}
$(".page_num").remove();
}
if ($('[data-block_type="lbla"]').length > 0) {
$('body').addClass('lbla');
var $h2 = $("h2");
var h2_text = $h2.text();
if (match = h2_text.match(/(Looking Back) (Looking Ahead)/)) {
$('[data-block_type="lbla"]').prepend(' | LOOKING BACK |
LOOKING AHEAD |
');
$h2.remove();
}
$('div[data-block_type="bx_v1_fn_v0"]').eq(0).css('margin-top', '2em');
if ($('[data-block_type="oda"]').length > 0) {
$('[data-type="box"]').addClass('oda');
var $e_img = $(".oda img");
$(".oda").prepend($e_img);
}
}
if ($('[data-block_type="review"]').length > 0 || $('[data-block_type="review_nq"]').length > 0) {
$('body').addClass('review');
var $h2 = $("h2");
var h2_text = $h2.text();
if (match = h2_text.match(/(Review and Explore)/)) {
$h2.html('REVIEW and EXPLORE');
} else if (match = h2_text.match(/(.*)/)) {
$h2.html('REVIEW and EXPLORE');
$h2.after("" + match[1] + "
");
}
var $li = $('[data-block_type="resources"] li');
$li.wrapInner('');
}
if ($('[data-block_type="about"]').length > 0) {
$('body').addClass('about');
var $h2 = $("h2");
var h2_text = $h2.text();
if (match = h2_text.match(/(Preface): (Why This Book This Way)/)) {
$h2.text(match[1]);
$h2.after("" + match[2] + "
");
}
if (match = h2_text.match(/(About the Authors)/)) {
$('body').addClass('authors');
$h2.text(match[1].toUpperCase());
}
$(".chrono_link").remove();
}
if ($('[data-block_type="about_src"]').length > 0) {
$('body').addClass('about_src');
var $h2 = $("h2");
var h2_text = $h2.text();
var $fullp = $(".fullp");
var fullp_text = $fullp.text();
if (match = fullp_text.match(/A History of Western Society: Printed Page (\d+)/)) {
$fullp.text("Sources for a History of Western Society: Printed Page " + match[1]);
}
$(".valuep").remove();
$(".chrono_link").remove();
}
/* remove width/height attributes from