1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +02:00

Updated Expands and Layout methods

This commit is contained in:
Fred Chasen 2015-05-24 09:44:35 -04:00
parent 6b25126f00
commit b88aab25d9
14 changed files with 1116 additions and 766 deletions

View file

@ -88,4 +88,34 @@ EPUBJS.Section.prototype.render = function(_request){
EPUBJS.Section.prototype.find = function(_query){
};
/**
* Reconciles the current chapters layout properies with
* the global layout properities.
* Takes: global layout settings object, chapter properties string
* Returns: Object with layout properties
*/
EPUBJS.Section.prototype.reconcileLayoutSettings = function(global){
//-- Get the global defaults
var settings = {
layout : global.layout,
spread : global.spread,
orientation : global.orientation
};
//-- Get the chapter's display type
this.properties.forEach(function(prop){
var rendition = prop.replace("rendition:", '');
var split = rendition.indexOf("-");
var property, value;
if(split != -1){
property = rendition.slice(0, split);
value = rendition.slice(split+1);
settings[property] = value;
}
});
return settings;
};