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:
parent
c0533232d6
commit
88fd89935d
2 changed files with 5 additions and 14 deletions
|
@ -406,8 +406,10 @@ class Contents {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(typeof target === "string") {
|
} else if(typeof target === "string" &&
|
||||||
let id = target;
|
target.indexOf("#") > -1) {
|
||||||
|
|
||||||
|
let id = target.substring(target.indexOf("#")+1);
|
||||||
let el = this.document.getElementById(id);
|
let el = this.document.getElementById(id);
|
||||||
|
|
||||||
if(el) {
|
if(el) {
|
||||||
|
|
|
@ -239,18 +239,7 @@ class Rendition {
|
||||||
return displayed;
|
return displayed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trim the target fragment
|
return this.manager.display(section, target)
|
||||||
// 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)
|
|
||||||
.then(function(){
|
.then(function(){
|
||||||
// this.emit("displayed", section);
|
// this.emit("displayed", section);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue