mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
Updates to contents for Android, server update, jszip updated to 3.1.1
This commit is contained in:
parent
155c3f123a
commit
874cabe510
6 changed files with 92 additions and 25 deletions
|
@ -10,7 +10,7 @@ function Contents(doc, content, cfiBase) {
|
|||
|
||||
this.document = doc;
|
||||
this.documentElement = this.document.documentElement;
|
||||
this.content = content;
|
||||
this.content = content || this.document.body;
|
||||
this.window = this.document.defaultView;
|
||||
// Dom events to listen for
|
||||
this.listenedEvents = ["keydown", "keyup", "keypressed", "mouseup", "mousedown", "click", "touchend", "touchstart"];
|
||||
|
@ -26,7 +26,8 @@ function Contents(doc, content, cfiBase) {
|
|||
};
|
||||
|
||||
Contents.prototype.width = function(w) {
|
||||
var frame = this.content || this.documentElement;
|
||||
// var frame = this.documentElement;
|
||||
var frame = this.content;
|
||||
|
||||
if (w && core.isNumber(w)) {
|
||||
w = w + "px";
|
||||
|
@ -34,6 +35,7 @@ Contents.prototype.width = function(w) {
|
|||
|
||||
if (w) {
|
||||
frame.style.width = w;
|
||||
// this.content.style.width = w;
|
||||
}
|
||||
|
||||
return this.window.getComputedStyle(frame)['width'];
|
||||
|
@ -42,7 +44,8 @@ Contents.prototype.width = function(w) {
|
|||
};
|
||||
|
||||
Contents.prototype.height = function(h) {
|
||||
var frame = this.content || this.documentElement;
|
||||
// var frame = this.documentElement;
|
||||
var frame = this.content;
|
||||
|
||||
if (h && core.isNumber(h)) {
|
||||
h = h + "px";
|
||||
|
@ -50,6 +53,7 @@ Contents.prototype.height = function(h) {
|
|||
|
||||
if (h) {
|
||||
frame.style.height = h;
|
||||
// this.content.style.height = h;
|
||||
}
|
||||
|
||||
return this.window.getComputedStyle(frame)['height'];
|
||||
|
@ -137,6 +141,24 @@ Contents.prototype.overflow = function(overflow) {
|
|||
return this.window.getComputedStyle(this.documentElement)['overflow'];
|
||||
};
|
||||
|
||||
Contents.prototype.overflowX = function(overflow) {
|
||||
|
||||
if (overflow) {
|
||||
this.documentElement.style.overflowX = overflow;
|
||||
}
|
||||
|
||||
return this.window.getComputedStyle(this.documentElement)['overflowX'];
|
||||
};
|
||||
|
||||
Contents.prototype.overflowY = function(overflow) {
|
||||
|
||||
if (overflow) {
|
||||
this.documentElement.style.overflowY = overflow;
|
||||
}
|
||||
|
||||
return this.window.getComputedStyle(this.documentElement)['overflowY'];
|
||||
};
|
||||
|
||||
Contents.prototype.css = function(property, value) {
|
||||
var content = this.content || this.document.body;
|
||||
|
||||
|
@ -232,7 +254,7 @@ Contents.prototype.listeners = function() {
|
|||
|
||||
this.mediaQueryListeners();
|
||||
|
||||
this.fontLoadListeners();
|
||||
// this.fontLoadListeners();
|
||||
|
||||
this.addEventListeners();
|
||||
|
||||
|
@ -330,7 +352,7 @@ Contents.prototype.imageLoadListeners = function(target) {
|
|||
};
|
||||
|
||||
Contents.prototype.fontLoadListeners = function(target) {
|
||||
if (!this.document.fonts) {
|
||||
if (!this.document || !this.document.fonts) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -549,9 +571,9 @@ Contents.prototype.size = function(width, height){
|
|||
this.height(height);
|
||||
}
|
||||
|
||||
if (width >= 0 && height >= 0) {
|
||||
this.overflow("hidden");
|
||||
}
|
||||
// if (width >= 0 && height >= 0) {
|
||||
// this.overflow("hidden");
|
||||
// }
|
||||
|
||||
};
|
||||
|
||||
|
@ -561,8 +583,16 @@ Contents.prototype.columns = function(width, height, columnWidth, gap){
|
|||
var COLUMN_WIDTH = core.prefixed('columnWidth');
|
||||
var COLUMN_FILL = core.prefixed('columnFill');
|
||||
|
||||
this.size(width, height);
|
||||
this.width(width);
|
||||
this.height(height);
|
||||
|
||||
// Deal with Mobile trying to scale to viewport
|
||||
this.viewport({ width: width, height: height, scale: 1.0 });
|
||||
|
||||
// this.overflowY("hidden");
|
||||
this.css("overflowY", "hidden");
|
||||
this.css("margin", "0");
|
||||
this.css("boxSizing", "border-box");
|
||||
|
||||
this.css(COLUMN_AXIS, "horizontal");
|
||||
this.css(COLUMN_FILL, "auto");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue