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

pagelist fixes

This commit is contained in:
fredc 2022-07-01 15:23:47 -07:00
parent 4458c7d584
commit e10047b338
5 changed files with 11 additions and 5 deletions

View file

@ -109,7 +109,7 @@ class Epub extends Publication {
this.landmarksUrl = navUrl; this.landmarksUrl = navUrl;
} }
if (pagelist.pages && pagelist.pages.length) { if (pagelist.pageList && pagelist.pageList.length) {
this.pagelistUrl = navUrl; this.pagelistUrl = navUrl;
} }
@ -120,7 +120,7 @@ class Epub extends Publication {
return { return {
toc: navigation.toc, toc: navigation.toc,
landmarks: navigation.landmarks, landmarks: navigation.landmarks,
pageList: pagelist.pages, pageList: pagelist.pageList,
locations: pagelist.locations locations: pagelist.locations
} }
} }
@ -180,6 +180,7 @@ class Epub extends Publication {
const { toc, landmarks, pageList, locations } = await this.loadNavigation(packaging); const { toc, landmarks, pageList, locations } = await this.loadNavigation(packaging);
this.toc = toc; this.toc = toc;
this.landmarks = landmarks; this.landmarks = landmarks;
console.log("pageList", pageList);
this.pagelist = pageList; this.pagelist = pageList;
this.locations = locations; this.locations = locations;

View file

@ -124,7 +124,7 @@ class PageList {
var content = qs(item, "a"), var content = qs(item, "a"),
href = content.getAttribute("href") || "", href = content.getAttribute("href") || "",
text = content.textContent || "", text = content.textContent || "",
page = parseInt(text), page = text,
isCfi = href.indexOf("epubcfi"), isCfi = href.indexOf("epubcfi"),
split, split,
packageUrl, packageUrl,

View file

@ -13,6 +13,10 @@ class Manifest extends Publication {
constructor(url, options) { constructor(url, options) {
super(); super();
this.settings = Object.assign({
url: undefined
}, options)
if (url) { if (url) {
this.opened = this.open(url); this.opened = this.open(url);
} }
@ -69,7 +73,7 @@ class Manifest extends Publication {
} }
async open(url) { async open(url) {
this.url = url; this.url = this.settings.url ? this.settings.url : url;
const manifest = await this.load(url, "json"); const manifest = await this.load(url, "json");

View file

@ -341,6 +341,7 @@ class Publication {
} }
for (const item of items) { for (const item of items) {
console.log("ITEM", item)
item.url = this.resolve(item.url || item.href); item.url = this.resolve(item.url || item.href);
item.canonical = item.canonical || item.url; item.canonical = item.canonical || item.url;

View file

@ -40,7 +40,7 @@ function createRange() {
async function process(section, chars, requestMethod, pause) { async function process(section, chars, requestMethod, pause) {
let contents = await requestMethod(section.url); let contents = await requestMethod(section.url);
let locations = parse(contents, section.cfiBase); let locations = parse(contents, section.cfiBase, chars);
return locations; return locations;
} }