mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
updated bower, bug fixes
This commit is contained in:
parent
e7839220f2
commit
1fdbf609f5
8 changed files with 69 additions and 32 deletions
26
bower.json
26
bower.json
|
@ -5,7 +5,7 @@
|
|||
"Fred Chasen <fchasen@gmail.com>"
|
||||
],
|
||||
"description": "Enhanced eBooks in the browser.",
|
||||
"main": "lib/epub.js",
|
||||
"main": "dist/epub.js",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
|
@ -21,12 +21,26 @@
|
|||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
"tools",
|
||||
"books",
|
||||
"examples"
|
||||
],
|
||||
"devDependencies": {
|
||||
"qunit": "~1.14.0",
|
||||
"jquery": "~2.1.1",
|
||||
"rsvp": "~3.0.8",
|
||||
"uri.js": "~1.13.2"
|
||||
"colors": "^0.6.2",
|
||||
"connect": "^3.0.1",
|
||||
"express": "^4.5.1",
|
||||
"gulp": "^3.8.7",
|
||||
"gulp-concat": "^2.3.4",
|
||||
"gulp-connect": "~2.0.6",
|
||||
"gulp-jshint": "^1.8.4",
|
||||
"gulp-plumber": "^0.6.4",
|
||||
"gulp-rename": "^1.2.0",
|
||||
"gulp-uglify": "^0.3.1",
|
||||
"gulp-util": "^3.0.0",
|
||||
"morgan": "^1.1.1",
|
||||
"optimist": "^0.6.1",
|
||||
"portfinder": "^0.2.1",
|
||||
"qunitjs": "^1.14.0",
|
||||
"serve-static": "^1.3.1"
|
||||
}
|
||||
}
|
||||
|
|
23
dist/epub.js
vendored
23
dist/epub.js
vendored
|
@ -5948,6 +5948,10 @@ EPUBJS.Paginate.prototype.prev = function(){
|
|||
console.log("prev", this.formated.pageWidth)
|
||||
this.renderer.infinite.scrollBy(-this.formated.pageWidth, 0);
|
||||
};
|
||||
|
||||
EPUBJS.Paginate.prototype.display = function(what){
|
||||
return this.renderer.display(what)
|
||||
};
|
||||
EPUBJS.Parser = function(){};
|
||||
|
||||
EPUBJS.Parser.prototype.container = function(containerXml){
|
||||
|
@ -6497,6 +6501,8 @@ EPUBJS.Renderer.prototype.display = function(what){
|
|||
var displaying = new RSVP.defer();
|
||||
var displayed = displaying.promise;
|
||||
|
||||
// TODO: check for fragments
|
||||
|
||||
// Clear views
|
||||
this.clear();
|
||||
|
||||
|
@ -6761,22 +6767,27 @@ EPUBJS.Renderer.prototype.replacements = function(view, renderer) {
|
|||
var links = view.document.querySelectorAll("a[href]");
|
||||
var replaceLinks = function(link){
|
||||
var href = link.getAttribute("href");
|
||||
var isRelative = href.search("://");
|
||||
// var directory = EPUBJS.core.uri(view.window.location.href).directory;
|
||||
// var relative;
|
||||
var uri = new EPUBJS.core.uri(href);
|
||||
|
||||
if(isRelative != -1){
|
||||
if(uri.protocol){
|
||||
|
||||
link.setAttribute("target", "_blank");
|
||||
|
||||
}else{
|
||||
|
||||
// relative = EPUBJS.core.resolveUrl(directory, href);
|
||||
|
||||
// if(uri.fragment && !base) {
|
||||
// link.onclick = function(){
|
||||
// renderer.fragment(href);
|
||||
// return false;
|
||||
// };
|
||||
// } else {
|
||||
link.onclick = function(){
|
||||
renderer.display(href);
|
||||
return false;
|
||||
};
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
@ -7053,7 +7064,7 @@ EPUBJS.View.prototype.display = function(contents) {
|
|||
|
||||
// Reset Body Styles
|
||||
this.document.body.style.margin = "0";
|
||||
// this.document.body.style.display = "inline-block";
|
||||
this.document.body.style.display = "inline-block";
|
||||
this.document.documentElement.style.width = "auto";
|
||||
|
||||
setTimeout(function(){
|
||||
|
|
4
dist/epub.min.js
vendored
4
dist/epub.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -17,16 +17,17 @@
|
|||
#viewer {
|
||||
display: block;
|
||||
margin: 0;
|
||||
width: 60%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#viewer iframe {
|
||||
background: white;
|
||||
box-shadow: 0 0 4px #ccc;
|
||||
margin: 10px;
|
||||
width: calc(100% - 60px) !important;
|
||||
width: calc(60% - 60px) !important;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
|
@ -72,7 +73,7 @@
|
|||
<div id="viewer"></div>
|
||||
|
||||
<script>
|
||||
var currentSectionIndex = 10;
|
||||
var currentSectionIndex = 0;
|
||||
// Load the opf
|
||||
var book = ePub("https://s3.amazonaws.com/moby-dick/OPS/package.opf");
|
||||
var rendition = book.renderTo("viewer");
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#viewer {
|
||||
width: 900px;
|
||||
height: 400px;
|
||||
height: 600px;
|
||||
background: white;
|
||||
box-shadow: 0 0 4px #ccc;
|
||||
border-radius: 5px;
|
||||
|
@ -114,10 +114,10 @@
|
|||
var currentSectionIndex = 10;
|
||||
// Load the opf
|
||||
var book = ePub("https://s3.amazonaws.com/moby-dick/OPS/package.opf");
|
||||
var rendition = book.renderTo("viewer", {axis: "horizontal", width: 900, height: 400});
|
||||
var rendition = book.renderTo("viewer", {axis: "horizontal", width: 900, height: 600});
|
||||
var pagination = rendition.paginate();
|
||||
|
||||
var displayed = rendition.display(currentSectionIndex);
|
||||
var displayed = pagination.display(currentSectionIndex);
|
||||
|
||||
|
||||
displayed.then(function(renderer){
|
||||
|
|
|
@ -138,3 +138,7 @@ EPUBJS.Paginate.prototype.prev = function(){
|
|||
console.log("prev", this.formated.pageWidth)
|
||||
this.renderer.infinite.scrollBy(-this.formated.pageWidth, 0);
|
||||
};
|
||||
|
||||
EPUBJS.Paginate.prototype.display = function(what){
|
||||
return this.renderer.display(what)
|
||||
};
|
|
@ -181,6 +181,8 @@ EPUBJS.Renderer.prototype.display = function(what){
|
|||
var displaying = new RSVP.defer();
|
||||
var displayed = displaying.promise;
|
||||
|
||||
// TODO: check for fragments
|
||||
|
||||
// Clear views
|
||||
this.clear();
|
||||
|
||||
|
@ -445,22 +447,27 @@ EPUBJS.Renderer.prototype.replacements = function(view, renderer) {
|
|||
var links = view.document.querySelectorAll("a[href]");
|
||||
var replaceLinks = function(link){
|
||||
var href = link.getAttribute("href");
|
||||
var isRelative = href.search("://");
|
||||
// var directory = EPUBJS.core.uri(view.window.location.href).directory;
|
||||
// var relative;
|
||||
var uri = new EPUBJS.core.uri(href);
|
||||
|
||||
if(isRelative != -1){
|
||||
if(uri.protocol){
|
||||
|
||||
link.setAttribute("target", "_blank");
|
||||
|
||||
}else{
|
||||
|
||||
// relative = EPUBJS.core.resolveUrl(directory, href);
|
||||
|
||||
// if(uri.fragment && !base) {
|
||||
// link.onclick = function(){
|
||||
// renderer.fragment(href);
|
||||
// return false;
|
||||
// };
|
||||
// } else {
|
||||
link.onclick = function(){
|
||||
renderer.display(href);
|
||||
return false;
|
||||
};
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -78,7 +78,7 @@ EPUBJS.View.prototype.display = function(contents) {
|
|||
|
||||
// Reset Body Styles
|
||||
this.document.body.style.margin = "0";
|
||||
// this.document.body.style.display = "inline-block";
|
||||
this.document.body.style.display = "inline-block";
|
||||
this.document.documentElement.style.width = "auto";
|
||||
|
||||
setTimeout(function(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue