mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +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>"
|
"Fred Chasen <fchasen@gmail.com>"
|
||||||
],
|
],
|
||||||
"description": "Enhanced eBooks in the browser.",
|
"description": "Enhanced eBooks in the browser.",
|
||||||
"main": "lib/epub.js",
|
"main": "dist/epub.js",
|
||||||
"moduleType": [
|
"moduleType": [
|
||||||
"amd",
|
"amd",
|
||||||
"globals",
|
"globals",
|
||||||
|
@ -21,12 +21,26 @@
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"bower_components",
|
"bower_components",
|
||||||
"test",
|
"test",
|
||||||
"tests"
|
"tools",
|
||||||
|
"books",
|
||||||
|
"examples"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"qunit": "~1.14.0",
|
"colors": "^0.6.2",
|
||||||
"jquery": "~2.1.1",
|
"connect": "^3.0.1",
|
||||||
"rsvp": "~3.0.8",
|
"express": "^4.5.1",
|
||||||
"uri.js": "~1.13.2"
|
"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)
|
console.log("prev", this.formated.pageWidth)
|
||||||
this.renderer.infinite.scrollBy(-this.formated.pageWidth, 0);
|
this.renderer.infinite.scrollBy(-this.formated.pageWidth, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EPUBJS.Paginate.prototype.display = function(what){
|
||||||
|
return this.renderer.display(what)
|
||||||
|
};
|
||||||
EPUBJS.Parser = function(){};
|
EPUBJS.Parser = function(){};
|
||||||
|
|
||||||
EPUBJS.Parser.prototype.container = function(containerXml){
|
EPUBJS.Parser.prototype.container = function(containerXml){
|
||||||
|
@ -6497,6 +6501,8 @@ EPUBJS.Renderer.prototype.display = function(what){
|
||||||
var displaying = new RSVP.defer();
|
var displaying = new RSVP.defer();
|
||||||
var displayed = displaying.promise;
|
var displayed = displaying.promise;
|
||||||
|
|
||||||
|
// TODO: check for fragments
|
||||||
|
|
||||||
// Clear views
|
// Clear views
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
|
@ -6761,22 +6767,27 @@ EPUBJS.Renderer.prototype.replacements = function(view, renderer) {
|
||||||
var links = view.document.querySelectorAll("a[href]");
|
var links = view.document.querySelectorAll("a[href]");
|
||||||
var replaceLinks = function(link){
|
var replaceLinks = function(link){
|
||||||
var href = link.getAttribute("href");
|
var href = link.getAttribute("href");
|
||||||
var isRelative = href.search("://");
|
var uri = new EPUBJS.core.uri(href);
|
||||||
// var directory = EPUBJS.core.uri(view.window.location.href).directory;
|
|
||||||
// var relative;
|
|
||||||
|
|
||||||
if(isRelative != -1){
|
if(uri.protocol){
|
||||||
|
|
||||||
link.setAttribute("target", "_blank");
|
link.setAttribute("target", "_blank");
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
// relative = EPUBJS.core.resolveUrl(directory, href);
|
// relative = EPUBJS.core.resolveUrl(directory, href);
|
||||||
|
// if(uri.fragment && !base) {
|
||||||
|
// link.onclick = function(){
|
||||||
|
// renderer.fragment(href);
|
||||||
|
// return false;
|
||||||
|
// };
|
||||||
|
// } else {
|
||||||
link.onclick = function(){
|
link.onclick = function(){
|
||||||
renderer.display(href);
|
renderer.display(href);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -7053,7 +7064,7 @@ EPUBJS.View.prototype.display = function(contents) {
|
||||||
|
|
||||||
// Reset Body Styles
|
// Reset Body Styles
|
||||||
this.document.body.style.margin = "0";
|
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";
|
this.document.documentElement.style.width = "auto";
|
||||||
|
|
||||||
setTimeout(function(){
|
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 {
|
#viewer {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: 60%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#viewer iframe {
|
#viewer iframe {
|
||||||
background: white;
|
background: white;
|
||||||
box-shadow: 0 0 4px #ccc;
|
box-shadow: 0 0 4px #ccc;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
width: calc(100% - 60px) !important;
|
width: calc(60% - 60px) !important;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@
|
||||||
<div id="viewer"></div>
|
<div id="viewer"></div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var currentSectionIndex = 10;
|
var currentSectionIndex = 0;
|
||||||
// Load the opf
|
// Load the opf
|
||||||
var book = ePub("https://s3.amazonaws.com/moby-dick/OPS/package.opf");
|
var book = ePub("https://s3.amazonaws.com/moby-dick/OPS/package.opf");
|
||||||
var rendition = book.renderTo("viewer");
|
var rendition = book.renderTo("viewer");
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#viewer {
|
#viewer {
|
||||||
width: 900px;
|
width: 900px;
|
||||||
height: 400px;
|
height: 600px;
|
||||||
background: white;
|
background: white;
|
||||||
box-shadow: 0 0 4px #ccc;
|
box-shadow: 0 0 4px #ccc;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
@ -114,10 +114,10 @@
|
||||||
var currentSectionIndex = 10;
|
var currentSectionIndex = 10;
|
||||||
// Load the opf
|
// Load the opf
|
||||||
var book = ePub("https://s3.amazonaws.com/moby-dick/OPS/package.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 pagination = rendition.paginate();
|
||||||
|
|
||||||
var displayed = rendition.display(currentSectionIndex);
|
var displayed = pagination.display(currentSectionIndex);
|
||||||
|
|
||||||
|
|
||||||
displayed.then(function(renderer){
|
displayed.then(function(renderer){
|
||||||
|
|
|
@ -138,3 +138,7 @@ EPUBJS.Paginate.prototype.prev = function(){
|
||||||
console.log("prev", this.formated.pageWidth)
|
console.log("prev", this.formated.pageWidth)
|
||||||
this.renderer.infinite.scrollBy(-this.formated.pageWidth, 0);
|
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 displaying = new RSVP.defer();
|
||||||
var displayed = displaying.promise;
|
var displayed = displaying.promise;
|
||||||
|
|
||||||
|
// TODO: check for fragments
|
||||||
|
|
||||||
// Clear views
|
// Clear views
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
|
@ -445,22 +447,27 @@ EPUBJS.Renderer.prototype.replacements = function(view, renderer) {
|
||||||
var links = view.document.querySelectorAll("a[href]");
|
var links = view.document.querySelectorAll("a[href]");
|
||||||
var replaceLinks = function(link){
|
var replaceLinks = function(link){
|
||||||
var href = link.getAttribute("href");
|
var href = link.getAttribute("href");
|
||||||
var isRelative = href.search("://");
|
var uri = new EPUBJS.core.uri(href);
|
||||||
// var directory = EPUBJS.core.uri(view.window.location.href).directory;
|
|
||||||
// var relative;
|
|
||||||
|
|
||||||
if(isRelative != -1){
|
if(uri.protocol){
|
||||||
|
|
||||||
link.setAttribute("target", "_blank");
|
link.setAttribute("target", "_blank");
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
// relative = EPUBJS.core.resolveUrl(directory, href);
|
// relative = EPUBJS.core.resolveUrl(directory, href);
|
||||||
|
// if(uri.fragment && !base) {
|
||||||
|
// link.onclick = function(){
|
||||||
|
// renderer.fragment(href);
|
||||||
|
// return false;
|
||||||
|
// };
|
||||||
|
// } else {
|
||||||
link.onclick = function(){
|
link.onclick = function(){
|
||||||
renderer.display(href);
|
renderer.display(href);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -78,7 +78,7 @@ EPUBJS.View.prototype.display = function(contents) {
|
||||||
|
|
||||||
// Reset Body Styles
|
// Reset Body Styles
|
||||||
this.document.body.style.margin = "0";
|
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";
|
this.document.documentElement.style.width = "auto";
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue