and
to data-width
var fig_width = $.trim($figureDiv.attr('data-width'));
if (!xBookUtils.emptyValue(fig_width) && /^\d+$/.test(fig_width)) {
$figureDiv.attr('data-layout-width', '');
$image.attr('width', fig_width);
$figureDiv.css('width', fig_width + "px");
}
// Otherwise, if resizeDivWidth is requested then attach to each
// figure
else if (resize_div_width === "on") {
$figureDiv.imagesLoaded(function($images, $proper, $broken) {
$proper.each(function() {
var $image = $(this);
var $parent = $image.parent('[data-type="figure"]');
if ($parent.length != 0) {
var img_width = $image.width();
if (img_width > 0) {
$parent.css("width", img_width + "px");
}
}
});
});
}
}); // end each()
} // end init()
}); // end Figures_manuscript_subtype
var XRefs_manuscript_subtype = XRefs.extend({
create_links: function(jq) {
xBookUtils.create_links(jq);
}
});
var Player_subtype = Player_manuscript.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: "",
initialize_sections: function() {
// Do not delete this
this._super();
// Anything that needs to be done before the page displays
// should be done here.
}, // 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) {
var $body = $('body');
xBookUtils.create_links($body);
// 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() {
// Do not delete this
this._super();
safe_log("initialize2");
var link_handler = new LinkHandler();
// Anything that can be done after the page displays
// should be done here.
$('img').bind('contextmenu', function(e) {
return false;
});
} // end initialize2
}); // end Player_subtype
// Do not delete this
player = new Player_subtype();
/*
* jQuery imagesLoaded plugin v2.1.2
* http://github.com/desandro/imagesloaded
*
* MIT License. by Paul Irish et al.
*/
/*
This plugin allows you to execute a callback function once all of
the images on the page have been loaded:
$('#manuscript').imagesLoaded(callback);
*/
(function(c,q){var m="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";c.fn.imagesLoaded=function(f){function n(){var b=c(j),a=c(h);d&&(h.length?d.reject(e,b,a):d.resolve(e));c.isFunction(f)&&f.call(g,e,b,a)}function p(b){k(b.target,"error"===b.type)}function k(b,a){b.src===m||-1!==c.inArray(b,l)||(l.push(b),a?h.push(b):j.push(b),c.data(b,"imagesLoaded",{isBroken:a,src:b.src}),r&&d.notifyWith(c(b),[a,e,c(j),c(h)]),e.length===l.length&&(setTimeout(n),e.unbind(".imagesLoaded",
p)))}var g=this,d=c.isFunction(c.Deferred)?c.Deferred():0,r=c.isFunction(d.notify),e=g.find("img").add(g.filter("img")),l=[],j=[],h=[];c.isPlainObject(f)&&c.each(f,function(b,a){if("callback"===b)f=a;else if(d)d[b](a)});e.length?e.bind("load.imagesLoaded error.imagesLoaded",p).each(function(b,a){var d=a.src,e=c.data(a,"imagesLoaded");if(e&&e.src===d)k(a,e.isBroken);else if(a.complete&&a.naturalWidth!==q)k(a,0===a.naturalWidth||0===a.naturalHeight);else if(a.readyState||a.complete)a.src=m,a.src=d}):
n();return d?d.promise(g):g}})(jQuery);
/*
* Purl (A JavaScript URL parser) v2.3.1
* Developed and maintanined by Mark Perkins, mark@allmarkedup.com
* Source repository: https://github.com/allmarkedup/jQuery-URL-Parser
* Licensed under an MIT-style license. See https://github.com/allmarkedup/jQuery-URL-Parser/blob/master/LICENSE for details.
*/
;(function(factory){if(typeof define==='function'&&define.amd){define(factory)}else{window.purl=factory()}})(function(){var tag2attr={a:'href',img:'src',form:'action',base:'href',script:'src',iframe:'src',link:'href',embed:'src',object:'data'},key=['source','protocol','authority','userInfo','user','password','host','port','relative','path','directory','file','query','fragment'],aliases={'anchor':'fragment'},parser={strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/},isint=/^[0-9]+$/;function parseUri(url,strictMode){var str=decodeURI(url),res=parser[strictMode||false?'strict':'loose'].exec(str),uri={attr:{},param:{},seg:{}},i=14;while(i--){uri.attr[key[i]]=res[i]||''}uri.param['query']=parseString(uri.attr['query']);uri.param['fragment']=parseString(uri.attr['fragment']);uri.seg['path']=uri.attr.path.replace(/^\/+|\/+$/g,'').split('/');uri.seg['fragment']=uri.attr.fragment.replace(/^\/+|\/+$/g,'').split('/');uri.attr['base']=uri.attr.host?(uri.attr.protocol?uri.attr.protocol+'://'+uri.attr.host:uri.attr.host)+(uri.attr.port?':'+uri.attr.port:''):'';return uri}function getAttrName(elm){var tn=elm.tagName;if(typeof tn!=='undefined')return tag2attr[tn.toLowerCase()];return tn}function promote(parent,key){if(parent[key].length===0)return parent[key]={};var t={};for(var i in parent[key])t[i]=parent[key][i];parent[key]=t;return t}function parse(parts,parent,key,val){var part=parts.shift();if(!part){if(isArray(parent[key])){parent[key].push(val)}else if('object'==typeof parent[key]){parent[key]=val}else if('undefined'==typeof parent[key]){parent[key]=val}else{parent[key]=[parent[key],val]}}else{var obj=parent[key]=parent[key]||[];if(']'==part){if(isArray(obj)){if(''!==val)obj.push(val)}else if('object'==typeof obj){obj[keys(obj).length]=val}else{obj=parent[key]=[parent[key],val]}}else if(~part.indexOf(']')){part=part.substr(0,part.length-1);if(!isint.test(part)&&isArray(obj))obj=promote(parent,key);parse(parts,obj,part,val)}else{if(!isint.test(part)&&isArray(obj))obj=promote(parent,key);parse(parts,obj,part,val)}}}function merge(parent,key,val){if(~key.indexOf(']')){var parts=key.split('[');parse(parts,parent,'base',val)}else{if(!isint.test(key)&&isArray(parent.base)){var t={};for(var k in parent.base)t[k]=parent.base[k];parent.base=t}if(key!==''){set(parent.base,key,val)}}return parent}function parseString(str){return reduce(String(str).split(/&|;/),function(ret,pair){try{pair=decodeURIComponent(pair.replace(/\+/g,' '))}catch(e){}var eql=pair.indexOf('='),brace=lastBraceInKey(pair),key=pair.substr(0,brace||eql),val=pair.substr(brace||eql,pair.length);val=val.substr(val.indexOf('=')+1,val.length);if(key===''){key=pair;val=''}return merge(ret,key,val)},{base:{}}).base}function set(obj,key,val){var v=obj[key];if(typeof v==='undefined'){obj[key]=val}else if(isArray(v)){v.push(val)}else{obj[key]=[v,val]}}function lastBraceInKey(str){var len=str.length,brace,c;for(var i=0;i
>0,curr=arguments[2];while(i" + $linkElement.html() + "");
});
}
xBookUtils.inPX = function() {
// Check if we are in the PX frame.
if (xBookUtils.inPXFrame()) {
return true;
}
// We could still be in a supp window in PX, so check the URL.
// P.S. Not sure if this is the most reliable way to check this?
if (/dlap\.bfwpub\.com/.test(window.location.href)) {
return true;
}
return false;
}
xBookUtils.inPXFrame = function() {
try {
if (top.PxPage) {
return true;
}
}
catch(err) { }
return false;
}
xBookUtils.ebookPage = function(url) {
if (/^[a-zA-Z0-9_\- ]+\.html([#\?].*)?$/.test(url)) {
return true;
}
return false;
}