1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

corrected load order for view

This commit is contained in:
Fred Chasen 2014-08-06 17:48:24 -07:00
parent a8bdd2d042
commit 87bd3a68ad
5 changed files with 18 additions and 16 deletions

15
dist/epub.js vendored
View file

@ -4401,6 +4401,7 @@ EPUBJS.SpineItem.prototype.load = function(_request){
request(this.url, 'xml').then(function(xml){
var base;
var directory = EPUBJS.core.folder(this.url);
this.document = xml;
this.contents = xml.documentElement;
@ -4449,17 +4450,12 @@ EPUBJS.View.prototype.load = function(contents) {
var loaded = loading.promise;
this.document = this.iframe.contentDocument;
// this.iframe.srcdoc = contents;
this.document.open();
this.document.write(contents);
this.document.close();
this.iframe.onload = function(e) {
this.window = this.iframe.contentWindow;
this.window.addEventListener("resize", this.resized.bind(this), false);
this.document = this.iframe.contentDocument;
this.iframe.style.display = "block";
// Reset Body Styles
@ -4476,6 +4472,11 @@ EPUBJS.View.prototype.load = function(contents) {
loading.resolve(this);
this.loading.resolve(this);
}.bind(this);
// this.iframe.srcdoc = contents;
this.document.open();
this.document.write(contents);
this.document.close();
return loaded;
};

2
dist/epub.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -66,7 +66,7 @@
var $prev = document.getElementById("prev");
var currentSectionIndex = 10;
// Load the opf
var book = ePub("../books/moby-dick/OPS/package.opf");
var book = ePub("https://s3.amazonaws.com/moby-dick/OPS/package.opf");
var rendition = book.renderTo("viewer", {width: 600, height: 400});
var displayed = rendition.display(currentSectionIndex);

View file

@ -73,6 +73,7 @@ EPUBJS.SpineItem.prototype.load = function(_request){
request(this.url, 'xml').then(function(xml){
var base;
var directory = EPUBJS.core.folder(this.url);
this.document = xml;
this.contents = xml.documentElement;

View file

@ -12,17 +12,12 @@ EPUBJS.View.prototype.load = function(contents) {
var loaded = loading.promise;
this.document = this.iframe.contentDocument;
// this.iframe.srcdoc = contents;
this.document.open();
this.document.write(contents);
this.document.close();
this.iframe.onload = function(e) {
this.window = this.iframe.contentWindow;
this.window.addEventListener("resize", this.resized.bind(this), false);
this.document = this.iframe.contentDocument;
this.iframe.style.display = "block";
// Reset Body Styles
@ -39,6 +34,11 @@ EPUBJS.View.prototype.load = function(contents) {
loading.resolve(this);
this.loading.resolve(this);
}.bind(this);
// this.iframe.srcdoc = contents;
this.document.open();
this.document.write(contents);
this.document.close();
return loaded;
};