1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00

save page position

This commit is contained in:
Fred Chasen 2013-01-27 11:50:11 -08:00
parent 7c15cec459
commit 954aba9627
3 changed files with 24 additions and 3 deletions

View file

@ -10,6 +10,8 @@ FP.Chapter = function(book, pos){
this.chapterPos = 1;
this.leftPos = 0;
localStorage.setItem("chapterPos", this.chapterPos);
this.book.registerHook("beforeChapterDisplay",
[this.replaceLinks.bind(this), this.replaceResources.bind(this)]);
@ -146,6 +148,8 @@ FP.Chapter.prototype.calcPages = function(){
this.displayedPages = Math.ceil(this.totalWidth / this.spreadWidth);
localStorage.setItem("displayedPages", this.displayedPages);
//console.log("Pages:", this.displayedPages)
}
@ -158,6 +162,8 @@ FP.Chapter.prototype.nextPage = function(){
this.setLeft(this.leftPos);
localStorage.setItem("chapterPos", this.chapterPos);
return this.chapterPos;
}else{
return false;
@ -172,6 +178,8 @@ FP.Chapter.prototype.prevPage = function(){
this.setLeft(this.leftPos);
localStorage.setItem("chapterPos", this.chapterPos);
return this.chapterPos;
}else{
return false;
@ -247,6 +255,7 @@ FP.Chapter.prototype.page = function(pg){
this.leftPos = this.spreadWidth * (pg-1); //-- pages start at 1
this.setLeft(this.leftPos);
localStorage.setItem("chapterPos", pg);
return true;
}