mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
added queue for loading and offline storage of parsed info
This commit is contained in:
parent
ca3e2c24c2
commit
d90fd14ad2
12 changed files with 10017 additions and 47 deletions
|
@ -9,24 +9,34 @@ FP.Chapter = function(book){
|
|||
this.chapterPos = 1;
|
||||
this.leftPos = 0;
|
||||
|
||||
this.loadFromStorage();
|
||||
this.load();
|
||||
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
FP.Chapter.prototype.loadFromStorage = function(){
|
||||
var path = this.path,
|
||||
file = FP.storage.get(path, this.postLoad.bind(this));
|
||||
FP.Chapter.prototype.load = function(){
|
||||
var path = this.path;
|
||||
|
||||
if(this.book.online){
|
||||
this.setIframeSrc(path);
|
||||
}else{
|
||||
this.loadFromStorage(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FP.Chapter.prototype.postLoad = function(file){
|
||||
FP.Chapter.prototype.loadFromStorage = function(path){
|
||||
var file = FP.storage.get(path, this.setIframeSrc.bind(this));
|
||||
}
|
||||
|
||||
FP.Chapter.prototype.setIframeSrc = function(url){
|
||||
var that = this;
|
||||
|
||||
//-- Not sure if this is the best time to do this, but hide current text
|
||||
if(this.bodyEl) this.bodyEl.style.visibility = "hidden";
|
||||
|
||||
this.iframe.src = file;
|
||||
this.iframe.src = url;
|
||||
|
||||
this.iframe.onload = function() {
|
||||
//that.bodyEl = that.iframe.contentDocument.documentElement.getElementsByTagName('body')[0];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue