From 053ddb23a5ec571c937502d783cb752db2bb2f05 Mon Sep 17 00:00:00 2001 From: Fred Chasen Date: Sun, 27 Jan 2013 19:17:54 -0800 Subject: [PATCH] invalidate stored page position if chapter is different --- fpjs/render/book.js | 5 ++++- fpjs/render/chapter.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fpjs/render/book.js b/fpjs/render/book.js index 488fc53..d9a11f0 100644 --- a/fpjs/render/book.js +++ b/fpjs/render/book.js @@ -466,10 +466,13 @@ FP.Book.prototype.chapterTitle = function(){ FP.Book.prototype.startDisplay = function(chapter){ var routed, + prevChapter = this.spinePos, loaded = function(chapter){ //-- If there is a saved page, and the pages haven't changed go to it - if(this.prevChapterPos && this.prevDisplayedPages == chapter.displayedPages){ + if( this.prevChapterPos + && prevChapter == chapter.pos + && this.prevDisplayedPages == chapter.displayedPages) { chapter.page(this.prevChapterPos); } diff --git a/fpjs/render/chapter.js b/fpjs/render/chapter.js index 4501932..1583f32 100644 --- a/fpjs/render/chapter.js +++ b/fpjs/render/chapter.js @@ -3,7 +3,8 @@ FP.Chapter = function(book, pos){ this.book = book; this.iframe = this.book.iframe; - this.chapInfo = this.book.spine[pos || this.book.spinePos]; + this.pos = pos || this.book.spinePos + this.chapInfo = this.book.spine[this.pos]; //-- Get the url to the book from the spine this.path = this.chapInfo.href; this.ID = this.chapInfo.id;