//========================================================================= 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_Glossary_hoverTerms: "on", initialize_sections: function() { this._super(); // anything that needs to be done before the page displays // should be done here. var matches; // Problems in each section: for questions with
" + li_html + "
"; $(this).html(li_html);//alert ($(this).html()); }); }); $("[data-block_type='contents_fig']").each(function(index,element) { var $this = $(this); var $contentsFig = $(element); var img_src = $contentsFig.find("img").attr('src'); $this.css('background', '#000 url('+ img_src +') no-repeat'); $this.css('background-size', '205px 205px'); $this.css('background-position', 'center'); }); $("[data-block_type='briefcontents_fig']").each(function(index,element) { var $this = $(this); var $contentsFig = $(element); var img_src = $contentsFig.find("img").attr('src'); $this.css('background', '#000 url('+ img_src +') no-repeat'); $this.css('background-size', '122px 122px'); }); // module number $("h2").each(function() { var $this = $(this); var this_html = $this.html(); //var matches; if (matches = this_html.match(/Module (\d+):\s+(.*)/) != null) { matches = this_html.match(/Module (\d+):\s+(.*)/); var modNum = matches[1]; var modTitle = matches[2]; modTitle.replace(/<\/span>/,""); //modTitle = modTitle.replace(/\[(\/?em)\]/g,"<$1>"); //alert (modNum + " " + modTitle); modTitle = modTitle.replace (/ /," "); this_html = this_html.replace(/Module (\d+):\s+(.*)/, ""+modNum +""+modTitle+""); $this.css('vertical-align', 'text-top'); $this.css('white-space', 'nowrap'); $this.css('height','auto'); } if (matches = this_html.match(/BUSINESS CASE:/i) != null) { this_html = ""; $this.css('background-image','none'); $this.css('display', 'none'); } if (matches = this_html.match(/Module\s+(\d+)\s+(Review)/i) != null) { this_html = this_html.replace(/Module\s+(\d+)\s+(Review)/i, "$1"); } if (matches = this_html.match(/Section\s+(\d+)\s+Review/) != null) { this_html = this_html.replace(/Section\s+(\d+)\s+(Review)/, "$1"); //var img_src = 'http://digfir.macmillanusa.com/asset/krugmanwellsmodulesmicro3/pics/section_review.png'; //var img_src = 'asset/pics/section_review.png'; //$this.css('background', '#fff url('+ img_src +') no-repeat'); //$this.css('background-position', 'center'); } if (this_html.match("(Summary|Key Terms|Problems)")) { $this.addClass("section_review_subhead_1"); $this.css('background','#fff url(asset/pics/section_subhead_bk.png) no-repeat'); $this.css('color', '#00A899'); $this.css('margin', '0px'); $this.css('padding-left', '50px'); if (this_html.match("Summary")) { $this.css('padding-top', '20px'); $this.css('height', '108px'); } } this_html = this_html.replace(/\[(\/?em)\]/g,"<$1>"); $this.html(this_html); }); // Pitfalls title, world business, questions for thought $("h3").each(function() { var $this = $(this); var this_html = $this.html(); if (this_html.match(/PITFALLS:?\s?(.*)/)) { this_html = this_html.replace(/PITFALLS:?\s?(.*)/i, " "); } if (this_html.match(/(!world! )?BUSINESS CASE: ?/i)!=null) { var world = "_case"; if (this_html.match(/!world!/)) {world = "_world";} this_html = this_html.replace(/(!world! )?BUSINESS CASE: ?/i, ""); this_html = this_html.replace(/!world! ?/i, ""); var urlText = "http://digfir.macmillanusa.com/asset/krugmanwellsmodulesmicro3/pics/business" + world + ".png"; $this.css('background', '#fff url('+ urlText+') no-repeat'); //alert ("business world background image url: " + urlText); //$this.addClass("business_case"); //$this.css('vertical-align', 'middle'); //$this.css('height','45px'); } if (this_html.match(/!world_eia!/i)!=null) { this_html = this_html.replace(/!world_eia!/i, ""); var urlText = "http://digfir.macmillanusa.com/asset/krugmanwellsmodulesmicro3/pics/eia_world_box_logo.jpg"; $this.css('background', '#fff url('+ urlText+') no-repeat'); } if (this_html == "") { // qft has empty h3 that holds space in html //this_html = 'empty h3'; $this.css('display', 'none'); } $this.html(this_html); }); /******** // table //$1-$2
$3
" + img_title + "
"); } }else { if ($this.attr("data-block_type")=="mod_open_fig") { //alert ("found mod_open_fig"); var source_div = $fig.find("div").attr("data-type"); $fig.find("div").attr("data-type","asset_source_open_fig"); //alert ($fig.find("div").attr("data-type")); } } }); }, // initialize_sections: end //========================================================================= initialize: function(id) { this._super(id); this.xrefs = new XRefs_manuscript_subtype(); // allow data-width for figures this.figures = new Figures_manuscript_subtype({auto_html: true}); this.glossary = new Glossary_manuscript_subtype(); }, //========================================================================= initialize2: function() { this._super(); // anything that you can do after the page displays // should be done here. // enable target="_pop" in xml var link_handler = new LinkHandler(); var modInSection = ["","01","01","01","01", // Section 1 "02","02","02", // 2 "03","03","03", // 3 "04","04", "05","05","05", "06","06", "07","07","07", "08","08","08", "09","09","09","09", "10","10","10", "11","11","11","11","11", "12","12","12","12", "13","13","13", "14","14"]; $("[data-type='figure']").each(function(index, element) { var $this = $(this); var $thisFig = $(element); var thisFigId = $thisFig.attr('data-figure-id'); thisFigId = thisFigId + ","; var figSize = ""; var regexp = new RegExp (thisFigId, 'i'); //alert ( " -- checking " + thisFigId + "\nimagesSmall: " + imagesSmall + "\nimagesMedium: " + imagesMedium + "\nimagesLarge: " + imagesLarge + "\nimagesXlarge: " + imagesXlarge + "\nimagesXXlarge: " + imagesXXlarge); if (imagesSmall.match(regexp) != null) {figSize = "small";} if (imagesMedium.match(regexp) != null) {figSize = "medium";} if (imagesLarge.match(regexp) != null) {figSize = "large";} if (imagesXlarge.match(regexp) != null) {figSize = "xlarge";} if (imagesXXlarge.match(regexp) != null) {figSize = "xxlarge";} if (figSize.match(/(small|medium|large|xlarge|xxlarge)/) ) { $thisFig.attr('data-layout-width',figSize); //alert (" Re-size figure " + thisFigId + " to " + figSize ); } }); } // end of initilized2 }); // var Player_subtype = Player_manuscript_type.extend _END_ player = new Player_subtype();