Skip to content

Commit

Permalink
Respect char break in locations generation, fixes futurepress#294
Browse files Browse the repository at this point in the history
  • Loading branch information
fchasen committed Oct 24, 2015
1 parent 6eb1b24 commit 90eaadc
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 10 deletions.
9 changes: 7 additions & 2 deletions build/epub.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/epub.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/epub.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/epub.min.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion reader/js/epub.js.map

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions reader/js/epub.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ EPUBJS.Locations = function(spine, store, credentials) {
this.spine = spine;
this.store = store;
this.credentials = credentials;

this.epubcfi = new EPUBJS.EpubCFI();

this._locations = [];
Expand All @@ -18,6 +18,7 @@ EPUBJS.Locations.prototype.generate = function(chars) {
var deferred = new RSVP.defer();
var spinePos = -1;
var spineLength = this.spine.length;
var finished;
var nextChapter = function(deferred){
var chapter;
var next = spinePos + 1;
Expand All @@ -40,7 +41,11 @@ EPUBJS.Locations.prototype.generate = function(chars) {
return done.promise;
}.bind(this);

var finished = nextChapter().then(function(){
if(typeof chars === 'number') {
this.break = chars;
}

finished = nextChapter().then(function(){
this.total = this._locations.length-1;

if (this._currentCfi) {
Expand Down

0 comments on commit 90eaadc

Please sign in to comment.