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

Fixes to examples, and lint errors per pr #230 (by pmstss)

This commit is contained in:
fchasen 2015-06-30 22:50:06 -04:00
parent 2e2d7dfb43
commit d7371a619d
9 changed files with 21 additions and 142 deletions

2
books

@ -1 +1 @@
Subproject commit 950c742b3d66cc7ac53bd0663a41315f001da1c4
Subproject commit e9790315c2510315e270a7a4c4921825e9918039

14
dist/epub.js vendored
View file

@ -4480,7 +4480,7 @@ EPUBJS.View.prototype.addStylesheetRules = function(rules) {
if(!this.document) return;
var styleEl = this.document.createElement('style');
styleEl = this.document.createElement('style');
// Append style element to head
this.document.head.appendChild(styleEl);
@ -5322,7 +5322,7 @@ EPUBJS.Rendition.prototype.next = function(){
if(next) {
view = this.createView(next);
return this.append(view);
return this.fill(view);
}
});
@ -5341,7 +5341,7 @@ EPUBJS.Rendition.prototype.prev = function(){
prev = this.views.first().section.prev();
if(prev) {
view = this.createView(prev);
return this.append(view);
return this.fill(view);
}
});
@ -5377,14 +5377,14 @@ EPUBJS.Rendition.prototype.isVisible = function(view, offsetPrev, offsetNext, _c
var container = _container || this.container.getBoundingClientRect();
if(this.settings.axis === "horizontal" &&
(position.right > container.left - offsetPrev) &&
!(position.left >= container.right + offsetNext)) {
position.right > container.left - offsetPrev &&
position.left < container.right + offsetNext) {
return true;
} else if(this.settings.axis === "vertical" &&
(position.bottom > container.top - offsetPrev) &&
!(position.top >= container.bottom + offsetNext)) {
position.bottom > container.top - offsetPrev &&
position.top < container.bottom + offsetNext) {
return true;
}

2
dist/epub.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -15,17 +15,9 @@
color: #333;
height: 100%;
width: 100%;
/* position: absolute; */
}
.epub-container {
/* display: block;
*/ /*width: 100%;*/
/*height: 100%;*/
/* text-align: center;
*/ /*position: absolute;
top: 0;
left: 0;*/
min-width: 320px;
margin: 0 auto;
}

View file

@ -1,103 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>EPUB.js Basic Example</title>
<script src="../dist/epub.js"></script>
<style type="text/css">
body {
margin: 0;
background: #fafafa;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #333;
}
#viewer {
width: 600px;
background: white;
box-shadow: 0 0 4px #ccc;
border-radius: 5px;
padding: 20px 40px;
/*width: 100%;*/
/* height: 400px;*/
position: relative;
margin: 100px auto;
}
#prev {
left: 40px;
}
#next {
right: 40px;
}
.arrow {
position: fixed;
top: 50%;
margin-top: -32px;
font-size: 64px;
color: #E2E2E2;
font-family: arial, sans-serif;
font-weight: bold;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.arrow:hover {
color: #777;
}
.arrow:active {
color: #000;
}
#toc {
display: block;
margin: 10px auto;
}
</style>
</head>
<body>
<div id="viewer"></div>
<div id="prev" class="arrow"></div>
<div id="next" class="arrow"></div>
<script>
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: "100%", height: "100%", infinite: false});
var displayed = rendition.display(currentSectionIndex);
displayed.then(function(renderer){
// -- do stuff
});
// Navigation loaded
book.loaded.navigation.then(function(toc){
// console.log(toc);
});
var next = document.getElementById("next");
next.addEventListener("click", function(){
rendition.forwards()
}, false);
var prev = document.getElementById("prev");
prev.addEventListener("click", function(){
rendition.backgrounds()
}, false);
</script>
</body>
</html>

View file

@ -4,18 +4,8 @@
<meta charset="utf-8">
<title>EPUB.js Basic Example</title>
<script src="../bower_components/rsvp/rsvp.js"></script>
<script src="../dist/epub.js"></script>
<script src="../lib/epub.js"></script>
<script src="../lib/epubjs/core.js"></script>
<script src="../lib/epubjs/hooks.js"></script>
<script src="../lib/epubjs/book.js"></script>
<script src="../lib/epubjs/parser.js"></script>
<script src="../lib/epubjs/spine.js"></script>
<script src="../lib/epubjs/navigation.js"></script>
<script src="../lib/epubjs/epubcfi.js"></script>
<script src="../lib/epubjs/renderer.js"></script>
<script src="../lib/epubjs/view.js"></script>
<style type="text/css">
body {

View file

@ -119,7 +119,7 @@
<script>
// Load the opf
// var book = ePub("https://s3.amazonaws.com/moby-dick/OPS/package.opf");
var book = ePub("../books/alice/OPS/package.opf");
var book = ePub("books/alice/OPS/package.opf");
var rendition = book.renderTo("viewer", {
method: "paginate",
width: "100%",

View file

@ -425,7 +425,7 @@ EPUBJS.Rendition.prototype.next = function(){
if(next) {
view = this.createView(next);
return this.append(view);
return this.fill(view);
}
});
@ -444,7 +444,7 @@ EPUBJS.Rendition.prototype.prev = function(){
prev = this.views.first().section.prev();
if(prev) {
view = this.createView(prev);
return this.append(view);
return this.fill(view);
}
});
@ -480,14 +480,14 @@ EPUBJS.Rendition.prototype.isVisible = function(view, offsetPrev, offsetNext, _c
var container = _container || this.container.getBoundingClientRect();
if(this.settings.axis === "horizontal" &&
(position.right > container.left - offsetPrev) &&
!(position.left >= container.right + offsetNext)) {
position.right > container.left - offsetPrev &&
position.left < container.right + offsetNext) {
return true;
} else if(this.settings.axis === "vertical" &&
(position.bottom > container.top - offsetPrev) &&
!(position.top >= container.bottom + offsetNext)) {
position.bottom > container.top - offsetPrev &&
position.top < container.bottom + offsetNext) {
return true;
}

View file

@ -641,7 +641,7 @@ EPUBJS.View.prototype.addStylesheetRules = function(rules) {
if(!this.document) return;
var styleEl = this.document.createElement('style');
styleEl = this.document.createElement('style');
// Append style element to head
this.document.head.appendChild(styleEl);