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

Moved the logic of idenitfying fragment to content.js

This commit is contained in:
Sunil.Belakeri 2017-02-07 14:08:31 +05:30
parent c0533232d6
commit 88fd89935d
2 changed files with 5 additions and 14 deletions

View file

@ -406,8 +406,10 @@ class Contents {
}
}
} else if(typeof target === "string") {
let id = target;
} else if(typeof target === "string" &&
target.indexOf("#") > -1) {
let id = target.substring(target.indexOf("#")+1);
let el = this.document.getElementById(id);
if(el) {

View file

@ -239,18 +239,7 @@ class Rendition {
return displayed;
}
// Trim the target fragment
// removing the chapter
if(!isCfiString && typeof target === "string" &&
target.indexOf("#") > -1) {
moveTo = target.substring(target.indexOf("#")+1);
}
if (isCfiString) {
moveTo = target;
}
return this.manager.display(section, moveTo)
return this.manager.display(section, target)
.then(function(){
// this.emit("displayed", section);
}.bind(this));