@d-i-t-a/reader 2.2.0-beta.5 → 2.2.0
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 +423 -245
- package/dist/esm/index.js.map +3 -3
- package/dist/injectables/click/click.js +1 -1
- package/dist/injectables/click/click.js.map +1 -1
- package/dist/reader.css.map +1 -1
- package/dist/reader.js +65732 -79
- 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
|
@@ -12262,7 +12262,7 @@ var require_parse = __commonJS({
|
|
|
12262
12262
|
try {
|
|
12263
12263
|
parser.parse();
|
|
12264
12264
|
} catch (e) {
|
|
12265
|
-
if (
|
|
12265
|
+
if (true) {
|
|
12266
12266
|
if (e.name === "CssSyntaxError" && opts && opts.from) {
|
|
12267
12267
|
if (/\.scss$/i.test(opts.from)) {
|
|
12268
12268
|
e.message += "\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser";
|
|
@@ -12456,7 +12456,7 @@ var require_lazy_result = __commonJS({
|
|
|
12456
12456
|
return this.css;
|
|
12457
12457
|
}
|
|
12458
12458
|
then(onFulfilled, onRejected) {
|
|
12459
|
-
if (
|
|
12459
|
+
if (true) {
|
|
12460
12460
|
if (!("from" in this.opts)) {
|
|
12461
12461
|
warnOnce("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.");
|
|
12462
12462
|
}
|
|
@@ -12603,7 +12603,7 @@ var require_lazy_result = __commonJS({
|
|
|
12603
12603
|
error.plugin = plugin.postcssPlugin;
|
|
12604
12604
|
error.setMessage();
|
|
12605
12605
|
} else if (plugin.postcssVersion) {
|
|
12606
|
-
if (
|
|
12606
|
+
if (true) {
|
|
12607
12607
|
let pluginName = plugin.postcssPlugin;
|
|
12608
12608
|
let pluginVer = plugin.postcssVersion;
|
|
12609
12609
|
let runtimeVer = this.result.processor.version;
|
|
@@ -12849,7 +12849,7 @@ var require_no_work_result = __commonJS({
|
|
|
12849
12849
|
return this._css;
|
|
12850
12850
|
}
|
|
12851
12851
|
then(onFulfilled, onRejected) {
|
|
12852
|
-
if (
|
|
12852
|
+
if (true) {
|
|
12853
12853
|
if (!("from" in this._opts)) {
|
|
12854
12854
|
warnOnce("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.");
|
|
12855
12855
|
}
|
|
@@ -12918,7 +12918,7 @@ var require_processor = __commonJS({
|
|
|
12918
12918
|
} else if (typeof i === "function") {
|
|
12919
12919
|
normalized.push(i);
|
|
12920
12920
|
} else if (typeof i === "object" && (i.parse || i.stringify)) {
|
|
12921
|
-
if (
|
|
12921
|
+
if (true) {
|
|
12922
12922
|
throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.");
|
|
12923
12923
|
}
|
|
12924
12924
|
} else {
|
|
@@ -55694,7 +55694,139 @@ 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
|
+
console.log("continueReadingSession", locator);
|
|
55761
|
+
if (this.properties.enableTrackingSession) {
|
|
55762
|
+
if (this.startResearchTimer === void 0) {
|
|
55763
|
+
this.startResearchSession();
|
|
55764
|
+
}
|
|
55765
|
+
if (this.lastReadingLocator === void 0 || this.lastReadingLocator.locations.totalProgression < locator.locations.totalProgression) {
|
|
55766
|
+
this.lastReadingLocator = locator;
|
|
55767
|
+
}
|
|
55768
|
+
if (this.firstReadingLocator === void 0) {
|
|
55769
|
+
this.firstReadingLocator = locator;
|
|
55770
|
+
}
|
|
55771
|
+
if (this.startReadingTimer === void 0) {
|
|
55772
|
+
this.startReadingTimer = new Date();
|
|
55773
|
+
}
|
|
55774
|
+
}
|
|
55775
|
+
}
|
|
55776
|
+
startResearchSession() {
|
|
55777
|
+
console.log("startResearchSession");
|
|
55778
|
+
if (this.properties.enableTrackingSession) {
|
|
55779
|
+
this.startResearchTimer = new Date();
|
|
55780
|
+
this.readingSessions = [];
|
|
55781
|
+
clearInterval(this.readingSessionsInterval);
|
|
55782
|
+
let timeElapsed = (new Date().getTime() - this.startResearchTimer.getTime()) / 1e3;
|
|
55783
|
+
this.researchSessionId = this.api?.startResearchSession(this.readingSessions, Math.round(timeElapsed));
|
|
55784
|
+
const self2 = this;
|
|
55785
|
+
this.readingSessionsInterval = setInterval(function() {
|
|
55786
|
+
self2.updateResearchSession();
|
|
55787
|
+
}, this.properties.updateSessionInterval * 1e3);
|
|
55788
|
+
}
|
|
55789
|
+
}
|
|
55790
|
+
updateResearchSession() {
|
|
55791
|
+
console.log("updateResearchSession");
|
|
55792
|
+
if (this.properties.enableTrackingSession) {
|
|
55793
|
+
let timeElapsed = (new Date().getTime() - this.startResearchTimer.getTime()) / 1e3;
|
|
55794
|
+
this.api?.updateResearchSession(this.researchSessionId, this.readingSessions, Math.round(timeElapsed));
|
|
55795
|
+
}
|
|
55796
|
+
}
|
|
55797
|
+
endResearchSession() {
|
|
55798
|
+
console.log("endResearchSession");
|
|
55799
|
+
if (this.properties.enableTrackingSession) {
|
|
55800
|
+
let timeElapsed = (new Date().getTime() - this.startResearchTimer.getTime()) / 1e3;
|
|
55801
|
+
this.api?.updateResearchSession(this.researchSessionId, this.readingSessions, Math.round(timeElapsed));
|
|
55802
|
+
this.api?.endResearchSession(this.researchSessionId, this.readingSessions, Math.round(timeElapsed));
|
|
55803
|
+
this.researchSessionId = void 0;
|
|
55804
|
+
this.readingSessions = [];
|
|
55805
|
+
this.startResearchTimer = void 0;
|
|
55806
|
+
clearInterval(this.readingSessionsInterval);
|
|
55807
|
+
}
|
|
55808
|
+
}
|
|
55809
|
+
startIdleTimer() {
|
|
55810
|
+
this.currSeconds++;
|
|
55811
|
+
if (this.currSeconds == this.properties.idleTimeout) {
|
|
55812
|
+
this.api?.idleSince(this.currSeconds);
|
|
55813
|
+
this.updateResearchSession();
|
|
55814
|
+
}
|
|
55815
|
+
if (this.currSeconds == this.properties.idleTimeout + this.properties.responseTimeout) {
|
|
55816
|
+
this.endResearchSession();
|
|
55817
|
+
}
|
|
55818
|
+
}
|
|
55819
|
+
resetTimer() {
|
|
55820
|
+
clearInterval(this.timer);
|
|
55821
|
+
this.currSeconds = 0;
|
|
55822
|
+
const self2 = this;
|
|
55823
|
+
this.timer = setInterval(function() {
|
|
55824
|
+
self2.startIdleTimer();
|
|
55825
|
+
}, 1e3);
|
|
55826
|
+
}
|
|
55827
|
+
};
|
|
55828
|
+
|
|
55829
|
+
// src/modules/AnnotationModule.ts
|
|
55698
55830
|
var AnnotationModule = class {
|
|
55699
55831
|
constructor(annotator, rights, publication, delegate, initialAnnotations, properties, highlighter, api, headerMenu) {
|
|
55700
55832
|
this.hide = findElement(document, "#menu-button-hide");
|
|
@@ -55715,7 +55847,7 @@ var AnnotationModule = class {
|
|
|
55715
55847
|
return annotations;
|
|
55716
55848
|
}
|
|
55717
55849
|
async stop() {
|
|
55718
|
-
|
|
55850
|
+
import_loglevel8.default.log("Annotation module stop");
|
|
55719
55851
|
}
|
|
55720
55852
|
async start() {
|
|
55721
55853
|
this.delegate.annotationModule = this;
|
|
@@ -55798,8 +55930,8 @@ var AnnotationModule = class {
|
|
|
55798
55930
|
return "";
|
|
55799
55931
|
}
|
|
55800
55932
|
} catch (err) {
|
|
55801
|
-
|
|
55802
|
-
|
|
55933
|
+
import_loglevel8.default.log("uniqueCssSelector:");
|
|
55934
|
+
import_loglevel8.default.error(err);
|
|
55803
55935
|
return "";
|
|
55804
55936
|
}
|
|
55805
55937
|
};
|
|
@@ -55820,7 +55952,7 @@ var AnnotationModule = class {
|
|
|
55820
55952
|
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
55953
|
if (book) {
|
|
55822
55954
|
this.saveAnnotation(book[0]).then((anno) => {
|
|
55823
|
-
|
|
55955
|
+
import_loglevel8.default.log("saved bookmark " + anno.id);
|
|
55824
55956
|
});
|
|
55825
55957
|
}
|
|
55826
55958
|
}
|
|
@@ -55830,7 +55962,7 @@ var AnnotationModule = class {
|
|
|
55830
55962
|
}
|
|
55831
55963
|
}
|
|
55832
55964
|
async scrollToHighlight(id2) {
|
|
55833
|
-
|
|
55965
|
+
import_loglevel8.default.log("still need to scroll to " + id2);
|
|
55834
55966
|
var element = await this.annotator?.getAnnotationElement(id2, this.delegate.iframes[0].contentWindow);
|
|
55835
55967
|
element.scrollIntoView({
|
|
55836
55968
|
block: "center",
|
|
@@ -55841,8 +55973,8 @@ var AnnotationModule = class {
|
|
|
55841
55973
|
if (this.annotator) {
|
|
55842
55974
|
let deleted = await this.annotator.deleteAnnotation(annotation.id);
|
|
55843
55975
|
let added = await this.addAnnotation(annotation);
|
|
55844
|
-
|
|
55845
|
-
|
|
55976
|
+
import_loglevel8.default.log("Highlight deleted " + JSON.stringify(deleted));
|
|
55977
|
+
import_loglevel8.default.log("Highlight added " + JSON.stringify(added));
|
|
55846
55978
|
await this.showHighlights();
|
|
55847
55979
|
await this.drawHighlights();
|
|
55848
55980
|
return added;
|
|
@@ -55853,7 +55985,7 @@ var AnnotationModule = class {
|
|
|
55853
55985
|
async deleteLocalHighlight(id2) {
|
|
55854
55986
|
if (this.annotator) {
|
|
55855
55987
|
var deleted = await this.annotator.deleteAnnotation(id2);
|
|
55856
|
-
|
|
55988
|
+
import_loglevel8.default.log("Highlight deleted " + JSON.stringify(deleted));
|
|
55857
55989
|
await this.showHighlights();
|
|
55858
55990
|
await this.drawHighlights();
|
|
55859
55991
|
return deleted;
|
|
@@ -55949,6 +56081,7 @@ var AnnotationModule = class {
|
|
|
55949
56081
|
}
|
|
55950
56082
|
}
|
|
55951
56083
|
if (annotation) {
|
|
56084
|
+
this.delegate.consumptionModule?.trackAction(annotation, Action.HighlightCreated);
|
|
55952
56085
|
if (this.api?.addAnnotation) {
|
|
55953
56086
|
try {
|
|
55954
56087
|
let result = await this.api.addAnnotation(annotation);
|
|
@@ -55997,7 +56130,7 @@ var AnnotationModule = class {
|
|
|
55997
56130
|
if (this.api) {
|
|
55998
56131
|
let highlights = [];
|
|
55999
56132
|
if (this.annotator) {
|
|
56000
|
-
highlights = this.annotator.
|
|
56133
|
+
highlights = this.annotator.getAnnotationsByChapter(this.delegate.currentLocator().href);
|
|
56001
56134
|
}
|
|
56002
56135
|
if (this.highlighter && highlights && this.delegate.iframes[0].contentDocument?.readyState === "complete") {
|
|
56003
56136
|
await this.highlighter.destroyHighlights(HighlightType.Annotation);
|
|
@@ -56045,7 +56178,7 @@ var AnnotationModule = class {
|
|
|
56045
56178
|
} else {
|
|
56046
56179
|
let highlights = [];
|
|
56047
56180
|
if (this.annotator) {
|
|
56048
|
-
highlights = this.annotator.
|
|
56181
|
+
highlights = this.annotator.getAnnotationsByChapter(this.delegate.currentLocator().href);
|
|
56049
56182
|
}
|
|
56050
56183
|
if (this.highlighter && highlights && this.delegate.iframes[0].contentDocument?.readyState === "complete") {
|
|
56051
56184
|
await this.highlighter.destroyHighlights(HighlightType.Annotation);
|
|
@@ -56097,15 +56230,15 @@ var AnnotationModule = class {
|
|
|
56097
56230
|
if (doc) {
|
|
56098
56231
|
this.commentGutter = doc.getElementById(HighlightContainer.R2_ID_GUTTER_RIGHT_CONTAINER);
|
|
56099
56232
|
if (this.delegate.view?.isScrollMode() && this.properties?.enableComments) {
|
|
56100
|
-
this.commentGutter
|
|
56233
|
+
this.commentGutter?.style.removeProperty("display");
|
|
56101
56234
|
} else {
|
|
56102
|
-
this.commentGutter
|
|
56235
|
+
this.commentGutter?.style.setProperty("display", "none");
|
|
56103
56236
|
}
|
|
56104
56237
|
if (this.commentGutter && this.delegate.view?.isScrollMode()) {
|
|
56105
56238
|
this.commentGutter.innerHTML = "";
|
|
56106
56239
|
let highlights = [];
|
|
56107
56240
|
if (this.annotator) {
|
|
56108
|
-
highlights = this.annotator.
|
|
56241
|
+
highlights = this.annotator.getAnnotationsByChapter(this.delegate.currentLocator().href);
|
|
56109
56242
|
if (highlights) {
|
|
56110
56243
|
highlights = highlights.filter((rangeRepresentation) => rangeRepresentation.highlight?.note?.length > 0);
|
|
56111
56244
|
highlights = this.syncPosition(highlights);
|
|
@@ -56280,17 +56413,17 @@ var AnnotationModule = class {
|
|
|
56280
56413
|
this.delegate.stopReadAloud();
|
|
56281
56414
|
this.delegate.navigate(locator);
|
|
56282
56415
|
} else {
|
|
56283
|
-
|
|
56416
|
+
import_loglevel8.default.log("annotation data missing: ", event);
|
|
56284
56417
|
}
|
|
56285
56418
|
}
|
|
56286
56419
|
handleAnnotationLinkDeleteClick(type, event, locator) {
|
|
56287
|
-
|
|
56420
|
+
import_loglevel8.default.log("annotation data locator: ", locator);
|
|
56288
56421
|
if (locator) {
|
|
56289
56422
|
if (type === AnnotationType.Annotation) {
|
|
56290
56423
|
this.deleteHighlight(locator);
|
|
56291
56424
|
}
|
|
56292
56425
|
} else {
|
|
56293
|
-
|
|
56426
|
+
import_loglevel8.default.log("annotation data missing: ", event);
|
|
56294
56427
|
}
|
|
56295
56428
|
}
|
|
56296
56429
|
static readableTimestamp(timestamp) {
|
|
@@ -56358,7 +56491,7 @@ var AnnotationModule = class {
|
|
|
56358
56491
|
// src/modules/BookmarkModule.ts
|
|
56359
56492
|
init_polyfills();
|
|
56360
56493
|
var import_uuid2 = __toModule(require_uuid());
|
|
56361
|
-
var
|
|
56494
|
+
var import_loglevel9 = __toModule(require_loglevel());
|
|
56362
56495
|
var BookmarkModule = class {
|
|
56363
56496
|
static async create(config2) {
|
|
56364
56497
|
const module2 = new this(config2.annotator, config2.rights || { enableBookmarks: false }, config2.publication, config2.delegate, config2, config2.initialAnnotations, config2.api, config2.headerMenu);
|
|
@@ -56376,7 +56509,7 @@ var BookmarkModule = class {
|
|
|
56376
56509
|
this.api = api;
|
|
56377
56510
|
}
|
|
56378
56511
|
stop() {
|
|
56379
|
-
|
|
56512
|
+
import_loglevel9.default.log("Bookmark module stop");
|
|
56380
56513
|
}
|
|
56381
56514
|
async start() {
|
|
56382
56515
|
this.delegate.bookmarkModule = this;
|
|
@@ -56426,13 +56559,13 @@ var BookmarkModule = class {
|
|
|
56426
56559
|
if (this.api?.deleteBookmark) {
|
|
56427
56560
|
await this.api?.deleteBookmark(bookmark);
|
|
56428
56561
|
let deleted = await this.annotator.deleteBookmark(bookmark);
|
|
56429
|
-
|
|
56562
|
+
import_loglevel9.default.log("Bookmark deleted " + JSON.stringify(deleted));
|
|
56430
56563
|
await this.showBookmarks();
|
|
56431
56564
|
await this.drawBookmarks();
|
|
56432
56565
|
return deleted;
|
|
56433
56566
|
} else {
|
|
56434
56567
|
let deleted = await this.annotator.deleteBookmark(bookmark);
|
|
56435
|
-
|
|
56568
|
+
import_loglevel9.default.log("Bookmark deleted " + JSON.stringify(deleted));
|
|
56436
56569
|
await this.showBookmarks();
|
|
56437
56570
|
await this.drawBookmarks();
|
|
56438
56571
|
return deleted;
|
|
@@ -56484,20 +56617,21 @@ var BookmarkModule = class {
|
|
|
56484
56617
|
};
|
|
56485
56618
|
}
|
|
56486
56619
|
if (!this.annotator.locatorExists(bookmark, AnnotationType.Bookmark)) {
|
|
56620
|
+
this.delegate.consumptionModule?.trackAction(bookmark, Action.BookmarkCreated);
|
|
56487
56621
|
if (this.api?.addBookmark) {
|
|
56488
56622
|
const result = await this.api.addBookmark(bookmark);
|
|
56489
56623
|
if (result) {
|
|
56490
56624
|
bookmark = result;
|
|
56491
56625
|
}
|
|
56492
|
-
|
|
56626
|
+
import_loglevel9.default.log(bookmark);
|
|
56493
56627
|
let saved = this.annotator.saveBookmark(bookmark);
|
|
56494
|
-
|
|
56628
|
+
import_loglevel9.default.log("Bookmark added " + JSON.stringify(saved));
|
|
56495
56629
|
this.showBookmarks();
|
|
56496
56630
|
await this.drawBookmarks();
|
|
56497
56631
|
return saved;
|
|
56498
56632
|
} else {
|
|
56499
56633
|
let saved = this.annotator.saveBookmark(bookmark);
|
|
56500
|
-
|
|
56634
|
+
import_loglevel9.default.log("Bookmark added " + JSON.stringify(saved));
|
|
56501
56635
|
this.showBookmarks();
|
|
56502
56636
|
await this.drawBookmarks();
|
|
56503
56637
|
return saved;
|
|
@@ -56597,7 +56731,7 @@ var BookmarkModule = class {
|
|
|
56597
56731
|
this.delegate.iframes[0].contentDocument?.getSelection()?.removeAllRanges();
|
|
56598
56732
|
if (book) {
|
|
56599
56733
|
return this.saveAnnotation(book[0]).then((anno) => {
|
|
56600
|
-
|
|
56734
|
+
import_loglevel9.default.log("saved bookmark " + anno?.id);
|
|
56601
56735
|
});
|
|
56602
56736
|
}
|
|
56603
56737
|
}
|
|
@@ -56656,6 +56790,7 @@ var BookmarkModule = class {
|
|
|
56656
56790
|
}
|
|
56657
56791
|
}
|
|
56658
56792
|
if (annotation) {
|
|
56793
|
+
this.delegate.consumptionModule?.trackAction(annotation, Action.BookmarkCreated);
|
|
56659
56794
|
if (this.api?.addBookmark) {
|
|
56660
56795
|
let result = await this.api.addBookmark(annotation);
|
|
56661
56796
|
const saved = await this.annotator.saveAnnotation(result);
|
|
@@ -56775,7 +56910,7 @@ var BookmarkModule = class {
|
|
|
56775
56910
|
async deleteLocalHighlight(id2) {
|
|
56776
56911
|
if (this.annotator) {
|
|
56777
56912
|
var deleted = await this.annotator.deleteAnnotation(id2);
|
|
56778
|
-
|
|
56913
|
+
import_loglevel9.default.log("Highlight deleted " + JSON.stringify(deleted));
|
|
56779
56914
|
await this.showBookmarks();
|
|
56780
56915
|
await this.drawBookmarks();
|
|
56781
56916
|
return deleted;
|
|
@@ -56885,17 +57020,17 @@ var BookmarkModule = class {
|
|
|
56885
57020
|
this.delegate.stopReadAloud();
|
|
56886
57021
|
this.delegate.navigate(locator);
|
|
56887
57022
|
} else {
|
|
56888
|
-
|
|
57023
|
+
import_loglevel9.default.log("bookmark data missing: ", event);
|
|
56889
57024
|
}
|
|
56890
57025
|
}
|
|
56891
57026
|
handleAnnotationLinkDeleteClick(type, event, locator) {
|
|
56892
|
-
|
|
57027
|
+
import_loglevel9.default.log("bookmark data locator: ", locator);
|
|
56893
57028
|
if (locator) {
|
|
56894
57029
|
if (type === AnnotationType.Bookmark) {
|
|
56895
57030
|
this.deleteBookmark(locator);
|
|
56896
57031
|
}
|
|
56897
57032
|
} else {
|
|
56898
|
-
|
|
57033
|
+
import_loglevel9.default.log("bookmark data missing: ", event);
|
|
56899
57034
|
}
|
|
56900
57035
|
}
|
|
56901
57036
|
static readableTimestamp(timestamp) {
|
|
@@ -56916,7 +57051,7 @@ var import_media_overlay = __toModule(require_media_overlay());
|
|
|
56916
57051
|
|
|
56917
57052
|
// src/modules/mediaoverlays/MediaOverlaySettings.ts
|
|
56918
57053
|
init_polyfills();
|
|
56919
|
-
var
|
|
57054
|
+
var import_loglevel10 = __toModule(require_loglevel());
|
|
56920
57055
|
var R2_MO_CLASS_ACTIVE = "r2-mo-active";
|
|
56921
57056
|
var _MEDIAOVERLAYREFS = class {
|
|
56922
57057
|
};
|
|
@@ -56948,7 +57083,7 @@ var MediaOverlaySettings = class {
|
|
|
56948
57083
|
this.api = api;
|
|
56949
57084
|
this.headerMenu = headerMenu;
|
|
56950
57085
|
this.initialise();
|
|
56951
|
-
|
|
57086
|
+
import_loglevel10.default.log(this.api);
|
|
56952
57087
|
}
|
|
56953
57088
|
static create(config2) {
|
|
56954
57089
|
const settings = new this(config2.store, config2.api, config2.headerMenu);
|
|
@@ -56956,34 +57091,34 @@ var MediaOverlaySettings = class {
|
|
|
56956
57091
|
let initialSettings = config2.initialMediaOverlaySettings;
|
|
56957
57092
|
if (initialSettings?.color) {
|
|
56958
57093
|
settings.color = initialSettings.color;
|
|
56959
|
-
|
|
57094
|
+
import_loglevel10.default.log(settings.color);
|
|
56960
57095
|
}
|
|
56961
57096
|
if (initialSettings?.autoScroll) {
|
|
56962
57097
|
settings.autoScroll = initialSettings.autoScroll;
|
|
56963
|
-
|
|
57098
|
+
import_loglevel10.default.log(settings.autoScroll);
|
|
56964
57099
|
}
|
|
56965
57100
|
if (initialSettings?.autoTurn) {
|
|
56966
57101
|
settings.autoTurn = initialSettings.autoTurn;
|
|
56967
|
-
|
|
57102
|
+
import_loglevel10.default.log(settings.autoScroll);
|
|
56968
57103
|
}
|
|
56969
57104
|
if (initialSettings?.volume) {
|
|
56970
57105
|
settings.volume = initialSettings.volume;
|
|
56971
|
-
|
|
57106
|
+
import_loglevel10.default.log(settings.volume);
|
|
56972
57107
|
}
|
|
56973
57108
|
if (initialSettings?.rate) {
|
|
56974
57109
|
settings.rate = initialSettings.rate;
|
|
56975
|
-
|
|
57110
|
+
import_loglevel10.default.log(settings.rate);
|
|
56976
57111
|
}
|
|
56977
57112
|
if (initialSettings?.wait) {
|
|
56978
57113
|
settings.wait = initialSettings.wait;
|
|
56979
|
-
|
|
57114
|
+
import_loglevel10.default.log(settings.wait);
|
|
56980
57115
|
}
|
|
56981
57116
|
}
|
|
56982
57117
|
settings.initializeSelections();
|
|
56983
57118
|
return settings;
|
|
56984
57119
|
}
|
|
56985
57120
|
stop() {
|
|
56986
|
-
|
|
57121
|
+
import_loglevel10.default.log("MediaOverlay settings stop");
|
|
56987
57122
|
}
|
|
56988
57123
|
initialise() {
|
|
56989
57124
|
this.autoScroll = this.getProperty(MEDIAOVERLAYREFS.AUTO_SCROLL_KEY) != null ? this.getProperty(MEDIAOVERLAYREFS.AUTO_SCROLL_KEY).value : this.autoScroll;
|
|
@@ -57049,7 +57184,7 @@ var MediaOverlaySettings = class {
|
|
|
57049
57184
|
this.applyMediaOverlaySettings(syncSettings);
|
|
57050
57185
|
if (this.api?.updateSettings) {
|
|
57051
57186
|
this.api?.updateSettings(syncSettings).then(async (settings) => {
|
|
57052
|
-
|
|
57187
|
+
import_loglevel10.default.log("api updated sync settings", settings);
|
|
57053
57188
|
});
|
|
57054
57189
|
}
|
|
57055
57190
|
}
|
|
@@ -57104,7 +57239,7 @@ var MediaOverlaySettings = class {
|
|
|
57104
57239
|
this.settingsChangeCallback();
|
|
57105
57240
|
}
|
|
57106
57241
|
if (mediaOverlaySettings.autoScroll !== void 0) {
|
|
57107
|
-
|
|
57242
|
+
import_loglevel10.default.log("autoScroll " + this.autoScroll);
|
|
57108
57243
|
this.autoScroll = mediaOverlaySettings.autoScroll;
|
|
57109
57244
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.AUTO_SCROLL_REF);
|
|
57110
57245
|
if (prop) {
|
|
@@ -57114,7 +57249,7 @@ var MediaOverlaySettings = class {
|
|
|
57114
57249
|
this.settingsChangeCallback();
|
|
57115
57250
|
}
|
|
57116
57251
|
if (mediaOverlaySettings.autoTurn !== void 0) {
|
|
57117
|
-
|
|
57252
|
+
import_loglevel10.default.log("autoTurn " + this.autoTurn);
|
|
57118
57253
|
this.autoTurn = mediaOverlaySettings.autoTurn;
|
|
57119
57254
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.AUTO_TURN_REF);
|
|
57120
57255
|
if (prop) {
|
|
@@ -57124,7 +57259,7 @@ var MediaOverlaySettings = class {
|
|
|
57124
57259
|
this.settingsChangeCallback();
|
|
57125
57260
|
}
|
|
57126
57261
|
if (mediaOverlaySettings.volume) {
|
|
57127
|
-
|
|
57262
|
+
import_loglevel10.default.log("volume " + this.volume);
|
|
57128
57263
|
this.volume = mediaOverlaySettings.volume;
|
|
57129
57264
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.VOLUME_REF);
|
|
57130
57265
|
if (prop) {
|
|
@@ -57134,7 +57269,7 @@ var MediaOverlaySettings = class {
|
|
|
57134
57269
|
this.settingsChangeCallback();
|
|
57135
57270
|
}
|
|
57136
57271
|
if (mediaOverlaySettings.rate) {
|
|
57137
|
-
|
|
57272
|
+
import_loglevel10.default.log("rate " + this.rate);
|
|
57138
57273
|
this.rate = mediaOverlaySettings.rate;
|
|
57139
57274
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.RATE_REF);
|
|
57140
57275
|
if (prop) {
|
|
@@ -57212,7 +57347,7 @@ var MediaOverlaySettings = class {
|
|
|
57212
57347
|
};
|
|
57213
57348
|
|
|
57214
57349
|
// src/modules/mediaoverlays/MediaOverlayModule.ts
|
|
57215
|
-
var
|
|
57350
|
+
var import_loglevel11 = __toModule(require_loglevel());
|
|
57216
57351
|
var MediaOverlayModule = class {
|
|
57217
57352
|
constructor(delegate, publication, settings, properties) {
|
|
57218
57353
|
this.play = findElement(document, "#menu-button-play");
|
|
@@ -57221,7 +57356,7 @@ var MediaOverlayModule = class {
|
|
|
57221
57356
|
this.pid = void 0;
|
|
57222
57357
|
this.__ontimeupdate = false;
|
|
57223
57358
|
this.ontimeupdate = async (_v) => {
|
|
57224
|
-
|
|
57359
|
+
import_loglevel11.default.log("ontimeupdate");
|
|
57225
57360
|
this.trackCurrentTime();
|
|
57226
57361
|
};
|
|
57227
57362
|
this.ensureOnTimeUpdate = (remove, replace) => {
|
|
@@ -57256,11 +57391,11 @@ var MediaOverlayModule = class {
|
|
|
57256
57391
|
return mediaOverlay;
|
|
57257
57392
|
}
|
|
57258
57393
|
stop() {
|
|
57259
|
-
|
|
57394
|
+
import_loglevel11.default.log("MediaOverlay module stop");
|
|
57260
57395
|
}
|
|
57261
57396
|
start() {
|
|
57262
57397
|
this.delegate.mediaOverlayModule = this;
|
|
57263
|
-
|
|
57398
|
+
import_loglevel11.default.log("MediaOverlay module start");
|
|
57264
57399
|
}
|
|
57265
57400
|
async initialize() {
|
|
57266
57401
|
return new Promise(async (resolve) => {
|
|
@@ -57293,7 +57428,7 @@ var MediaOverlayModule = class {
|
|
|
57293
57428
|
return;
|
|
57294
57429
|
}
|
|
57295
57430
|
if (!response.ok) {
|
|
57296
|
-
|
|
57431
|
+
import_loglevel11.default.log("BAD RESPONSE?!");
|
|
57297
57432
|
}
|
|
57298
57433
|
let moJson;
|
|
57299
57434
|
try {
|
|
@@ -57302,7 +57437,7 @@ var MediaOverlayModule = class {
|
|
|
57302
57437
|
console.error(e);
|
|
57303
57438
|
}
|
|
57304
57439
|
if (!moJson) {
|
|
57305
|
-
|
|
57440
|
+
import_loglevel11.default.log("## moJson" + moJson);
|
|
57306
57441
|
return;
|
|
57307
57442
|
}
|
|
57308
57443
|
link.MediaOverlays = TaJsonDeserialize(moJson, import_media_overlay.MediaOverlayNode);
|
|
@@ -57388,7 +57523,7 @@ var MediaOverlayModule = class {
|
|
|
57388
57523
|
}
|
|
57389
57524
|
}
|
|
57390
57525
|
findDepthFirstTextAudioPair(textHref, mo, textFragmentIDChain) {
|
|
57391
|
-
|
|
57526
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair()");
|
|
57392
57527
|
let isTextUrlMatch;
|
|
57393
57528
|
let isFragmentIDMatch;
|
|
57394
57529
|
if (mo.Text) {
|
|
@@ -57409,16 +57544,16 @@ var MediaOverlayModule = class {
|
|
|
57409
57544
|
isTextUrlMatch = false;
|
|
57410
57545
|
}
|
|
57411
57546
|
}
|
|
57412
|
-
|
|
57413
|
-
|
|
57547
|
+
import_loglevel11.default.log("isFragmentIDMatch: " + isFragmentIDMatch);
|
|
57548
|
+
import_loglevel11.default.log("isTextUrlMatch: " + isTextUrlMatch);
|
|
57414
57549
|
if (!mo.Children || !mo.Children.length) {
|
|
57415
|
-
|
|
57550
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - leaf text/audio pair");
|
|
57416
57551
|
if (!isTextUrlMatch) {
|
|
57417
|
-
|
|
57552
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - leaf - !isTextUrlMatch");
|
|
57418
57553
|
return void 0;
|
|
57419
57554
|
}
|
|
57420
57555
|
if (isFragmentIDMatch || isTextUrlMatch && !textFragmentIDChain) {
|
|
57421
|
-
|
|
57556
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - leaf - isFragmentIDMatch || (isTextUrlMatch && !textFragmentIDChain");
|
|
57422
57557
|
return mo;
|
|
57423
57558
|
}
|
|
57424
57559
|
return void 0;
|
|
@@ -57426,25 +57561,25 @@ var MediaOverlayModule = class {
|
|
|
57426
57561
|
const textFragmentIDChainOriginal = textFragmentIDChain;
|
|
57427
57562
|
let frags = textFragmentIDChain;
|
|
57428
57563
|
for (const child of mo.Children) {
|
|
57429
|
-
|
|
57430
|
-
|
|
57564
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - child");
|
|
57565
|
+
import_loglevel11.default.log(JSON.stringify(child));
|
|
57431
57566
|
const match = this.findDepthFirstTextAudioPair(textHref, child, frags);
|
|
57432
57567
|
if (match === null) {
|
|
57433
|
-
|
|
57568
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - child - match null (skip)");
|
|
57434
57569
|
frags = void 0;
|
|
57435
57570
|
}
|
|
57436
57571
|
if (match) {
|
|
57437
|
-
|
|
57438
|
-
|
|
57572
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - child - match");
|
|
57573
|
+
import_loglevel11.default.log(JSON.stringify(match));
|
|
57439
57574
|
return match;
|
|
57440
57575
|
}
|
|
57441
57576
|
}
|
|
57442
57577
|
if (isFragmentIDMatch) {
|
|
57443
|
-
|
|
57578
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch");
|
|
57444
57579
|
const match = this.findDepthFirstTextAudioPair(textHref, mo, void 0);
|
|
57445
57580
|
if (match) {
|
|
57446
|
-
|
|
57447
|
-
|
|
57581
|
+
import_loglevel11.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch - match");
|
|
57582
|
+
import_loglevel11.default.log(JSON.stringify(match));
|
|
57448
57583
|
return match;
|
|
57449
57584
|
} else {
|
|
57450
57585
|
return match;
|
|
@@ -57460,7 +57595,7 @@ var MediaOverlayModule = class {
|
|
|
57460
57595
|
if (this.mediaOverlayTextAudioPair) {
|
|
57461
57596
|
try {
|
|
57462
57597
|
if (this.currentAudioEnd && this.audioElement.currentTime >= this.currentAudioEnd - 0.05) {
|
|
57463
|
-
|
|
57598
|
+
import_loglevel11.default.log("ontimeupdate - mediaOverlaysNext()");
|
|
57464
57599
|
this.mediaOverlaysNext();
|
|
57465
57600
|
}
|
|
57466
57601
|
const match_i = this.mediaOverlayTextAudioPair.Text.lastIndexOf("#");
|
|
@@ -57472,11 +57607,11 @@ var MediaOverlayModule = class {
|
|
|
57472
57607
|
}
|
|
57473
57608
|
}
|
|
57474
57609
|
mediaOverlaysNext(escape2) {
|
|
57475
|
-
|
|
57610
|
+
import_loglevel11.default.log("mediaOverlaysNext()");
|
|
57476
57611
|
if (this.mediaOverlayRoot && this.mediaOverlayTextAudioPair) {
|
|
57477
57612
|
const nextTextAudioPair = this.findNextTextAudioPair(this.mediaOverlayRoot, this.mediaOverlayTextAudioPair, { prev: void 0 }, escape2 ? true : false);
|
|
57478
57613
|
if (!nextTextAudioPair) {
|
|
57479
|
-
|
|
57614
|
+
import_loglevel11.default.log("mediaOverlaysNext() - navLeftOrRight()");
|
|
57480
57615
|
this.mediaOverlaysStop();
|
|
57481
57616
|
if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
|
|
57482
57617
|
this.currentLinkIndex++;
|
|
@@ -57496,21 +57631,21 @@ var MediaOverlayModule = class {
|
|
|
57496
57631
|
const hrefUrlObj1 = new URL("https://dita.digital/" + this.mediaOverlayTextAudioPair.Text);
|
|
57497
57632
|
const hrefUrlObj2 = new URL("https://dita.digital/" + nextTextAudioPair.Text);
|
|
57498
57633
|
if (hrefUrlObj1.pathname !== hrefUrlObj2.pathname) {
|
|
57499
|
-
|
|
57634
|
+
import_loglevel11.default.log("mediaOverlaysNext() SWITCH! " + hrefUrlObj1.pathname + " != " + hrefUrlObj2.pathname);
|
|
57500
57635
|
switchDoc = true;
|
|
57501
57636
|
}
|
|
57502
57637
|
}
|
|
57503
57638
|
if (switchDoc) {
|
|
57504
57639
|
this.mediaOverlaysStop();
|
|
57505
57640
|
} else {
|
|
57506
|
-
|
|
57641
|
+
import_loglevel11.default.log("mediaOverlaysNext() - playMediaOverlaysAudio()");
|
|
57507
57642
|
setTimeout(async () => {
|
|
57508
57643
|
await this.playMediaOverlaysAudio(nextTextAudioPair, void 0, void 0);
|
|
57509
57644
|
}, 0);
|
|
57510
57645
|
}
|
|
57511
57646
|
}
|
|
57512
57647
|
} else {
|
|
57513
|
-
|
|
57648
|
+
import_loglevel11.default.log("mediaOverlaysNext() - navLeftOrRight() 2");
|
|
57514
57649
|
this.mediaOverlaysStop();
|
|
57515
57650
|
if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
|
|
57516
57651
|
this.currentLinkIndex++;
|
|
@@ -57527,13 +57662,13 @@ var MediaOverlayModule = class {
|
|
|
57527
57662
|
}
|
|
57528
57663
|
}
|
|
57529
57664
|
mediaOverlaysStop() {
|
|
57530
|
-
|
|
57665
|
+
import_loglevel11.default.log("mediaOverlaysStop()");
|
|
57531
57666
|
this.mediaOverlaysPause();
|
|
57532
57667
|
this.mediaOverlayRoot = void 0;
|
|
57533
57668
|
this.mediaOverlayTextAudioPair = void 0;
|
|
57534
57669
|
}
|
|
57535
57670
|
mediaOverlaysPause() {
|
|
57536
|
-
|
|
57671
|
+
import_loglevel11.default.log("mediaOverlaysPause()");
|
|
57537
57672
|
this.mediaOverlayHighlight(void 0);
|
|
57538
57673
|
if (this.audioElement) {
|
|
57539
57674
|
this.audioElement.pause();
|
|
@@ -57542,28 +57677,28 @@ var MediaOverlayModule = class {
|
|
|
57542
57677
|
findNextTextAudioPair(mo, moToMatch, previousMo, escape2) {
|
|
57543
57678
|
if (!mo.Children || !mo.Children.length) {
|
|
57544
57679
|
if (previousMo?.prev === moToMatch) {
|
|
57545
|
-
|
|
57680
|
+
import_loglevel11.default.log("findNextTextAudioPair() - prevMo === moToMatch");
|
|
57546
57681
|
return mo;
|
|
57547
57682
|
}
|
|
57548
|
-
|
|
57549
|
-
|
|
57683
|
+
import_loglevel11.default.log("findNextTextAudioPair() - set previous");
|
|
57684
|
+
import_loglevel11.default.log(JSON.stringify(mo));
|
|
57550
57685
|
previousMo.prev = mo;
|
|
57551
57686
|
return void 0;
|
|
57552
57687
|
}
|
|
57553
57688
|
for (const child of mo.Children) {
|
|
57554
|
-
|
|
57555
|
-
|
|
57689
|
+
import_loglevel11.default.log("findNextTextAudioPair() - child");
|
|
57690
|
+
import_loglevel11.default.log(JSON.stringify(child));
|
|
57556
57691
|
const match = this.findNextTextAudioPair(child, moToMatch, previousMo, escape2);
|
|
57557
57692
|
if (match) {
|
|
57558
|
-
|
|
57559
|
-
|
|
57693
|
+
import_loglevel11.default.log("findNextTextAudioPair() - match");
|
|
57694
|
+
import_loglevel11.default.log(JSON.stringify(match));
|
|
57560
57695
|
return match;
|
|
57561
57696
|
}
|
|
57562
57697
|
}
|
|
57563
57698
|
return void 0;
|
|
57564
57699
|
}
|
|
57565
57700
|
async playMediaOverlaysAudio(moTextAudioPair, begin, end) {
|
|
57566
|
-
|
|
57701
|
+
import_loglevel11.default.log("playMediaOverlaysAudio()");
|
|
57567
57702
|
this.mediaOverlayTextAudioPair = moTextAudioPair;
|
|
57568
57703
|
if (!moTextAudioPair.Audio) {
|
|
57569
57704
|
return;
|
|
@@ -57587,14 +57722,14 @@ var MediaOverlayModule = class {
|
|
|
57587
57722
|
try {
|
|
57588
57723
|
this.currentAudioBegin = parseFloat(b);
|
|
57589
57724
|
} catch (err) {
|
|
57590
|
-
|
|
57725
|
+
import_loglevel11.default.error(err);
|
|
57591
57726
|
}
|
|
57592
57727
|
if (matches.length >= 3) {
|
|
57593
57728
|
const e = matches[3];
|
|
57594
57729
|
try {
|
|
57595
57730
|
this.currentAudioEnd = parseFloat(e);
|
|
57596
57731
|
} catch (err) {
|
|
57597
|
-
|
|
57732
|
+
import_loglevel11.default.error(err);
|
|
57598
57733
|
}
|
|
57599
57734
|
}
|
|
57600
57735
|
}
|
|
@@ -57603,7 +57738,7 @@ var MediaOverlayModule = class {
|
|
|
57603
57738
|
this.currentAudioBegin = begin;
|
|
57604
57739
|
this.currentAudioEnd = end;
|
|
57605
57740
|
}
|
|
57606
|
-
|
|
57741
|
+
import_loglevel11.default.log(`${urlFull} => [${this.currentAudioBegin}-${this.currentAudioEnd}]`);
|
|
57607
57742
|
const playClip = async (initial) => {
|
|
57608
57743
|
if (!this.audioElement) {
|
|
57609
57744
|
return;
|
|
@@ -57611,7 +57746,7 @@ var MediaOverlayModule = class {
|
|
|
57611
57746
|
const timeToSeekTo = this.currentAudioBegin ? this.currentAudioBegin : 0;
|
|
57612
57747
|
if (initial || this.audioElement.paused) {
|
|
57613
57748
|
if (initial && !timeToSeekTo || this.audioElement.currentTime === timeToSeekTo) {
|
|
57614
|
-
|
|
57749
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - _currentAudioElement.play()");
|
|
57615
57750
|
this.ensureOnTimeUpdate(false, false);
|
|
57616
57751
|
this.audioElement.playbackRate = this.settings.rate;
|
|
57617
57752
|
this.audioElement.volume = this.settings.volume;
|
|
@@ -57630,10 +57765,10 @@ var MediaOverlayModule = class {
|
|
|
57630
57765
|
checkReady();
|
|
57631
57766
|
}
|
|
57632
57767
|
} else {
|
|
57633
|
-
|
|
57768
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked");
|
|
57634
57769
|
const ontimeupdateSeeked = async (_ev) => {
|
|
57635
57770
|
this.audioElement.removeEventListener("timeupdate", ontimeupdateSeeked);
|
|
57636
|
-
|
|
57771
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked - .play()");
|
|
57637
57772
|
this.ensureOnTimeUpdate(false, false);
|
|
57638
57773
|
if (this.audioElement) {
|
|
57639
57774
|
this.audioElement.playbackRate = this.settings.rate;
|
|
@@ -57661,9 +57796,9 @@ var MediaOverlayModule = class {
|
|
|
57661
57796
|
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
57797
|
this.ensureOnTimeUpdate(false, false);
|
|
57663
57798
|
if (contiguous) {
|
|
57664
|
-
|
|
57799
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - ensureOnTimeUpdate");
|
|
57665
57800
|
} else {
|
|
57666
|
-
|
|
57801
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - currentTime = timeToSeekTo");
|
|
57667
57802
|
this.audioElement.currentTime = timeToSeekTo;
|
|
57668
57803
|
}
|
|
57669
57804
|
}
|
|
@@ -57671,7 +57806,7 @@ var MediaOverlayModule = class {
|
|
|
57671
57806
|
this.previousAudioUrl = this.currentAudioUrl;
|
|
57672
57807
|
if (!this.currentAudioUrl || urlNoQuery !== this.currentAudioUrl) {
|
|
57673
57808
|
this.currentAudioUrl = urlNoQuery;
|
|
57674
|
-
|
|
57809
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - RESET: " + this.previousAudioUrl + " => " + this.currentAudioUrl);
|
|
57675
57810
|
this.audioElement = document.getElementById("AUDIO_MO_ID");
|
|
57676
57811
|
if (this.audioElement) {
|
|
57677
57812
|
this.audioElement.pause();
|
|
@@ -57688,21 +57823,21 @@ var MediaOverlayModule = class {
|
|
|
57688
57823
|
this.audioElement.playbackRate = this.settings.rate;
|
|
57689
57824
|
document.body.appendChild(this.audioElement);
|
|
57690
57825
|
this.audioElement.addEventListener("error", (ev) => {
|
|
57691
|
-
|
|
57826
|
+
import_loglevel11.default.log("-1) error: " + (this.currentAudioUrl !== ev.currentTarget.src ? this.currentAudioUrl + " -- " : "") + ev.currentTarget.src.substr(ev.currentTarget.src.lastIndexOf("/")));
|
|
57692
57827
|
if (this.audioElement && this.audioElement.error) {
|
|
57693
|
-
|
|
57694
|
-
|
|
57828
|
+
import_loglevel11.default.log(this.audioElement.error.code);
|
|
57829
|
+
import_loglevel11.default.log(this.audioElement.error.message);
|
|
57695
57830
|
}
|
|
57696
57831
|
});
|
|
57697
57832
|
const oncanplaythrough = async (ev) => {
|
|
57698
57833
|
const currentAudioElement = ev.currentTarget;
|
|
57699
57834
|
currentAudioElement.removeEventListener("canplaythrough", oncanplaythrough);
|
|
57700
|
-
|
|
57835
|
+
import_loglevel11.default.log("oncanplaythrough");
|
|
57701
57836
|
await playClip(true);
|
|
57702
57837
|
};
|
|
57703
57838
|
this.audioElement.addEventListener("canplaythrough", oncanplaythrough);
|
|
57704
57839
|
const onended = async (_ev) => {
|
|
57705
|
-
|
|
57840
|
+
import_loglevel11.default.log("onended");
|
|
57706
57841
|
if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
|
|
57707
57842
|
this.currentLinkIndex++;
|
|
57708
57843
|
await this.playLink();
|
|
@@ -57719,35 +57854,35 @@ var MediaOverlayModule = class {
|
|
|
57719
57854
|
this.audioElement.playbackRate = this.settings.rate;
|
|
57720
57855
|
this.audioElement.setAttribute("src", this.currentAudioUrl);
|
|
57721
57856
|
} else {
|
|
57722
|
-
|
|
57857
|
+
import_loglevel11.default.log("playMediaOverlaysAudio() - playClip()");
|
|
57723
57858
|
await playClip(false);
|
|
57724
57859
|
}
|
|
57725
57860
|
}
|
|
57726
57861
|
async playMediaOverlays(textHref, rootMo, textFragmentIDChain) {
|
|
57727
|
-
|
|
57862
|
+
import_loglevel11.default.log("playMediaOverlays()");
|
|
57728
57863
|
let textFragmentIDChain_ = textFragmentIDChain ? textFragmentIDChain.filter((id2) => id2) : void 0;
|
|
57729
57864
|
if (textFragmentIDChain_ && textFragmentIDChain_.length === 0) {
|
|
57730
57865
|
textFragmentIDChain_ = void 0;
|
|
57731
57866
|
}
|
|
57732
57867
|
let moTextAudioPair = this.findDepthFirstTextAudioPair(textHref, rootMo, textFragmentIDChain_);
|
|
57733
57868
|
if (!moTextAudioPair && textFragmentIDChain_) {
|
|
57734
|
-
|
|
57735
|
-
|
|
57736
|
-
|
|
57869
|
+
import_loglevel11.default.log("playMediaOverlays() - findDepthFirstTextAudioPair() SECOND CHANCE ");
|
|
57870
|
+
import_loglevel11.default.log(JSON.stringify(textFragmentIDChain_, null, 4));
|
|
57871
|
+
import_loglevel11.default.log(JSON.stringify(rootMo, null, 4));
|
|
57737
57872
|
moTextAudioPair = this.findDepthFirstTextAudioPair(textHref, rootMo, void 0);
|
|
57738
57873
|
}
|
|
57739
57874
|
if (moTextAudioPair) {
|
|
57740
57875
|
if (moTextAudioPair.Audio) {
|
|
57741
|
-
|
|
57876
|
+
import_loglevel11.default.log("playMediaOverlays() - playMediaOverlaysAudio()");
|
|
57742
57877
|
this.mediaOverlayRoot = rootMo;
|
|
57743
57878
|
await this.playMediaOverlaysAudio(moTextAudioPair, void 0, void 0);
|
|
57744
57879
|
}
|
|
57745
57880
|
} else {
|
|
57746
|
-
|
|
57881
|
+
import_loglevel11.default.log("playMediaOverlays() - !moTextAudioPair " + textHref);
|
|
57747
57882
|
}
|
|
57748
57883
|
}
|
|
57749
57884
|
mediaOverlayHighlight(id2) {
|
|
57750
|
-
|
|
57885
|
+
import_loglevel11.default.log("moHighlight: ## " + id2);
|
|
57751
57886
|
let classActive = this.publication.Metadata?.MediaOverlay?.ActiveClass;
|
|
57752
57887
|
if (!classActive) {
|
|
57753
57888
|
classActive = this.settings.color;
|
|
@@ -57792,7 +57927,7 @@ var MediaOverlayModule = class {
|
|
|
57792
57927
|
|
|
57793
57928
|
// src/modules/positions/TimelineModule.ts
|
|
57794
57929
|
init_polyfills();
|
|
57795
|
-
var
|
|
57930
|
+
var import_loglevel12 = __toModule(require_loglevel());
|
|
57796
57931
|
var TimelineModule = class {
|
|
57797
57932
|
static async create(config2) {
|
|
57798
57933
|
const timeline = new this(config2.delegate, config2.publication);
|
|
@@ -57804,7 +57939,7 @@ var TimelineModule = class {
|
|
|
57804
57939
|
this.publication = publication;
|
|
57805
57940
|
}
|
|
57806
57941
|
async stop() {
|
|
57807
|
-
|
|
57942
|
+
import_loglevel12.default.log("Timeline module stop");
|
|
57808
57943
|
}
|
|
57809
57944
|
async start() {
|
|
57810
57945
|
this.delegate.timelineModule = this;
|
|
@@ -57873,7 +58008,7 @@ var TimelineModule = class {
|
|
|
57873
58008
|
title: link.Title
|
|
57874
58009
|
};
|
|
57875
58010
|
}
|
|
57876
|
-
|
|
58011
|
+
import_loglevel12.default.log(position);
|
|
57877
58012
|
this.delegate.navigate(position);
|
|
57878
58013
|
});
|
|
57879
58014
|
if (tocHrefAbs === this.delegate.currentChapterLink.href) {
|
|
@@ -57896,19 +58031,19 @@ var import_debounce3 = __toModule(require_debounce());
|
|
|
57896
58031
|
|
|
57897
58032
|
// src/utils/index.ts
|
|
57898
58033
|
init_polyfills();
|
|
57899
|
-
var
|
|
58034
|
+
var import_loglevel13 = __toModule(require_loglevel());
|
|
57900
58035
|
function delay(t, v) {
|
|
57901
58036
|
return new Promise(function(resolve) {
|
|
57902
58037
|
setTimeout(resolve.bind(null, v), t);
|
|
57903
58038
|
});
|
|
57904
58039
|
}
|
|
57905
|
-
var IS_DEV =
|
|
57906
|
-
|
|
58040
|
+
var IS_DEV = true;
|
|
58041
|
+
import_loglevel13.default.setLevel(IS_DEV ? "trace" : "warn", true);
|
|
57907
58042
|
|
|
57908
58043
|
// src/modules/protection/ContentProtectionModule.ts
|
|
57909
58044
|
var import_browserslist_useragent_regexp = __toModule(require_lib7());
|
|
57910
58045
|
var import_devtools_detector = __toModule(require_devtools_detector());
|
|
57911
|
-
var
|
|
58046
|
+
var import_loglevel14 = __toModule(require_loglevel());
|
|
57912
58047
|
var ContentProtectionModule = class {
|
|
57913
58048
|
constructor(delegate, properties) {
|
|
57914
58049
|
this.hasEventListener = false;
|
|
@@ -57970,14 +58105,14 @@ var ContentProtectionModule = class {
|
|
|
57970
58105
|
var self2 = this;
|
|
57971
58106
|
this.mutationObserver = new MutationObserver(function(mutations) {
|
|
57972
58107
|
mutations.forEach(function(mutation) {
|
|
57973
|
-
|
|
58108
|
+
import_loglevel14.default.log(mutation.type);
|
|
57974
58109
|
self2.isHacked = true;
|
|
57975
58110
|
});
|
|
57976
58111
|
});
|
|
57977
58112
|
}
|
|
57978
58113
|
}
|
|
57979
58114
|
async stop() {
|
|
57980
|
-
|
|
58115
|
+
import_loglevel14.default.log("Protection module stop");
|
|
57981
58116
|
this.mutationObserver.disconnect();
|
|
57982
58117
|
if (this.properties?.disableKeys) {
|
|
57983
58118
|
removeEventListenerOptional(this.delegate.mainElement, "keydown", this.disableSave);
|
|
@@ -58287,7 +58422,7 @@ var ContentProtectionModule = class {
|
|
|
58287
58422
|
return true;
|
|
58288
58423
|
}
|
|
58289
58424
|
preventCopy(event) {
|
|
58290
|
-
|
|
58425
|
+
import_loglevel14.default.log("copy action initiated");
|
|
58291
58426
|
event.clipboardData.setData("text/plain", "copy not allowed");
|
|
58292
58427
|
event.stopPropagation();
|
|
58293
58428
|
event.preventDefault();
|
|
@@ -58305,7 +58440,7 @@ var ContentProtectionModule = class {
|
|
|
58305
58440
|
if (this.citation) {
|
|
58306
58441
|
return;
|
|
58307
58442
|
}
|
|
58308
|
-
|
|
58443
|
+
import_loglevel14.default.log("copy action initiated");
|
|
58309
58444
|
let win = this.delegate.iframes[0].contentWindow;
|
|
58310
58445
|
if (win) {
|
|
58311
58446
|
let getCssSelector = function(element) {
|
|
@@ -58409,7 +58544,7 @@ var ContentProtectionModule = class {
|
|
|
58409
58544
|
selection?.addRange(rangeToSelect);
|
|
58410
58545
|
}
|
|
58411
58546
|
beforePrint(event) {
|
|
58412
|
-
|
|
58547
|
+
import_loglevel14.default.log("before print");
|
|
58413
58548
|
if (this.delegate && this.delegate.headerMenu) {
|
|
58414
58549
|
this.delegate.headerMenu.style.display = "none";
|
|
58415
58550
|
this.delegate.mainElement.style.display = "none";
|
|
@@ -58419,7 +58554,7 @@ var ContentProtectionModule = class {
|
|
|
58419
58554
|
return false;
|
|
58420
58555
|
}
|
|
58421
58556
|
afterPrint(event) {
|
|
58422
|
-
|
|
58557
|
+
import_loglevel14.default.log("after print");
|
|
58423
58558
|
if (this.delegate && this.delegate.headerMenu) {
|
|
58424
58559
|
this.delegate.headerMenu.style.removeProperty("display");
|
|
58425
58560
|
this.delegate.mainElement.style.removeProperty("display");
|
|
@@ -58509,12 +58644,12 @@ var ContentProtectionModule = class {
|
|
|
58509
58644
|
rect.width = width;
|
|
58510
58645
|
rect.left = left;
|
|
58511
58646
|
} catch (error) {
|
|
58512
|
-
|
|
58513
|
-
|
|
58514
|
-
|
|
58515
|
-
|
|
58516
|
-
|
|
58517
|
-
|
|
58647
|
+
import_loglevel14.default.log("error " + error);
|
|
58648
|
+
import_loglevel14.default.log(rect);
|
|
58649
|
+
import_loglevel14.default.log(rect.node);
|
|
58650
|
+
import_loglevel14.default.log("scrambledTextContent " + rect.scrambledTextContent);
|
|
58651
|
+
import_loglevel14.default.log("textContent " + rect.textContent);
|
|
58652
|
+
import_loglevel14.default.log("isObfuscated " + rect.isObfuscated);
|
|
58518
58653
|
}
|
|
58519
58654
|
});
|
|
58520
58655
|
}
|
|
@@ -58570,14 +58705,14 @@ var ContentProtectionModule = class {
|
|
|
58570
58705
|
range.detach();
|
|
58571
58706
|
return rect;
|
|
58572
58707
|
} catch (error) {
|
|
58573
|
-
|
|
58574
|
-
|
|
58575
|
-
|
|
58708
|
+
import_loglevel14.default.log("measureTextNode " + error);
|
|
58709
|
+
import_loglevel14.default.log("measureTextNode " + node);
|
|
58710
|
+
import_loglevel14.default.log(node.textContent);
|
|
58576
58711
|
}
|
|
58577
58712
|
}
|
|
58578
58713
|
isBeingHacked(element) {
|
|
58579
58714
|
if (element.style.animation || element.style.transition || element.style.position || element.hasAttribute("style")) {
|
|
58580
|
-
|
|
58715
|
+
import_loglevel14.default.log("content being hacked");
|
|
58581
58716
|
return true;
|
|
58582
58717
|
}
|
|
58583
58718
|
return false;
|
|
@@ -58741,7 +58876,7 @@ async function searchDocDomSeek(searchInput, doc, href, title, fullWordSearch =
|
|
|
58741
58876
|
}
|
|
58742
58877
|
|
|
58743
58878
|
// src/modules/search/SearchModule.ts
|
|
58744
|
-
var
|
|
58879
|
+
var import_loglevel15 = __toModule(require_loglevel());
|
|
58745
58880
|
var SearchModule = class {
|
|
58746
58881
|
constructor(delegate, publication, properties, highlighter, api, headerMenu) {
|
|
58747
58882
|
this.currentChapterSearchResult = [];
|
|
@@ -58760,7 +58895,7 @@ var SearchModule = class {
|
|
|
58760
58895
|
return search;
|
|
58761
58896
|
}
|
|
58762
58897
|
async stop() {
|
|
58763
|
-
|
|
58898
|
+
import_loglevel15.default.log("Search module stop");
|
|
58764
58899
|
removeEventListenerOptional(this.searchInput, "keypress", this.handleSearch.bind(this));
|
|
58765
58900
|
removeEventListenerOptional(this.searchGo, "click", this.handleSearch.bind(this));
|
|
58766
58901
|
}
|
|
@@ -59182,7 +59317,7 @@ var SearchModule = class {
|
|
|
59182
59317
|
if (this.delegate.api?.getContent) {
|
|
59183
59318
|
await this.delegate.api?.getContent(href).then((content) => {
|
|
59184
59319
|
let parser = new DOMParser();
|
|
59185
|
-
let doc = parser.parseFromString(
|
|
59320
|
+
let doc = parser.parseFromString(content, "application/xhtml+xml");
|
|
59186
59321
|
if (tocItem) {
|
|
59187
59322
|
searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
|
|
59188
59323
|
result.forEach((searchItem) => {
|
|
@@ -59234,7 +59369,7 @@ var SearchModule = class {
|
|
|
59234
59369
|
if (this.delegate.api?.getContent) {
|
|
59235
59370
|
await this.delegate.api?.getContent(href).then((content) => {
|
|
59236
59371
|
let parser = new DOMParser();
|
|
59237
|
-
let doc = parser.parseFromString(
|
|
59372
|
+
let doc = parser.parseFromString(content, "application/xhtml+xml");
|
|
59238
59373
|
if (tocItem) {
|
|
59239
59374
|
searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
|
|
59240
59375
|
result.forEach((searchItem) => {
|
|
@@ -59316,7 +59451,7 @@ var SearchModule = class {
|
|
|
59316
59451
|
|
|
59317
59452
|
// src/modules/TTS/TTSSettings.ts
|
|
59318
59453
|
init_polyfills();
|
|
59319
|
-
var
|
|
59454
|
+
var import_loglevel16 = __toModule(require_loglevel());
|
|
59320
59455
|
var _TTSREFS = class {
|
|
59321
59456
|
};
|
|
59322
59457
|
var TTSREFS = _TTSREFS;
|
|
@@ -59358,34 +59493,34 @@ var TTSSettings = class {
|
|
|
59358
59493
|
let initialTTSSettings = config2.initialTTSSettings;
|
|
59359
59494
|
if (initialTTSSettings?.rate) {
|
|
59360
59495
|
settings.rate = initialTTSSettings.rate;
|
|
59361
|
-
|
|
59496
|
+
import_loglevel16.default.log(settings.rate);
|
|
59362
59497
|
}
|
|
59363
59498
|
if (initialTTSSettings?.pitch) {
|
|
59364
59499
|
settings.pitch = initialTTSSettings.pitch;
|
|
59365
|
-
|
|
59500
|
+
import_loglevel16.default.log(settings.pitch);
|
|
59366
59501
|
}
|
|
59367
59502
|
if (initialTTSSettings?.volume) {
|
|
59368
59503
|
settings.volume = initialTTSSettings.volume;
|
|
59369
|
-
|
|
59504
|
+
import_loglevel16.default.log(settings.volume);
|
|
59370
59505
|
}
|
|
59371
59506
|
if (initialTTSSettings?.color) {
|
|
59372
59507
|
settings.color = initialTTSSettings.color;
|
|
59373
|
-
|
|
59508
|
+
import_loglevel16.default.log(settings.color);
|
|
59374
59509
|
}
|
|
59375
59510
|
if (initialTTSSettings?.autoScroll) {
|
|
59376
59511
|
settings.autoScroll = initialTTSSettings.autoScroll;
|
|
59377
|
-
|
|
59512
|
+
import_loglevel16.default.log(settings.autoScroll);
|
|
59378
59513
|
}
|
|
59379
59514
|
if (initialTTSSettings?.voice) {
|
|
59380
59515
|
settings.voice = initialTTSSettings.voice;
|
|
59381
|
-
|
|
59516
|
+
import_loglevel16.default.log(settings.voice);
|
|
59382
59517
|
}
|
|
59383
59518
|
}
|
|
59384
59519
|
settings.initializeSelections();
|
|
59385
59520
|
return settings;
|
|
59386
59521
|
}
|
|
59387
59522
|
stop() {
|
|
59388
|
-
|
|
59523
|
+
import_loglevel16.default.log("tts settings stop");
|
|
59389
59524
|
}
|
|
59390
59525
|
initialise() {
|
|
59391
59526
|
this.autoScroll = this.getProperty(TTSREFS.AUTO_SCROLL_KEY) != null ? this.getProperty(TTSREFS.AUTO_SCROLL_KEY).value : this.autoScroll;
|
|
@@ -59458,7 +59593,7 @@ var TTSSettings = class {
|
|
|
59458
59593
|
this.applyTTSSettings(ttsSettings);
|
|
59459
59594
|
if (this.api?.updateSettings) {
|
|
59460
59595
|
this.api?.updateSettings(ttsSettings).then(async (settings) => {
|
|
59461
|
-
|
|
59596
|
+
import_loglevel16.default.log("api updated tts settings", settings);
|
|
59462
59597
|
});
|
|
59463
59598
|
}
|
|
59464
59599
|
}
|
|
@@ -59506,7 +59641,7 @@ var TTSSettings = class {
|
|
|
59506
59641
|
}
|
|
59507
59642
|
applyTTSSettings(ttsSettings) {
|
|
59508
59643
|
if (ttsSettings.rate) {
|
|
59509
|
-
|
|
59644
|
+
import_loglevel16.default.log("rate " + this.rate);
|
|
59510
59645
|
this.rate = ttsSettings.rate;
|
|
59511
59646
|
let prop = this.userProperties.getByRef(TTSREFS.RATE_REF);
|
|
59512
59647
|
if (prop) {
|
|
@@ -59517,7 +59652,7 @@ var TTSSettings = class {
|
|
|
59517
59652
|
this.restartCallback();
|
|
59518
59653
|
}
|
|
59519
59654
|
if (ttsSettings.pitch) {
|
|
59520
|
-
|
|
59655
|
+
import_loglevel16.default.log("pitch " + this.pitch);
|
|
59521
59656
|
this.pitch = ttsSettings.pitch;
|
|
59522
59657
|
let prop = this.userProperties.getByRef(TTSREFS.PITCH_REF);
|
|
59523
59658
|
if (prop) {
|
|
@@ -59528,7 +59663,7 @@ var TTSSettings = class {
|
|
|
59528
59663
|
this.restartCallback();
|
|
59529
59664
|
}
|
|
59530
59665
|
if (ttsSettings.volume) {
|
|
59531
|
-
|
|
59666
|
+
import_loglevel16.default.log("volume " + this.volume);
|
|
59532
59667
|
this.volume = ttsSettings.volume;
|
|
59533
59668
|
let prop = this.userProperties.getByRef(TTSREFS.VOLUME_REF);
|
|
59534
59669
|
if (prop) {
|
|
@@ -59548,7 +59683,7 @@ var TTSSettings = class {
|
|
|
59548
59683
|
this.settingsChangeCallback();
|
|
59549
59684
|
}
|
|
59550
59685
|
if (ttsSettings.autoScroll !== void 0) {
|
|
59551
|
-
|
|
59686
|
+
import_loglevel16.default.log("autoScroll " + this.autoScroll);
|
|
59552
59687
|
this.autoScroll = ttsSettings.autoScroll;
|
|
59553
59688
|
let prop = this.userProperties.getByRef(TTSREFS.AUTO_SCROLL_REF);
|
|
59554
59689
|
if (prop) {
|
|
@@ -59558,7 +59693,7 @@ var TTSSettings = class {
|
|
|
59558
59693
|
this.settingsChangeCallback();
|
|
59559
59694
|
}
|
|
59560
59695
|
if (ttsSettings.voice) {
|
|
59561
|
-
|
|
59696
|
+
import_loglevel16.default.log("voice " + this.voice);
|
|
59562
59697
|
this.voice = ttsSettings.voice;
|
|
59563
59698
|
let prop = this.userProperties.getByRef(TTSREFS.VOICE_REF);
|
|
59564
59699
|
if (prop) {
|
|
@@ -59779,6 +59914,15 @@ var KeyboardEventHandler = class {
|
|
|
59779
59914
|
self2.onBackwardSwipe(event);
|
|
59780
59915
|
break;
|
|
59781
59916
|
}
|
|
59917
|
+
switch (event.code) {
|
|
59918
|
+
case "Space":
|
|
59919
|
+
if (event.ctrlKey) {
|
|
59920
|
+
self2.onBackwardSwipe(event);
|
|
59921
|
+
} else {
|
|
59922
|
+
self2.onForwardSwipe(event);
|
|
59923
|
+
}
|
|
59924
|
+
break;
|
|
59925
|
+
}
|
|
59782
59926
|
}, false);
|
|
59783
59927
|
}
|
|
59784
59928
|
};
|
|
@@ -59894,7 +60038,7 @@ var SampleReadEventHandler = class {
|
|
|
59894
60038
|
|
|
59895
60039
|
// src/navigator/IFrameNavigator.ts
|
|
59896
60040
|
var import_eventemitter3 = __toModule(require_eventemitter3());
|
|
59897
|
-
var
|
|
60041
|
+
var import_loglevel17 = __toModule(require_loglevel());
|
|
59898
60042
|
var IFrameNavigator = class extends import_eventemitter3.default {
|
|
59899
60043
|
constructor(settings, annotator = void 0, initialLastReadingPosition = void 0, publication, api, rights, tts, injectables, attributes, services, sample, requestConfig) {
|
|
59900
60044
|
super();
|
|
@@ -59930,8 +60074,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
59930
60074
|
}
|
|
59931
60075
|
if (lastReadingPosition) {
|
|
59932
60076
|
const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
|
|
59933
|
-
|
|
59934
|
-
|
|
60077
|
+
import_loglevel17.default.log(lastReadingPosition.href);
|
|
60078
|
+
import_loglevel17.default.log(linkHref);
|
|
59935
60079
|
lastReadingPosition.href = linkHref;
|
|
59936
60080
|
await this.navigate(lastReadingPosition);
|
|
59937
60081
|
}
|
|
@@ -59997,7 +60141,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
59997
60141
|
return new Promise((resolve) => resolve(navigator2));
|
|
59998
60142
|
}
|
|
59999
60143
|
stop() {
|
|
60000
|
-
|
|
60144
|
+
import_loglevel17.default.log("Iframe navigator stop");
|
|
60001
60145
|
removeEventListenerOptional(this.previousChapterAnchorElement, "click", this.handlePreviousChapterClick.bind(this));
|
|
60002
60146
|
removeEventListenerOptional(this.nextChapterAnchorElement, "click", this.handleNextChapterClick.bind(this));
|
|
60003
60147
|
removeEventListenerOptional(this.previousChapterTopAnchorElement, "click", this.handlePreviousPageClick.bind(this));
|
|
@@ -60205,7 +60349,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60205
60349
|
this.setupEvents();
|
|
60206
60350
|
return await this.loadManifest();
|
|
60207
60351
|
} catch (err) {
|
|
60208
|
-
|
|
60352
|
+
import_loglevel17.default.error(err);
|
|
60209
60353
|
this.abortOnError(err);
|
|
60210
60354
|
return Promise.reject(err);
|
|
60211
60355
|
}
|
|
@@ -60228,7 +60372,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60228
60372
|
addEventListenerOptional(iframe, "resize", this.onResize);
|
|
60229
60373
|
}
|
|
60230
60374
|
}
|
|
60231
|
-
updateBookView() {
|
|
60375
|
+
updateBookView(options) {
|
|
60232
60376
|
if (this.view?.layout === "fixed") {
|
|
60233
60377
|
if (this.nextPageAnchorElement)
|
|
60234
60378
|
this.nextPageAnchorElement.style.display = "none";
|
|
@@ -60386,7 +60530,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60386
60530
|
await this.highlighter?.destroyHighlights(HighlightType.PageBreak);
|
|
60387
60531
|
await this.pageBreakModule.drawPageBreaks();
|
|
60388
60532
|
}
|
|
60389
|
-
if (this.annotationModule !== void 0) {
|
|
60533
|
+
if (!options?.skipDrawingAnnotations && this.annotationModule !== void 0) {
|
|
60390
60534
|
await this.annotationModule.drawHighlights();
|
|
60391
60535
|
}
|
|
60392
60536
|
if (this.bookmarkModule !== void 0) {
|
|
@@ -60499,8 +60643,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60499
60643
|
}
|
|
60500
60644
|
if (lastReadingPosition) {
|
|
60501
60645
|
const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
|
|
60502
|
-
|
|
60503
|
-
|
|
60646
|
+
import_loglevel17.default.log(lastReadingPosition.href);
|
|
60647
|
+
import_loglevel17.default.log(linkHref);
|
|
60504
60648
|
lastReadingPosition.href = linkHref;
|
|
60505
60649
|
await this.navigate(lastReadingPosition);
|
|
60506
60650
|
} else if (startUrl) {
|
|
@@ -60516,7 +60660,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60516
60660
|
}
|
|
60517
60661
|
return new Promise((resolve) => resolve());
|
|
60518
60662
|
} catch (err) {
|
|
60519
|
-
|
|
60663
|
+
import_loglevel17.default.error(err);
|
|
60520
60664
|
this.abortOnError(err);
|
|
60521
60665
|
return new Promise((_, reject) => reject(err)).catch(() => {
|
|
60522
60666
|
});
|
|
@@ -60532,7 +60676,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60532
60676
|
bookViewPosition = this.newPosition.locations.progression;
|
|
60533
60677
|
}
|
|
60534
60678
|
await this.handleResize();
|
|
60535
|
-
this.updateBookView();
|
|
60679
|
+
this.updateBookView({ skipDrawingAnnotations: true });
|
|
60536
60680
|
await this.settings.applyProperties();
|
|
60537
60681
|
let currentLocation = this.currentChapterLink.href;
|
|
60538
60682
|
if (currentLocation) {
|
|
@@ -60624,6 +60768,11 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60624
60768
|
await this.contentProtectionModule.initialize();
|
|
60625
60769
|
}
|
|
60626
60770
|
}
|
|
60771
|
+
if (this.rights.enableConsumption) {
|
|
60772
|
+
if (this.consumptionModule !== void 0) {
|
|
60773
|
+
await this.consumptionModule.initialize();
|
|
60774
|
+
}
|
|
60775
|
+
}
|
|
60627
60776
|
if (this.eventHandler) {
|
|
60628
60777
|
for (const iframe of this.iframes) {
|
|
60629
60778
|
this.eventHandler.setupEvents(iframe.contentDocument);
|
|
@@ -60698,7 +60847,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
60698
60847
|
}, 200);
|
|
60699
60848
|
return new Promise((resolve) => resolve());
|
|
60700
60849
|
} catch (err) {
|
|
60701
|
-
|
|
60850
|
+
import_loglevel17.default.error(err);
|
|
60702
60851
|
this.abortOnError(err);
|
|
60703
60852
|
return Promise.reject(err);
|
|
60704
60853
|
}
|
|
@@ -61242,8 +61391,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61242
61391
|
const position = __spreadValues({}, locator);
|
|
61243
61392
|
position.locations = locations;
|
|
61244
61393
|
const linkHref = this.publication.getAbsoluteHref(locator.href);
|
|
61245
|
-
|
|
61246
|
-
|
|
61394
|
+
import_loglevel17.default.log(locator.href);
|
|
61395
|
+
import_loglevel17.default.log(linkHref);
|
|
61247
61396
|
position.href = linkHref;
|
|
61248
61397
|
this.stopReadAloud();
|
|
61249
61398
|
this.navigate(position);
|
|
@@ -61299,7 +61448,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61299
61448
|
snapToSelector(selector2) {
|
|
61300
61449
|
const doc = this.iframes[0].contentDocument;
|
|
61301
61450
|
if (doc) {
|
|
61302
|
-
|
|
61451
|
+
import_loglevel17.default.log(selector2);
|
|
61303
61452
|
let result = doc.querySelectorAll(selector2);
|
|
61304
61453
|
if (result.length > 0)
|
|
61305
61454
|
this.view?.snap(result[0]);
|
|
@@ -61577,7 +61726,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61577
61726
|
title: previous.Title
|
|
61578
61727
|
};
|
|
61579
61728
|
this.stopReadAloud();
|
|
61580
|
-
this.navigate(position);
|
|
61729
|
+
this.navigate(position, false);
|
|
61581
61730
|
} else {
|
|
61582
61731
|
if (this.previousChapterLink) {
|
|
61583
61732
|
const position = {
|
|
@@ -61589,7 +61738,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61589
61738
|
title: this.previousChapterLink.title
|
|
61590
61739
|
};
|
|
61591
61740
|
this.stopReadAloud();
|
|
61592
|
-
this.navigate(position);
|
|
61741
|
+
this.navigate(position, false);
|
|
61593
61742
|
}
|
|
61594
61743
|
}
|
|
61595
61744
|
if (event) {
|
|
@@ -61613,7 +61762,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61613
61762
|
title: next.Title
|
|
61614
61763
|
};
|
|
61615
61764
|
this.stopReadAloud();
|
|
61616
|
-
this.navigate(position);
|
|
61765
|
+
this.navigate(position, false);
|
|
61617
61766
|
} else {
|
|
61618
61767
|
if (this.nextChapterLink) {
|
|
61619
61768
|
const position = {
|
|
@@ -61625,7 +61774,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61625
61774
|
title: this.nextChapterLink.title
|
|
61626
61775
|
};
|
|
61627
61776
|
this.stopReadAloud();
|
|
61628
|
-
this.navigate(position);
|
|
61777
|
+
this.navigate(position, false);
|
|
61629
61778
|
}
|
|
61630
61779
|
}
|
|
61631
61780
|
if (event) {
|
|
@@ -61653,6 +61802,11 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61653
61802
|
}
|
|
61654
61803
|
}
|
|
61655
61804
|
async navigate(locator, history = true) {
|
|
61805
|
+
if (this.consumptionModule) {
|
|
61806
|
+
if (history) {
|
|
61807
|
+
this.consumptionModule.startReadingSession(locator);
|
|
61808
|
+
}
|
|
61809
|
+
}
|
|
61656
61810
|
if (this.historyModule) {
|
|
61657
61811
|
this.historyModule.push(locator, history);
|
|
61658
61812
|
}
|
|
@@ -61812,10 +61966,6 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61812
61966
|
if (this.rights.enableContentProtection && this.contentProtectionModule !== void 0) {
|
|
61813
61967
|
this.contentProtectionModule.recalculate(300);
|
|
61814
61968
|
}
|
|
61815
|
-
if (this.annotationModule !== void 0) {
|
|
61816
|
-
await this.annotationModule.drawHighlights();
|
|
61817
|
-
await this.annotationModule.showHighlights();
|
|
61818
|
-
}
|
|
61819
61969
|
if (this.bookmarkModule !== void 0) {
|
|
61820
61970
|
await this.bookmarkModule.drawBookmarks();
|
|
61821
61971
|
await this.bookmarkModule.showBookmarks();
|
|
@@ -61831,6 +61981,9 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61831
61981
|
if (this.rights.enableDefinitions && this.definitionsModule !== void 0 && this.highlighter !== void 0) {
|
|
61832
61982
|
this.definitionsModule.drawDefinitions();
|
|
61833
61983
|
}
|
|
61984
|
+
if (this.rights.enableConsumption && this.consumptionModule !== void 0) {
|
|
61985
|
+
this.consumptionModule.continueReadingSession(locator);
|
|
61986
|
+
}
|
|
61834
61987
|
if (this.view?.layout === "fixed") {
|
|
61835
61988
|
if (this.nextChapterBottomAnchorElement)
|
|
61836
61989
|
this.nextChapterBottomAnchorElement.style.display = "none";
|
|
@@ -61995,13 +62148,16 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
61995
62148
|
}
|
|
61996
62149
|
if (this.api?.updateCurrentLocation) {
|
|
61997
62150
|
this.api?.updateCurrentLocation(position).then(async (_) => {
|
|
61998
|
-
|
|
62151
|
+
import_loglevel17.default.log("api updated current location", position);
|
|
61999
62152
|
return this.annotator?.saveLastReadingPosition(position);
|
|
62000
62153
|
});
|
|
62001
62154
|
} else {
|
|
62002
|
-
|
|
62155
|
+
import_loglevel17.default.log("save last reading position", position);
|
|
62003
62156
|
this.annotator.saveLastReadingPosition(position);
|
|
62004
62157
|
}
|
|
62158
|
+
if (this.consumptionModule) {
|
|
62159
|
+
this.consumptionModule.continueReadingSession(position);
|
|
62160
|
+
}
|
|
62005
62161
|
}
|
|
62006
62162
|
}
|
|
62007
62163
|
}
|
|
@@ -62314,6 +62470,22 @@ var _LocalAnnotator = class {
|
|
|
62314
62470
|
}
|
|
62315
62471
|
return [];
|
|
62316
62472
|
}
|
|
62473
|
+
getAnnotationsByChapter(chapter) {
|
|
62474
|
+
const savedAnnotations = this.store.get(_LocalAnnotator.ANNOTATIONS);
|
|
62475
|
+
if (savedAnnotations) {
|
|
62476
|
+
let annotations = JSON.parse(savedAnnotations);
|
|
62477
|
+
annotations = annotations.filter((annotation) => annotation.href === chapter);
|
|
62478
|
+
annotations = annotations.sort((n1, n2) => {
|
|
62479
|
+
if (n1.locations.progression && n2.locations.progression) {
|
|
62480
|
+
return n1.locations.progression - n2.locations.progression;
|
|
62481
|
+
} else {
|
|
62482
|
+
return void 0;
|
|
62483
|
+
}
|
|
62484
|
+
});
|
|
62485
|
+
return annotations;
|
|
62486
|
+
}
|
|
62487
|
+
return [];
|
|
62488
|
+
}
|
|
62317
62489
|
getAnnotationPosition(id2, iframeWin) {
|
|
62318
62490
|
const savedAnnotations = this.store.get(_LocalAnnotator.ANNOTATIONS);
|
|
62319
62491
|
if (savedAnnotations) {
|
|
@@ -62517,7 +62689,7 @@ function convertAndCamel(o) {
|
|
|
62517
62689
|
|
|
62518
62690
|
// src/modules/highlight/LayerSettings.ts
|
|
62519
62691
|
init_polyfills();
|
|
62520
|
-
var
|
|
62692
|
+
var import_loglevel18 = __toModule(require_loglevel());
|
|
62521
62693
|
var LayerSettings = class {
|
|
62522
62694
|
constructor(store) {
|
|
62523
62695
|
this.LAYERSETTINGS = "layerSetting";
|
|
@@ -62529,7 +62701,7 @@ var LayerSettings = class {
|
|
|
62529
62701
|
return new Promise((resolve) => resolve(settings));
|
|
62530
62702
|
}
|
|
62531
62703
|
async stop() {
|
|
62532
|
-
|
|
62704
|
+
import_loglevel18.default.log("MediaOverlay settings stop");
|
|
62533
62705
|
}
|
|
62534
62706
|
async initialize() {
|
|
62535
62707
|
this.userProperties = await this.getLayerSettings();
|
|
@@ -62573,7 +62745,7 @@ var LayerSettings = class {
|
|
|
62573
62745
|
|
|
62574
62746
|
// src/modules/pagebreak/PageBreakModule.ts
|
|
62575
62747
|
init_polyfills();
|
|
62576
|
-
var
|
|
62748
|
+
var import_loglevel19 = __toModule(require_loglevel());
|
|
62577
62749
|
var PageBreakModule = class {
|
|
62578
62750
|
static async create(config2) {
|
|
62579
62751
|
const pageBreak = new this(config2.delegate, config2.publication, config2, config2.headerMenu);
|
|
@@ -62587,7 +62759,7 @@ var PageBreakModule = class {
|
|
|
62587
62759
|
this.properties = properties;
|
|
62588
62760
|
}
|
|
62589
62761
|
async stop() {
|
|
62590
|
-
|
|
62762
|
+
import_loglevel19.default.log("Page Break module stop");
|
|
62591
62763
|
}
|
|
62592
62764
|
async start() {
|
|
62593
62765
|
this.delegate.pageBreakModule = this;
|
|
@@ -62656,15 +62828,15 @@ var PageBreakModule = class {
|
|
|
62656
62828
|
return "";
|
|
62657
62829
|
}
|
|
62658
62830
|
} catch (err) {
|
|
62659
|
-
|
|
62660
|
-
|
|
62831
|
+
import_loglevel19.default.log("uniqueCssSelector:");
|
|
62832
|
+
import_loglevel19.default.error(err);
|
|
62661
62833
|
return "";
|
|
62662
62834
|
}
|
|
62663
62835
|
}
|
|
62664
62836
|
if (pageBreaks) {
|
|
62665
62837
|
for (let i = 0; i < pageBreaks.length; i++) {
|
|
62666
62838
|
let img = pageBreaks[i];
|
|
62667
|
-
|
|
62839
|
+
import_loglevel19.default.log(img);
|
|
62668
62840
|
let title = img.innerHTML;
|
|
62669
62841
|
let hide = false;
|
|
62670
62842
|
if (img.innerHTML.length === 0) {
|
|
@@ -62737,7 +62909,7 @@ var PageBreakModule = class {
|
|
|
62737
62909
|
init_polyfills();
|
|
62738
62910
|
var import_sanitize_html2 = __toModule(require_sanitize_html());
|
|
62739
62911
|
var import_debounce6 = __toModule(require_debounce());
|
|
62740
|
-
var
|
|
62912
|
+
var import_loglevel20 = __toModule(require_loglevel());
|
|
62741
62913
|
var TTSModule2 = class {
|
|
62742
62914
|
constructor(delegate, tts, rights, highlighter, properties, api, headerMenu) {
|
|
62743
62915
|
this.voices = [];
|
|
@@ -62860,14 +63032,14 @@ var TTSModule2 = class {
|
|
|
62860
63032
|
}
|
|
62861
63033
|
let s = setSpeech();
|
|
62862
63034
|
s.then(async (voices) => {
|
|
62863
|
-
|
|
63035
|
+
import_loglevel20.default.log(voices);
|
|
62864
63036
|
this.voices = [];
|
|
62865
63037
|
voices.forEach((voice) => {
|
|
62866
63038
|
if (voice.localService === true) {
|
|
62867
63039
|
this.voices.push(voice);
|
|
62868
63040
|
}
|
|
62869
63041
|
});
|
|
62870
|
-
|
|
63042
|
+
import_loglevel20.default.log(this.voices);
|
|
62871
63043
|
if (first) {
|
|
62872
63044
|
if (this.headerMenu) {
|
|
62873
63045
|
var preferredLanguageSelector = findElement(this.headerMenu, "#preferred-languages");
|
|
@@ -62956,16 +63128,16 @@ var TTSModule2 = class {
|
|
|
62956
63128
|
restOfTheText = restOfTheText.replace(textToBeSpoken, "").trim();
|
|
62957
63129
|
}
|
|
62958
63130
|
utterance = new SpeechSynthesisUtterance(textToBeSpoken);
|
|
62959
|
-
|
|
62960
|
-
|
|
62961
|
-
|
|
62962
|
-
|
|
62963
|
-
|
|
62964
|
-
|
|
63131
|
+
import_loglevel20.default.log(selectionInfo);
|
|
63132
|
+
import_loglevel20.default.log(textToBeSpoken, selectionInfo.range?.commonAncestorContainer.textContent);
|
|
63133
|
+
import_loglevel20.default.log(ttsQueueItem);
|
|
63134
|
+
import_loglevel20.default.log(ttsQueueItem.item.textNodes);
|
|
63135
|
+
import_loglevel20.default.log(startIndex);
|
|
63136
|
+
import_loglevel20.default.log(ttsQueueItem.item.combinedText);
|
|
62965
63137
|
let node = ttsQueueItem.item.textNodes.filter((node2) => {
|
|
62966
63138
|
return node2 === selectionInfo.range?.commonAncestorContainer;
|
|
62967
63139
|
})[0];
|
|
62968
|
-
|
|
63140
|
+
import_loglevel20.default.log(node);
|
|
62969
63141
|
utterance.onboundary = (ev) => {
|
|
62970
63142
|
this.updateTTSInfo(ttsQueueItem, ev.charIndex, ev.charLength, startIndex, utterance.text);
|
|
62971
63143
|
};
|
|
@@ -62978,7 +63150,7 @@ var TTSModule2 = class {
|
|
|
62978
63150
|
utterance.rate = this.tts.rate;
|
|
62979
63151
|
utterance.pitch = this.tts.pitch;
|
|
62980
63152
|
utterance.volume = this.tts.volume;
|
|
62981
|
-
|
|
63153
|
+
import_loglevel20.default.log("this.tts.voice.lang", this.tts.voice.lang);
|
|
62982
63154
|
var initialVoiceHasHyphen = true;
|
|
62983
63155
|
if (this.tts.voice && this.tts.voice.lang) {
|
|
62984
63156
|
initialVoiceHasHyphen = this.tts.voice.lang.indexOf("-") !== -1;
|
|
@@ -62987,8 +63159,8 @@ var TTSModule2 = class {
|
|
|
62987
63159
|
initialVoiceHasHyphen = true;
|
|
62988
63160
|
}
|
|
62989
63161
|
}
|
|
62990
|
-
|
|
62991
|
-
|
|
63162
|
+
import_loglevel20.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
|
|
63163
|
+
import_loglevel20.default.log("voices", this.voices);
|
|
62992
63164
|
var initialVoice;
|
|
62993
63165
|
if (initialVoiceHasHyphen === true) {
|
|
62994
63166
|
initialVoice = this.tts.voice && this.tts.voice.lang && this.tts.voice.name ? this.voices.filter((v) => {
|
|
@@ -63006,9 +63178,9 @@ var TTSModule2 = class {
|
|
|
63006
63178
|
initialVoice = this.tts.voice && this.tts.voice.lang ? this.voices.filter((v) => v.lang === this.tts.voice.lang)[0] : void 0;
|
|
63007
63179
|
}
|
|
63008
63180
|
}
|
|
63009
|
-
|
|
63181
|
+
import_loglevel20.default.log("initialVoice", initialVoice);
|
|
63010
63182
|
var publicationVoiceHasHyphen = self2.delegate.publication.Metadata.Language[0].indexOf("-") !== -1;
|
|
63011
|
-
|
|
63183
|
+
import_loglevel20.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
|
|
63012
63184
|
var publicationVoice;
|
|
63013
63185
|
if (publicationVoiceHasHyphen === true) {
|
|
63014
63186
|
publicationVoice = this.tts.voice && this.tts.voice.usePublication ? this.voices.filter((v) => {
|
|
@@ -63020,9 +63192,9 @@ var TTSModule2 = class {
|
|
|
63020
63192
|
return v.lang.startsWith(self2.delegate.publication.Metadata.Language[0]) || v.lang.endsWith(self2.delegate.publication.Metadata.Language[0].toUpperCase());
|
|
63021
63193
|
})[0] : void 0;
|
|
63022
63194
|
}
|
|
63023
|
-
|
|
63195
|
+
import_loglevel20.default.log("publicationVoice", publicationVoice);
|
|
63024
63196
|
var defaultVoiceHasHyphen = navigator.language.indexOf("-") !== -1;
|
|
63025
|
-
|
|
63197
|
+
import_loglevel20.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
|
|
63026
63198
|
var defaultVoice;
|
|
63027
63199
|
if (defaultVoiceHasHyphen === true) {
|
|
63028
63200
|
defaultVoice = this.voices.filter((voice) => {
|
|
@@ -63041,23 +63213,23 @@ var TTSModule2 = class {
|
|
|
63041
63213
|
return lang.includes(navigator.language) && voice.localService === true;
|
|
63042
63214
|
})[0];
|
|
63043
63215
|
}
|
|
63044
|
-
|
|
63216
|
+
import_loglevel20.default.log("defaultVoice", defaultVoice);
|
|
63045
63217
|
if (initialVoice) {
|
|
63046
|
-
|
|
63218
|
+
import_loglevel20.default.log("initialVoice");
|
|
63047
63219
|
utterance.voice = initialVoice;
|
|
63048
63220
|
} else if (publicationVoice) {
|
|
63049
|
-
|
|
63221
|
+
import_loglevel20.default.log("publicationVoice");
|
|
63050
63222
|
utterance.voice = publicationVoice;
|
|
63051
63223
|
} else if (defaultVoice) {
|
|
63052
|
-
|
|
63224
|
+
import_loglevel20.default.log("defaultVoice");
|
|
63053
63225
|
utterance.voice = defaultVoice;
|
|
63054
63226
|
}
|
|
63055
63227
|
if (utterance.voice !== void 0 && utterance.voice !== null) {
|
|
63056
63228
|
utterance.lang = utterance.voice.lang;
|
|
63057
|
-
|
|
63058
|
-
|
|
63229
|
+
import_loglevel20.default.log("utterance.voice.lang", utterance.voice.lang);
|
|
63230
|
+
import_loglevel20.default.log("utterance.lang", utterance.lang);
|
|
63059
63231
|
}
|
|
63060
|
-
|
|
63232
|
+
import_loglevel20.default.log("navigator.language", navigator.language);
|
|
63061
63233
|
setTimeout(() => {
|
|
63062
63234
|
window.speechSynthesis.speak(utterance);
|
|
63063
63235
|
}, 0);
|
|
@@ -63092,14 +63264,14 @@ var TTSModule2 = class {
|
|
|
63092
63264
|
onend();
|
|
63093
63265
|
}
|
|
63094
63266
|
if (idx > idxEnd) {
|
|
63095
|
-
|
|
63267
|
+
import_loglevel20.default.log("utterance ended");
|
|
63096
63268
|
self2.highlighter.doneSpeaking();
|
|
63097
63269
|
self2.api?.finished();
|
|
63098
63270
|
self2.delegate.emit("readaloud.finished", "finished");
|
|
63099
63271
|
}
|
|
63100
63272
|
}
|
|
63101
63273
|
} else {
|
|
63102
|
-
|
|
63274
|
+
import_loglevel20.default.log("utterance ended");
|
|
63103
63275
|
self2.highlighter.doneSpeaking();
|
|
63104
63276
|
self2.api?.finished();
|
|
63105
63277
|
self2.delegate.emit("readaloud.finished", "finished");
|
|
@@ -63216,7 +63388,7 @@ var TTSModule2 = class {
|
|
|
63216
63388
|
}
|
|
63217
63389
|
}
|
|
63218
63390
|
stop() {
|
|
63219
|
-
|
|
63391
|
+
import_loglevel20.default.log("TTS module stop");
|
|
63220
63392
|
removeEventListenerOptional(document, "wheel", this.wheel.bind(this));
|
|
63221
63393
|
removeEventListenerOptional(this.body, "wheel", this.wheel.bind(this));
|
|
63222
63394
|
removeEventListenerOptional(document, "keydown", this.wheel.bind(this));
|
|
@@ -63374,7 +63546,7 @@ var TTSModule2 = class {
|
|
|
63374
63546
|
utterance.rate = this.tts.rate;
|
|
63375
63547
|
utterance.pitch = this.tts.pitch;
|
|
63376
63548
|
utterance.volume = this.tts.volume;
|
|
63377
|
-
|
|
63549
|
+
import_loglevel20.default.log("this.tts.voice.lang", this.tts.voice.lang);
|
|
63378
63550
|
var initialVoiceHasHyphen = true;
|
|
63379
63551
|
if (this.tts.voice && this.tts.voice.lang) {
|
|
63380
63552
|
initialVoiceHasHyphen = this.tts.voice.lang.indexOf("-") !== -1;
|
|
@@ -63383,8 +63555,8 @@ var TTSModule2 = class {
|
|
|
63383
63555
|
initialVoiceHasHyphen = true;
|
|
63384
63556
|
}
|
|
63385
63557
|
}
|
|
63386
|
-
|
|
63387
|
-
|
|
63558
|
+
import_loglevel20.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
|
|
63559
|
+
import_loglevel20.default.log("voices", this.voices);
|
|
63388
63560
|
var initialVoice;
|
|
63389
63561
|
if (initialVoiceHasHyphen === true) {
|
|
63390
63562
|
initialVoice = this.tts.voice && this.tts.voice.lang && this.tts.voice.name ? this.voices.filter((v) => {
|
|
@@ -63402,10 +63574,10 @@ var TTSModule2 = class {
|
|
|
63402
63574
|
initialVoice = this.tts.voice && this.tts.voice.lang ? this.voices.filter((v) => v.lang === this.tts.voice.lang)[0] : void 0;
|
|
63403
63575
|
}
|
|
63404
63576
|
}
|
|
63405
|
-
|
|
63577
|
+
import_loglevel20.default.log("initialVoice", initialVoice);
|
|
63406
63578
|
var self2 = this;
|
|
63407
63579
|
var publicationVoiceHasHyphen = self2.delegate.publication.Metadata.Language[0].indexOf("-") !== -1;
|
|
63408
|
-
|
|
63580
|
+
import_loglevel20.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
|
|
63409
63581
|
var publicationVoice;
|
|
63410
63582
|
if (publicationVoiceHasHyphen === true) {
|
|
63411
63583
|
publicationVoice = this.tts.voice && this.tts.voice.usePublication ? this.voices.filter((v) => {
|
|
@@ -63417,9 +63589,9 @@ var TTSModule2 = class {
|
|
|
63417
63589
|
return v.lang.startsWith(self2.delegate.publication.Metadata.Language[0]) || v.lang.endsWith(self2.delegate.publication.Metadata.Language[0].toUpperCase());
|
|
63418
63590
|
})[0] : void 0;
|
|
63419
63591
|
}
|
|
63420
|
-
|
|
63592
|
+
import_loglevel20.default.log("publicationVoice", publicationVoice);
|
|
63421
63593
|
var defaultVoiceHasHyphen = navigator.language.indexOf("-") !== -1;
|
|
63422
|
-
|
|
63594
|
+
import_loglevel20.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
|
|
63423
63595
|
var defaultVoice;
|
|
63424
63596
|
if (defaultVoiceHasHyphen === true) {
|
|
63425
63597
|
defaultVoice = this.voices.filter((voice) => {
|
|
@@ -63438,25 +63610,25 @@ var TTSModule2 = class {
|
|
|
63438
63610
|
return lang.includes(navigator.language) && voice.localService === true;
|
|
63439
63611
|
})[0];
|
|
63440
63612
|
}
|
|
63441
|
-
|
|
63613
|
+
import_loglevel20.default.log("defaultVoice", defaultVoice);
|
|
63442
63614
|
if (initialVoice) {
|
|
63443
|
-
|
|
63615
|
+
import_loglevel20.default.log("initialVoice");
|
|
63444
63616
|
utterance.voice = initialVoice;
|
|
63445
63617
|
} else if (publicationVoice) {
|
|
63446
|
-
|
|
63618
|
+
import_loglevel20.default.log("publicationVoice");
|
|
63447
63619
|
utterance.voice = publicationVoice;
|
|
63448
63620
|
} else if (defaultVoice) {
|
|
63449
|
-
|
|
63621
|
+
import_loglevel20.default.log("defaultVoice");
|
|
63450
63622
|
utterance.voice = defaultVoice;
|
|
63451
63623
|
}
|
|
63452
63624
|
if (utterance.voice !== void 0 && utterance.voice !== null) {
|
|
63453
63625
|
utterance.lang = utterance.voice.lang;
|
|
63454
|
-
|
|
63455
|
-
|
|
63626
|
+
import_loglevel20.default.log("utterance.voice.lang", utterance.voice.lang);
|
|
63627
|
+
import_loglevel20.default.log("utterance.lang", utterance.lang);
|
|
63456
63628
|
}
|
|
63457
|
-
|
|
63629
|
+
import_loglevel20.default.log("navigator.language", navigator.language);
|
|
63458
63630
|
utterance.onboundary = (ev) => {
|
|
63459
|
-
|
|
63631
|
+
import_loglevel20.default.log(ev.name);
|
|
63460
63632
|
this.updateTTSInfo(ttsQueueItem, ev.charIndex, ev.charLength, 0, utterance.text);
|
|
63461
63633
|
};
|
|
63462
63634
|
setTimeout(() => {
|
|
@@ -63475,7 +63647,7 @@ var TTSModule2 = class {
|
|
|
63475
63647
|
if (!ttsQueueItem) {
|
|
63476
63648
|
return void 0;
|
|
63477
63649
|
}
|
|
63478
|
-
|
|
63650
|
+
import_loglevel20.default.log(ttsQueueItem, charIndex, charLength, utteranceText);
|
|
63479
63651
|
const ttsQueueItemText = utteranceText ? utteranceText : getTtsQueueItemRefText(ttsQueueItem);
|
|
63480
63652
|
if (charIndex >= 0 && utteranceText) {
|
|
63481
63653
|
const start = utteranceText.slice(0, charIndex + 1).search(/\S+$/);
|
|
@@ -63496,9 +63668,9 @@ var TTSModule2 = class {
|
|
|
63496
63668
|
return ttsQueueItemText;
|
|
63497
63669
|
}
|
|
63498
63670
|
wrapHighlightWord(ttsQueueItemRef, utteranceText, charIndex, charLength, word, start, end) {
|
|
63499
|
-
|
|
63500
|
-
|
|
63501
|
-
|
|
63671
|
+
import_loglevel20.default.log(ttsQueueItemRef);
|
|
63672
|
+
import_loglevel20.default.log(utteranceText);
|
|
63673
|
+
import_loglevel20.default.log(charIndex, charLength, word, start, end);
|
|
63502
63674
|
if (this._ttsQueueItemHighlightsWord) {
|
|
63503
63675
|
this.delegate.highlighter?.destroyHighlights(HighlightType.ReadAloud);
|
|
63504
63676
|
this._ttsQueueItemHighlightsWord = void 0;
|
|
@@ -63541,8 +63713,8 @@ var TTSModule2 = class {
|
|
|
63541
63713
|
return "";
|
|
63542
63714
|
}
|
|
63543
63715
|
} catch (err) {
|
|
63544
|
-
|
|
63545
|
-
|
|
63716
|
+
import_loglevel20.default.log("uniqueCssSelector:");
|
|
63717
|
+
import_loglevel20.default.error(err);
|
|
63546
63718
|
return "";
|
|
63547
63719
|
}
|
|
63548
63720
|
};
|
|
@@ -63649,7 +63821,7 @@ function getTtsQueueItemRefText(obj) {
|
|
|
63649
63821
|
init_polyfills();
|
|
63650
63822
|
var lodash3 = __toModule(require_lodash());
|
|
63651
63823
|
var import_debounce7 = __toModule(require_debounce());
|
|
63652
|
-
var
|
|
63824
|
+
var import_loglevel21 = __toModule(require_loglevel());
|
|
63653
63825
|
var DefinitionsModule = class {
|
|
63654
63826
|
constructor(delegate, publication, properties, highlighter, api) {
|
|
63655
63827
|
this.currentChapterPopupResult = [];
|
|
@@ -63674,7 +63846,7 @@ var DefinitionsModule = class {
|
|
|
63674
63846
|
return search;
|
|
63675
63847
|
}
|
|
63676
63848
|
async stop() {
|
|
63677
|
-
|
|
63849
|
+
import_loglevel21.default.log("Definitions module stop");
|
|
63678
63850
|
}
|
|
63679
63851
|
async start() {
|
|
63680
63852
|
this.delegate.definitionsModule = this;
|
|
@@ -63796,7 +63968,7 @@ var DefinitionsModule = class {
|
|
|
63796
63968
|
|
|
63797
63969
|
// src/modules/linefocus/LineFocusModule.ts
|
|
63798
63970
|
init_polyfills();
|
|
63799
|
-
var
|
|
63971
|
+
var import_loglevel22 = __toModule(require_loglevel());
|
|
63800
63972
|
var DEFAULT_BACKGROUND_COLOR_OPACITY2 = 0.5;
|
|
63801
63973
|
var LineFocusModule = class {
|
|
63802
63974
|
constructor(delegate, properties, highlighter, api) {
|
|
@@ -63821,7 +63993,7 @@ var LineFocusModule = class {
|
|
|
63821
63993
|
return search;
|
|
63822
63994
|
}
|
|
63823
63995
|
async stop() {
|
|
63824
|
-
|
|
63996
|
+
import_loglevel22.default.log("Definitions module stop");
|
|
63825
63997
|
this.hasEventListener = false;
|
|
63826
63998
|
removeEventListenerOptional(document, "keydown", this.keydown.bind(this));
|
|
63827
63999
|
removeEventListenerOptional(document, "keyup", this.keyup.bind(this));
|
|
@@ -64216,9 +64388,9 @@ var LineFocusModule = class {
|
|
|
64216
64388
|
range.detach();
|
|
64217
64389
|
return rect;
|
|
64218
64390
|
} catch (error) {
|
|
64219
|
-
|
|
64220
|
-
|
|
64221
|
-
|
|
64391
|
+
import_loglevel22.default.log("measureTextNode " + error);
|
|
64392
|
+
import_loglevel22.default.log("measureTextNode " + node);
|
|
64393
|
+
import_loglevel22.default.log(`${node.textContent}`);
|
|
64222
64394
|
}
|
|
64223
64395
|
}
|
|
64224
64396
|
measureImageNodes(node) {
|
|
@@ -64229,16 +64401,16 @@ var LineFocusModule = class {
|
|
|
64229
64401
|
range.detach();
|
|
64230
64402
|
return rect;
|
|
64231
64403
|
} catch (error) {
|
|
64232
|
-
|
|
64233
|
-
|
|
64234
|
-
|
|
64404
|
+
import_loglevel22.default.log("measureTextNode " + error);
|
|
64405
|
+
import_loglevel22.default.log("measureTextNode " + node);
|
|
64406
|
+
import_loglevel22.default.log(`${node.textContent}`);
|
|
64235
64407
|
}
|
|
64236
64408
|
}
|
|
64237
64409
|
};
|
|
64238
64410
|
|
|
64239
64411
|
// src/modules/history/HistoryModule.ts
|
|
64240
64412
|
init_polyfills();
|
|
64241
|
-
var
|
|
64413
|
+
var import_loglevel23 = __toModule(require_loglevel());
|
|
64242
64414
|
var HistoryModule = class {
|
|
64243
64415
|
constructor(annotator, delegate, publication, properties, headerMenu) {
|
|
64244
64416
|
this.history = [];
|
|
@@ -64254,7 +64426,7 @@ var HistoryModule = class {
|
|
|
64254
64426
|
return pageBreak;
|
|
64255
64427
|
}
|
|
64256
64428
|
async stop() {
|
|
64257
|
-
|
|
64429
|
+
import_loglevel23.default.log("Page Break module stop");
|
|
64258
64430
|
removeEventListenerOptional(this.historyForwardAnchorElement, "click", this.handleHistoryForwardClick.bind(this));
|
|
64259
64431
|
removeEventListenerOptional(this.historyBackAnchorElement, "click", this.handleHistoryBackClick.bind(this));
|
|
64260
64432
|
}
|
|
@@ -64292,8 +64464,8 @@ var HistoryModule = class {
|
|
|
64292
64464
|
lastInHistory = this.history[this.history.length - 1];
|
|
64293
64465
|
if (lastInHistory && lastInHistory.href !== lastReadingPosition.href || lastInHistory === void 0) {
|
|
64294
64466
|
const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
|
|
64295
|
-
|
|
64296
|
-
|
|
64467
|
+
import_loglevel23.default.log(lastReadingPosition.href);
|
|
64468
|
+
import_loglevel23.default.log(linkHref);
|
|
64297
64469
|
lastReadingPosition.href = linkHref;
|
|
64298
64470
|
this.history.push(lastReadingPosition);
|
|
64299
64471
|
this.historyCurrentIndex = this.history.length - 1;
|
|
@@ -64349,7 +64521,7 @@ var HistoryModule = class {
|
|
|
64349
64521
|
|
|
64350
64522
|
// src/modules/citation/CitationModule.ts
|
|
64351
64523
|
init_polyfills();
|
|
64352
|
-
var
|
|
64524
|
+
var import_loglevel24 = __toModule(require_loglevel());
|
|
64353
64525
|
var CitationStyle;
|
|
64354
64526
|
(function(CitationStyle2) {
|
|
64355
64527
|
CitationStyle2[CitationStyle2["Chicago"] = 0] = "Chicago";
|
|
@@ -64377,7 +64549,7 @@ var CitationModule = class {
|
|
|
64377
64549
|
return module2;
|
|
64378
64550
|
}
|
|
64379
64551
|
async stop() {
|
|
64380
|
-
|
|
64552
|
+
import_loglevel24.default.log("Citation module stop");
|
|
64381
64553
|
}
|
|
64382
64554
|
copyToClipboard(textToClipboard) {
|
|
64383
64555
|
if (this.delegate?.contentProtectionModule) {
|
|
@@ -64966,7 +65138,7 @@ var PDFNavigator = class extends import_eventemitter32.default {
|
|
|
64966
65138
|
|
|
64967
65139
|
// src/reader.ts
|
|
64968
65140
|
var D2Reader = class {
|
|
64969
|
-
constructor(settings, navigator2, highlighter, bookmarkModule, annotationModule, ttsSettings, ttsModule, searchModule, definitionsModule, contentProtectionModule, timelineModule, mediaOverlaySettings, mediaOverlayModule, pageBreakModule, lineFocusModule, historyModule, citationModule) {
|
|
65141
|
+
constructor(settings, navigator2, highlighter, bookmarkModule, annotationModule, ttsSettings, ttsModule, searchModule, definitionsModule, contentProtectionModule, timelineModule, mediaOverlaySettings, mediaOverlayModule, pageBreakModule, lineFocusModule, historyModule, citationModule, consumptionModule) {
|
|
64970
65142
|
this.settings = settings;
|
|
64971
65143
|
this.navigator = navigator2;
|
|
64972
65144
|
this.highlighter = highlighter;
|
|
@@ -64984,6 +65156,7 @@ var D2Reader = class {
|
|
|
64984
65156
|
this.lineFocusModule = lineFocusModule;
|
|
64985
65157
|
this.historyModule = historyModule;
|
|
64986
65158
|
this.citationModule = citationModule;
|
|
65159
|
+
this.consumptionModule = consumptionModule;
|
|
64987
65160
|
this.startReadAloud = () => {
|
|
64988
65161
|
if (this.navigator instanceof IFrameNavigator) {
|
|
64989
65162
|
this.navigator.startReadAloud();
|
|
@@ -65293,7 +65466,8 @@ var D2Reader = class {
|
|
|
65293
65466
|
const navigator2 = await PDFNavigator.create({
|
|
65294
65467
|
mainElement,
|
|
65295
65468
|
publication,
|
|
65296
|
-
settings
|
|
65469
|
+
settings,
|
|
65470
|
+
api: initialConfig.api
|
|
65297
65471
|
});
|
|
65298
65472
|
return new D2Reader(settings, navigator2);
|
|
65299
65473
|
} else {
|
|
@@ -65421,7 +65595,11 @@ var D2Reader = class {
|
|
|
65421
65595
|
delegate: navigator2,
|
|
65422
65596
|
headerMenu
|
|
65423
65597
|
}) : void 0;
|
|
65424
|
-
|
|
65598
|
+
const consumptionModule = rights.enableConsumption ? await ConsumptionModule.create(__spreadValues({
|
|
65599
|
+
publication,
|
|
65600
|
+
delegate: navigator2
|
|
65601
|
+
}, initialConfig.consumption)) : void 0;
|
|
65602
|
+
return new D2Reader(settings, navigator2, highlighter, bookmarkModule, annotationModule, ttsSettings, ttsModule, searchModule, definitionsModule, contentProtectionModule, timelineModule, mediaOverlaySettings, mediaOverlayModule, pageBreakModule, lineFocusModule, historyModule, citationModule, consumptionModule);
|
|
65425
65603
|
}
|
|
65426
65604
|
}
|
|
65427
65605
|
get hasMediaOverlays() {
|