@d-i-t-a/reader 2.1.0-beta.2 → 2.1.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +64 -73
- package/dist/esm/index.js.map +3 -3
- package/dist/injectables/click/click.js.map +1 -1
- package/dist/reader.css +1 -1216
- package/dist/reader.css.map +1 -0
- package/dist/reader.js +32 -34
- package/dist/reader.js.map +3 -3
- package/dist/types/model/Publication.d.ts +5 -5
- package/dist/types/model/user-settings/UserSettings.d.ts +4 -5
- package/dist/types/modules/AnnotationModule.d.ts +2 -2
- package/dist/types/modules/BookmarkModule.d.ts +2 -2
- package/dist/types/modules/TTS/TTSModule2.d.ts +1 -1
- package/dist/types/modules/TTS/TTSSettings.d.ts +1 -1
- package/dist/types/modules/protection/ContentProtectionModule.d.ts +2 -2
- package/dist/types/modules/search/SearchModule.d.ts +4 -1
- package/dist/types/navigator/IFrameNavigator.d.ts +29 -34
- package/dist/types/utils/HTMLTemplates.d.ts +0 -2
- package/package.json +12 -10
- package/dist/reader.map.css +0 -21
package/dist/esm/index.js
CHANGED
|
@@ -10118,9 +10118,9 @@ var require_source_map = __commonJS({
|
|
|
10118
10118
|
}
|
|
10119
10119
|
});
|
|
10120
10120
|
|
|
10121
|
-
// (disabled):path
|
|
10121
|
+
// (disabled):node_modules/path/path.js
|
|
10122
10122
|
var require_path = __commonJS({
|
|
10123
|
-
"(disabled):path"() {
|
|
10123
|
+
"(disabled):node_modules/path/path.js"() {
|
|
10124
10124
|
init_polyfills();
|
|
10125
10125
|
}
|
|
10126
10126
|
});
|
|
@@ -34139,10 +34139,8 @@ function TaJsonDeserialize(json, type) {
|
|
|
34139
34139
|
|
|
34140
34140
|
// src/model/Publication.ts
|
|
34141
34141
|
var Publication = class extends import_publication.Publication {
|
|
34142
|
-
static async fromUrl(url) {
|
|
34143
|
-
const response = await fetch(url.href,
|
|
34144
|
-
credentials: "same-origin"
|
|
34145
|
-
});
|
|
34142
|
+
static async fromUrl(url, requestConfig) {
|
|
34143
|
+
const response = await fetch(url.href, requestConfig);
|
|
34146
34144
|
const manifestJSON = await response.json();
|
|
34147
34145
|
let publication = TaJsonDeserialize(manifestJSON, Publication);
|
|
34148
34146
|
publication.manifestUrl = url;
|
|
@@ -34318,7 +34316,7 @@ var Publication = class extends import_publication.Publication {
|
|
|
34318
34316
|
const decodedHref = decodeURI(href) ?? "";
|
|
34319
34317
|
return this.positions?.filter((p) => decodedHref.includes(p.href));
|
|
34320
34318
|
}
|
|
34321
|
-
async autoGeneratePositions(getContentBytesLength = fetchContentBytesLength) {
|
|
34319
|
+
async autoGeneratePositions(requestConfig, getContentBytesLength = fetchContentBytesLength) {
|
|
34322
34320
|
let startPosition = 0;
|
|
34323
34321
|
let totalContentLength = 0;
|
|
34324
34322
|
const positions = [];
|
|
@@ -34337,7 +34335,7 @@ var Publication = class extends import_publication.Publication {
|
|
|
34337
34335
|
startPosition = startPosition + 1;
|
|
34338
34336
|
} else {
|
|
34339
34337
|
let href = this.getAbsoluteHref(link.Href);
|
|
34340
|
-
let length = await getContentBytesLength(href);
|
|
34338
|
+
let length = await getContentBytesLength(href, requestConfig);
|
|
34341
34339
|
link.contentLength = length;
|
|
34342
34340
|
totalContentLength += length;
|
|
34343
34341
|
let positionLength = 1024;
|
|
@@ -34381,17 +34379,17 @@ var Publication = class extends import_publication.Publication {
|
|
|
34381
34379
|
}
|
|
34382
34380
|
this.positions = positions;
|
|
34383
34381
|
}
|
|
34384
|
-
async fetchPositionsFromService(href) {
|
|
34385
|
-
const result = await fetch(href);
|
|
34382
|
+
async fetchPositionsFromService(href, requestConfig) {
|
|
34383
|
+
const result = await fetch(href, requestConfig);
|
|
34386
34384
|
const content = await result.json();
|
|
34387
34385
|
this.positions = content.positions;
|
|
34388
34386
|
}
|
|
34389
|
-
async fetchWeightsFromService(href) {
|
|
34387
|
+
async fetchWeightsFromService(href, requestConfig) {
|
|
34390
34388
|
if (this.isFixedLayout) {
|
|
34391
34389
|
console.warn("Not fetching weights from service for fixed layout publication.");
|
|
34392
34390
|
return;
|
|
34393
34391
|
}
|
|
34394
|
-
const result = await fetch(href);
|
|
34392
|
+
const result = await fetch(href, requestConfig);
|
|
34395
34393
|
const weights = await result.json();
|
|
34396
34394
|
if (this.readingOrder !== void 0) {
|
|
34397
34395
|
this.readingOrder.forEach((link) => {
|
|
@@ -34403,8 +34401,8 @@ var Publication = class extends import_publication.Publication {
|
|
|
34403
34401
|
Publication = __decorateClass([
|
|
34404
34402
|
(0, import_ta_json_x2.JsonObject)()
|
|
34405
34403
|
], Publication);
|
|
34406
|
-
var fetchContentBytesLength = async (href) => {
|
|
34407
|
-
const r = await fetch(href);
|
|
34404
|
+
var fetchContentBytesLength = async (href, requestConfig) => {
|
|
34405
|
+
const r = await fetch(href, requestConfig);
|
|
34408
34406
|
const b = await r.blob();
|
|
34409
34407
|
return b.size;
|
|
34410
34408
|
};
|
|
@@ -34637,7 +34635,7 @@ var Popup = class {
|
|
|
34637
34635
|
absolute = absolute.substring(0, absolute.indexOf("#"));
|
|
34638
34636
|
event.preventDefault();
|
|
34639
34637
|
event.stopPropagation();
|
|
34640
|
-
await fetch(absolute).then((r) => r.text()).then(async (data) => {
|
|
34638
|
+
await fetch(absolute, this.navigator.requestConfig).then((r) => r.text()).then(async (data) => {
|
|
34641
34639
|
const parser = new DOMParser();
|
|
34642
34640
|
const doc = parser.parseFromString(data, "text/html");
|
|
34643
34641
|
const element = doc.querySelector("#" + id2);
|
|
@@ -34687,7 +34685,7 @@ var Popup = class {
|
|
|
34687
34685
|
const d2content = document.createElement("div");
|
|
34688
34686
|
d2content.className = "d2-popover-content";
|
|
34689
34687
|
d2wrapper.appendChild(d2content);
|
|
34690
|
-
await fetch(absolute).then((r) => r.text()).then(async (data) => {
|
|
34688
|
+
await fetch(absolute, this.navigator.requestConfig).then((r) => r.text()).then(async (data) => {
|
|
34691
34689
|
d2content.innerHTML = data;
|
|
34692
34690
|
let doc = this.navigator.iframes[0].contentDocument;
|
|
34693
34691
|
if (doc) {
|
|
@@ -40977,7 +40975,7 @@ var MediaOverlayModule = class {
|
|
|
40977
40975
|
const moUrlFull = moUrlObjFull.toString();
|
|
40978
40976
|
let response;
|
|
40979
40977
|
try {
|
|
40980
|
-
response = await fetch(moUrlFull);
|
|
40978
|
+
response = await fetch(moUrlFull, this.delegate.requestConfig);
|
|
40981
40979
|
} catch (e) {
|
|
40982
40980
|
console.error(e, moUrlFull);
|
|
40983
40981
|
return;
|
|
@@ -42299,7 +42297,7 @@ async function searchDocDomSeek(searchInput, doc, href, title, fullWordSearch =
|
|
|
42299
42297
|
|
|
42300
42298
|
// src/modules/search/SearchModule.ts
|
|
42301
42299
|
var SearchModule = class {
|
|
42302
|
-
constructor(delegate, publication, properties, highlighter, api, headerMenu) {
|
|
42300
|
+
constructor(delegate, publication, properties, highlighter, requestConfig, api, headerMenu) {
|
|
42303
42301
|
this.currentChapterSearchResult = [];
|
|
42304
42302
|
this.bookSearchResult = [];
|
|
42305
42303
|
this.currentSearchHighlights = [];
|
|
@@ -42309,9 +42307,10 @@ var SearchModule = class {
|
|
|
42309
42307
|
this.properties = properties;
|
|
42310
42308
|
this.api = api;
|
|
42311
42309
|
this.highlighter = highlighter;
|
|
42310
|
+
this.requestConfig = requestConfig;
|
|
42312
42311
|
}
|
|
42313
42312
|
static async create(config2) {
|
|
42314
|
-
const search = new this(config2.delegate, config2.publication, config2, config2.highlighter, config2.api, config2.headerMenu);
|
|
42313
|
+
const search = new this(config2.delegate, config2.publication, config2, config2.highlighter, config2.requestConfig, config2.api, config2.headerMenu);
|
|
42315
42314
|
await search.start();
|
|
42316
42315
|
return search;
|
|
42317
42316
|
}
|
|
@@ -42737,9 +42736,9 @@ var SearchModule = class {
|
|
|
42737
42736
|
}
|
|
42738
42737
|
if (tocItem) {
|
|
42739
42738
|
let href = this.publication.getAbsoluteHref(tocItem.Href);
|
|
42740
|
-
await fetch(href).then((r) => r.text()).then(async (data) => {
|
|
42739
|
+
await fetch(href, this.requestConfig).then((r) => r.text()).then(async (data) => {
|
|
42741
42740
|
let parser = new DOMParser();
|
|
42742
|
-
let doc = parser.parseFromString(data, "application/xhtml+xml");
|
|
42741
|
+
let doc = parser.parseFromString(this.requestConfig?.encoded ? this.decodeBase64(data) : data, "application/xhtml+xml");
|
|
42743
42742
|
if (tocItem) {
|
|
42744
42743
|
searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
|
|
42745
42744
|
result.forEach((searchItem) => {
|
|
@@ -42755,6 +42754,16 @@ var SearchModule = class {
|
|
|
42755
42754
|
}
|
|
42756
42755
|
}
|
|
42757
42756
|
}
|
|
42757
|
+
decodeBase64(base64) {
|
|
42758
|
+
const text = atob(base64);
|
|
42759
|
+
const length = text.length;
|
|
42760
|
+
const bytes = new Uint8Array(length);
|
|
42761
|
+
for (let i = 0; i < length; i++) {
|
|
42762
|
+
bytes[i] = text.charCodeAt(i);
|
|
42763
|
+
}
|
|
42764
|
+
const decoder = new TextDecoder();
|
|
42765
|
+
return decoder.decode(bytes);
|
|
42766
|
+
}
|
|
42758
42767
|
async searchChapter(term) {
|
|
42759
42768
|
let localSearchResultBook = [];
|
|
42760
42769
|
const linkHref = this.publication.getAbsoluteHref(this.publication.readingOrder[this.delegate.currentResource() ?? 0].Href);
|
|
@@ -42764,9 +42773,9 @@ var SearchModule = class {
|
|
|
42764
42773
|
}
|
|
42765
42774
|
if (tocItem) {
|
|
42766
42775
|
let href = this.publication.getAbsoluteHref(tocItem.Href);
|
|
42767
|
-
await fetch(href).then((r) => r.text()).then(async (data) => {
|
|
42776
|
+
await fetch(href, this.requestConfig).then((r) => r.text()).then(async (data) => {
|
|
42768
42777
|
let parser = new DOMParser();
|
|
42769
|
-
let doc = parser.parseFromString(data, "application/xhtml+xml");
|
|
42778
|
+
let doc = parser.parseFromString(this.requestConfig?.encoded ? this.decodeBase64(data) : data, "application/xhtml+xml");
|
|
42770
42779
|
if (tocItem) {
|
|
42771
42780
|
searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
|
|
42772
42781
|
result.forEach((searchItem) => {
|
|
@@ -43180,9 +43189,6 @@ init_polyfills();
|
|
|
43180
43189
|
|
|
43181
43190
|
// src/utils/HTMLTemplates.ts
|
|
43182
43191
|
init_polyfills();
|
|
43183
|
-
var simpleUpLinkTemplate = (href, _label, ariaLabel) => `
|
|
43184
|
-
<a rel="up" href='${href}' aria-label="${ariaLabel}" style="padding: 0px"><i class="material-icons show-on-large">arrow_back_ios</i></a>
|
|
43185
|
-
`;
|
|
43186
43192
|
var readerLoading = `${icons.loading}`;
|
|
43187
43193
|
var readerError = `
|
|
43188
43194
|
<span>
|
|
@@ -43431,14 +43437,12 @@ var SampleReadEventHandler = class {
|
|
|
43431
43437
|
// src/navigator/IFrameNavigator.ts
|
|
43432
43438
|
var import_eventemitter3 = __toModule(require_eventemitter3());
|
|
43433
43439
|
var IFrameNavigator = class extends import_eventemitter3.default {
|
|
43434
|
-
constructor(settings, annotator = void 0,
|
|
43440
|
+
constructor(settings, annotator = void 0, initialLastReadingPosition = void 0, publication, api, rights, tts, injectables, attributes, services, sample, requestConfig) {
|
|
43435
43441
|
super();
|
|
43436
43442
|
this.iframes = [];
|
|
43437
43443
|
this.sideNavExpanded = false;
|
|
43438
|
-
this.material = false;
|
|
43439
43444
|
this.currentChapterLink = { href: "" };
|
|
43440
43445
|
this.currentSpreadLinks = {};
|
|
43441
|
-
this.upLink = void 0;
|
|
43442
43446
|
this.rights = {
|
|
43443
43447
|
autoGeneratePositions: false,
|
|
43444
43448
|
enableAnnotations: false,
|
|
@@ -43503,10 +43507,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
43503
43507
|
this.eventHandler = new EventHandler(this);
|
|
43504
43508
|
this.touchEventHandler = new TouchEventHandler(this);
|
|
43505
43509
|
this.keyboardEventHandler = new KeyboardEventHandler(this);
|
|
43506
|
-
this.upLinkConfig = upLinkConfig;
|
|
43507
43510
|
this.initialLastReadingPosition = initialLastReadingPosition;
|
|
43508
43511
|
this.publication = publication;
|
|
43509
|
-
this.material = material;
|
|
43510
43512
|
this.api = api;
|
|
43511
43513
|
this.rights = rights ?? {
|
|
43512
43514
|
autoGeneratePositions: false,
|
|
@@ -43529,10 +43531,11 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
43529
43531
|
this.attributes = attributes || { margin: 0 };
|
|
43530
43532
|
this.services = services;
|
|
43531
43533
|
this.sample = sample;
|
|
43534
|
+
this.requestConfig = requestConfig;
|
|
43532
43535
|
this.sampleReadEventHandler = new SampleReadEventHandler(this);
|
|
43533
43536
|
}
|
|
43534
43537
|
static async create(config2) {
|
|
43535
|
-
const navigator2 = new this(config2.settings, config2.annotator || void 0, config2.
|
|
43538
|
+
const navigator2 = new this(config2.settings, config2.annotator || void 0, config2.initialLastReadingPosition || void 0, config2.publication, config2.api, config2.rights, config2.tts, config2.injectables, config2.attributes || { margin: 0 }, config2.services, config2.sample);
|
|
43536
43539
|
await navigator2.start(config2.mainElement, config2.headerMenu, config2.footerMenu);
|
|
43537
43540
|
return new Promise((resolve) => resolve(navigator2));
|
|
43538
43541
|
}
|
|
@@ -44030,22 +44033,6 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44030
44033
|
this.landmarksSection.parentElement?.removeChild(this.landmarksSection);
|
|
44031
44034
|
}
|
|
44032
44035
|
}
|
|
44033
|
-
if ((this.links || this.linksTopLeft) && this.upLinkConfig && this.upLinkConfig.url) {
|
|
44034
|
-
const upUrl = this.upLinkConfig.url;
|
|
44035
|
-
const upLabel = this.upLinkConfig.label || "";
|
|
44036
|
-
const upAriaLabel = this.upLinkConfig.ariaLabel || upLabel;
|
|
44037
|
-
var upHTML = simpleUpLinkTemplate(upUrl.href, upLabel, upAriaLabel);
|
|
44038
|
-
const upParent = document.createElement("li");
|
|
44039
|
-
upParent.classList.add("uplink-wrapper");
|
|
44040
|
-
upParent.innerHTML = upHTML;
|
|
44041
|
-
if (this.links) {
|
|
44042
|
-
this.links.insertBefore(upParent, this.links.firstChild);
|
|
44043
|
-
this.upLink = findRequiredElement(this.links, "a[rel=up]");
|
|
44044
|
-
} else {
|
|
44045
|
-
this.linksTopLeft.insertBefore(upParent, this.linksTopLeft.firstChild);
|
|
44046
|
-
this.upLink = findRequiredElement(this.linksTopLeft, "a[rel=up]");
|
|
44047
|
-
}
|
|
44048
|
-
}
|
|
44049
44036
|
let lastReadingPosition = void 0;
|
|
44050
44037
|
if (this.annotator) {
|
|
44051
44038
|
lastReadingPosition = await this.annotator.getLastReadingPosition();
|
|
@@ -44385,7 +44372,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44385
44372
|
if (isSameOrigin) {
|
|
44386
44373
|
this.iframes[0].src = this.currentChapterLink.href;
|
|
44387
44374
|
} else {
|
|
44388
|
-
fetch(this.currentChapterLink.href).then((r) => r.text()).then(async (content2) => {
|
|
44375
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content2) => {
|
|
44389
44376
|
writeIframeDoc.call(this, content2, this.currentChapterLink.href);
|
|
44390
44377
|
});
|
|
44391
44378
|
}
|
|
@@ -44406,7 +44393,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44406
44393
|
if (isSameOrigin) {
|
|
44407
44394
|
this.iframes[1].src = href;
|
|
44408
44395
|
} else {
|
|
44409
|
-
fetch(href).then((r) => r.text()).then(async (content2) => {
|
|
44396
|
+
fetch(href, this.requestConfig).then((r) => r.text()).then(async (content2) => {
|
|
44410
44397
|
writeIframe2Doc.call(this, content2, href);
|
|
44411
44398
|
this.currentSpreadLinks.right = {
|
|
44412
44399
|
href
|
|
@@ -44435,7 +44422,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44435
44422
|
if (isSameOrigin) {
|
|
44436
44423
|
this.iframes[0].src = href;
|
|
44437
44424
|
} else {
|
|
44438
|
-
fetch(href).then((r) => r.text()).then(async (content2) => {
|
|
44425
|
+
fetch(href, this.requestConfig).then((r) => r.text()).then(async (content2) => {
|
|
44439
44426
|
writeIframeDoc.call(this, content2, href);
|
|
44440
44427
|
});
|
|
44441
44428
|
}
|
|
@@ -44456,7 +44443,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44456
44443
|
if (isSameOrigin) {
|
|
44457
44444
|
this.iframes[1].src = this.currentChapterLink.href;
|
|
44458
44445
|
} else {
|
|
44459
|
-
fetch(this.currentChapterLink.href).then((r) => r.text()).then(async (content2) => {
|
|
44446
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content2) => {
|
|
44460
44447
|
writeIframe2Doc.call(this, content2, this.currentChapterLink.href);
|
|
44461
44448
|
});
|
|
44462
44449
|
}
|
|
@@ -44475,7 +44462,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44475
44462
|
if (isSameOrigin) {
|
|
44476
44463
|
this.iframes[0].src = this.currentChapterLink.href;
|
|
44477
44464
|
} else {
|
|
44478
|
-
fetch(this.currentChapterLink.href).then((r) => r.text()).then(async (content2) => {
|
|
44465
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content2) => {
|
|
44479
44466
|
writeIframeDoc.call(this, content2, this.currentChapterLink.href);
|
|
44480
44467
|
});
|
|
44481
44468
|
}
|
|
@@ -44493,7 +44480,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44493
44480
|
if (isSameOrigin) {
|
|
44494
44481
|
this.iframes[0].src = this.currentChapterLink.href;
|
|
44495
44482
|
} else {
|
|
44496
|
-
fetch(this.currentChapterLink.href).then((r) => r.text()).then(async (content2) => {
|
|
44483
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content2) => {
|
|
44497
44484
|
writeIframeDoc.call(this, content2, this.currentChapterLink.href);
|
|
44498
44485
|
});
|
|
44499
44486
|
}
|
|
@@ -44526,7 +44513,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44526
44513
|
}
|
|
44527
44514
|
}
|
|
44528
44515
|
} else {
|
|
44529
|
-
fetch(this.currentChapterLink.href).then((r) => r.text()).then(async (content) => {
|
|
44516
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44530
44517
|
writeIframeDoc.call(this, content, this.currentChapterLink.href);
|
|
44531
44518
|
});
|
|
44532
44519
|
if (this.iframes.length === 2) {
|
|
@@ -44537,7 +44524,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44537
44524
|
this.currentSpreadLinks.right = {
|
|
44538
44525
|
href
|
|
44539
44526
|
};
|
|
44540
|
-
fetch(href).then((r) => r.text()).then(async (content) => {
|
|
44527
|
+
fetch(href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44541
44528
|
writeIframe2Doc.call(this, content, href);
|
|
44542
44529
|
});
|
|
44543
44530
|
}
|
|
@@ -44560,14 +44547,14 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44560
44547
|
this.iframes[1].src = this.currentChapterLink.href;
|
|
44561
44548
|
}
|
|
44562
44549
|
} else {
|
|
44563
|
-
fetch(href).then((r) => r.text()).then(async (content) => {
|
|
44550
|
+
fetch(href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44564
44551
|
writeIframeDoc.call(this, content, href);
|
|
44565
44552
|
});
|
|
44566
44553
|
if (this.iframes.length === 2) {
|
|
44567
44554
|
this.currentSpreadLinks.right = {
|
|
44568
44555
|
href: this.currentChapterLink.href
|
|
44569
44556
|
};
|
|
44570
|
-
fetch(this.currentChapterLink.href).then((r) => r.text()).then(async (content) => {
|
|
44557
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44571
44558
|
writeIframe2Doc.call(this, content, this.currentChapterLink.href);
|
|
44572
44559
|
});
|
|
44573
44560
|
}
|
|
@@ -44583,7 +44570,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44583
44570
|
if (isSameOrigin) {
|
|
44584
44571
|
this.iframes[1].src = this.currentChapterLink.href;
|
|
44585
44572
|
} else {
|
|
44586
|
-
fetch(this.currentChapterLink.href).then((r) => r.text()).then(async (content) => {
|
|
44573
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44587
44574
|
writeIframe2Doc.call(this, content, this.currentChapterLink.href);
|
|
44588
44575
|
});
|
|
44589
44576
|
}
|
|
@@ -44596,7 +44583,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44596
44583
|
if (isSameOrigin) {
|
|
44597
44584
|
this.iframes[0].src = this.currentChapterLink.href;
|
|
44598
44585
|
} else {
|
|
44599
|
-
fetch(this.currentChapterLink.href).then((r) => r.text()).then(async (content) => {
|
|
44586
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44600
44587
|
writeIframeDoc.call(this, content, this.currentChapterLink.href);
|
|
44601
44588
|
});
|
|
44602
44589
|
}
|
|
@@ -44608,7 +44595,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44608
44595
|
if (isSameOrigin) {
|
|
44609
44596
|
this.iframes[0].src = this.currentChapterLink.href;
|
|
44610
44597
|
} else {
|
|
44611
|
-
fetch(this.currentChapterLink.href).then((r) => r.text()).then(async (content) => {
|
|
44598
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44612
44599
|
writeIframeDoc.call(this, content, this.currentChapterLink.href);
|
|
44613
44600
|
});
|
|
44614
44601
|
}
|
|
@@ -48317,9 +48304,16 @@ var D2Reader = class {
|
|
|
48317
48304
|
const mainElement = findRequiredElement(document, "#D2Reader-Container");
|
|
48318
48305
|
const headerMenu = findElement(document, "#headerMenu");
|
|
48319
48306
|
const footerMenu = findElement(document, "#footerMenu");
|
|
48320
|
-
|
|
48307
|
+
let webPubManifestUrl = initialConfig.url;
|
|
48308
|
+
let publication;
|
|
48309
|
+
if (initialConfig.publication) {
|
|
48310
|
+
publication = TaJsonDeserialize(initialConfig.publication, Publication);
|
|
48311
|
+
publication.manifestUrl = new URL(webPubManifestUrl);
|
|
48312
|
+
} else {
|
|
48313
|
+
publication = await Publication.fromUrl(webPubManifestUrl, initialConfig.requestConfig);
|
|
48314
|
+
}
|
|
48321
48315
|
const store = new LocalStorageStore({
|
|
48322
|
-
prefix:
|
|
48316
|
+
prefix: publication.manifestUrl,
|
|
48323
48317
|
useLocalStorage: initialConfig.useLocalStorage ?? false
|
|
48324
48318
|
});
|
|
48325
48319
|
const settingsStore = new LocalStorageStore({
|
|
@@ -48331,18 +48325,16 @@ var D2Reader = class {
|
|
|
48331
48325
|
useLocalStorage: initialConfig.useLocalStorage ?? false
|
|
48332
48326
|
});
|
|
48333
48327
|
const annotator = new LocalAnnotator({ store });
|
|
48334
|
-
const upLink = initialConfig.upLinkUrl ?? void 0;
|
|
48335
|
-
const publication = await Publication.fromUrl(webPubManifestUrl);
|
|
48336
48328
|
publication.sample = initialConfig.sample;
|
|
48337
48329
|
rights = updateConfig(rights, publication);
|
|
48338
48330
|
if (rights.autoGeneratePositions) {
|
|
48339
|
-
await publication.autoGeneratePositions();
|
|
48331
|
+
await publication.autoGeneratePositions(initialConfig.requestConfig);
|
|
48340
48332
|
} else {
|
|
48341
48333
|
if (initialConfig.services?.positions) {
|
|
48342
|
-
await publication.fetchPositionsFromService(initialConfig.services?.positions.href);
|
|
48334
|
+
await publication.fetchPositionsFromService(initialConfig.services?.positions.href, initialConfig.requestConfig);
|
|
48343
48335
|
}
|
|
48344
48336
|
if (initialConfig.services?.weight) {
|
|
48345
|
-
await publication.fetchWeightsFromService(initialConfig.services?.weight.href);
|
|
48337
|
+
await publication.fetchWeightsFromService(initialConfig.services?.weight.href, initialConfig.requestConfig);
|
|
48346
48338
|
}
|
|
48347
48339
|
}
|
|
48348
48340
|
const layers = await LayerSettings.create({ store: layerStore });
|
|
@@ -48350,7 +48342,6 @@ var D2Reader = class {
|
|
|
48350
48342
|
store: settingsStore,
|
|
48351
48343
|
initialUserSettings: initialConfig.userSettings,
|
|
48352
48344
|
headerMenu,
|
|
48353
|
-
material: initialConfig.material,
|
|
48354
48345
|
api: initialConfig.api,
|
|
48355
48346
|
injectables: (publication.Metadata.Rendition?.Layout ?? "unknown") === "fixed" ? initialConfig.injectablesFixed : initialConfig.injectables,
|
|
48356
48347
|
layout: (publication.Metadata.Rendition?.Layout ?? "unknown") === "fixed" ? "fixed" : "reflowable"
|
|
@@ -48362,14 +48353,13 @@ var D2Reader = class {
|
|
|
48362
48353
|
publication,
|
|
48363
48354
|
settings,
|
|
48364
48355
|
annotator,
|
|
48365
|
-
upLink,
|
|
48366
48356
|
initialLastReadingPosition: initialConfig.lastReadingPosition,
|
|
48367
|
-
material: initialConfig.material,
|
|
48368
48357
|
api: initialConfig.api,
|
|
48369
48358
|
rights,
|
|
48370
48359
|
tts: initialConfig.tts,
|
|
48371
48360
|
sample: initialConfig.sample,
|
|
48372
|
-
|
|
48361
|
+
requestConfig: initialConfig.requestConfig,
|
|
48362
|
+
injectables: (publication.Metadata.Rendition?.Layout ?? "unknown") === "fixed" ? initialConfig.injectablesFixed ?? [] : initialConfig.injectables,
|
|
48373
48363
|
attributes: initialConfig.attributes,
|
|
48374
48364
|
services: initialConfig.services
|
|
48375
48365
|
});
|
|
@@ -48414,7 +48404,8 @@ var D2Reader = class {
|
|
|
48414
48404
|
headerMenu,
|
|
48415
48405
|
delegate: navigator2,
|
|
48416
48406
|
publication,
|
|
48417
|
-
highlighter
|
|
48407
|
+
highlighter,
|
|
48408
|
+
requestConfig: initialConfig.requestConfig
|
|
48418
48409
|
}, initialConfig.search)) : void 0;
|
|
48419
48410
|
const definitionsModule = rights.enableDefinitions ? await DefinitionsModule.create(__spreadValues({
|
|
48420
48411
|
delegate: navigator2,
|