mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
pagelist fixes
This commit is contained in:
parent
4458c7d584
commit
e10047b338
5 changed files with 11 additions and 5 deletions
|
@ -109,7 +109,7 @@ class Epub extends Publication {
|
|||
this.landmarksUrl = navUrl;
|
||||
}
|
||||
|
||||
if (pagelist.pages && pagelist.pages.length) {
|
||||
if (pagelist.pageList && pagelist.pageList.length) {
|
||||
this.pagelistUrl = navUrl;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ class Epub extends Publication {
|
|||
return {
|
||||
toc: navigation.toc,
|
||||
landmarks: navigation.landmarks,
|
||||
pageList: pagelist.pages,
|
||||
pageList: pagelist.pageList,
|
||||
locations: pagelist.locations
|
||||
}
|
||||
}
|
||||
|
@ -180,6 +180,7 @@ class Epub extends Publication {
|
|||
const { toc, landmarks, pageList, locations } = await this.loadNavigation(packaging);
|
||||
this.toc = toc;
|
||||
this.landmarks = landmarks;
|
||||
console.log("pageList", pageList);
|
||||
this.pagelist = pageList;
|
||||
this.locations = locations;
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ class PageList {
|
|||
var content = qs(item, "a"),
|
||||
href = content.getAttribute("href") || "",
|
||||
text = content.textContent || "",
|
||||
page = parseInt(text),
|
||||
page = text,
|
||||
isCfi = href.indexOf("epubcfi"),
|
||||
split,
|
||||
packageUrl,
|
||||
|
|
|
@ -13,6 +13,10 @@ class Manifest extends Publication {
|
|||
constructor(url, options) {
|
||||
super();
|
||||
|
||||
this.settings = Object.assign({
|
||||
url: undefined
|
||||
}, options)
|
||||
|
||||
if (url) {
|
||||
this.opened = this.open(url);
|
||||
}
|
||||
|
@ -69,7 +73,7 @@ class Manifest extends Publication {
|
|||
}
|
||||
|
||||
async open(url) {
|
||||
this.url = url;
|
||||
this.url = this.settings.url ? this.settings.url : url;
|
||||
|
||||
const manifest = await this.load(url, "json");
|
||||
|
||||
|
|
|
@ -341,6 +341,7 @@ class Publication {
|
|||
}
|
||||
|
||||
for (const item of items) {
|
||||
console.log("ITEM", item)
|
||||
item.url = this.resolve(item.url || item.href);
|
||||
item.canonical = item.canonical || item.url;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ function createRange() {
|
|||
|
||||
async function process(section, chars, requestMethod, pause) {
|
||||
let contents = await requestMethod(section.url);
|
||||
let locations = parse(contents, section.cfiBase);
|
||||
let locations = parse(contents, section.cfiBase, chars);
|
||||
|
||||
return locations;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue