mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +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
48
dist/epub.js
vendored
48
dist/epub.js
vendored
|
@ -6657,7 +6657,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"];
|
||||
|
@ -6673,7 +6673,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";
|
||||
|
@ -6681,6 +6682,7 @@ Contents.prototype.width = function(w) {
|
|||
|
||||
if (w) {
|
||||
frame.style.width = w;
|
||||
// this.content.style.width = w;
|
||||
}
|
||||
|
||||
return this.window.getComputedStyle(frame)['width'];
|
||||
|
@ -6689,7 +6691,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";
|
||||
|
@ -6697,6 +6700,7 @@ Contents.prototype.height = function(h) {
|
|||
|
||||
if (h) {
|
||||
frame.style.height = h;
|
||||
// this.content.style.height = h;
|
||||
}
|
||||
|
||||
return this.window.getComputedStyle(frame)['height'];
|
||||
|
@ -6784,6 +6788,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;
|
||||
|
||||
|
@ -6879,7 +6901,7 @@ Contents.prototype.listeners = function() {
|
|||
|
||||
this.mediaQueryListeners();
|
||||
|
||||
this.fontLoadListeners();
|
||||
// this.fontLoadListeners();
|
||||
|
||||
this.addEventListeners();
|
||||
|
||||
|
@ -6977,7 +6999,7 @@ Contents.prototype.imageLoadListeners = function(target) {
|
|||
};
|
||||
|
||||
Contents.prototype.fontLoadListeners = function(target) {
|
||||
if (!this.document.fonts) {
|
||||
if (!this.document || !this.document.fonts) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7196,9 +7218,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");
|
||||
// }
|
||||
|
||||
};
|
||||
|
||||
|
@ -7208,8 +7230,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");
|
||||
|
|
2
dist/epub.js.map
vendored
2
dist/epub.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -118,7 +118,7 @@
|
|||
<div id="next" class="arrow">›</div>
|
||||
<script>
|
||||
// Load the opf
|
||||
var book = ePub("https://s3.amazonaws.com/moby-dick/OPS/package.opf");
|
||||
var book = ePub("https://s3.amazonaws.com/moby-dick/moby-dick.epub");
|
||||
var rendition = book.renderTo("viewer", {
|
||||
manager: "continuous",
|
||||
flow: "paginated",
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
"watchify": "^3.6.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"jszip": "^2.5.0",
|
||||
"jszip": "^3.1.1",
|
||||
"rsvp": "^3.0.18",
|
||||
"urijs": "^1.17.0",
|
||||
"xmldom": "^0.1.22"
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
var connect = require('connect');
|
||||
var express = require('express');
|
||||
var http = require('http');
|
||||
var fs = require('fs');
|
||||
var serveStatic = require('serve-static');
|
||||
var morgan = require('morgan');
|
||||
var colors = require('colors');
|
||||
|
@ -33,11 +35,16 @@ function allowCrossDomain(req, res, next) {
|
|||
|
||||
|
||||
function listen(port) {
|
||||
var server = express();
|
||||
server.use(allowCrossDomain);
|
||||
server.use(serveStatic(path.resolve(__dirname, '../')));
|
||||
|
||||
if(!logger) server.use(morgan('dev'))
|
||||
var app = express();
|
||||
var staticServer = serveStatic(path.resolve(__dirname, '../'), {'index': ['index.html', 'index.htm']})
|
||||
|
||||
var server = http.createServer(app);
|
||||
|
||||
app.use(allowCrossDomain);
|
||||
app.use(staticServer);
|
||||
|
||||
if(!logger) app.use(morgan('dev'))
|
||||
|
||||
server.listen(port);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue