@d-i-t-a/reader 2.2.0-beta.6 → 2.2.1
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 +411 -250
- package/dist/esm/index.js.map +3 -3
- package/dist/reader.css.map +1 -1
- package/dist/reader.js +37 -37
- package/dist/reader.js.map +3 -3
- package/dist/types/modules/consumption/ConsumptionModule.d.ts +56 -0
- package/dist/types/navigator/IFrameNavigator.d.ts +4 -0
- package/dist/types/reader.d.ts +1 -0
- package/dist/types/store/Annotator.d.ts +1 -0
- package/dist/types/store/LocalAnnotator.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -55694,7 +55694,135 @@ var _getCssSelectorOptions = {
|
|
|
55694
55694
|
|
|
55695
55695
|
// src/modules/AnnotationModule.ts
|
|
55696
55696
|
var lodash2 = __toModule(require_lodash());
|
|
55697
|
+
var import_loglevel8 = __toModule(require_loglevel());
|
|
55698
|
+
|
|
55699
|
+
// src/modules/consumption/ConsumptionModule.ts
|
|
55700
|
+
init_polyfills();
|
|
55697
55701
|
var import_loglevel7 = __toModule(require_loglevel());
|
|
55702
|
+
var Action;
|
|
55703
|
+
(function(Action2) {
|
|
55704
|
+
Action2["BookmarkCreated"] = "BookmarkCreated";
|
|
55705
|
+
Action2["HighlightCreated"] = "HighlightCreated";
|
|
55706
|
+
})(Action || (Action = {}));
|
|
55707
|
+
var ConsumptionModule = class {
|
|
55708
|
+
constructor(delegate, publication, properties, api) {
|
|
55709
|
+
this.currSeconds = 0;
|
|
55710
|
+
this.delegate = delegate;
|
|
55711
|
+
this.publication = publication;
|
|
55712
|
+
this.properties = properties;
|
|
55713
|
+
this.api = api;
|
|
55714
|
+
}
|
|
55715
|
+
static async create(config2) {
|
|
55716
|
+
const consumption = new this(config2.delegate, config2.publication, config2, config2.api);
|
|
55717
|
+
await consumption.start();
|
|
55718
|
+
return consumption;
|
|
55719
|
+
}
|
|
55720
|
+
async start() {
|
|
55721
|
+
this.delegate.consumptionModule = this;
|
|
55722
|
+
this.startResearchSession();
|
|
55723
|
+
}
|
|
55724
|
+
async stop() {
|
|
55725
|
+
import_loglevel7.default.log("Consumption module stop");
|
|
55726
|
+
this.updateResearchSession();
|
|
55727
|
+
}
|
|
55728
|
+
initialize() {
|
|
55729
|
+
let win = this.delegate.iframes[0].contentWindow;
|
|
55730
|
+
if (win) {
|
|
55731
|
+
const self2 = this;
|
|
55732
|
+
win.onload = function() {
|
|
55733
|
+
self2.resetTimer();
|
|
55734
|
+
};
|
|
55735
|
+
win.onmousemove = function() {
|
|
55736
|
+
self2.resetTimer();
|
|
55737
|
+
};
|
|
55738
|
+
win.onmousedown = function() {
|
|
55739
|
+
self2.resetTimer();
|
|
55740
|
+
};
|
|
55741
|
+
win.ontouchstart = function() {
|
|
55742
|
+
self2.resetTimer();
|
|
55743
|
+
};
|
|
55744
|
+
win.onclick = function() {
|
|
55745
|
+
self2.resetTimer();
|
|
55746
|
+
};
|
|
55747
|
+
win.onkeypress = function() {
|
|
55748
|
+
self2.resetTimer();
|
|
55749
|
+
};
|
|
55750
|
+
}
|
|
55751
|
+
}
|
|
55752
|
+
trackAction(locator, action) {
|
|
55753
|
+
this.api?.actionTracked(locator, action);
|
|
55754
|
+
}
|
|
55755
|
+
startReadingSession(locator) {
|
|
55756
|
+
this.firstReadingLocator = locator;
|
|
55757
|
+
this.startReadingTimer = new Date();
|
|
55758
|
+
}
|
|
55759
|
+
continueReadingSession(locator) {
|
|
55760
|
+
if (this.properties.enableTrackingSession) {
|
|
55761
|
+
if (this.startResearchTimer === void 0) {
|
|
55762
|
+
this.startResearchSession();
|
|
55763
|
+
}
|
|
55764
|
+
if (this.lastReadingLocator === void 0 || this.lastReadingLocator.locations.totalProgression < locator.locations.totalProgression) {
|
|
55765
|
+
this.lastReadingLocator = locator;
|
|
55766
|
+
}
|
|
55767
|
+
if (this.firstReadingLocator === void 0) {
|
|
55768
|
+
this.firstReadingLocator = locator;
|
|
55769
|
+
}
|
|
55770
|
+
if (this.startReadingTimer === void 0) {
|
|
55771
|
+
this.startReadingTimer = new Date();
|
|
55772
|
+
}
|
|
55773
|
+
}
|
|
55774
|
+
}
|
|
55775
|
+
startResearchSession() {
|
|
55776
|
+
if (this.properties.enableTrackingSession) {
|
|
55777
|
+
this.startResearchTimer = new Date();
|
|
55778
|
+
this.readingSessions = [];
|
|
55779
|
+
clearInterval(this.readingSessionsInterval);
|
|
55780
|
+
let timeElapsed = (new Date().getTime() - this.startResearchTimer.getTime()) / 1e3;
|
|
55781
|
+
this.researchSessionId = this.api?.startResearchSession(this.readingSessions, Math.round(timeElapsed));
|
|
55782
|
+
const self2 = this;
|
|
55783
|
+
this.readingSessionsInterval = setInterval(function() {
|
|
55784
|
+
self2.updateResearchSession();
|
|
55785
|
+
}, this.properties.updateSessionInterval * 1e3);
|
|
55786
|
+
}
|
|
55787
|
+
}
|
|
55788
|
+
updateResearchSession() {
|
|
55789
|
+
if (this.properties.enableTrackingSession) {
|
|
55790
|
+
let timeElapsed = (new Date().getTime() - this.startResearchTimer.getTime()) / 1e3;
|
|
55791
|
+
this.api?.updateResearchSession(this.researchSessionId, this.readingSessions, Math.round(timeElapsed));
|
|
55792
|
+
}
|
|
55793
|
+
}
|
|
55794
|
+
endResearchSession() {
|
|
55795
|
+
if (this.properties.enableTrackingSession) {
|
|
55796
|
+
let timeElapsed = (new Date().getTime() - this.startResearchTimer.getTime()) / 1e3;
|
|
55797
|
+
this.api?.updateResearchSession(this.researchSessionId, this.readingSessions, Math.round(timeElapsed));
|
|
55798
|
+
this.api?.endResearchSession(this.researchSessionId, this.readingSessions, Math.round(timeElapsed));
|
|
55799
|
+
this.researchSessionId = void 0;
|
|
55800
|
+
this.readingSessions = [];
|
|
55801
|
+
this.startResearchTimer = void 0;
|
|
55802
|
+
clearInterval(this.readingSessionsInterval);
|
|
55803
|
+
}
|
|
55804
|
+
}
|
|
55805
|
+
startIdleTimer() {
|
|
55806
|
+
this.currSeconds++;
|
|
55807
|
+
if (this.currSeconds == this.properties.idleTimeout) {
|
|
55808
|
+
this.api?.idleSince(this.currSeconds);
|
|
55809
|
+
this.updateResearchSession();
|
|
55810
|
+
}
|
|
55811
|
+
if (this.currSeconds == this.properties.idleTimeout + this.properties.responseTimeout) {
|
|
55812
|
+
this.endResearchSession();
|
|
55813
|
+
}
|
|
55814
|
+
}
|
|
55815
|
+
resetTimer() {
|
|
55816
|
+
clearInterval(this.timer);
|
|
55817
|
+
this.currSeconds = 0;
|
|
55818
|
+
const self2 = this;
|
|
55819
|
+
this.timer = setInterval(function() {
|
|
55820
|
+
self2.startIdleTimer();
|
|
55821
|
+
}, 1e3);
|
|
55822
|
+
}
|
|
55823
|
+
};
|
|
55824
|
+
|
|
55825
|
+
// src/modules/AnnotationModule.ts
|
|
55698
55826
|
var AnnotationModule = class {
|
|
55699
55827
|
constructor(annotator, rights, publication, delegate, initialAnnotations, properties, highlighter, api, headerMenu) {
|
|
55700
55828
|
this.hide = findElement(document, "#menu-button-hide");
|
|
@@ -55715,7 +55843,7 @@ var AnnotationModule = class {
|
|
|
55715
55843
|
return annotations;
|
|
55716
55844
|
}
|
|
55717
55845
|
async stop() {
|
|
55718
|
-
|
|
55846
|
+
import_loglevel8.default.log("Annotation module stop");
|
|
55719
55847
|
}
|
|
55720
55848
|
async start() {
|
|
55721
55849
|
this.delegate.annotationModule = this;
|
|
@@ -55798,8 +55926,8 @@ var AnnotationModule = class {
|
|
|
55798
55926
|
return "";
|
|
55799
55927
|
}
|
|
55800
55928
|
} catch (err) {
|
|
55801
|
-
|
|
55802
|
-
|
|
55929
|
+
import_loglevel8.default.log("uniqueCssSelector:");
|
|
55930
|
+
import_loglevel8.default.error(err);
|
|
55803
55931
|
return "";
|
|
55804
55932
|
}
|
|
55805
55933
|
};
|
|
@@ -55820,7 +55948,7 @@ var AnnotationModule = class {
|
|
|
55820
55948
|
let book = this.delegate.highlighter?.createHighlight(this.delegate.highlighter?.dom(doc.body).getWindow(), selectionInfo, menuItem.highlight.color, true, AnnotationMarker.Bookmark, menuItem.icon, menuItem.popup, menuItem.highlight.style);
|
|
55821
55949
|
if (book) {
|
|
55822
55950
|
this.saveAnnotation(book[0]).then((anno) => {
|
|
55823
|
-
|
|
55951
|
+
import_loglevel8.default.log("saved bookmark " + anno.id);
|
|
55824
55952
|
});
|
|
55825
55953
|
}
|
|
55826
55954
|
}
|
|
@@ -55830,7 +55958,7 @@ var AnnotationModule = class {
|
|
|
55830
55958
|
}
|
|
55831
55959
|
}
|
|
55832
55960
|
async scrollToHighlight(id2) {
|
|
55833
|
-
|
|
55961
|
+
import_loglevel8.default.log("still need to scroll to " + id2);
|
|
55834
55962
|
var element = await this.annotator?.getAnnotationElement(id2, this.delegate.iframes[0].contentWindow);
|
|
55835
55963
|
element.scrollIntoView({
|
|
55836
55964
|
block: "center",
|
|
@@ -55841,8 +55969,8 @@ var AnnotationModule = class {
|
|
|
55841
55969
|
if (this.annotator) {
|
|
55842
55970
|
let deleted = await this.annotator.deleteAnnotation(annotation.id);
|
|
55843
55971
|
let added = await this.addAnnotation(annotation);
|
|
55844
|
-
|
|
55845
|
-
|
|
55972
|
+
import_loglevel8.default.log("Highlight deleted " + JSON.stringify(deleted));
|
|
55973
|
+
import_loglevel8.default.log("Highlight added " + JSON.stringify(added));
|
|
55846
55974
|
await this.showHighlights();
|
|
55847
55975
|
await this.drawHighlights();
|
|
55848
55976
|
return added;
|
|
@@ -55853,7 +55981,7 @@ var AnnotationModule = class {
|
|
|
55853
55981
|
async deleteLocalHighlight(id2) {
|
|
55854
55982
|
if (this.annotator) {
|
|
55855
55983
|
var deleted = await this.annotator.deleteAnnotation(id2);
|
|
55856
|
-
|
|
55984
|
+
import_loglevel8.default.log("Highlight deleted " + JSON.stringify(deleted));
|
|
55857
55985
|
await this.showHighlights();
|
|
55858
55986
|
await this.drawHighlights();
|
|
55859
55987
|
return deleted;
|
|
@@ -55949,6 +56077,7 @@ var AnnotationModule = class {
|
|
|
55949
56077
|
}
|
|
55950
56078
|
}
|
|
55951
56079
|
if (annotation) {
|
|
56080
|
+
this.delegate.consumptionModule?.trackAction(annotation, Action.HighlightCreated);
|
|
55952
56081
|
if (this.api?.addAnnotation) {
|
|
55953
56082
|
try {
|
|
55954
56083
|
let result = await this.api.addAnnotation(annotation);
|
|
@@ -55997,7 +56126,7 @@ var AnnotationModule = class {
|
|
|
55997
56126
|
if (this.api) {
|
|
55998
56127
|
let highlights = [];
|
|
55999
56128
|
if (this.annotator) {
|
|
56000
|
-
highlights = this.annotator.
|
|
56129
|
+
highlights = this.annotator.getAnnotationsByChapter(this.delegate.currentLocator().href);
|
|
56001
56130
|
}
|
|
56002
56131
|
if (this.highlighter && highlights && this.delegate.iframes[0].contentDocument?.readyState === "complete") {
|
|
56003
56132
|
await this.highlighter.destroyHighlights(HighlightType.Annotation);
|
|
@@ -56045,7 +56174,7 @@ var AnnotationModule = class {
|
|
|
56045
56174
|
} else {
|
|
56046
56175
|
let highlights = [];
|
|
56047
56176
|
if (this.annotator) {
|
|
56048
|
-
highlights = this.annotator.
|
|
56177
|
+
highlights = this.annotator.getAnnotationsByChapter(this.delegate.currentLocator().href);
|
|
56049
56178
|
}
|
|
56050
56179
|
if (this.highlighter && highlights && this.delegate.iframes[0].contentDocument?.readyState === "complete") {
|
|
56051
56180
|
await this.highlighter.destroyHighlights(HighlightType.Annotation);
|
|
@@ -56097,15 +56226,15 @@ var AnnotationModule = class {
|
|
|
56097
56226
|
if (doc) {
|
|
56098
56227
|
this.commentGutter = doc.getElementById(HighlightContainer.R2_ID_GUTTER_RIGHT_CONTAINER);
|
|
56099
56228
|
if (this.delegate.view?.isScrollMode() && this.properties?.enableComments) {
|
|
56100
|
-
this.commentGutter
|
|
56229
|
+
this.commentGutter?.style.removeProperty("display");
|
|
56101
56230
|
} else {
|
|
56102
|
-
this.commentGutter
|
|
56231
|
+
this.commentGutter?.style.setProperty("display", "none");
|
|
56103
56232
|
}
|
|
56104
56233
|
if (this.commentGutter && this.delegate.view?.isScrollMode()) {
|
|
56105
56234
|
this.commentGutter.innerHTML = "";
|
|
56106
56235
|
let highlights = [];
|
|
56107
56236
|
if (this.annotator) {
|
|
56108
|
-
highlights = this.annotator.
|
|
56237
|
+
highlights = this.annotator.getAnnotationsByChapter(this.delegate.currentLocator().href);
|
|
56109
56238
|
if (highlights) {
|
|
56110
56239
|
highlights = highlights.filter((rangeRepresentation) => rangeRepresentation.highlight?.note?.length > 0);
|
|
56111
56240
|
highlights = this.syncPosition(highlights);
|
|
@@ -56280,17 +56409,17 @@ var AnnotationModule = class {
|
|
|
56280
56409
|
this.delegate.stopReadAloud();
|
|
56281
56410
|
this.delegate.navigate(locator);
|
|
56282
56411
|
} else {
|
|
56283
|
-
|
|
56412
|
+
import_loglevel8.default.log("annotation data missing: ", event);
|
|
56284
56413
|
}
|
|
56285
56414
|
}
|
|
56286
56415
|
handleAnnotationLinkDeleteClick(type, event, locator) {
|
|
56287
|
-
|
|
56416
|
+
import_loglevel8.default.log("annotation data locator: ", locator);
|
|
56288
56417
|
if (locator) {
|
|
56289
56418
|
if (type === AnnotationType.Annotation) {
|
|
56290
56419
|
this.deleteHighlight(locator);
|
|
56291
56420
|
}
|
|
56292
56421
|
} else {
|
|
56293
|
-
|
|
56422
|
+
import_loglevel8.default.log("annotation data missing: ", event);
|
|
56294
56423
|
}
|
|
56295
56424
|
}
|
|
56296
56425
|
static readableTimestamp(timestamp) {
|
|
@@ -56358,7 +56487,7 @@ var AnnotationModule = class {
|
|
|
56358
56487
|
// src/modules/BookmarkModule.ts
|
|
56359
56488
|
init_polyfills();
|
|
56360
56489
|
var import_uuid2 = __toModule(require_uuid());
|
|
56361
|
-
var
|
|
56490
|
+
var import_loglevel9 = __toModule(require_loglevel());
|
|
56362
56491
|
var BookmarkModule = class {
|
|
56363
56492
|
static async create(config2) {
|
|
56364
56493
|
const module2 = new this(config2.annotator, config2.rights || { enableBookmarks: false }, config2.publication, config2.delegate, config2, config2.initialAnnotations, config2.api, config2.headerMenu);
|
|
@@ -56376,7 +56505,7 @@ var BookmarkModule = class {
|
|
|
56376
56505
|
this.api = api;
|
|
56377
56506
|
}
|
|
56378
56507
|
stop() {
|
|
56379
|
-
|
|
56508
|
+
import_loglevel9.default.log("Bookmark module stop");
|
|
56380
56509
|
}
|
|
56381
56510
|
async start() {
|
|
56382
56511
|
this.delegate.bookmarkModule = this;
|
|
@@ -56426,13 +56555,13 @@ var BookmarkModule = class {
|
|
|
56426
56555
|
if (this.api?.deleteBookmark) {
|
|
56427
56556
|
await this.api?.deleteBookmark(bookmark);
|
|
56428
56557
|
let deleted = await this.annotator.deleteBookmark(bookmark);
|
|
56429
|
-
|
|
56558
|
+
import_loglevel9.default.log("Bookmark deleted " + JSON.stringify(deleted));
|
|
56430
56559
|
await this.showBookmarks();
|
|
56431
56560
|
await this.drawBookmarks();
|
|
56432
56561
|
return deleted;
|
|
56433
56562
|
} else {
|
|
56434
56563
|
let deleted = await this.annotator.deleteBookmark(bookmark);
|
|
56435
|
-
|
|
56564
|
+
import_loglevel9.default.log("Bookmark deleted " + JSON.stringify(deleted));
|
|
56436
56565
|
await this.showBookmarks();
|
|
56437
56566
|
await this.drawBookmarks();
|
|
56438
56567
|
return deleted;
|
|
@@ -56484,20 +56613,21 @@ var BookmarkModule = class {
|
|
|
56484
56613
|
};
|
|
56485
56614
|
}
|
|
56486
56615
|
if (!this.annotator.locatorExists(bookmark, AnnotationType.Bookmark)) {
|
|
56616
|
+
this.delegate.consumptionModule?.trackAction(bookmark, Action.BookmarkCreated);
|
|
56487
56617
|
if (this.api?.addBookmark) {
|
|
56488
56618
|
const result = await this.api.addBookmark(bookmark);
|
|
56489
56619
|
if (result) {
|
|
56490
56620
|
bookmark = result;
|
|
56491
56621
|
}
|
|
56492
|
-
|
|
56622
|
+
import_loglevel9.default.log(bookmark);
|
|
56493
56623
|
let saved = this.annotator.saveBookmark(bookmark);
|
|
56494
|
-
|
|
56624
|
+
import_loglevel9.default.log("Bookmark added " + JSON.stringify(saved));
|
|
56495
56625
|
this.showBookmarks();
|
|
56496
56626
|
await this.drawBookmarks();
|
|
56497
56627
|
return saved;
|
|
56498
56628
|
} else {
|
|
56499
56629
|
let saved = this.annotator.saveBookmark(bookmark);
|
|
56500
|
-
|
|
56630
|
+
import_loglevel9.default.log("Bookmark added " + JSON.stringify(saved));
|
|
56501
56631
|
this.showBookmarks();
|
|
56502
56632
|
await this.drawBookmarks();
|
|
56503
56633
|
return saved;
|
|
@@ -56597,7 +56727,7 @@ var BookmarkModule = class {
|
|
|
56597
56727
|
this.delegate.iframes[0].contentDocument?.getSelection()?.removeAllRanges();
|
|
56598
56728
|
if (book) {
|
|
56599
56729
|
return this.saveAnnotation(book[0]).then((anno) => {
|
|
56600
|
-
|
|
56730
|
+
import_loglevel9.default.log("saved bookmark " + anno?.id);
|
|
56601
56731
|
});
|
|
56602
56732
|
}
|
|
56603
56733
|
}
|
|
@@ -56656,6 +56786,7 @@ var BookmarkModule = class {
|
|
|
56656
56786
|
}
|
|
56657
56787
|
}
|
|
56658
56788
|
if (annotation) {
|
|
56789
|
+
this.delegate.consumptionModule?.trackAction(annotation, Action.BookmarkCreated);
|
|
56659
56790
|
if (this.api?.addBookmark) {
|
|
56660
56791
|
let result = await this.api.addBookmark(annotation);
|
|
56661
56792
|
const saved = await this.annotator.saveAnnotation(result);
|
|
@@ -56775,7 +56906,7 @@ var BookmarkModule = class {
|
|
|
56775
56906
|
async deleteLocalHighlight(id2) {
|
|
56776
56907
|
if (this.annotator) {
|
|
56777
56908
|
var deleted = await this.annotator.deleteAnnotation(id2);
|
|
56778
|
-
|
|
56909
|
+
import_loglevel9.default.log("Highlight deleted " + JSON.stringify(deleted));
|
|
56779
56910
|
await this.showBookmarks();
|
|
56780
56911
|
await this.drawBookmarks();
|
|
56781
56912
|
return deleted;
|
|
@@ -56885,17 +57016,17 @@ var BookmarkModule = class {
|
|
|
56885
57016
|
this.delegate.stopReadAloud();
|
|
56886
57017
|
this.delegate.navigate(locator);
|
|
56887
57018
|
} else {
|
|
56888
|
-
|
|
57019
|
+
import_loglevel9.default.log("bookmark data missing: ", event);
|
|
56889
57020
|
}
|
|
56890
57021
|
}
|
|
56891
57022
|
handleAnnotationLinkDeleteClick(type, event, locator) {
|
|
56892
|
-
|
|
57023
|
+
import_loglevel9.default.log("bookmark data locator: ", locator);
|
|
56893
57024
|
if (locator) {
|
|
56894
57025
|
if (type === AnnotationType.Bookmark) {
|
|
56895
57026
|
this.deleteBookmark(locator);
|
|
56896
57027
|
}
|
|
56897
57028
|
} else {
|
|
56898
|
-
|
|
57029
|
+
import_loglevel9.default.log("bookmark data missing: ", event);
|
|
56899
57030
|
}
|
|
56900
57031
|
}
|
|
56901
57032
|
static readableTimestamp(timestamp) {
|
|
@@ -56916,7 +57047,7 @@ var import_media_overlay = __toModule(require_media_overlay());
|
|
|
56916
57047
|
|
|
56917
57048
|
// src/modules/mediaoverlays/MediaOverlaySettings.ts
|
|
56918
57049
|
init_polyfills();
|
|
56919
|
-
var
|
|
57050
|
+
var import_loglevel10 = __toModule(require_loglevel());
|
|
56920
57051
|
var R2_MO_CLASS_ACTIVE = "r2-mo-active";
|
|
56921
57052
|
var _MEDIAOVERLAYREFS = class {
|
|
56922
57053
|
};
|
|
@@ -56948,7 +57079,7 @@ var MediaOverlaySettings = class {
|
|
|
56948
57079
|
this.api = api;
|
|
56949
57080
|
this.headerMenu = headerMenu;
|
|
56950
57081
|
this.initialise();
|
|
56951
|
-
|
|
57082
|
+
import_loglevel10.default.log(this.api);
|
|
56952
57083
|
}
|
|
56953
57084
|
static create(config2) {
|
|
56954
57085
|
const settings = new this(config2.store, config2.api, config2.headerMenu);
|
|
@@ -56956,34 +57087,34 @@ var MediaOverlaySettings = class {
|
|
|
56956
57087
|
let initialSettings = config2.initialMediaOverlaySettings;
|
|
56957
57088
|
if (initialSettings?.color) {
|
|
56958
57089
|
settings.color = initialSettings.color;
|
|
56959
|
-
|
|
57090
|
+
import_loglevel10.default.log(settings.color);
|
|
56960
57091
|
}
|
|
56961
57092
|
if (initialSettings?.autoScroll) {
|
|
56962
57093
|
settings.autoScroll = initialSettings.autoScroll;
|
|
56963
|
-
|
|
57094
|
+
import_loglevel10.default.log(settings.autoScroll);
|
|
56964
57095
|
}
|
|
56965
57096
|
if (initialSettings?.autoTurn) {
|
|
56966
57097
|
settings.autoTurn = initialSettings.autoTurn;
|
|
56967
|
-
|
|
57098
|
+
import_loglevel10.default.log(settings.autoScroll);
|
|
56968
57099
|
}
|
|
56969
57100
|
if (initialSettings?.volume) {
|
|
56970
57101
|
settings.volume = initialSettings.volume;
|
|
56971
|
-
|
|
57102
|
+
import_loglevel10.default.log(settings.volume);
|
|
56972
57103
|
}
|
|
56973
57104
|
if (initialSettings?.rate) {
|
|
56974
57105
|
settings.rate = initialSettings.rate;
|
|
56975
|
-
|
|
57106
|
+
import_loglevel10.default.log(settings.rate);
|
|
56976
57107
|
}
|
|
56977
57108
|
if (initialSettings?.wait) {
|
|
56978
57109
|
settings.wait = initialSettings.wait;
|
|
56979
|
-
|
|
57110
|
+
import_loglevel10.default.log(settings.wait);
|
|
56980
57111
|
}
|
|
56981
57112
|
}
|
|
56982
57113
|
settings.initializeSelections();
|
|
56983
57114
|
return settings;
|
|
56984
57115
|
}
|
|
56985
57116
|
stop() {
|
|
56986
|
-
|
|
57117
|
+
import_loglevel10.default.log("MediaOverlay settings stop");
|
|
56987
57118
|
}
|
|
56988
57119
|
initialise() {
|
|
56989
57120
|
this.autoScroll = this.getProperty(MEDIAOVERLAYREFS.AUTO_SCROLL_KEY) != null ? this.getProperty(MEDIAOVERLAYREFS.AUTO_SCROLL_KEY).value : this.autoScroll;
|
|
@@ -57049,7 +57180,7 @@ var MediaOverlaySettings = class {
|
|
|
57049
57180
|
this.applyMediaOverlaySettings(syncSettings);
|
|
57050
57181
|
if (this.api?.updateSettings) {
|
|
57051
57182
|
this.api?.updateSettings(syncSettings).then(async (settings) => {
|
|
57052
|
-
|
|
57183
|
+
import_loglevel10.default.log("api updated sync settings", settings);
|
|
57053
57184
|
});
|
|
57054
57185
|
}
|
|
57055
57186
|
}
|
|
@@ -57104,7 +57235,7 @@ var MediaOverlaySettings = class {
|
|
|
57104
57235
|
this.settingsChangeCallback();
|
|
57105
57236
|
}
|
|
57106
57237
|
if (mediaOverlaySettings.autoScroll !== void 0) {
|
|
57107
|
-
|
|
57238
|
+
import_loglevel10.default.log("autoScroll " + this.autoScroll);
|
|
57108
57239
|
this.autoScroll = mediaOverlaySettings.autoScroll;
|
|
57109
57240
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.AUTO_SCROLL_REF);
|
|
57110
57241
|
if (prop) {
|
|
@@ -57114,7 +57245,7 @@ var MediaOverlaySettings = class {
|
|
|
57114
57245
|
this.settingsChangeCallback();
|
|
57115
57246
|
}
|
|
57116
57247
|
if (mediaOverlaySettings.autoTurn !== void 0) {
|
|
57117
|
-
|
|
57248
|
+
import_loglevel10.default.log("autoTurn " + this.autoTurn);
|
|
57118
57249
|
this.autoTurn = mediaOverlaySettings.autoTurn;
|
|
57119
57250
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.AUTO_TURN_REF);
|
|
57120
57251
|
if (prop) {
|
|
@@ -57124,7 +57255,7 @@ var MediaOverlaySettings = class {
|
|
|
57124
57255
|
this.settingsChangeCallback();
|
|
57125
57256
|
}
|
|
57126
57257
|
if (mediaOverlaySettings.volume) {
|
|
57127
|
-
|
|
57258
|
+
import_loglevel10.default.log("volume " + this.volume);
|
|
57128
57259
|
this.volume = mediaOverlaySettings.volume;
|
|
57129
57260
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.VOLUME_REF);
|
|
57130
57261
|
if (prop) {
|
|
@@ -57134,7 +57265,7 @@ var MediaOverlaySettings = class {
|
|
|
57134
57265
|
this.settingsChangeCallback();
|
|
57135
57266
|
}
|
|
57136
57267
|
if (mediaOverlaySettings.rate) {
|
|
57137
|
-
|
|
57268
|
+
import_loglevel10.default.log("rate " + this.rate);
|
|
57138
57269
|
this.rate = mediaOverlaySettings.rate;
|
|
57139
57270
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.RATE_REF);
|
|
57140
57271
|
if (prop) {
|
|
@@ -57212,7 +57343,7 @@ var MediaOverlaySettings = class {
|
|
|
57212
57343
|
};
|
|
57213
57344
|
|
|
57214
57345
|
// src/modules/mediaoverlays/MediaOverlayModule.ts
|
|
57215
|
-
var
|
|
57346
|
+
var import_loglevel11 = __toModule(require_loglevel());
|
|
57216
57347
|
var MediaOverlayModule = class {
|
|
57217
57348
|
constructor(delegate, publication, settings, properties) {
|
|
57218
57349
|
this.play = findElement(document, "#menu-button-play");
|
|
@@ -57221,7 +57352,7 @@ var MediaOverlayModule = class {
|
|
|
57221
57352
|
this.pid = void 0;
|
|
57222
57353
|
this.__ontimeupdate = false;
|
|
57223
57354
|
this.ontimeupdate = async (_v) => {
|
|
57224
|
-
|
|
57355
|
+
import_loglevel11.default.log("ontimeupdate");
|
|
57225
57356
|
this.trackCurrentTime();
|
|
57226
57357
|
};
|
|
57227
57358
|
this.ensureOnTimeUpdate = (remove, replace) => {
|
|
@@ -57256,11 +57387,11 @@ var MediaOverlayModule = class {
|
|
|
57256
57387
|
return mediaOverlay;
|
|
57257
57388
|
}
|
|
57258
57389
|
stop() {
|
|
57259
|
-
|
|
57390
|
+
import_loglevel11.default.log("MediaOverlay module stop");
|
|
57260
57391
|
}
|
|
57261
57392
|
start() {
|
|
57262
57393
|
this.delegate.mediaOverlayModule = this;
|
|
57263
|
-
|
|
57394
|
+
import_loglevel11.default.log("MediaOverlay module start");
|
|
57264
57395
|
}
|
|
57265
57396
|
async initialize() {
|
|
57266
57397
|
return new Promise(async (resolve) => {
|
|
@@ -57293,7 +57424,7 @@ var MediaOverlayModule = class {
|
|
|
57293
57424
|
return;
|
|
57294
57425
|
}
|
|
57295
57426
|
if (!response.ok) {
|
|
57296
|
-
|
|
57427
|
+
import_loglevel11.default.log("BAD RESPONSE?!");
|
|
57297
57428
|
}
|
|
57298
57429
|
let moJson;
|
|
57299
57430
|
try {
|
|
@@ -57302,7 +57433,7 @@ var MediaOverlayModule = class {
|
|
|
57302
57433
|
console.error(e);
|
|
57303
57434
|
}
|
|
57304
57435
|
if (!moJson) {
|
|
57305
|
-
|
|
57436
|
+
import_loglevel11.default.log("## moJson" + moJson);
|
|
57306
57437
|
return;
|
|
57307
57438
|
}
|
|
57308
57439
|
link.MediaOverlays = TaJsonDeserialize(moJson, import_media_overlay.MediaOverlayNode);
|
|
@@ -57388,7 +57519,7 @@ var MediaOverlayModule = class {
|
|
|
57388
57519
|
}
|
|
57389
57520
|
}
|
|
57390
57521
|
findDepthFirstTextAudioPair(textHref, mo, textFragmentIDChain) {
|
|
57391
|
-
|
|
57522
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair()");
|
|
57392
57523
|
let isTextUrlMatch;
|
|
57393
57524
|
let isFragmentIDMatch;
|
|
57394
57525
|
if (mo.Text) {
|
|
@@ -57409,16 +57540,16 @@ var MediaOverlayModule = class {
|
|
|
57409
57540
|
isTextUrlMatch = false;
|
|
57410
57541
|
}
|
|
57411
57542
|
}
|
|
57412
|
-
|
|
57413
|
-
|
|
57543
|
+
import_loglevel11.default.log("isFragmentIDMatch: " + isFragmentIDMatch);
|
|
57544
|
+
import_loglevel11.default.log("isTextUrlMatch: " + isTextUrlMatch);
|
|
57414
57545
|
if (!mo.Children || !mo.Children.length) {
|
|
57415
|
-
|
|
57546
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - leaf text/audio pair");
|
|
57416
57547
|
if (!isTextUrlMatch) {
|
|
57417
|
-
|
|
57548
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - leaf - !isTextUrlMatch");
|
|
57418
57549
|
return void 0;
|
|
57419
57550
|
}
|
|
57420
57551
|
if (isFragmentIDMatch || isTextUrlMatch && !textFragmentIDChain) {
|
|
57421
|
-
|
|
57552
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - leaf - isFragmentIDMatch || (isTextUrlMatch && !textFragmentIDChain");
|
|
57422
57553
|
return mo;
|
|
57423
57554
|
}
|
|
57424
57555
|
return void 0;
|
|
@@ -57426,25 +57557,25 @@ var MediaOverlayModule = class {
|
|
|
57426
57557
|
const textFragmentIDChainOriginal = textFragmentIDChain;
|
|
57427
57558
|
let frags = textFragmentIDChain;
|
|
57428
57559
|
for (const child of mo.Children) {
|
|
57429
|
-
|
|
57430
|
-
|
|
57560
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - child");
|
|
57561
|
+
import_loglevel11.default.log(JSON.stringify(child));
|
|
57431
57562
|
const match = this.findDepthFirstTextAudioPair(textHref, child, frags);
|
|
57432
57563
|
if (match === null) {
|
|
57433
|
-
|
|
57564
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - child - match null (skip)");
|
|
57434
57565
|
frags = void 0;
|
|
57435
57566
|
}
|
|
57436
57567
|
if (match) {
|
|
57437
|
-
|
|
57438
|
-
|
|
57568
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - child - match");
|
|
57569
|
+
import_loglevel11.default.log(JSON.stringify(match));
|
|
57439
57570
|
return match;
|
|
57440
57571
|
}
|
|
57441
57572
|
}
|
|
57442
57573
|
if (isFragmentIDMatch) {
|
|
57443
|
-
|
|
57574
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch");
|
|
57444
57575
|
const match = this.findDepthFirstTextAudioPair(textHref, mo, void 0);
|
|
57445
57576
|
if (match) {
|
|
57446
|
-
|
|
57447
|
-
|
|
57577
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch - match");
|
|
57578
|
+
import_loglevel11.default.log(JSON.stringify(match));
|
|
57448
57579
|
return match;
|
|
57449
57580
|
} else {
|
|
57450
57581
|
return match;
|
|
@@ -57460,7 +57591,7 @@ var MediaOverlayModule = class {
|
|
|
57460
57591
|
if (this.mediaOverlayTextAudioPair) {
|
|
57461
57592
|
try {
|
|
57462
57593
|
if (this.currentAudioEnd && this.audioElement.currentTime >= this.currentAudioEnd - 0.05) {
|
|
57463
|
-
|
|
57594
|
+
import_loglevel11.default.log("ontimeupdate - mediaOverlaysNext()");
|
|
57464
57595
|
this.mediaOverlaysNext();
|
|
57465
57596
|
}
|
|
57466
57597
|
const match_i = this.mediaOverlayTextAudioPair.Text.lastIndexOf("#");
|
|
@@ -57472,11 +57603,11 @@ var MediaOverlayModule = class {
|
|
|
57472
57603
|
}
|
|
57473
57604
|
}
|
|
57474
57605
|
mediaOverlaysNext(escape2) {
|
|
57475
|
-
|
|
57606
|
+
import_loglevel11.default.log("mediaOverlaysNext()");
|
|
57476
57607
|
if (this.mediaOverlayRoot && this.mediaOverlayTextAudioPair) {
|
|
57477
57608
|
const nextTextAudioPair = this.findNextTextAudioPair(this.mediaOverlayRoot, this.mediaOverlayTextAudioPair, { prev: void 0 }, escape2 ? true : false);
|
|
57478
57609
|
if (!nextTextAudioPair) {
|
|
57479
|
-
|
|
57610
|
+
import_loglevel11.default.log("mediaOverlaysNext() - navLeftOrRight()");
|
|
57480
57611
|
this.mediaOverlaysStop();
|
|
57481
57612
|
if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
|
|
57482
57613
|
this.currentLinkIndex++;
|
|
@@ -57496,21 +57627,21 @@ var MediaOverlayModule = class {
|
|
|
57496
57627
|
const hrefUrlObj1 = new URL("https://dita.digital/" + this.mediaOverlayTextAudioPair.Text);
|
|
57497
57628
|
const hrefUrlObj2 = new URL("https://dita.digital/" + nextTextAudioPair.Text);
|
|
57498
57629
|
if (hrefUrlObj1.pathname !== hrefUrlObj2.pathname) {
|
|
57499
|
-
|
|
57630
|
+
import_loglevel11.default.log("mediaOverlaysNext() SWITCH! " + hrefUrlObj1.pathname + " != " + hrefUrlObj2.pathname);
|
|
57500
57631
|
switchDoc = true;
|
|
57501
57632
|
}
|
|
57502
57633
|
}
|
|
57503
57634
|
if (switchDoc) {
|
|
57504
57635
|
this.mediaOverlaysStop();
|
|
57505
57636
|
} else {
|
|
57506
|
-
|
|
57637
|
+
import_loglevel11.default.log("mediaOverlaysNext() - playMediaOverlaysAudio()");
|
|
57507
57638
|
setTimeout(async () => {
|
|
57508
57639
|
await this.playMediaOverlaysAudio(nextTextAudioPair, void 0, void 0);
|
|
57509
57640
|
}, 0);
|
|
57510
57641
|
}
|
|
57511
57642
|
}
|
|
57512
57643
|
} else {
|
|
57513
|
-
|
|
57644
|
+
import_loglevel11.default.log("mediaOverlaysNext() - navLeftOrRight() 2");
|
|
57514
57645
|
this.mediaOverlaysStop();
|
|
57515
57646
|
if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
|
|
57516
57647
|
this.currentLinkIndex++;
|
|
@@ -57527,13 +57658,13 @@ var MediaOverlayModule = class {
|
|
|
57527
57658
|
}
|
|
57528
57659
|
}
|
|
57529
57660
|
mediaOverlaysStop() {
|
|
57530
|
-
|
|
57661
|
+
import_loglevel11.default.log("mediaOverlaysStop()");
|
|
57531
57662
|
this.mediaOverlaysPause();
|
|
57532
57663
|
this.mediaOverlayRoot = void 0;
|
|
57533
57664
|
this.mediaOverlayTextAudioPair = void 0;
|
|
57534
57665
|
}
|
|
57535
57666
|
mediaOverlaysPause() {
|
|
57536
|
-
|
|
57667
|
+
import_loglevel11.default.log("mediaOverlaysPause()");
|
|
57537
57668
|
this.mediaOverlayHighlight(void 0);
|
|
57538
57669
|
if (this.audioElement) {
|
|
57539
57670
|
this.audioElement.pause();
|
|
@@ -57542,28 +57673,28 @@ var MediaOverlayModule = class {
|
|
|
57542
57673
|
findNextTextAudioPair(mo, moToMatch, previousMo, escape2) {
|
|
57543
57674
|
if (!mo.Children || !mo.Children.length) {
|
|
57544
57675
|
if (previousMo?.prev === moToMatch) {
|
|
57545
|
-
|
|
57676
|
+
import_loglevel11.default.log("findNextTextAudioPair() - prevMo === moToMatch");
|
|
57546
57677
|
return mo;
|
|
57547
57678
|
}
|
|
57548
|
-
|
|
57549
|
-
|
|
57679
|
+
import_loglevel11.default.log("findNextTextAudioPair() - set previous");
|
|
57680
|
+
import_loglevel11.default.log(JSON.stringify(mo));
|
|
57550
57681
|
previousMo.prev = mo;
|
|
57551
57682
|
return void 0;
|
|
57552
57683
|
}
|
|
57553
57684
|
for (const child of mo.Children) {
|
|
57554
|
-
|
|
57555
|
-
|
|
57685
|
+
import_loglevel11.default.log("findNextTextAudioPair() - child");
|
|
57686
|
+
import_loglevel11.default.log(JSON.stringify(child));
|
|
57556
57687
|
const match = this.findNextTextAudioPair(child, moToMatch, previousMo, escape2);
|
|
57557
57688
|
if (match) {
|
|
57558
|
-
|
|
57559
|
-
|
|
57689
|
+
import_loglevel11.default.log("findNextTextAudioPair() - match");
|
|
57690
|
+
import_loglevel11.default.log(JSON.stringify(match));
|
|
57560
57691
|
return match;
|
|
57561
57692
|
}
|
|
57562
57693
|
}
|
|
57563
57694
|
return void 0;
|
|
57564
57695
|
}
|
|
57565
57696
|
async playMediaOverlaysAudio(moTextAudioPair, begin, end) {
|
|
57566
|
-
|
|
57697
|
+
import_loglevel11.default.log("playMediaOverlaysAudio()");
|
|
57567
57698
|
this.mediaOverlayTextAudioPair = moTextAudioPair;
|
|
57568
57699
|
if (!moTextAudioPair.Audio) {
|
|
57569
57700
|
return;
|
|
@@ -57587,14 +57718,14 @@ var MediaOverlayModule = class {
|
|
|
57587
57718
|
try {
|
|
57588
57719
|
this.currentAudioBegin = parseFloat(b);
|
|
57589
57720
|
} catch (err) {
|
|
57590
|
-
|
|
57721
|
+
import_loglevel11.default.error(err);
|
|
57591
57722
|
}
|
|
57592
57723
|
if (matches.length >= 3) {
|
|
57593
57724
|
const e = matches[3];
|
|
57594
57725
|
try {
|
|
57595
57726
|
this.currentAudioEnd = parseFloat(e);
|
|
57596
57727
|
} catch (err) {
|
|
57597
|
-
|
|
57728
|
+
import_loglevel11.default.error(err);
|
|
57598
57729
|
}
|
|
57599
57730
|
}
|
|
57600
57731
|
}
|
|
@@ -57603,7 +57734,7 @@ var MediaOverlayModule = class {
|
|
|
57603
57734
|
this.currentAudioBegin = begin;
|
|
57604
57735
|
this.currentAudioEnd = end;
|
|
57605
57736
|
}
|
|
57606
|
-
|
|
57737
|
+
import_loglevel11.default.log(`${urlFull} => [${this.currentAudioBegin}-${this.currentAudioEnd}]`);
|
|
57607
57738
|
const playClip = async (initial) => {
|
|
57608
57739
|
if (!this.audioElement) {
|
|
57609
57740
|
return;
|
|
@@ -57611,7 +57742,7 @@ var MediaOverlayModule = class {
|
|
|
57611
57742
|
const timeToSeekTo = this.currentAudioBegin ? this.currentAudioBegin : 0;
|
|
57612
57743
|
if (initial || this.audioElement.paused) {
|
|
57613
57744
|
if (initial && !timeToSeekTo || this.audioElement.currentTime === timeToSeekTo) {
|
|
57614
|
-
|
|
57745
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - _currentAudioElement.play()");
|
|
57615
57746
|
this.ensureOnTimeUpdate(false, false);
|
|
57616
57747
|
this.audioElement.playbackRate = this.settings.rate;
|
|
57617
57748
|
this.audioElement.volume = this.settings.volume;
|
|
@@ -57630,10 +57761,10 @@ var MediaOverlayModule = class {
|
|
|
57630
57761
|
checkReady();
|
|
57631
57762
|
}
|
|
57632
57763
|
} else {
|
|
57633
|
-
|
|
57764
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked");
|
|
57634
57765
|
const ontimeupdateSeeked = async (_ev) => {
|
|
57635
57766
|
this.audioElement.removeEventListener("timeupdate", ontimeupdateSeeked);
|
|
57636
|
-
|
|
57767
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked - .play()");
|
|
57637
57768
|
this.ensureOnTimeUpdate(false, false);
|
|
57638
57769
|
if (this.audioElement) {
|
|
57639
57770
|
this.audioElement.playbackRate = this.settings.rate;
|
|
@@ -57661,9 +57792,9 @@ var MediaOverlayModule = class {
|
|
|
57661
57792
|
const contiguous = this.previousAudioUrl === this.currentAudioUrl && typeof this.previousAudioEnd !== "undefined" && this.previousAudioEnd > timeToSeekTo - 0.02 && this.previousAudioEnd <= timeToSeekTo && this.audioElement.currentTime >= timeToSeekTo - 0.1;
|
|
57662
57793
|
this.ensureOnTimeUpdate(false, false);
|
|
57663
57794
|
if (contiguous) {
|
|
57664
|
-
|
|
57795
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - ensureOnTimeUpdate");
|
|
57665
57796
|
} else {
|
|
57666
|
-
|
|
57797
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - currentTime = timeToSeekTo");
|
|
57667
57798
|
this.audioElement.currentTime = timeToSeekTo;
|
|
57668
57799
|
}
|
|
57669
57800
|
}
|
|
@@ -57671,7 +57802,7 @@ var MediaOverlayModule = class {
|
|
|
57671
57802
|
this.previousAudioUrl = this.currentAudioUrl;
|
|
57672
57803
|
if (!this.currentAudioUrl || urlNoQuery !== this.currentAudioUrl) {
|
|
57673
57804
|
this.currentAudioUrl = urlNoQuery;
|
|
57674
|
-
|
|
57805
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - RESET: " + this.previousAudioUrl + " => " + this.currentAudioUrl);
|
|
57675
57806
|
this.audioElement = document.getElementById("AUDIO_MO_ID");
|
|
57676
57807
|
if (this.audioElement) {
|
|
57677
57808
|
this.audioElement.pause();
|
|
@@ -57688,21 +57819,21 @@ var MediaOverlayModule = class {
|
|
|
57688
57819
|
this.audioElement.playbackRate = this.settings.rate;
|
|
57689
57820
|
document.body.appendChild(this.audioElement);
|
|
57690
57821
|
this.audioElement.addEventListener("error", (ev) => {
|
|
57691
|
-
|
|
57822
|
+
import_loglevel11.default.log("-1) error: " + (this.currentAudioUrl !== ev.currentTarget.src ? this.currentAudioUrl + " -- " : "") + ev.currentTarget.src.substr(ev.currentTarget.src.lastIndexOf("/")));
|
|
57692
57823
|
if (this.audioElement && this.audioElement.error) {
|
|
57693
|
-
|
|
57694
|
-
|
|
57824
|
+
import_loglevel11.default.log(this.audioElement.error.code);
|
|
57825
|
+
import_loglevel11.default.log(this.audioElement.error.message);
|
|
57695
57826
|
}
|
|
57696
57827
|
});
|
|
57697
57828
|
const oncanplaythrough = async (ev) => {
|
|
57698
57829
|
const currentAudioElement = ev.currentTarget;
|
|
57699
57830
|
currentAudioElement.removeEventListener("canplaythrough", oncanplaythrough);
|
|
57700
|
-
|
|
57831
|
+
import_loglevel11.default.log("oncanplaythrough");
|
|
57701
57832
|
await playClip(true);
|
|
57702
57833
|
};
|
|
57703
57834
|
this.audioElement.addEventListener("canplaythrough", oncanplaythrough);
|
|
57704
57835
|
const onended = async (_ev) => {
|
|
57705
|
-
|
|
57836
|
+
import_loglevel11.default.log("onended");
|
|
57706
57837
|
if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
|
|
57707
57838
|
this.currentLinkIndex++;
|
|
57708
57839
|
await this.playLink();
|
|
@@ -57719,35 +57850,35 @@ var MediaOverlayModule = class {
|
|
|
57719
57850
|
this.audioElement.playbackRate = this.settings.rate;
|
|
57720
57851
|
this.audioElement.setAttribute("src", this.currentAudioUrl);
|
|
57721
57852
|
} else {
|
|
57722
|
-
|
|
57853
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - playClip()");
|
|
57723
57854
|
await playClip(false);
|
|
57724
57855
|
}
|
|
57725
57856
|
}
|
|
57726
57857
|
async playMediaOverlays(textHref, rootMo, textFragmentIDChain) {
|
|
57727
|
-
|
|
57858
|
+
import_loglevel11.default.log("playMediaOverlays()");
|
|
57728
57859
|
let textFragmentIDChain_ = textFragmentIDChain ? textFragmentIDChain.filter((id2) => id2) : void 0;
|
|
57729
57860
|
if (textFragmentIDChain_ && textFragmentIDChain_.length === 0) {
|
|
57730
57861
|
textFragmentIDChain_ = void 0;
|
|
57731
57862
|
}
|
|
57732
57863
|
let moTextAudioPair = this.findDepthFirstTextAudioPair(textHref, rootMo, textFragmentIDChain_);
|
|
57733
57864
|
if (!moTextAudioPair && textFragmentIDChain_) {
|
|
57734
|
-
|
|
57735
|
-
|
|
57736
|
-
|
|
57865
|
+
import_loglevel11.default.log("playMediaOverlays() - findDepthFirstTextAudioPair() SECOND CHANCE ");
|
|
57866
|
+
import_loglevel11.default.log(JSON.stringify(textFragmentIDChain_, null, 4));
|
|
57867
|
+
import_loglevel11.default.log(JSON.stringify(rootMo, null, 4));
|
|
57737
57868
|
moTextAudioPair = this.findDepthFirstTextAudioPair(textHref, rootMo, void 0);
|
|
57738
57869
|
}
|
|
57739
57870
|
if (moTextAudioPair) {
|
|
57740
57871
|
if (moTextAudioPair.Audio) {
|
|
57741
|
-
|
|
57872
|
+
import_loglevel11.default.log("playMediaOverlays() - playMediaOverlaysAudio()");
|
|
57742
57873
|
this.mediaOverlayRoot = rootMo;
|
|
57743
57874
|
await this.playMediaOverlaysAudio(moTextAudioPair, void 0, void 0);
|
|
57744
57875
|
}
|
|
57745
57876
|
} else {
|
|
57746
|
-
|
|
57877
|
+
import_loglevel11.default.log("playMediaOverlays() - !moTextAudioPair " + textHref);
|
|
57747
57878
|
}
|
|
57748
57879
|
}
|
|
57749
57880
|
mediaOverlayHighlight(id2) {
|
|
57750
|
-
|
|
57881
|
+
import_loglevel11.default.log("moHighlight: ## " + id2);
|
|
57751
57882
|
let classActive = this.publication.Metadata?.MediaOverlay?.ActiveClass;
|
|
57752
57883
|
if (!classActive) {
|
|
57753
57884
|
classActive = this.settings.color;
|
|
@@ -57792,7 +57923,7 @@ var MediaOverlayModule = class {
|
|
|
57792
57923
|
|
|
57793
57924
|
// src/modules/positions/TimelineModule.ts
|
|
57794
57925
|
init_polyfills();
|
|
57795
|
-
var
|
|
57926
|
+
var import_loglevel12 = __toModule(require_loglevel());
|
|
57796
57927
|
var TimelineModule = class {
|
|
57797
57928
|
static async create(config2) {
|
|
57798
57929
|
const timeline = new this(config2.delegate, config2.publication);
|
|
@@ -57804,7 +57935,7 @@ var TimelineModule = class {
|
|
|
57804
57935
|
this.publication = publication;
|
|
57805
57936
|
}
|
|
57806
57937
|
async stop() {
|
|
57807
|
-
|
|
57938
|
+
import_loglevel12.default.log("Timeline module stop");
|
|
57808
57939
|
}
|
|
57809
57940
|
async start() {
|
|
57810
57941
|
this.delegate.timelineModule = this;
|
|
@@ -57873,7 +58004,7 @@ var TimelineModule = class {
|
|
|
57873
58004
|
title: link.Title
|
|
57874
58005
|
};
|
|
57875
58006
|
}
|
|
57876
|
-
|
|
58007
|
+
import_loglevel12.default.log(position);
|
|
57877
58008
|
this.delegate.navigate(position);
|
|
57878
58009
|
});
|
|
57879
58010
|
if (tocHrefAbs === this.delegate.currentChapterLink.href) {
|
|
@@ -57896,19 +58027,19 @@ var import_debounce3 = __toModule(require_debounce());
|
|
|
57896
58027
|
|
|
57897
58028
|
// src/utils/index.ts
|
|
57898
58029
|
init_polyfills();
|
|
57899
|
-
var
|
|
58030
|
+
var import_loglevel13 = __toModule(require_loglevel());
|
|
57900
58031
|
function delay(t, v) {
|
|
57901
58032
|
return new Promise(function(resolve) {
|
|
57902
58033
|
setTimeout(resolve.bind(null, v), t);
|
|
57903
58034
|
});
|
|
57904
58035
|
}
|
|
57905
58036
|
var IS_DEV = false;
|
|
57906
|
-
|
|
58037
|
+
import_loglevel13.default.setLevel(IS_DEV ? "trace" : "warn", true);
|
|
57907
58038
|
|
|
57908
58039
|
// src/modules/protection/ContentProtectionModule.ts
|
|
57909
58040
|
var import_browserslist_useragent_regexp = __toModule(require_lib7());
|
|
57910
58041
|
var import_devtools_detector = __toModule(require_devtools_detector());
|
|
57911
|
-
var
|
|
58042
|
+
var import_loglevel14 = __toModule(require_loglevel());
|
|
57912
58043
|
var ContentProtectionModule = class {
|
|
57913
58044
|
constructor(delegate, properties) {
|
|
57914
58045
|
this.hasEventListener = false;
|
|
@@ -57970,14 +58101,14 @@ var ContentProtectionModule = class {
|
|
|
57970
58101
|
var self2 = this;
|
|
57971
58102
|
this.mutationObserver = new MutationObserver(function(mutations) {
|
|
57972
58103
|
mutations.forEach(function(mutation) {
|
|
57973
|
-
|
|
58104
|
+
import_loglevel14.default.log(mutation.type);
|
|
57974
58105
|
self2.isHacked = true;
|
|
57975
58106
|
});
|
|
57976
58107
|
});
|
|
57977
58108
|
}
|
|
57978
58109
|
}
|
|
57979
58110
|
async stop() {
|
|
57980
|
-
|
|
58111
|
+
import_loglevel14.default.log("Protection module stop");
|
|
57981
58112
|
this.mutationObserver.disconnect();
|
|
57982
58113
|
if (this.properties?.disableKeys) {
|
|
57983
58114
|
removeEventListenerOptional(this.delegate.mainElement, "keydown", this.disableSave);
|
|
@@ -58287,7 +58418,7 @@ var ContentProtectionModule = class {
|
|
|
58287
58418
|
return true;
|
|
58288
58419
|
}
|
|
58289
58420
|
preventCopy(event) {
|
|
58290
|
-
|
|
58421
|
+
import_loglevel14.default.log("copy action initiated");
|
|
58291
58422
|
event.clipboardData.setData("text/plain", "copy not allowed");
|
|
58292
58423
|
event.stopPropagation();
|
|
58293
58424
|
event.preventDefault();
|
|
@@ -58305,7 +58436,7 @@ var ContentProtectionModule = class {
|
|
|
58305
58436
|
if (this.citation) {
|
|
58306
58437
|
return;
|
|
58307
58438
|
}
|
|
58308
|
-
|
|
58439
|
+
import_loglevel14.default.log("copy action initiated");
|
|
58309
58440
|
let win = this.delegate.iframes[0].contentWindow;
|
|
58310
58441
|
if (win) {
|
|
58311
58442
|
let getCssSelector = function(element) {
|
|
@@ -58409,7 +58540,7 @@ var ContentProtectionModule = class {
|
|
|
58409
58540
|
selection?.addRange(rangeToSelect);
|
|
58410
58541
|
}
|
|
58411
58542
|
beforePrint(event) {
|
|
58412
|
-
|
|
58543
|
+
import_loglevel14.default.log("before print");
|
|
58413
58544
|
if (this.delegate && this.delegate.headerMenu) {
|
|
58414
58545
|
this.delegate.headerMenu.style.display = "none";
|
|
58415
58546
|
this.delegate.mainElement.style.display = "none";
|
|
@@ -58419,7 +58550,7 @@ var ContentProtectionModule = class {
|
|
|
58419
58550
|
return false;
|
|
58420
58551
|
}
|
|
58421
58552
|
afterPrint(event) {
|
|
58422
|
-
|
|
58553
|
+
import_loglevel14.default.log("after print");
|
|
58423
58554
|
if (this.delegate && this.delegate.headerMenu) {
|
|
58424
58555
|
this.delegate.headerMenu.style.removeProperty("display");
|
|
58425
58556
|
this.delegate.mainElement.style.removeProperty("display");
|
|
@@ -58509,12 +58640,12 @@ var ContentProtectionModule = class {
|
|
|
58509
58640
|
rect.width = width;
|
|
58510
58641
|
rect.left = left;
|
|
58511
58642
|
} catch (error) {
|
|
58512
|
-
|
|
58513
|
-
|
|
58514
|
-
|
|
58515
|
-
|
|
58516
|
-
|
|
58517
|
-
|
|
58643
|
+
import_loglevel14.default.log("error " + error);
|
|
58644
|
+
import_loglevel14.default.log(rect);
|
|
58645
|
+
import_loglevel14.default.log(rect.node);
|
|
58646
|
+
import_loglevel14.default.log("scrambledTextContent " + rect.scrambledTextContent);
|
|
58647
|
+
import_loglevel14.default.log("textContent " + rect.textContent);
|
|
58648
|
+
import_loglevel14.default.log("isObfuscated " + rect.isObfuscated);
|
|
58518
58649
|
}
|
|
58519
58650
|
});
|
|
58520
58651
|
}
|
|
@@ -58570,14 +58701,14 @@ var ContentProtectionModule = class {
|
|
|
58570
58701
|
range.detach();
|
|
58571
58702
|
return rect;
|
|
58572
58703
|
} catch (error) {
|
|
58573
|
-
|
|
58574
|
-
|
|
58575
|
-
|
|
58704
|
+
import_loglevel14.default.log("measureTextNode " + error);
|
|
58705
|
+
import_loglevel14.default.log("measureTextNode " + node);
|
|
58706
|
+
import_loglevel14.default.log(node.textContent);
|
|
58576
58707
|
}
|
|
58577
58708
|
}
|
|
58578
58709
|
isBeingHacked(element) {
|
|
58579
58710
|
if (element.style.animation || element.style.transition || element.style.position || element.hasAttribute("style")) {
|
|
58580
|
-
|
|
58711
|
+
import_loglevel14.default.log("content being hacked");
|
|
58581
58712
|
return true;
|
|
58582
58713
|
}
|
|
58583
58714
|
return false;
|
|
@@ -58741,7 +58872,7 @@ async function searchDocDomSeek(searchInput, doc, href, title, fullWordSearch =
|
|
|
58741
58872
|
}
|
|
58742
58873
|
|
|
58743
58874
|
// src/modules/search/SearchModule.ts
|
|
58744
|
-
var
|
|
58875
|
+
var import_loglevel15 = __toModule(require_loglevel());
|
|
58745
58876
|
var SearchModule = class {
|
|
58746
58877
|
constructor(delegate, publication, properties, highlighter, api, headerMenu) {
|
|
58747
58878
|
this.currentChapterSearchResult = [];
|
|
@@ -58760,7 +58891,7 @@ var SearchModule = class {
|
|
|
58760
58891
|
return search;
|
|
58761
58892
|
}
|
|
58762
58893
|
async stop() {
|
|
58763
|
-
|
|
58894
|
+
import_loglevel15.default.log("Search module stop");
|
|
58764
58895
|
removeEventListenerOptional(this.searchInput, "keypress", this.handleSearch.bind(this));
|
|
58765
58896
|
removeEventListenerOptional(this.searchGo, "click", this.handleSearch.bind(this));
|
|
58766
58897
|
}
|
|
@@ -59182,7 +59313,7 @@ var SearchModule = class {
|
|
|
59182
59313
|
if (this.delegate.api?.getContent) {
|
|
59183
59314
|
await this.delegate.api?.getContent(href).then((content) => {
|
|
59184
59315
|
let parser = new DOMParser();
|
|
59185
|
-
let doc = parser.parseFromString(
|
|
59316
|
+
let doc = parser.parseFromString(content, "application/xhtml+xml");
|
|
59186
59317
|
if (tocItem) {
|
|
59187
59318
|
searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
|
|
59188
59319
|
result.forEach((searchItem) => {
|
|
@@ -59234,7 +59365,7 @@ var SearchModule = class {
|
|
|
59234
59365
|
if (this.delegate.api?.getContent) {
|
|
59235
59366
|
await this.delegate.api?.getContent(href).then((content) => {
|
|
59236
59367
|
let parser = new DOMParser();
|
|
59237
|
-
let doc = parser.parseFromString(
|
|
59368
|
+
let doc = parser.parseFromString(content, "application/xhtml+xml");
|
|
59238
59369
|
if (tocItem) {
|
|
59239
59370
|
searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
|
|
59240
59371
|
result.forEach((searchItem) => {
|
|
@@ -59316,7 +59447,7 @@ var SearchModule = class {
|
|
|
59316
59447
|
|
|
59317
59448
|
// src/modules/TTS/TTSSettings.ts
|
|
59318
59449
|
init_polyfills();
|
|
59319
|
-
var
|
|
59450
|
+
var import_loglevel16 = __toModule(require_loglevel());
|
|
59320
59451
|
var _TTSREFS = class {
|
|
59321
59452
|
};
|
|
59322
59453
|
var TTSREFS = _TTSREFS;
|
|
@@ -59358,34 +59489,34 @@ var TTSSettings = class {
|
|
|
59358
59489
|
let initialTTSSettings = config2.initialTTSSettings;
|
|
59359
59490
|
if (initialTTSSettings?.rate) {
|
|
59360
59491
|
settings.rate = initialTTSSettings.rate;
|
|
59361
|
-
|
|
59492
|
+
import_loglevel16.default.log(settings.rate);
|
|
59362
59493
|
}
|
|
59363
59494
|
if (initialTTSSettings?.pitch) {
|
|
59364
59495
|
settings.pitch = initialTTSSettings.pitch;
|
|
59365
|
-
|
|
59496
|
+
import_loglevel16.default.log(settings.pitch);
|
|
59366
59497
|
}
|
|
59367
59498
|
if (initialTTSSettings?.volume) {
|
|
59368
59499
|
settings.volume = initialTTSSettings.volume;
|
|
59369
|
-
|
|
59500
|
+
import_loglevel16.default.log(settings.volume);
|
|
59370
59501
|
}
|
|
59371
59502
|
if (initialTTSSettings?.color) {
|
|
59372
59503
|
settings.color = initialTTSSettings.color;
|
|
59373
|
-
|
|
59504
|
+
import_loglevel16.default.log(settings.color);
|
|
59374
59505
|
}
|
|
59375
59506
|
if (initialTTSSettings?.autoScroll) {
|
|
59376
59507
|
settings.autoScroll = initialTTSSettings.autoScroll;
|
|
59377
|
-
|
|
59508
|
+
import_loglevel16.default.log(settings.autoScroll);
|
|
59378
59509
|
}
|
|
59379
59510
|
if (initialTTSSettings?.voice) {
|
|
59380
59511
|
settings.voice = initialTTSSettings.voice;
|
|
59381
|
-
|
|
59512
|
+
import_loglevel16.default.log(settings.voice);
|
|
59382
59513
|
}
|
|
59383
59514
|
}
|
|
59384
59515
|
settings.initializeSelections();
|
|
59385
59516
|
return settings;
|
|
59386
59517
|
}
|
|
59387
59518
|
stop() {
|
|
59388
|
-
|
|
59519
|
+
import_loglevel16.default.log("tts settings stop");
|
|
59389
59520
|
}
|
|
59390
59521
|
initialise() {
|
|
59391
59522
|
this.autoScroll = this.getProperty(TTSREFS.AUTO_SCROLL_KEY) != null ? this.getProperty(TTSREFS.AUTO_SCROLL_KEY).value : this.autoScroll;
|
|
@@ -59458,7 +59589,7 @@ var TTSSettings = class {
|
|
|
59458
59589
|
this.applyTTSSettings(ttsSettings);
|
|
59459
59590
|
if (this.api?.updateSettings) {
|
|
59460
59591
|
this.api?.updateSettings(ttsSettings).then(async (settings) => {
|
|
59461
|
-
|
|
59592
|
+
import_loglevel16.default.log("api updated tts settings", settings);
|
|
59462
59593
|
});
|
|
59463
59594
|
}
|
|
59464
59595
|
}
|
|
@@ -59506,7 +59637,7 @@ var TTSSettings = class {
|
|
|
59506
59637
|
}
|
|
59507
59638
|
applyTTSSettings(ttsSettings) {
|
|
59508
59639
|
if (ttsSettings.rate) {
|
|
59509
|
-
|
|
59640
|
+
import_loglevel16.default.log("rate " + this.rate);
|
|
59510
59641
|
this.rate = ttsSettings.rate;
|
|
59511
59642
|
let prop = this.userProperties.getByRef(TTSREFS.RATE_REF);
|
|
59512
59643
|
if (prop) {
|
|
@@ -59517,7 +59648,7 @@ var TTSSettings = class {
|
|
|
59517
59648
|
this.restartCallback();
|
|
59518
59649
|
}
|
|
59519
59650
|
if (ttsSettings.pitch) {
|
|
59520
|
-
|
|
59651
|
+
import_loglevel16.default.log("pitch " + this.pitch);
|
|
59521
59652
|
this.pitch = ttsSettings.pitch;
|
|
59522
59653
|
let prop = this.userProperties.getByRef(TTSREFS.PITCH_REF);
|
|
59523
59654
|
if (prop) {
|
|
@@ -59528,7 +59659,7 @@ var TTSSettings = class {
|
|
|
59528
59659
|
this.restartCallback();
|
|
59529
59660
|
}
|
|
59530
59661
|
if (ttsSettings.volume) {
|
|
59531
|
-
|
|
59662
|
+
import_loglevel16.default.log("volume " + this.volume);
|
|
59532
59663
|
this.volume = ttsSettings.volume;
|
|
59533
59664
|
let prop = this.userProperties.getByRef(TTSREFS.VOLUME_REF);
|
|
59534
59665
|
if (prop) {
|
|
@@ -59548,7 +59679,7 @@ var TTSSettings = class {
|
|
|
59548
59679
|
this.settingsChangeCallback();
|
|
59549
59680
|
}
|
|
59550
59681
|
if (ttsSettings.autoScroll !== void 0) {
|
|
59551
|
-
|
|
59682
|
+
import_loglevel16.default.log("autoScroll " + this.autoScroll);
|
|
59552
59683
|
this.autoScroll = ttsSettings.autoScroll;
|
|
59553
59684
|
let prop = this.userProperties.getByRef(TTSREFS.AUTO_SCROLL_REF);
|
|
59554
59685
|
if (prop) {
|
|
@@ -59558,7 +59689,7 @@ var TTSSettings = class {
|
|
|
59558
59689
|
this.settingsChangeCallback();
|
|
59559
59690
|
}
|
|
59560
59691
|
if (ttsSettings.voice) {
|
|
59561
|
-
|
|
59692
|
+
import_loglevel16.default.log("voice " + this.voice);
|
|
59562
59693
|
this.voice = ttsSettings.voice;
|
|
59563
59694
|
let prop = this.userProperties.getByRef(TTSREFS.VOICE_REF);
|
|
59564
59695
|
if (prop) {
|
|
@@ -59779,6 +59910,15 @@ var KeyboardEventHandler = class {
|
|
|
59779
59910
|
self2.onBackwardSwipe(event);
|
|
59780
59911
|
break;
|
|
59781
59912
|
}
|
|
59913
|
+
switch (event.code) {
|
|
59914
|
+
case "Space":
|
|
59915
|
+
if (event.ctrlKey) {
|
|
59916
|
+
self2.onBackwardSwipe(event);
|
|
59917
|
+
} else {
|
|
59918
|
+
self2.onForwardSwipe(event);
|
|
59919
|
+
}
|
|
59920
|
+
break;
|
|
59921
|
+
}
|
|
59782
59922
|
}, false);
|
|
59783
59923
|
}
|
|
59784
59924
|
};
|
|
@@ -59894,7 +60034,7 @@ var SampleReadEventHandler = class {
|
|
|
59894
60034
|
|
|
59895
60035
|
// src/navigator/IFrameNavigator.ts
|
|
59896
60036
|
var import_eventemitter3 = __toModule(require_eventemitter3());
|
|
59897
|
-
var
|
|
60037
|
+
var import_loglevel17 = __toModule(require_loglevel());
|
|
59898
60038
|
var IFrameNavigator = class extends import_eventemitter3.default {
|
|
59899
60039
|
constructor(settings, annotator = void 0, initialLastReadingPosition = void 0, publication, api, rights, tts, injectables, attributes, services, sample, requestConfig) {
|
|
59900
60040
|
super();
|
|
@@ -59930,8 +60070,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
59930
60070
|
}
|
|
59931
60071
|
if (lastReadingPosition) {
|
|
59932
60072
|
const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
|
|
59933
|
-
|
|
59934
|
-
|
|
60073
|
+
import_loglevel17.default.log(lastReadingPosition.href);
|
|
60074
|
+
import_loglevel17.default.log(linkHref);
|
|
59935
60075
|
lastReadingPosition.href = linkHref;
|
|
59936
60076
|
await this.navigate(lastReadingPosition);
|
|
59937
60077
|
}
|
|
@@ -59997,7 +60137,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
59997
60137
|
return new Promise((resolve) => resolve(navigator2));
|
|
59998
60138
|
}
|
|
59999
60139
|
stop() {
|
|
60000
|
-
|
|
60140
|
+
import_loglevel17.default.log("Iframe navigator stop");
|
|
60001
60141
|
removeEventListenerOptional(this.previousChapterAnchorElement, "click", this.handlePreviousChapterClick.bind(this));
|
|
60002
60142
|
removeEventListenerOptional(this.nextChapterAnchorElement, "click", this.handleNextChapterClick.bind(this));
|
|
60003
60143
|
removeEventListenerOptional(this.previousChapterTopAnchorElement, "click", this.handlePreviousPageClick.bind(this));
|
|
@@ -60205,7 +60345,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60205
60345
|
this.setupEvents();
|
|
60206
60346
|
return await this.loadManifest();
|
|
60207
60347
|
} catch (err) {
|
|
60208
|
-
|
|
60348
|
+
import_loglevel17.default.error(err);
|
|
60209
60349
|
this.abortOnError(err);
|
|
60210
60350
|
return Promise.reject(err);
|
|
60211
60351
|
}
|
|
@@ -60228,7 +60368,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60228
60368
|
addEventListenerOptional(iframe, "resize", this.onResize);
|
|
60229
60369
|
}
|
|
60230
60370
|
}
|
|
60231
|
-
updateBookView() {
|
|
60371
|
+
updateBookView(options) {
|
|
60232
60372
|
if (this.view?.layout === "fixed") {
|
|
60233
60373
|
if (this.nextPageAnchorElement)
|
|
60234
60374
|
this.nextPageAnchorElement.style.display = "none";
|
|
@@ -60386,7 +60526,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60386
60526
|
await this.highlighter?.destroyHighlights(HighlightType.PageBreak);
|
|
60387
60527
|
await this.pageBreakModule.drawPageBreaks();
|
|
60388
60528
|
}
|
|
60389
|
-
if (this.annotationModule !== void 0) {
|
|
60529
|
+
if (!options?.skipDrawingAnnotations && this.annotationModule !== void 0) {
|
|
60390
60530
|
await this.annotationModule.drawHighlights();
|
|
60391
60531
|
}
|
|
60392
60532
|
if (this.bookmarkModule !== void 0) {
|
|
@@ -60499,8 +60639,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60499
60639
|
}
|
|
60500
60640
|
if (lastReadingPosition) {
|
|
60501
60641
|
const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
|
|
60502
|
-
|
|
60503
|
-
|
|
60642
|
+
import_loglevel17.default.log(lastReadingPosition.href);
|
|
60643
|
+
import_loglevel17.default.log(linkHref);
|
|
60504
60644
|
lastReadingPosition.href = linkHref;
|
|
60505
60645
|
await this.navigate(lastReadingPosition);
|
|
60506
60646
|
} else if (startUrl) {
|
|
@@ -60516,7 +60656,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60516
60656
|
}
|
|
60517
60657
|
return new Promise((resolve) => resolve());
|
|
60518
60658
|
} catch (err) {
|
|
60519
|
-
|
|
60659
|
+
import_loglevel17.default.error(err);
|
|
60520
60660
|
this.abortOnError(err);
|
|
60521
60661
|
return new Promise((_, reject) => reject(err)).catch(() => {
|
|
60522
60662
|
});
|
|
@@ -60532,7 +60672,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60532
60672
|
bookViewPosition = this.newPosition.locations.progression;
|
|
60533
60673
|
}
|
|
60534
60674
|
await this.handleResize();
|
|
60535
|
-
this.updateBookView();
|
|
60675
|
+
this.updateBookView({ skipDrawingAnnotations: true });
|
|
60536
60676
|
await this.settings.applyProperties();
|
|
60537
60677
|
let currentLocation = this.currentChapterLink.href;
|
|
60538
60678
|
if (currentLocation) {
|
|
@@ -60624,6 +60764,11 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60624
60764
|
await this.contentProtectionModule.initialize();
|
|
60625
60765
|
}
|
|
60626
60766
|
}
|
|
60767
|
+
if (this.rights.enableConsumption) {
|
|
60768
|
+
if (this.consumptionModule !== void 0) {
|
|
60769
|
+
await this.consumptionModule.initialize();
|
|
60770
|
+
}
|
|
60771
|
+
}
|
|
60627
60772
|
if (this.eventHandler) {
|
|
60628
60773
|
for (const iframe of this.iframes) {
|
|
60629
60774
|
this.eventHandler.setupEvents(iframe.contentDocument);
|
|
@@ -60698,7 +60843,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60698
60843
|
}, 200);
|
|
60699
60844
|
return new Promise((resolve) => resolve());
|
|
60700
60845
|
} catch (err) {
|
|
60701
|
-
|
|
60846
|
+
import_loglevel17.default.error(err);
|
|
60702
60847
|
this.abortOnError(err);
|
|
60703
60848
|
return Promise.reject(err);
|
|
60704
60849
|
}
|
|
@@ -61242,8 +61387,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61242
61387
|
const position = __spreadValues({}, locator);
|
|
61243
61388
|
position.locations = locations;
|
|
61244
61389
|
const linkHref = this.publication.getAbsoluteHref(locator.href);
|
|
61245
|
-
|
|
61246
|
-
|
|
61390
|
+
import_loglevel17.default.log(locator.href);
|
|
61391
|
+
import_loglevel17.default.log(linkHref);
|
|
61247
61392
|
position.href = linkHref;
|
|
61248
61393
|
this.stopReadAloud();
|
|
61249
61394
|
this.navigate(position);
|
|
@@ -61299,7 +61444,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61299
61444
|
snapToSelector(selector2) {
|
|
61300
61445
|
const doc = this.iframes[0].contentDocument;
|
|
61301
61446
|
if (doc) {
|
|
61302
|
-
|
|
61447
|
+
import_loglevel17.default.log(selector2);
|
|
61303
61448
|
let result = doc.querySelectorAll(selector2);
|
|
61304
61449
|
if (result.length > 0)
|
|
61305
61450
|
this.view?.snap(result[0]);
|
|
@@ -61577,7 +61722,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61577
61722
|
title: previous.Title
|
|
61578
61723
|
};
|
|
61579
61724
|
this.stopReadAloud();
|
|
61580
|
-
this.navigate(position);
|
|
61725
|
+
this.navigate(position, false);
|
|
61581
61726
|
} else {
|
|
61582
61727
|
if (this.previousChapterLink) {
|
|
61583
61728
|
const position = {
|
|
@@ -61589,7 +61734,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61589
61734
|
title: this.previousChapterLink.title
|
|
61590
61735
|
};
|
|
61591
61736
|
this.stopReadAloud();
|
|
61592
|
-
this.navigate(position);
|
|
61737
|
+
this.navigate(position, false);
|
|
61593
61738
|
}
|
|
61594
61739
|
}
|
|
61595
61740
|
if (event) {
|
|
@@ -61613,7 +61758,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61613
61758
|
title: next.Title
|
|
61614
61759
|
};
|
|
61615
61760
|
this.stopReadAloud();
|
|
61616
|
-
this.navigate(position);
|
|
61761
|
+
this.navigate(position, false);
|
|
61617
61762
|
} else {
|
|
61618
61763
|
if (this.nextChapterLink) {
|
|
61619
61764
|
const position = {
|
|
@@ -61625,7 +61770,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61625
61770
|
title: this.nextChapterLink.title
|
|
61626
61771
|
};
|
|
61627
61772
|
this.stopReadAloud();
|
|
61628
|
-
this.navigate(position);
|
|
61773
|
+
this.navigate(position, false);
|
|
61629
61774
|
}
|
|
61630
61775
|
}
|
|
61631
61776
|
if (event) {
|
|
@@ -61653,6 +61798,11 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61653
61798
|
}
|
|
61654
61799
|
}
|
|
61655
61800
|
async navigate(locator, history = true) {
|
|
61801
|
+
if (this.consumptionModule) {
|
|
61802
|
+
if (history) {
|
|
61803
|
+
this.consumptionModule.startReadingSession(locator);
|
|
61804
|
+
}
|
|
61805
|
+
}
|
|
61656
61806
|
if (this.historyModule) {
|
|
61657
61807
|
this.historyModule.push(locator, history);
|
|
61658
61808
|
}
|
|
@@ -61812,10 +61962,6 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61812
61962
|
if (this.rights.enableContentProtection && this.contentProtectionModule !== void 0) {
|
|
61813
61963
|
this.contentProtectionModule.recalculate(300);
|
|
61814
61964
|
}
|
|
61815
|
-
if (this.annotationModule !== void 0) {
|
|
61816
|
-
await this.annotationModule.drawHighlights();
|
|
61817
|
-
await this.annotationModule.showHighlights();
|
|
61818
|
-
}
|
|
61819
61965
|
if (this.bookmarkModule !== void 0) {
|
|
61820
61966
|
await this.bookmarkModule.drawBookmarks();
|
|
61821
61967
|
await this.bookmarkModule.showBookmarks();
|
|
@@ -61831,6 +61977,9 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61831
61977
|
if (this.rights.enableDefinitions && this.definitionsModule !== void 0 && this.highlighter !== void 0) {
|
|
61832
61978
|
this.definitionsModule.drawDefinitions();
|
|
61833
61979
|
}
|
|
61980
|
+
if (this.rights.enableConsumption && this.consumptionModule !== void 0) {
|
|
61981
|
+
this.consumptionModule.continueReadingSession(locator);
|
|
61982
|
+
}
|
|
61834
61983
|
if (this.view?.layout === "fixed") {
|
|
61835
61984
|
if (this.nextChapterBottomAnchorElement)
|
|
61836
61985
|
this.nextChapterBottomAnchorElement.style.display = "none";
|
|
@@ -61995,13 +62144,16 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61995
62144
|
}
|
|
61996
62145
|
if (this.api?.updateCurrentLocation) {
|
|
61997
62146
|
this.api?.updateCurrentLocation(position).then(async (_) => {
|
|
61998
|
-
|
|
62147
|
+
import_loglevel17.default.log("api updated current location", position);
|
|
61999
62148
|
return this.annotator?.saveLastReadingPosition(position);
|
|
62000
62149
|
});
|
|
62001
62150
|
} else {
|
|
62002
|
-
|
|
62151
|
+
import_loglevel17.default.log("save last reading position", position);
|
|
62003
62152
|
this.annotator.saveLastReadingPosition(position);
|
|
62004
62153
|
}
|
|
62154
|
+
if (this.consumptionModule) {
|
|
62155
|
+
this.consumptionModule.continueReadingSession(position);
|
|
62156
|
+
}
|
|
62005
62157
|
}
|
|
62006
62158
|
}
|
|
62007
62159
|
}
|
|
@@ -62314,6 +62466,22 @@ var _LocalAnnotator = class {
|
|
|
62314
62466
|
}
|
|
62315
62467
|
return [];
|
|
62316
62468
|
}
|
|
62469
|
+
getAnnotationsByChapter(chapter) {
|
|
62470
|
+
const savedAnnotations = this.store.get(_LocalAnnotator.ANNOTATIONS);
|
|
62471
|
+
if (savedAnnotations) {
|
|
62472
|
+
let annotations = JSON.parse(savedAnnotations);
|
|
62473
|
+
annotations = annotations.filter((annotation) => annotation.href === chapter);
|
|
62474
|
+
annotations = annotations.sort((n1, n2) => {
|
|
62475
|
+
if (n1.locations.progression && n2.locations.progression) {
|
|
62476
|
+
return n1.locations.progression - n2.locations.progression;
|
|
62477
|
+
} else {
|
|
62478
|
+
return void 0;
|
|
62479
|
+
}
|
|
62480
|
+
});
|
|
62481
|
+
return annotations;
|
|
62482
|
+
}
|
|
62483
|
+
return [];
|
|
62484
|
+
}
|
|
62317
62485
|
getAnnotationPosition(id2, iframeWin) {
|
|
62318
62486
|
const savedAnnotations = this.store.get(_LocalAnnotator.ANNOTATIONS);
|
|
62319
62487
|
if (savedAnnotations) {
|
|
@@ -62517,7 +62685,7 @@ function convertAndCamel(o) {
|
|
|
62517
62685
|
|
|
62518
62686
|
// src/modules/highlight/LayerSettings.ts
|
|
62519
62687
|
init_polyfills();
|
|
62520
|
-
var
|
|
62688
|
+
var import_loglevel18 = __toModule(require_loglevel());
|
|
62521
62689
|
var LayerSettings = class {
|
|
62522
62690
|
constructor(store) {
|
|
62523
62691
|
this.LAYERSETTINGS = "layerSetting";
|
|
@@ -62529,7 +62697,7 @@ var LayerSettings = class {
|
|
|
62529
62697
|
return new Promise((resolve) => resolve(settings));
|
|
62530
62698
|
}
|
|
62531
62699
|
async stop() {
|
|
62532
|
-
|
|
62700
|
+
import_loglevel18.default.log("MediaOverlay settings stop");
|
|
62533
62701
|
}
|
|
62534
62702
|
async initialize() {
|
|
62535
62703
|
this.userProperties = await this.getLayerSettings();
|
|
@@ -62573,7 +62741,7 @@ var LayerSettings = class {
|
|
|
62573
62741
|
|
|
62574
62742
|
// src/modules/pagebreak/PageBreakModule.ts
|
|
62575
62743
|
init_polyfills();
|
|
62576
|
-
var
|
|
62744
|
+
var import_loglevel19 = __toModule(require_loglevel());
|
|
62577
62745
|
var PageBreakModule = class {
|
|
62578
62746
|
static async create(config2) {
|
|
62579
62747
|
const pageBreak = new this(config2.delegate, config2.publication, config2, config2.headerMenu);
|
|
@@ -62587,7 +62755,7 @@ var PageBreakModule = class {
|
|
|
62587
62755
|
this.properties = properties;
|
|
62588
62756
|
}
|
|
62589
62757
|
async stop() {
|
|
62590
|
-
|
|
62758
|
+
import_loglevel19.default.log("Page Break module stop");
|
|
62591
62759
|
}
|
|
62592
62760
|
async start() {
|
|
62593
62761
|
this.delegate.pageBreakModule = this;
|
|
@@ -62656,15 +62824,15 @@ var PageBreakModule = class {
|
|
|
62656
62824
|
return "";
|
|
62657
62825
|
}
|
|
62658
62826
|
} catch (err) {
|
|
62659
|
-
|
|
62660
|
-
|
|
62827
|
+
import_loglevel19.default.log("uniqueCssSelector:");
|
|
62828
|
+
import_loglevel19.default.error(err);
|
|
62661
62829
|
return "";
|
|
62662
62830
|
}
|
|
62663
62831
|
}
|
|
62664
62832
|
if (pageBreaks) {
|
|
62665
62833
|
for (let i = 0; i < pageBreaks.length; i++) {
|
|
62666
62834
|
let img = pageBreaks[i];
|
|
62667
|
-
|
|
62835
|
+
import_loglevel19.default.log(img);
|
|
62668
62836
|
let title = img.innerHTML;
|
|
62669
62837
|
let hide = false;
|
|
62670
62838
|
if (img.innerHTML.length === 0) {
|
|
@@ -62737,7 +62905,7 @@ var PageBreakModule = class {
|
|
|
62737
62905
|
init_polyfills();
|
|
62738
62906
|
var import_sanitize_html2 = __toModule(require_sanitize_html());
|
|
62739
62907
|
var import_debounce6 = __toModule(require_debounce());
|
|
62740
|
-
var
|
|
62908
|
+
var import_loglevel20 = __toModule(require_loglevel());
|
|
62741
62909
|
var TTSModule2 = class {
|
|
62742
62910
|
constructor(delegate, tts, rights, highlighter, properties, api, headerMenu) {
|
|
62743
62911
|
this.voices = [];
|
|
@@ -62860,14 +63028,14 @@ var TTSModule2 = class {
|
|
|
62860
63028
|
}
|
|
62861
63029
|
let s = setSpeech();
|
|
62862
63030
|
s.then(async (voices) => {
|
|
62863
|
-
|
|
63031
|
+
import_loglevel20.default.log(voices);
|
|
62864
63032
|
this.voices = [];
|
|
62865
63033
|
voices.forEach((voice) => {
|
|
62866
63034
|
if (voice.localService === true) {
|
|
62867
63035
|
this.voices.push(voice);
|
|
62868
63036
|
}
|
|
62869
63037
|
});
|
|
62870
|
-
|
|
63038
|
+
import_loglevel20.default.log(this.voices);
|
|
62871
63039
|
if (first) {
|
|
62872
63040
|
if (this.headerMenu) {
|
|
62873
63041
|
var preferredLanguageSelector = findElement(this.headerMenu, "#preferred-languages");
|
|
@@ -62956,16 +63124,16 @@ var TTSModule2 = class {
|
|
|
62956
63124
|
restOfTheText = restOfTheText.replace(textToBeSpoken, "").trim();
|
|
62957
63125
|
}
|
|
62958
63126
|
utterance = new SpeechSynthesisUtterance(textToBeSpoken);
|
|
62959
|
-
|
|
62960
|
-
|
|
62961
|
-
|
|
62962
|
-
|
|
62963
|
-
|
|
62964
|
-
|
|
63127
|
+
import_loglevel20.default.log(selectionInfo);
|
|
63128
|
+
import_loglevel20.default.log(textToBeSpoken, selectionInfo.range?.commonAncestorContainer.textContent);
|
|
63129
|
+
import_loglevel20.default.log(ttsQueueItem);
|
|
63130
|
+
import_loglevel20.default.log(ttsQueueItem.item.textNodes);
|
|
63131
|
+
import_loglevel20.default.log(startIndex);
|
|
63132
|
+
import_loglevel20.default.log(ttsQueueItem.item.combinedText);
|
|
62965
63133
|
let node = ttsQueueItem.item.textNodes.filter((node2) => {
|
|
62966
63134
|
return node2 === selectionInfo.range?.commonAncestorContainer;
|
|
62967
63135
|
})[0];
|
|
62968
|
-
|
|
63136
|
+
import_loglevel20.default.log(node);
|
|
62969
63137
|
utterance.onboundary = (ev) => {
|
|
62970
63138
|
this.updateTTSInfo(ttsQueueItem, ev.charIndex, ev.charLength, startIndex, utterance.text);
|
|
62971
63139
|
};
|
|
@@ -62978,7 +63146,7 @@ var TTSModule2 = class {
|
|
|
62978
63146
|
utterance.rate = this.tts.rate;
|
|
62979
63147
|
utterance.pitch = this.tts.pitch;
|
|
62980
63148
|
utterance.volume = this.tts.volume;
|
|
62981
|
-
|
|
63149
|
+
import_loglevel20.default.log("this.tts.voice.lang", this.tts.voice.lang);
|
|
62982
63150
|
var initialVoiceHasHyphen = true;
|
|
62983
63151
|
if (this.tts.voice && this.tts.voice.lang) {
|
|
62984
63152
|
initialVoiceHasHyphen = this.tts.voice.lang.indexOf("-") !== -1;
|
|
@@ -62987,8 +63155,8 @@ var TTSModule2 = class {
|
|
|
62987
63155
|
initialVoiceHasHyphen = true;
|
|
62988
63156
|
}
|
|
62989
63157
|
}
|
|
62990
|
-
|
|
62991
|
-
|
|
63158
|
+
import_loglevel20.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
|
|
63159
|
+
import_loglevel20.default.log("voices", this.voices);
|
|
62992
63160
|
var initialVoice;
|
|
62993
63161
|
if (initialVoiceHasHyphen === true) {
|
|
62994
63162
|
initialVoice = this.tts.voice && this.tts.voice.lang && this.tts.voice.name ? this.voices.filter((v) => {
|
|
@@ -63006,9 +63174,9 @@ var TTSModule2 = class {
|
|
|
63006
63174
|
initialVoice = this.tts.voice && this.tts.voice.lang ? this.voices.filter((v) => v.lang === this.tts.voice.lang)[0] : void 0;
|
|
63007
63175
|
}
|
|
63008
63176
|
}
|
|
63009
|
-
|
|
63177
|
+
import_loglevel20.default.log("initialVoice", initialVoice);
|
|
63010
63178
|
var publicationVoiceHasHyphen = self2.delegate.publication.Metadata.Language[0].indexOf("-") !== -1;
|
|
63011
|
-
|
|
63179
|
+
import_loglevel20.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
|
|
63012
63180
|
var publicationVoice;
|
|
63013
63181
|
if (publicationVoiceHasHyphen === true) {
|
|
63014
63182
|
publicationVoice = this.tts.voice && this.tts.voice.usePublication ? this.voices.filter((v) => {
|
|
@@ -63020,9 +63188,9 @@ var TTSModule2 = class {
|
|
|
63020
63188
|
return v.lang.startsWith(self2.delegate.publication.Metadata.Language[0]) || v.lang.endsWith(self2.delegate.publication.Metadata.Language[0].toUpperCase());
|
|
63021
63189
|
})[0] : void 0;
|
|
63022
63190
|
}
|
|
63023
|
-
|
|
63191
|
+
import_loglevel20.default.log("publicationVoice", publicationVoice);
|
|
63024
63192
|
var defaultVoiceHasHyphen = navigator.language.indexOf("-") !== -1;
|
|
63025
|
-
|
|
63193
|
+
import_loglevel20.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
|
|
63026
63194
|
var defaultVoice;
|
|
63027
63195
|
if (defaultVoiceHasHyphen === true) {
|
|
63028
63196
|
defaultVoice = this.voices.filter((voice) => {
|
|
@@ -63041,23 +63209,23 @@ var TTSModule2 = class {
|
|
|
63041
63209
|
return lang.includes(navigator.language) && voice.localService === true;
|
|
63042
63210
|
})[0];
|
|
63043
63211
|
}
|
|
63044
|
-
|
|
63212
|
+
import_loglevel20.default.log("defaultVoice", defaultVoice);
|
|
63045
63213
|
if (initialVoice) {
|
|
63046
|
-
|
|
63214
|
+
import_loglevel20.default.log("initialVoice");
|
|
63047
63215
|
utterance.voice = initialVoice;
|
|
63048
63216
|
} else if (publicationVoice) {
|
|
63049
|
-
|
|
63217
|
+
import_loglevel20.default.log("publicationVoice");
|
|
63050
63218
|
utterance.voice = publicationVoice;
|
|
63051
63219
|
} else if (defaultVoice) {
|
|
63052
|
-
|
|
63220
|
+
import_loglevel20.default.log("defaultVoice");
|
|
63053
63221
|
utterance.voice = defaultVoice;
|
|
63054
63222
|
}
|
|
63055
63223
|
if (utterance.voice !== void 0 && utterance.voice !== null) {
|
|
63056
63224
|
utterance.lang = utterance.voice.lang;
|
|
63057
|
-
|
|
63058
|
-
|
|
63225
|
+
import_loglevel20.default.log("utterance.voice.lang", utterance.voice.lang);
|
|
63226
|
+
import_loglevel20.default.log("utterance.lang", utterance.lang);
|
|
63059
63227
|
}
|
|
63060
|
-
|
|
63228
|
+
import_loglevel20.default.log("navigator.language", navigator.language);
|
|
63061
63229
|
setTimeout(() => {
|
|
63062
63230
|
window.speechSynthesis.speak(utterance);
|
|
63063
63231
|
}, 0);
|
|
@@ -63092,14 +63260,14 @@ var TTSModule2 = class {
|
|
|
63092
63260
|
onend();
|
|
63093
63261
|
}
|
|
63094
63262
|
if (idx > idxEnd) {
|
|
63095
|
-
|
|
63263
|
+
import_loglevel20.default.log("utterance ended");
|
|
63096
63264
|
self2.highlighter.doneSpeaking();
|
|
63097
63265
|
self2.api?.finished();
|
|
63098
63266
|
self2.delegate.emit("readaloud.finished", "finished");
|
|
63099
63267
|
}
|
|
63100
63268
|
}
|
|
63101
63269
|
} else {
|
|
63102
|
-
|
|
63270
|
+
import_loglevel20.default.log("utterance ended");
|
|
63103
63271
|
self2.highlighter.doneSpeaking();
|
|
63104
63272
|
self2.api?.finished();
|
|
63105
63273
|
self2.delegate.emit("readaloud.finished", "finished");
|
|
@@ -63216,7 +63384,7 @@ var TTSModule2 = class {
|
|
|
63216
63384
|
}
|
|
63217
63385
|
}
|
|
63218
63386
|
stop() {
|
|
63219
|
-
|
|
63387
|
+
import_loglevel20.default.log("TTS module stop");
|
|
63220
63388
|
removeEventListenerOptional(document, "wheel", this.wheel.bind(this));
|
|
63221
63389
|
removeEventListenerOptional(this.body, "wheel", this.wheel.bind(this));
|
|
63222
63390
|
removeEventListenerOptional(document, "keydown", this.wheel.bind(this));
|
|
@@ -63374,7 +63542,7 @@ var TTSModule2 = class {
|
|
|
63374
63542
|
utterance.rate = this.tts.rate;
|
|
63375
63543
|
utterance.pitch = this.tts.pitch;
|
|
63376
63544
|
utterance.volume = this.tts.volume;
|
|
63377
|
-
|
|
63545
|
+
import_loglevel20.default.log("this.tts.voice.lang", this.tts.voice.lang);
|
|
63378
63546
|
var initialVoiceHasHyphen = true;
|
|
63379
63547
|
if (this.tts.voice && this.tts.voice.lang) {
|
|
63380
63548
|
initialVoiceHasHyphen = this.tts.voice.lang.indexOf("-") !== -1;
|
|
@@ -63383,8 +63551,8 @@ var TTSModule2 = class {
|
|
|
63383
63551
|
initialVoiceHasHyphen = true;
|
|
63384
63552
|
}
|
|
63385
63553
|
}
|
|
63386
|
-
|
|
63387
|
-
|
|
63554
|
+
import_loglevel20.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
|
|
63555
|
+
import_loglevel20.default.log("voices", this.voices);
|
|
63388
63556
|
var initialVoice;
|
|
63389
63557
|
if (initialVoiceHasHyphen === true) {
|
|
63390
63558
|
initialVoice = this.tts.voice && this.tts.voice.lang && this.tts.voice.name ? this.voices.filter((v) => {
|
|
@@ -63402,10 +63570,10 @@ var TTSModule2 = class {
|
|
|
63402
63570
|
initialVoice = this.tts.voice && this.tts.voice.lang ? this.voices.filter((v) => v.lang === this.tts.voice.lang)[0] : void 0;
|
|
63403
63571
|
}
|
|
63404
63572
|
}
|
|
63405
|
-
|
|
63573
|
+
import_loglevel20.default.log("initialVoice", initialVoice);
|
|
63406
63574
|
var self2 = this;
|
|
63407
63575
|
var publicationVoiceHasHyphen = self2.delegate.publication.Metadata.Language[0].indexOf("-") !== -1;
|
|
63408
|
-
|
|
63576
|
+
import_loglevel20.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
|
|
63409
63577
|
var publicationVoice;
|
|
63410
63578
|
if (publicationVoiceHasHyphen === true) {
|
|
63411
63579
|
publicationVoice = this.tts.voice && this.tts.voice.usePublication ? this.voices.filter((v) => {
|
|
@@ -63417,9 +63585,9 @@ var TTSModule2 = class {
|
|
|
63417
63585
|
return v.lang.startsWith(self2.delegate.publication.Metadata.Language[0]) || v.lang.endsWith(self2.delegate.publication.Metadata.Language[0].toUpperCase());
|
|
63418
63586
|
})[0] : void 0;
|
|
63419
63587
|
}
|
|
63420
|
-
|
|
63588
|
+
import_loglevel20.default.log("publicationVoice", publicationVoice);
|
|
63421
63589
|
var defaultVoiceHasHyphen = navigator.language.indexOf("-") !== -1;
|
|
63422
|
-
|
|
63590
|
+
import_loglevel20.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
|
|
63423
63591
|
var defaultVoice;
|
|
63424
63592
|
if (defaultVoiceHasHyphen === true) {
|
|
63425
63593
|
defaultVoice = this.voices.filter((voice) => {
|
|
@@ -63438,25 +63606,25 @@ var TTSModule2 = class {
|
|
|
63438
63606
|
return lang.includes(navigator.language) && voice.localService === true;
|
|
63439
63607
|
})[0];
|
|
63440
63608
|
}
|
|
63441
|
-
|
|
63609
|
+
import_loglevel20.default.log("defaultVoice", defaultVoice);
|
|
63442
63610
|
if (initialVoice) {
|
|
63443
|
-
|
|
63611
|
+
import_loglevel20.default.log("initialVoice");
|
|
63444
63612
|
utterance.voice = initialVoice;
|
|
63445
63613
|
} else if (publicationVoice) {
|
|
63446
|
-
|
|
63614
|
+
import_loglevel20.default.log("publicationVoice");
|
|
63447
63615
|
utterance.voice = publicationVoice;
|
|
63448
63616
|
} else if (defaultVoice) {
|
|
63449
|
-
|
|
63617
|
+
import_loglevel20.default.log("defaultVoice");
|
|
63450
63618
|
utterance.voice = defaultVoice;
|
|
63451
63619
|
}
|
|
63452
63620
|
if (utterance.voice !== void 0 && utterance.voice !== null) {
|
|
63453
63621
|
utterance.lang = utterance.voice.lang;
|
|
63454
|
-
|
|
63455
|
-
|
|
63622
|
+
import_loglevel20.default.log("utterance.voice.lang", utterance.voice.lang);
|
|
63623
|
+
import_loglevel20.default.log("utterance.lang", utterance.lang);
|
|
63456
63624
|
}
|
|
63457
|
-
|
|
63625
|
+
import_loglevel20.default.log("navigator.language", navigator.language);
|
|
63458
63626
|
utterance.onboundary = (ev) => {
|
|
63459
|
-
|
|
63627
|
+
import_loglevel20.default.log(ev.name);
|
|
63460
63628
|
this.updateTTSInfo(ttsQueueItem, ev.charIndex, ev.charLength, 0, utterance.text);
|
|
63461
63629
|
};
|
|
63462
63630
|
setTimeout(() => {
|
|
@@ -63475,7 +63643,7 @@ var TTSModule2 = class {
|
|
|
63475
63643
|
if (!ttsQueueItem) {
|
|
63476
63644
|
return void 0;
|
|
63477
63645
|
}
|
|
63478
|
-
|
|
63646
|
+
import_loglevel20.default.log(ttsQueueItem, charIndex, charLength, utteranceText);
|
|
63479
63647
|
const ttsQueueItemText = utteranceText ? utteranceText : getTtsQueueItemRefText(ttsQueueItem);
|
|
63480
63648
|
if (charIndex >= 0 && utteranceText) {
|
|
63481
63649
|
const start = utteranceText.slice(0, charIndex + 1).search(/\S+$/);
|
|
@@ -63496,9 +63664,9 @@ var TTSModule2 = class {
|
|
|
63496
63664
|
return ttsQueueItemText;
|
|
63497
63665
|
}
|
|
63498
63666
|
wrapHighlightWord(ttsQueueItemRef, utteranceText, charIndex, charLength, word, start, end) {
|
|
63499
|
-
|
|
63500
|
-
|
|
63501
|
-
|
|
63667
|
+
import_loglevel20.default.log(ttsQueueItemRef);
|
|
63668
|
+
import_loglevel20.default.log(utteranceText);
|
|
63669
|
+
import_loglevel20.default.log(charIndex, charLength, word, start, end);
|
|
63502
63670
|
if (this._ttsQueueItemHighlightsWord) {
|
|
63503
63671
|
this.delegate.highlighter?.destroyHighlights(HighlightType.ReadAloud);
|
|
63504
63672
|
this._ttsQueueItemHighlightsWord = void 0;
|
|
@@ -63541,8 +63709,8 @@ var TTSModule2 = class {
|
|
|
63541
63709
|
return "";
|
|
63542
63710
|
}
|
|
63543
63711
|
} catch (err) {
|
|
63544
|
-
|
|
63545
|
-
|
|
63712
|
+
import_loglevel20.default.log("uniqueCssSelector:");
|
|
63713
|
+
import_loglevel20.default.error(err);
|
|
63546
63714
|
return "";
|
|
63547
63715
|
}
|
|
63548
63716
|
};
|
|
@@ -63649,7 +63817,7 @@ function getTtsQueueItemRefText(obj) {
|
|
|
63649
63817
|
init_polyfills();
|
|
63650
63818
|
var lodash3 = __toModule(require_lodash());
|
|
63651
63819
|
var import_debounce7 = __toModule(require_debounce());
|
|
63652
|
-
var
|
|
63820
|
+
var import_loglevel21 = __toModule(require_loglevel());
|
|
63653
63821
|
var DefinitionsModule = class {
|
|
63654
63822
|
constructor(delegate, publication, properties, highlighter, api) {
|
|
63655
63823
|
this.currentChapterPopupResult = [];
|
|
@@ -63674,7 +63842,7 @@ var DefinitionsModule = class {
|
|
|
63674
63842
|
return search;
|
|
63675
63843
|
}
|
|
63676
63844
|
async stop() {
|
|
63677
|
-
|
|
63845
|
+
import_loglevel21.default.log("Definitions module stop");
|
|
63678
63846
|
}
|
|
63679
63847
|
async start() {
|
|
63680
63848
|
this.delegate.definitionsModule = this;
|
|
@@ -63796,7 +63964,7 @@ var DefinitionsModule = class {
|
|
|
63796
63964
|
|
|
63797
63965
|
// src/modules/linefocus/LineFocusModule.ts
|
|
63798
63966
|
init_polyfills();
|
|
63799
|
-
var
|
|
63967
|
+
var import_loglevel22 = __toModule(require_loglevel());
|
|
63800
63968
|
var DEFAULT_BACKGROUND_COLOR_OPACITY2 = 0.5;
|
|
63801
63969
|
var LineFocusModule = class {
|
|
63802
63970
|
constructor(delegate, properties, highlighter, api) {
|
|
@@ -63821,7 +63989,7 @@ var LineFocusModule = class {
|
|
|
63821
63989
|
return search;
|
|
63822
63990
|
}
|
|
63823
63991
|
async stop() {
|
|
63824
|
-
|
|
63992
|
+
import_loglevel22.default.log("Definitions module stop");
|
|
63825
63993
|
this.hasEventListener = false;
|
|
63826
63994
|
removeEventListenerOptional(document, "keydown", this.keydown.bind(this));
|
|
63827
63995
|
removeEventListenerOptional(document, "keyup", this.keyup.bind(this));
|
|
@@ -64216,9 +64384,9 @@ var LineFocusModule = class {
|
|
|
64216
64384
|
range.detach();
|
|
64217
64385
|
return rect;
|
|
64218
64386
|
} catch (error) {
|
|
64219
|
-
|
|
64220
|
-
|
|
64221
|
-
|
|
64387
|
+
import_loglevel22.default.log("measureTextNode " + error);
|
|
64388
|
+
import_loglevel22.default.log("measureTextNode " + node);
|
|
64389
|
+
import_loglevel22.default.log(`${node.textContent}`);
|
|
64222
64390
|
}
|
|
64223
64391
|
}
|
|
64224
64392
|
measureImageNodes(node) {
|
|
@@ -64229,16 +64397,16 @@ var LineFocusModule = class {
|
|
|
64229
64397
|
range.detach();
|
|
64230
64398
|
return rect;
|
|
64231
64399
|
} catch (error) {
|
|
64232
|
-
|
|
64233
|
-
|
|
64234
|
-
|
|
64400
|
+
import_loglevel22.default.log("measureTextNode " + error);
|
|
64401
|
+
import_loglevel22.default.log("measureTextNode " + node);
|
|
64402
|
+
import_loglevel22.default.log(`${node.textContent}`);
|
|
64235
64403
|
}
|
|
64236
64404
|
}
|
|
64237
64405
|
};
|
|
64238
64406
|
|
|
64239
64407
|
// src/modules/history/HistoryModule.ts
|
|
64240
64408
|
init_polyfills();
|
|
64241
|
-
var
|
|
64409
|
+
var import_loglevel23 = __toModule(require_loglevel());
|
|
64242
64410
|
var HistoryModule = class {
|
|
64243
64411
|
constructor(annotator, delegate, publication, properties, headerMenu) {
|
|
64244
64412
|
this.history = [];
|
|
@@ -64254,7 +64422,7 @@ var HistoryModule = class {
|
|
|
64254
64422
|
return pageBreak;
|
|
64255
64423
|
}
|
|
64256
64424
|
async stop() {
|
|
64257
|
-
|
|
64425
|
+
import_loglevel23.default.log("Page Break module stop");
|
|
64258
64426
|
removeEventListenerOptional(this.historyForwardAnchorElement, "click", this.handleHistoryForwardClick.bind(this));
|
|
64259
64427
|
removeEventListenerOptional(this.historyBackAnchorElement, "click", this.handleHistoryBackClick.bind(this));
|
|
64260
64428
|
}
|
|
@@ -64292,8 +64460,8 @@ var HistoryModule = class {
|
|
|
64292
64460
|
lastInHistory = this.history[this.history.length - 1];
|
|
64293
64461
|
if (lastInHistory && lastInHistory.href !== lastReadingPosition.href || lastInHistory === void 0) {
|
|
64294
64462
|
const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
|
|
64295
|
-
|
|
64296
|
-
|
|
64463
|
+
import_loglevel23.default.log(lastReadingPosition.href);
|
|
64464
|
+
import_loglevel23.default.log(linkHref);
|
|
64297
64465
|
lastReadingPosition.href = linkHref;
|
|
64298
64466
|
this.history.push(lastReadingPosition);
|
|
64299
64467
|
this.historyCurrentIndex = this.history.length - 1;
|
|
@@ -64349,7 +64517,7 @@ var HistoryModule = class {
|
|
|
64349
64517
|
|
|
64350
64518
|
// src/modules/citation/CitationModule.ts
|
|
64351
64519
|
init_polyfills();
|
|
64352
|
-
var
|
|
64520
|
+
var import_loglevel24 = __toModule(require_loglevel());
|
|
64353
64521
|
var CitationStyle;
|
|
64354
64522
|
(function(CitationStyle2) {
|
|
64355
64523
|
CitationStyle2[CitationStyle2["Chicago"] = 0] = "Chicago";
|
|
@@ -64377,7 +64545,7 @@ var CitationModule = class {
|
|
|
64377
64545
|
return module2;
|
|
64378
64546
|
}
|
|
64379
64547
|
async stop() {
|
|
64380
|
-
|
|
64548
|
+
import_loglevel24.default.log("Citation module stop");
|
|
64381
64549
|
}
|
|
64382
64550
|
copyToClipboard(textToClipboard) {
|
|
64383
64551
|
if (this.delegate?.contentProtectionModule) {
|
|
@@ -64737,8 +64905,6 @@ var PDFNavigator = class extends import_eventemitter32.default {
|
|
|
64737
64905
|
this.mainElement = mainElement;
|
|
64738
64906
|
this.resourceIndex = 0;
|
|
64739
64907
|
this.resource = this.publication.readingOrder[this.resourceIndex];
|
|
64740
|
-
console.log(this.resource);
|
|
64741
|
-
console.log(this.resource.Href1);
|
|
64742
64908
|
import_pdfjs_dist.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.worker.js`;
|
|
64743
64909
|
this.wrapper = findRequiredElement(this.mainElement, "main#iframe-wrapper");
|
|
64744
64910
|
this.pdfContainer = findRequiredElement(this.mainElement, "#pdf-container");
|
|
@@ -64790,7 +64956,6 @@ var PDFNavigator = class extends import_eventemitter32.default {
|
|
|
64790
64956
|
if (self2.scale === 1) {
|
|
64791
64957
|
const fitPage = self2.wrapper.clientHeight / viewport.height;
|
|
64792
64958
|
const fitWidth = self2.wrapper.clientWidth / viewport.width;
|
|
64793
|
-
console.log(fitPage, fitWidth);
|
|
64794
64959
|
if (self2.scaleType === 0) {
|
|
64795
64960
|
viewport = page.getViewport({
|
|
64796
64961
|
scale: fitPage < fitWidth ? fitPage : fitWidth
|
|
@@ -64872,13 +65037,11 @@ var PDFNavigator = class extends import_eventemitter32.default {
|
|
|
64872
65037
|
}
|
|
64873
65038
|
nextResource() {
|
|
64874
65039
|
const self2 = this;
|
|
64875
|
-
console.log(self2.resourceIndex, this.publication.readingOrder.length - 1);
|
|
64876
65040
|
if (this.resourceIndex >= this.publication.readingOrder.length - 1) {
|
|
64877
65041
|
return;
|
|
64878
65042
|
}
|
|
64879
65043
|
self2.resourceIndex++;
|
|
64880
65044
|
self2.resource = this.publication.readingOrder[self2.resourceIndex];
|
|
64881
|
-
console.log(this.resource.Href1);
|
|
64882
65045
|
(0, import_pdfjs_dist.getDocument)(this.publication.getAbsoluteHref(this.resource.Href)).promise.then(function(pdfDoc_) {
|
|
64883
65046
|
self2.pdfDoc = pdfDoc_;
|
|
64884
65047
|
self2.pageNum = 1;
|
|
@@ -64887,13 +65050,11 @@ var PDFNavigator = class extends import_eventemitter32.default {
|
|
|
64887
65050
|
}
|
|
64888
65051
|
previousResource() {
|
|
64889
65052
|
const self2 = this;
|
|
64890
|
-
console.log(self2.resourceIndex, this.publication.readingOrder.length - 1);
|
|
64891
65053
|
if (this.resourceIndex === 0) {
|
|
64892
65054
|
return;
|
|
64893
65055
|
}
|
|
64894
65056
|
self2.resourceIndex--;
|
|
64895
65057
|
self2.resource = this.publication.readingOrder[self2.resourceIndex];
|
|
64896
|
-
console.log(this.resource.Href1);
|
|
64897
65058
|
(0, import_pdfjs_dist.getDocument)(this.publication.getAbsoluteHref(this.resource.Href)).promise.then(function(pdfDoc_) {
|
|
64898
65059
|
self2.pdfDoc = pdfDoc_;
|
|
64899
65060
|
self2.pageNum = self2.pdfDoc.numPages;
|
|
@@ -64901,7 +65062,6 @@ var PDFNavigator = class extends import_eventemitter32.default {
|
|
|
64901
65062
|
});
|
|
64902
65063
|
}
|
|
64903
65064
|
goTo(locator) {
|
|
64904
|
-
console.log(locator);
|
|
64905
65065
|
const url = new URL(locator.href);
|
|
64906
65066
|
if (url.searchParams.has("start")) {
|
|
64907
65067
|
const page = url.searchParams.get("start");
|
|
@@ -64913,21 +65073,17 @@ var PDFNavigator = class extends import_eventemitter32.default {
|
|
|
64913
65073
|
}
|
|
64914
65074
|
}
|
|
64915
65075
|
goToPosition(value) {
|
|
64916
|
-
console.log(value);
|
|
64917
65076
|
this.queueRenderPage(value);
|
|
64918
65077
|
}
|
|
64919
65078
|
async goToPage(page) {
|
|
64920
|
-
console.log(page);
|
|
64921
65079
|
this.queueRenderPage(page);
|
|
64922
65080
|
}
|
|
64923
65081
|
fitToWidth() {
|
|
64924
|
-
console.log("fit to width", this.pageNum);
|
|
64925
65082
|
this.scale = 1;
|
|
64926
65083
|
this.scaleType = 1;
|
|
64927
65084
|
this.loadPDFJS(this.pageNum);
|
|
64928
65085
|
}
|
|
64929
65086
|
fitToPage() {
|
|
64930
|
-
console.log("fit to page", this.pageNum);
|
|
64931
65087
|
this.scale = 1;
|
|
64932
65088
|
this.scaleType = 0;
|
|
64933
65089
|
this.loadPDFJS(this.pageNum);
|
|
@@ -64966,7 +65122,7 @@ var PDFNavigator = class extends import_eventemitter32.default {
|
|
|
64966
65122
|
|
|
64967
65123
|
// src/reader.ts
|
|
64968
65124
|
var D2Reader = class {
|
|
64969
|
-
constructor(settings, navigator2, highlighter, bookmarkModule, annotationModule, ttsSettings, ttsModule, searchModule, definitionsModule, contentProtectionModule, timelineModule, mediaOverlaySettings, mediaOverlayModule, pageBreakModule, lineFocusModule, historyModule, citationModule) {
|
|
65125
|
+
constructor(settings, navigator2, highlighter, bookmarkModule, annotationModule, ttsSettings, ttsModule, searchModule, definitionsModule, contentProtectionModule, timelineModule, mediaOverlaySettings, mediaOverlayModule, pageBreakModule, lineFocusModule, historyModule, citationModule, consumptionModule) {
|
|
64970
65126
|
this.settings = settings;
|
|
64971
65127
|
this.navigator = navigator2;
|
|
64972
65128
|
this.highlighter = highlighter;
|
|
@@ -64984,6 +65140,7 @@ var D2Reader = class {
|
|
|
64984
65140
|
this.lineFocusModule = lineFocusModule;
|
|
64985
65141
|
this.historyModule = historyModule;
|
|
64986
65142
|
this.citationModule = citationModule;
|
|
65143
|
+
this.consumptionModule = consumptionModule;
|
|
64987
65144
|
this.startReadAloud = () => {
|
|
64988
65145
|
if (this.navigator instanceof IFrameNavigator) {
|
|
64989
65146
|
this.navigator.startReadAloud();
|
|
@@ -65422,7 +65579,11 @@ var D2Reader = class {
|
|
|
65422
65579
|
delegate: navigator2,
|
|
65423
65580
|
headerMenu
|
|
65424
65581
|
}) : void 0;
|
|
65425
|
-
|
|
65582
|
+
const consumptionModule = rights.enableConsumption ? await ConsumptionModule.create(__spreadValues({
|
|
65583
|
+
publication,
|
|
65584
|
+
delegate: navigator2
|
|
65585
|
+
}, initialConfig.consumption)) : void 0;
|
|
65586
|
+
return new D2Reader(settings, navigator2, highlighter, bookmarkModule, annotationModule, ttsSettings, ttsModule, searchModule, definitionsModule, contentProtectionModule, timelineModule, mediaOverlaySettings, mediaOverlayModule, pageBreakModule, lineFocusModule, historyModule, citationModule, consumptionModule);
|
|
65426
65587
|
}
|
|
65427
65588
|
}
|
|
65428
65589
|
get hasMediaOverlays() {
|