mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
parent
0e57823e86
commit
b2db4fd03a
4 changed files with 21 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="no-js">
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
<script>
|
<script>
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var Book = ePub("../demo/moby-dick.epub", {restore: true});
|
var Book = ePub("../demo/moby-dick.epub", {restore: true, reload: true });
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -69,7 +69,7 @@ EPUBJS.Book = function(options){
|
||||||
this.opened = new RSVP.Promise();
|
this.opened = new RSVP.Promise();
|
||||||
// BookUrl is optional, but if present start loading process
|
// BookUrl is optional, but if present start loading process
|
||||||
if(this.settings.bookPath) {
|
if(this.settings.bookPath) {
|
||||||
this.open(this.settings.bookPath);
|
this.open(this.settings.bookPath, this.settings.reload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -635,7 +635,7 @@ EPUBJS.Book.prototype.removeStyle = function(style) {
|
||||||
delete this.settings.styles[style];
|
delete this.settings.styles[style];
|
||||||
}
|
}
|
||||||
|
|
||||||
EPUBJS.Book.prototype.unload = function(bookPath, forceReload){
|
EPUBJS.Book.prototype.unload = function(){
|
||||||
|
|
||||||
if(this.settings.restore) {
|
if(this.settings.restore) {
|
||||||
this.saveSettings();
|
this.saveSettings();
|
||||||
|
|
|
@ -24,7 +24,8 @@ EPUBJS.Renderer = function(book) {
|
||||||
EPUBJS.Renderer.prototype.initialize = function(){
|
EPUBJS.Renderer.prototype.initialize = function(){
|
||||||
this.iframe = document.createElement('iframe');
|
this.iframe = document.createElement('iframe');
|
||||||
//this.iframe.id = "epubjs-iframe";
|
//this.iframe.id = "epubjs-iframe";
|
||||||
|
this.iframe.scrolling = "no";
|
||||||
|
|
||||||
if(this.book.settings.width || this.book.settings.height){
|
if(this.book.settings.width || this.book.settings.height){
|
||||||
this.resizeIframe(false, this.book.settings.width || this.el.clientWidth, this.book.settings.height || this.el.clientHeight);
|
this.resizeIframe(false, this.book.settings.width || this.el.clientWidth, this.book.settings.height || this.el.clientHeight);
|
||||||
} else {
|
} else {
|
||||||
|
@ -193,7 +194,14 @@ EPUBJS.Renderer.prototype.setIframeSrc = function(url){
|
||||||
|
|
||||||
this.iframe.src = url;
|
this.iframe.src = url;
|
||||||
|
|
||||||
|
|
||||||
|
this.derf = document.createElement('iframe');
|
||||||
|
var b = new Blob(['<h1>PASS (1/1)</h1>'], { type: 'text/html' });
|
||||||
|
this.derf.src = window.webkitURL.createObjectURL(b);
|
||||||
|
this.derf.onload = function() {
|
||||||
|
console.log("this.derf");
|
||||||
|
}
|
||||||
|
document.body.appendChild(this.derf)
|
||||||
this.iframe.onload = function() {
|
this.iframe.onload = function() {
|
||||||
renderer.doc = renderer.iframe.contentDocument;
|
renderer.doc = renderer.iframe.contentDocument;
|
||||||
renderer.docEl = renderer.doc.documentElement;
|
renderer.docEl = renderer.doc.documentElement;
|
||||||
|
@ -277,7 +285,7 @@ EPUBJS.Renderer.prototype.formatSpread = function(){
|
||||||
// this.bodyEl.style.fontSize = localStorage.getItem("fontSize") || "medium";
|
// this.bodyEl.style.fontSize = localStorage.getItem("fontSize") || "medium";
|
||||||
|
|
||||||
//-- Clear Margins
|
//-- Clear Margins
|
||||||
this.bodyEl.style.margin = "0";
|
if(this.bodyEl) this.bodyEl.style.margin = "0";
|
||||||
|
|
||||||
this.docEl.style.overflow = "hidden";
|
this.docEl.style.overflow = "hidden";
|
||||||
|
|
||||||
|
@ -403,8 +411,6 @@ EPUBJS.Renderer.prototype.prevPage = function(){
|
||||||
|
|
||||||
EPUBJS.Renderer.prototype.chapterEnd = function(){
|
EPUBJS.Renderer.prototype.chapterEnd = function(){
|
||||||
this.page(this.displayedPages);
|
this.page(this.displayedPages);
|
||||||
|
|
||||||
this.currentLocationCfi = this.getPageCfi();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EPUBJS.Renderer.prototype.setLeft = function(leftPos){
|
EPUBJS.Renderer.prototype.setLeft = function(leftPos){
|
||||||
|
@ -544,7 +550,11 @@ EPUBJS.Renderer.prototype.page = function(pg){
|
||||||
this.chapterPos = pg;
|
this.chapterPos = pg;
|
||||||
this.leftPos = this.spreadWidth * (pg-1); //-- pages start at 1
|
this.leftPos = this.spreadWidth * (pg-1); //-- pages start at 1
|
||||||
this.setLeft(this.leftPos);
|
this.setLeft(this.leftPos);
|
||||||
|
|
||||||
|
this.currentLocationCfi = this.getPageCfi();
|
||||||
|
|
||||||
|
this.book.trigger("renderer:pageChanged", this.currentLocationCfi);
|
||||||
|
|
||||||
// localStorage.setItem("chapterPos", pg);
|
// localStorage.setItem("chapterPos", pg);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ EPUBJS.Unarchiver.prototype.getUrl = function(url, mime){
|
||||||
promise.resolve(this.urlCache[url]);
|
promise.resolve(this.urlCache[url]);
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.getBlob(mime || zip.getMimeType(entry.name), function(blob){
|
entry.getBlob(mime || zip.getMimeType(entry.name), function(blob){
|
||||||
var tempUrl = _URL.createObjectURL(blob);
|
var tempUrl = _URL.createObjectURL(blob);
|
||||||
promise.resolve(tempUrl);
|
promise.resolve(tempUrl);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue