@d-i-t-a/reader 2.1.0-beta.3 → 2.1.0-beta.6
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 +600 -686
- package/dist/esm/index.js.map +3 -3
- package/dist/injectables/click/click.js.map +1 -1
- package/dist/reader.css +1 -1216
- package/dist/reader.css.map +1 -0
- package/dist/reader.js +38 -40
- package/dist/reader.js.map +3 -3
- package/dist/types/model/Publication.d.ts +5 -5
- package/dist/types/model/user-settings/UserSettings.d.ts +5 -6
- package/dist/types/modules/AnnotationModule.d.ts +2 -2
- package/dist/types/modules/BookmarkModule.d.ts +2 -2
- package/dist/types/modules/TTS/TTSModule2.d.ts +1 -1
- package/dist/types/modules/TTS/TTSSettings.d.ts +1 -1
- package/dist/types/modules/protection/ContentProtectionModule.d.ts +1 -1
- package/dist/types/modules/search/SearchModule.d.ts +4 -1
- package/dist/types/navigator/IFrameNavigator.d.ts +29 -39
- package/dist/types/utils/HTMLTemplates.d.ts +0 -2
- package/dist/types/utils/index.d.ts +0 -5
- package/package.json +13 -10
- package/dist/reader.map.css +0 -21
package/dist/esm/index.js
CHANGED
|
@@ -10118,9 +10118,9 @@ var require_source_map = __commonJS({
|
|
|
10118
10118
|
}
|
|
10119
10119
|
});
|
|
10120
10120
|
|
|
10121
|
-
// (disabled):path
|
|
10121
|
+
// (disabled):node_modules/path/path.js
|
|
10122
10122
|
var require_path = __commonJS({
|
|
10123
|
-
"(disabled):path"() {
|
|
10123
|
+
"(disabled):node_modules/path/path.js"() {
|
|
10124
10124
|
init_polyfills();
|
|
10125
10125
|
}
|
|
10126
10126
|
});
|
|
@@ -13677,6 +13677,231 @@ and ensure you are accounting for this risk.
|
|
|
13677
13677
|
}
|
|
13678
13678
|
});
|
|
13679
13679
|
|
|
13680
|
+
// node_modules/loglevel/lib/loglevel.js
|
|
13681
|
+
var require_loglevel = __commonJS({
|
|
13682
|
+
"node_modules/loglevel/lib/loglevel.js"(exports, module) {
|
|
13683
|
+
init_polyfills();
|
|
13684
|
+
(function(root, definition) {
|
|
13685
|
+
"use strict";
|
|
13686
|
+
if (typeof define === "function" && define.amd) {
|
|
13687
|
+
define(definition);
|
|
13688
|
+
} else if (typeof module === "object" && module.exports) {
|
|
13689
|
+
module.exports = definition();
|
|
13690
|
+
} else {
|
|
13691
|
+
root.log = definition();
|
|
13692
|
+
}
|
|
13693
|
+
})(exports, function() {
|
|
13694
|
+
"use strict";
|
|
13695
|
+
var noop = function() {
|
|
13696
|
+
};
|
|
13697
|
+
var undefinedType = "undefined";
|
|
13698
|
+
var isIE2 = typeof window !== undefinedType && typeof window.navigator !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent);
|
|
13699
|
+
var logMethods = [
|
|
13700
|
+
"trace",
|
|
13701
|
+
"debug",
|
|
13702
|
+
"info",
|
|
13703
|
+
"warn",
|
|
13704
|
+
"error"
|
|
13705
|
+
];
|
|
13706
|
+
function bindMethod(obj, methodName) {
|
|
13707
|
+
var method = obj[methodName];
|
|
13708
|
+
if (typeof method.bind === "function") {
|
|
13709
|
+
return method.bind(obj);
|
|
13710
|
+
} else {
|
|
13711
|
+
try {
|
|
13712
|
+
return Function.prototype.bind.call(method, obj);
|
|
13713
|
+
} catch (e) {
|
|
13714
|
+
return function() {
|
|
13715
|
+
return Function.prototype.apply.apply(method, [obj, arguments]);
|
|
13716
|
+
};
|
|
13717
|
+
}
|
|
13718
|
+
}
|
|
13719
|
+
}
|
|
13720
|
+
function traceForIE() {
|
|
13721
|
+
if (console.log) {
|
|
13722
|
+
if (console.log.apply) {
|
|
13723
|
+
console.log.apply(console, arguments);
|
|
13724
|
+
} else {
|
|
13725
|
+
Function.prototype.apply.apply(console.log, [console, arguments]);
|
|
13726
|
+
}
|
|
13727
|
+
}
|
|
13728
|
+
if (console.trace)
|
|
13729
|
+
console.trace();
|
|
13730
|
+
}
|
|
13731
|
+
function realMethod(methodName) {
|
|
13732
|
+
if (methodName === "debug") {
|
|
13733
|
+
methodName = "log";
|
|
13734
|
+
}
|
|
13735
|
+
if (typeof console === undefinedType) {
|
|
13736
|
+
return false;
|
|
13737
|
+
} else if (methodName === "trace" && isIE2) {
|
|
13738
|
+
return traceForIE;
|
|
13739
|
+
} else if (console[methodName] !== void 0) {
|
|
13740
|
+
return bindMethod(console, methodName);
|
|
13741
|
+
} else if (console.log !== void 0) {
|
|
13742
|
+
return bindMethod(console, "log");
|
|
13743
|
+
} else {
|
|
13744
|
+
return noop;
|
|
13745
|
+
}
|
|
13746
|
+
}
|
|
13747
|
+
function replaceLoggingMethods(level, loggerName) {
|
|
13748
|
+
for (var i = 0; i < logMethods.length; i++) {
|
|
13749
|
+
var methodName = logMethods[i];
|
|
13750
|
+
this[methodName] = i < level ? noop : this.methodFactory(methodName, level, loggerName);
|
|
13751
|
+
}
|
|
13752
|
+
this.log = this.debug;
|
|
13753
|
+
}
|
|
13754
|
+
function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {
|
|
13755
|
+
return function() {
|
|
13756
|
+
if (typeof console !== undefinedType) {
|
|
13757
|
+
replaceLoggingMethods.call(this, level, loggerName);
|
|
13758
|
+
this[methodName].apply(this, arguments);
|
|
13759
|
+
}
|
|
13760
|
+
};
|
|
13761
|
+
}
|
|
13762
|
+
function defaultMethodFactory(methodName, level, loggerName) {
|
|
13763
|
+
return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments);
|
|
13764
|
+
}
|
|
13765
|
+
function Logger(name, defaultLevel, factory) {
|
|
13766
|
+
var self2 = this;
|
|
13767
|
+
var currentLevel;
|
|
13768
|
+
defaultLevel = defaultLevel == null ? "WARN" : defaultLevel;
|
|
13769
|
+
var storageKey = "loglevel";
|
|
13770
|
+
if (typeof name === "string") {
|
|
13771
|
+
storageKey += ":" + name;
|
|
13772
|
+
} else if (typeof name === "symbol") {
|
|
13773
|
+
storageKey = void 0;
|
|
13774
|
+
}
|
|
13775
|
+
function persistLevelIfPossible(levelNum) {
|
|
13776
|
+
var levelName = (logMethods[levelNum] || "silent").toUpperCase();
|
|
13777
|
+
if (typeof window === undefinedType || !storageKey)
|
|
13778
|
+
return;
|
|
13779
|
+
try {
|
|
13780
|
+
window.localStorage[storageKey] = levelName;
|
|
13781
|
+
return;
|
|
13782
|
+
} catch (ignore) {
|
|
13783
|
+
}
|
|
13784
|
+
try {
|
|
13785
|
+
window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";";
|
|
13786
|
+
} catch (ignore) {
|
|
13787
|
+
}
|
|
13788
|
+
}
|
|
13789
|
+
function getPersistedLevel() {
|
|
13790
|
+
var storedLevel;
|
|
13791
|
+
if (typeof window === undefinedType || !storageKey)
|
|
13792
|
+
return;
|
|
13793
|
+
try {
|
|
13794
|
+
storedLevel = window.localStorage[storageKey];
|
|
13795
|
+
} catch (ignore) {
|
|
13796
|
+
}
|
|
13797
|
+
if (typeof storedLevel === undefinedType) {
|
|
13798
|
+
try {
|
|
13799
|
+
var cookie = window.document.cookie;
|
|
13800
|
+
var location = cookie.indexOf(encodeURIComponent(storageKey) + "=");
|
|
13801
|
+
if (location !== -1) {
|
|
13802
|
+
storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];
|
|
13803
|
+
}
|
|
13804
|
+
} catch (ignore) {
|
|
13805
|
+
}
|
|
13806
|
+
}
|
|
13807
|
+
if (self2.levels[storedLevel] === void 0) {
|
|
13808
|
+
storedLevel = void 0;
|
|
13809
|
+
}
|
|
13810
|
+
return storedLevel;
|
|
13811
|
+
}
|
|
13812
|
+
function clearPersistedLevel() {
|
|
13813
|
+
if (typeof window === undefinedType || !storageKey)
|
|
13814
|
+
return;
|
|
13815
|
+
try {
|
|
13816
|
+
window.localStorage.removeItem(storageKey);
|
|
13817
|
+
return;
|
|
13818
|
+
} catch (ignore) {
|
|
13819
|
+
}
|
|
13820
|
+
try {
|
|
13821
|
+
window.document.cookie = encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
13822
|
+
} catch (ignore) {
|
|
13823
|
+
}
|
|
13824
|
+
}
|
|
13825
|
+
self2.name = name;
|
|
13826
|
+
self2.levels = {
|
|
13827
|
+
"TRACE": 0,
|
|
13828
|
+
"DEBUG": 1,
|
|
13829
|
+
"INFO": 2,
|
|
13830
|
+
"WARN": 3,
|
|
13831
|
+
"ERROR": 4,
|
|
13832
|
+
"SILENT": 5
|
|
13833
|
+
};
|
|
13834
|
+
self2.methodFactory = factory || defaultMethodFactory;
|
|
13835
|
+
self2.getLevel = function() {
|
|
13836
|
+
return currentLevel;
|
|
13837
|
+
};
|
|
13838
|
+
self2.setLevel = function(level, persist) {
|
|
13839
|
+
if (typeof level === "string" && self2.levels[level.toUpperCase()] !== void 0) {
|
|
13840
|
+
level = self2.levels[level.toUpperCase()];
|
|
13841
|
+
}
|
|
13842
|
+
if (typeof level === "number" && level >= 0 && level <= self2.levels.SILENT) {
|
|
13843
|
+
currentLevel = level;
|
|
13844
|
+
if (persist !== false) {
|
|
13845
|
+
persistLevelIfPossible(level);
|
|
13846
|
+
}
|
|
13847
|
+
replaceLoggingMethods.call(self2, level, name);
|
|
13848
|
+
if (typeof console === undefinedType && level < self2.levels.SILENT) {
|
|
13849
|
+
return "No console available for logging";
|
|
13850
|
+
}
|
|
13851
|
+
} else {
|
|
13852
|
+
throw "log.setLevel() called with invalid level: " + level;
|
|
13853
|
+
}
|
|
13854
|
+
};
|
|
13855
|
+
self2.setDefaultLevel = function(level) {
|
|
13856
|
+
defaultLevel = level;
|
|
13857
|
+
if (!getPersistedLevel()) {
|
|
13858
|
+
self2.setLevel(level, false);
|
|
13859
|
+
}
|
|
13860
|
+
};
|
|
13861
|
+
self2.resetLevel = function() {
|
|
13862
|
+
self2.setLevel(defaultLevel, false);
|
|
13863
|
+
clearPersistedLevel();
|
|
13864
|
+
};
|
|
13865
|
+
self2.enableAll = function(persist) {
|
|
13866
|
+
self2.setLevel(self2.levels.TRACE, persist);
|
|
13867
|
+
};
|
|
13868
|
+
self2.disableAll = function(persist) {
|
|
13869
|
+
self2.setLevel(self2.levels.SILENT, persist);
|
|
13870
|
+
};
|
|
13871
|
+
var initialLevel = getPersistedLevel();
|
|
13872
|
+
if (initialLevel == null) {
|
|
13873
|
+
initialLevel = defaultLevel;
|
|
13874
|
+
}
|
|
13875
|
+
self2.setLevel(initialLevel, false);
|
|
13876
|
+
}
|
|
13877
|
+
var defaultLogger = new Logger();
|
|
13878
|
+
var _loggersByName = {};
|
|
13879
|
+
defaultLogger.getLogger = function getLogger(name) {
|
|
13880
|
+
if (typeof name !== "symbol" && typeof name !== "string" || name === "") {
|
|
13881
|
+
throw new TypeError("You must supply a name when creating a logger.");
|
|
13882
|
+
}
|
|
13883
|
+
var logger = _loggersByName[name];
|
|
13884
|
+
if (!logger) {
|
|
13885
|
+
logger = _loggersByName[name] = new Logger(name, defaultLogger.getLevel(), defaultLogger.methodFactory);
|
|
13886
|
+
}
|
|
13887
|
+
return logger;
|
|
13888
|
+
};
|
|
13889
|
+
var _log = typeof window !== undefinedType ? window.log : void 0;
|
|
13890
|
+
defaultLogger.noConflict = function() {
|
|
13891
|
+
if (typeof window !== undefinedType && window.log === defaultLogger) {
|
|
13892
|
+
window.log = _log;
|
|
13893
|
+
}
|
|
13894
|
+
return defaultLogger;
|
|
13895
|
+
};
|
|
13896
|
+
defaultLogger.getLoggers = function getLoggers() {
|
|
13897
|
+
return _loggersByName;
|
|
13898
|
+
};
|
|
13899
|
+
defaultLogger["default"] = defaultLogger;
|
|
13900
|
+
return defaultLogger;
|
|
13901
|
+
});
|
|
13902
|
+
}
|
|
13903
|
+
});
|
|
13904
|
+
|
|
13680
13905
|
// node_modules/debounce/index.js
|
|
13681
13906
|
var require_debounce = __commonJS({
|
|
13682
13907
|
"node_modules/debounce/index.js"(exports, module) {
|
|
@@ -34139,8 +34364,8 @@ function TaJsonDeserialize(json, type) {
|
|
|
34139
34364
|
|
|
34140
34365
|
// src/model/Publication.ts
|
|
34141
34366
|
var Publication = class extends import_publication.Publication {
|
|
34142
|
-
static async fromUrl(url,
|
|
34143
|
-
const response = await fetch(url.href,
|
|
34367
|
+
static async fromUrl(url, requestConfig) {
|
|
34368
|
+
const response = await fetch(url.href, requestConfig);
|
|
34144
34369
|
const manifestJSON = await response.json();
|
|
34145
34370
|
let publication = TaJsonDeserialize(manifestJSON, Publication);
|
|
34146
34371
|
publication.manifestUrl = url;
|
|
@@ -34316,7 +34541,7 @@ var Publication = class extends import_publication.Publication {
|
|
|
34316
34541
|
const decodedHref = decodeURI(href) ?? "";
|
|
34317
34542
|
return this.positions?.filter((p) => decodedHref.includes(p.href));
|
|
34318
34543
|
}
|
|
34319
|
-
async autoGeneratePositions(
|
|
34544
|
+
async autoGeneratePositions(requestConfig, getContentBytesLength = fetchContentBytesLength) {
|
|
34320
34545
|
let startPosition = 0;
|
|
34321
34546
|
let totalContentLength = 0;
|
|
34322
34547
|
const positions = [];
|
|
@@ -34335,7 +34560,7 @@ var Publication = class extends import_publication.Publication {
|
|
|
34335
34560
|
startPosition = startPosition + 1;
|
|
34336
34561
|
} else {
|
|
34337
34562
|
let href = this.getAbsoluteHref(link.Href);
|
|
34338
|
-
let length = await getContentBytesLength(href,
|
|
34563
|
+
let length = await getContentBytesLength(href, requestConfig);
|
|
34339
34564
|
link.contentLength = length;
|
|
34340
34565
|
totalContentLength += length;
|
|
34341
34566
|
let positionLength = 1024;
|
|
@@ -34379,17 +34604,17 @@ var Publication = class extends import_publication.Publication {
|
|
|
34379
34604
|
}
|
|
34380
34605
|
this.positions = positions;
|
|
34381
34606
|
}
|
|
34382
|
-
async fetchPositionsFromService(href,
|
|
34383
|
-
const result = await fetch(href,
|
|
34607
|
+
async fetchPositionsFromService(href, requestConfig) {
|
|
34608
|
+
const result = await fetch(href, requestConfig);
|
|
34384
34609
|
const content = await result.json();
|
|
34385
34610
|
this.positions = content.positions;
|
|
34386
34611
|
}
|
|
34387
|
-
async fetchWeightsFromService(href,
|
|
34612
|
+
async fetchWeightsFromService(href, requestConfig) {
|
|
34388
34613
|
if (this.isFixedLayout) {
|
|
34389
34614
|
console.warn("Not fetching weights from service for fixed layout publication.");
|
|
34390
34615
|
return;
|
|
34391
34616
|
}
|
|
34392
|
-
const result = await fetch(href,
|
|
34617
|
+
const result = await fetch(href, requestConfig);
|
|
34393
34618
|
const weights = await result.json();
|
|
34394
34619
|
if (this.readingOrder !== void 0) {
|
|
34395
34620
|
this.readingOrder.forEach((link) => {
|
|
@@ -34401,8 +34626,8 @@ var Publication = class extends import_publication.Publication {
|
|
|
34401
34626
|
Publication = __decorateClass([
|
|
34402
34627
|
(0, import_ta_json_x2.JsonObject)()
|
|
34403
34628
|
], Publication);
|
|
34404
|
-
var fetchContentBytesLength = async (href,
|
|
34405
|
-
const r = await fetch(href,
|
|
34629
|
+
var fetchContentBytesLength = async (href, requestConfig) => {
|
|
34630
|
+
const r = await fetch(href, requestConfig);
|
|
34406
34631
|
const b = await r.blob();
|
|
34407
34632
|
return b.size;
|
|
34408
34633
|
};
|
|
@@ -34597,15 +34822,6 @@ function setAttr(element, attr, value) {
|
|
|
34597
34822
|
element.setAttribute(attr, value);
|
|
34598
34823
|
}
|
|
34599
34824
|
|
|
34600
|
-
// src/utils/index.ts
|
|
34601
|
-
init_polyfills();
|
|
34602
|
-
function delay(t, v) {
|
|
34603
|
-
return new Promise(function(resolve) {
|
|
34604
|
-
setTimeout(resolve.bind(null, v), t);
|
|
34605
|
-
});
|
|
34606
|
-
}
|
|
34607
|
-
var IS_DEV = false;
|
|
34608
|
-
|
|
34609
34825
|
// src/utils/EventHandler.ts
|
|
34610
34826
|
init_polyfills();
|
|
34611
34827
|
|
|
@@ -34635,7 +34851,7 @@ var Popup = class {
|
|
|
34635
34851
|
absolute = absolute.substring(0, absolute.indexOf("#"));
|
|
34636
34852
|
event.preventDefault();
|
|
34637
34853
|
event.stopPropagation();
|
|
34638
|
-
await fetch(absolute, this.navigator.
|
|
34854
|
+
await fetch(absolute, this.navigator.requestConfig).then((r) => r.text()).then(async (data) => {
|
|
34639
34855
|
const parser = new DOMParser();
|
|
34640
34856
|
const doc = parser.parseFromString(data, "text/html");
|
|
34641
34857
|
const element = doc.querySelector("#" + id2);
|
|
@@ -34685,7 +34901,7 @@ var Popup = class {
|
|
|
34685
34901
|
const d2content = document.createElement("div");
|
|
34686
34902
|
d2content.className = "d2-popover-content";
|
|
34687
34903
|
d2wrapper.appendChild(d2content);
|
|
34688
|
-
await fetch(absolute, this.navigator.
|
|
34904
|
+
await fetch(absolute, this.navigator.requestConfig).then((r) => r.text()).then(async (data) => {
|
|
34689
34905
|
d2content.innerHTML = data;
|
|
34690
34906
|
let doc = this.navigator.iframes[0].contentDocument;
|
|
34691
34907
|
if (doc) {
|
|
@@ -34811,6 +35027,7 @@ var Popup = class {
|
|
|
34811
35027
|
};
|
|
34812
35028
|
|
|
34813
35029
|
// src/utils/EventHandler.ts
|
|
35030
|
+
var import_loglevel = __toModule(require_loglevel());
|
|
34814
35031
|
function addEventListenerOptional(element, eventType, eventListener) {
|
|
34815
35032
|
if (element) {
|
|
34816
35033
|
element.addEventListener(eventType, eventListener, true);
|
|
@@ -34842,20 +35059,17 @@ var EventHandler = class {
|
|
|
34842
35059
|
return !link.Rel?.includes("external") && this.navigator.publication.getRelativeHref(clickedHref).includes(link.Href);
|
|
34843
35060
|
});
|
|
34844
35061
|
this.isReadingOrderInternal = (clickedLink) => {
|
|
34845
|
-
|
|
34846
|
-
console.log("clickedLink: ", clickedLink);
|
|
35062
|
+
import_loglevel.default.log("clickedLink: ", clickedLink);
|
|
34847
35063
|
const isEpubInternal = this.linkInPublication(this.navigator.publication.readingOrder, clickedLink.href);
|
|
34848
35064
|
return isEpubInternal;
|
|
34849
35065
|
};
|
|
34850
35066
|
this.isResourceInternal = (clickedLink) => {
|
|
34851
|
-
|
|
34852
|
-
console.log("clickedLink: ", clickedLink);
|
|
35067
|
+
import_loglevel.default.log("clickedLink: ", clickedLink);
|
|
34853
35068
|
const isEpubInternal = this.linkInPublication(this.navigator.publication.resources, clickedLink.href);
|
|
34854
35069
|
return isEpubInternal;
|
|
34855
35070
|
};
|
|
34856
35071
|
this.handleLinks = async (event) => {
|
|
34857
|
-
|
|
34858
|
-
console.log("R2 Click Handler");
|
|
35072
|
+
import_loglevel.default.log("R2 Click Handler");
|
|
34859
35073
|
const link = this.checkForLink(event);
|
|
34860
35074
|
if (link) {
|
|
34861
35075
|
const isSameOrigin = window.location.protocol === link.protocol && window.location.port === link.port && window.location.hostname === link.hostname;
|
|
@@ -35352,6 +35566,7 @@ var FixedBookView = class {
|
|
|
35352
35566
|
};
|
|
35353
35567
|
|
|
35354
35568
|
// src/model/user-settings/UserSettings.ts
|
|
35569
|
+
var import_loglevel2 = __toModule(require_loglevel());
|
|
35355
35570
|
var _UserSettings = class {
|
|
35356
35571
|
constructor(store, headerMenu, api, injectables, layout) {
|
|
35357
35572
|
this.USERSETTINGS = "userSetting";
|
|
@@ -35390,7 +35605,7 @@ var _UserSettings = class {
|
|
|
35390
35605
|
}
|
|
35391
35606
|
async isPaginated() {
|
|
35392
35607
|
let scroll = await this.getPropertyAndFallback("verticalScroll", ReadiumCSS.SCROLL_KEY);
|
|
35393
|
-
return scroll
|
|
35608
|
+
return !scroll;
|
|
35394
35609
|
}
|
|
35395
35610
|
async isScrollMode() {
|
|
35396
35611
|
return !await this.isPaginated();
|
|
@@ -35410,8 +35625,7 @@ var _UserSettings = class {
|
|
|
35410
35625
|
prop.value = settings.verticalScroll;
|
|
35411
35626
|
await settings.saveProperty(prop);
|
|
35412
35627
|
}
|
|
35413
|
-
|
|
35414
|
-
console.log(settings.verticalScroll);
|
|
35628
|
+
import_loglevel2.default.log(settings.verticalScroll);
|
|
35415
35629
|
}
|
|
35416
35630
|
if (initialUserSettings.appearance) {
|
|
35417
35631
|
settings.appearance = _UserSettings.appearanceValues.findIndex((el) => el === initialUserSettings.appearance);
|
|
@@ -35420,8 +35634,7 @@ var _UserSettings = class {
|
|
|
35420
35634
|
prop.value = settings.appearance;
|
|
35421
35635
|
await settings.saveProperty(prop);
|
|
35422
35636
|
}
|
|
35423
|
-
|
|
35424
|
-
console.log(settings.appearance);
|
|
35637
|
+
import_loglevel2.default.log(settings.appearance);
|
|
35425
35638
|
}
|
|
35426
35639
|
if (initialUserSettings.fontSize) {
|
|
35427
35640
|
settings.fontSize = initialUserSettings.fontSize;
|
|
@@ -35430,8 +35643,7 @@ var _UserSettings = class {
|
|
|
35430
35643
|
prop.value = settings.fontSize;
|
|
35431
35644
|
await settings.saveProperty(prop);
|
|
35432
35645
|
}
|
|
35433
|
-
|
|
35434
|
-
console.log(settings.fontSize);
|
|
35646
|
+
import_loglevel2.default.log(settings.fontSize);
|
|
35435
35647
|
}
|
|
35436
35648
|
if (initialUserSettings.fontFamily) {
|
|
35437
35649
|
settings.fontFamily = _UserSettings.fontFamilyValues.findIndex((el) => el === initialUserSettings.fontFamily);
|
|
@@ -35440,8 +35652,7 @@ var _UserSettings = class {
|
|
|
35440
35652
|
prop.value = settings.fontFamily;
|
|
35441
35653
|
await settings.saveProperty(prop);
|
|
35442
35654
|
}
|
|
35443
|
-
|
|
35444
|
-
console.log(settings.fontFamily);
|
|
35655
|
+
import_loglevel2.default.log(settings.fontFamily);
|
|
35445
35656
|
if (settings.fontFamily !== 0) {
|
|
35446
35657
|
settings.fontOverride = true;
|
|
35447
35658
|
}
|
|
@@ -35453,8 +35664,7 @@ var _UserSettings = class {
|
|
|
35453
35664
|
prop.value = settings.textAlignment;
|
|
35454
35665
|
await settings.saveProperty(prop);
|
|
35455
35666
|
}
|
|
35456
|
-
|
|
35457
|
-
console.log(settings.textAlignment);
|
|
35667
|
+
import_loglevel2.default.log(settings.textAlignment);
|
|
35458
35668
|
}
|
|
35459
35669
|
if (initialUserSettings.columnCount) {
|
|
35460
35670
|
settings.columnCount = _UserSettings.columnCountValues.findIndex((el) => el === initialUserSettings.columnCount);
|
|
@@ -35463,8 +35673,7 @@ var _UserSettings = class {
|
|
|
35463
35673
|
prop.value = settings.columnCount;
|
|
35464
35674
|
await settings.saveProperty(prop);
|
|
35465
35675
|
}
|
|
35466
|
-
|
|
35467
|
-
console.log(settings.columnCount);
|
|
35676
|
+
import_loglevel2.default.log(settings.columnCount);
|
|
35468
35677
|
}
|
|
35469
35678
|
if (initialUserSettings.wordSpacing) {
|
|
35470
35679
|
settings.wordSpacing = initialUserSettings.wordSpacing;
|
|
@@ -35473,8 +35682,7 @@ var _UserSettings = class {
|
|
|
35473
35682
|
prop.value = settings.wordSpacing;
|
|
35474
35683
|
await settings.saveProperty(prop);
|
|
35475
35684
|
}
|
|
35476
|
-
|
|
35477
|
-
console.log(settings.wordSpacing);
|
|
35685
|
+
import_loglevel2.default.log(settings.wordSpacing);
|
|
35478
35686
|
}
|
|
35479
35687
|
if (initialUserSettings.letterSpacing) {
|
|
35480
35688
|
settings.letterSpacing = initialUserSettings.letterSpacing;
|
|
@@ -35483,8 +35691,7 @@ var _UserSettings = class {
|
|
|
35483
35691
|
prop.value = settings.letterSpacing;
|
|
35484
35692
|
await settings.saveProperty(prop);
|
|
35485
35693
|
}
|
|
35486
|
-
|
|
35487
|
-
console.log(settings.letterSpacing);
|
|
35694
|
+
import_loglevel2.default.log(settings.letterSpacing);
|
|
35488
35695
|
}
|
|
35489
35696
|
if (initialUserSettings.pageMargins) {
|
|
35490
35697
|
settings.pageMargins = initialUserSettings.pageMargins;
|
|
@@ -35493,8 +35700,7 @@ var _UserSettings = class {
|
|
|
35493
35700
|
prop.value = settings.pageMargins;
|
|
35494
35701
|
await settings.saveProperty(prop);
|
|
35495
35702
|
}
|
|
35496
|
-
|
|
35497
|
-
console.log(settings.pageMargins);
|
|
35703
|
+
import_loglevel2.default.log(settings.pageMargins);
|
|
35498
35704
|
}
|
|
35499
35705
|
if (initialUserSettings.lineHeight) {
|
|
35500
35706
|
settings.lineHeight = initialUserSettings.lineHeight;
|
|
@@ -35503,8 +35709,7 @@ var _UserSettings = class {
|
|
|
35503
35709
|
prop.value = settings.lineHeight;
|
|
35504
35710
|
await settings.saveProperty(prop);
|
|
35505
35711
|
}
|
|
35506
|
-
|
|
35507
|
-
console.log(settings.lineHeight);
|
|
35712
|
+
import_loglevel2.default.log(settings.lineHeight);
|
|
35508
35713
|
}
|
|
35509
35714
|
settings.userProperties = settings.getUserSettings();
|
|
35510
35715
|
await settings.initialise();
|
|
@@ -35513,9 +35718,7 @@ var _UserSettings = class {
|
|
|
35513
35718
|
return new Promise((resolve) => resolve(settings));
|
|
35514
35719
|
}
|
|
35515
35720
|
stop() {
|
|
35516
|
-
|
|
35517
|
-
console.log("book settings stop");
|
|
35518
|
-
}
|
|
35721
|
+
import_loglevel2.default.log("book settings stop");
|
|
35519
35722
|
}
|
|
35520
35723
|
async initialise() {
|
|
35521
35724
|
this.appearance = await this.getPropertyAndFallback("appearance", ReadiumCSS.APPEARANCE_KEY);
|
|
@@ -35673,9 +35876,9 @@ var _UserSettings = class {
|
|
|
35673
35876
|
this.view.iframe = iframe;
|
|
35674
35877
|
}
|
|
35675
35878
|
if (this.settingsView)
|
|
35676
|
-
|
|
35879
|
+
_UserSettings.renderControls(this.settingsView);
|
|
35677
35880
|
}
|
|
35678
|
-
renderControls(element) {
|
|
35881
|
+
static renderControls(element) {
|
|
35679
35882
|
addEventListenerOptional(findElement(element, "ul"), "click", (event) => {
|
|
35680
35883
|
event.stopPropagation();
|
|
35681
35884
|
});
|
|
@@ -35722,9 +35925,7 @@ var _UserSettings = class {
|
|
|
35722
35925
|
};
|
|
35723
35926
|
if (this.api?.updateSettings) {
|
|
35724
35927
|
this.api?.updateSettings(userSettings).then((_) => {
|
|
35725
|
-
|
|
35726
|
-
console.log("api updated user settings", userSettings);
|
|
35727
|
-
}
|
|
35928
|
+
import_loglevel2.default.log("api updated user settings", JSON.stringify(userSettings));
|
|
35728
35929
|
});
|
|
35729
35930
|
}
|
|
35730
35931
|
}
|
|
@@ -36459,7 +36660,7 @@ var HighlightType;
|
|
|
36459
36660
|
|
|
36460
36661
|
// src/modules/highlight/common/rect-utils.ts
|
|
36461
36662
|
init_polyfills();
|
|
36462
|
-
var
|
|
36663
|
+
var import_loglevel3 = __toModule(require_loglevel());
|
|
36463
36664
|
function getClientRectsNoOverlap(range, doNotMergeHorizontallyAlignedRects) {
|
|
36464
36665
|
const rangeClientRects = range.getClientRects();
|
|
36465
36666
|
return getClientRectsNoOverlap_(rangeClientRects, doNotMergeHorizontallyAlignedRects);
|
|
@@ -36486,24 +36687,16 @@ function getClientRectsNoOverlap_(clientRects, doNotMergeHorizontallyAlignedRect
|
|
|
36486
36687
|
const bigEnough = rect.width * rect.height > minArea;
|
|
36487
36688
|
if (!bigEnough) {
|
|
36488
36689
|
if (newRects.length > 1) {
|
|
36489
|
-
|
|
36490
|
-
console.log("CLIENT RECT: remove small");
|
|
36491
|
-
}
|
|
36690
|
+
import_loglevel3.default.log("CLIENT RECT: remove small");
|
|
36492
36691
|
newRects.splice(j, 1);
|
|
36493
36692
|
} else {
|
|
36494
|
-
|
|
36495
|
-
console.log("CLIENT RECT: remove small, but keep otherwise empty!");
|
|
36496
|
-
}
|
|
36693
|
+
import_loglevel3.default.log("CLIENT RECT: remove small, but keep otherwise empty!");
|
|
36497
36694
|
break;
|
|
36498
36695
|
}
|
|
36499
36696
|
}
|
|
36500
36697
|
}
|
|
36501
|
-
|
|
36502
|
-
|
|
36503
|
-
}
|
|
36504
|
-
if (IS_DEV2) {
|
|
36505
|
-
console.log(`CLIENT RECT: reduced ${originalRects.length} --> ${newRects.length}`);
|
|
36506
|
-
}
|
|
36698
|
+
checkOverlaps(newRects);
|
|
36699
|
+
import_loglevel3.default.log(`CLIENT RECT: reduced ${originalRects.length} --> ${newRects.length}`);
|
|
36507
36700
|
return newRects;
|
|
36508
36701
|
}
|
|
36509
36702
|
function almostEqual(a, b, tolerance) {
|
|
@@ -36620,9 +36813,7 @@ function mergeTouchingRects(rects, tolerance, doNotMergeHorizontallyAlignedRects
|
|
|
36620
36813
|
const rect1 = rects[i];
|
|
36621
36814
|
const rect2 = rects[j];
|
|
36622
36815
|
if (rect1 === rect2) {
|
|
36623
|
-
|
|
36624
|
-
console.log("mergeTouchingRects rect1 === rect2 ??!");
|
|
36625
|
-
}
|
|
36816
|
+
import_loglevel3.default.log("mergeTouchingRects rect1 === rect2 ??!");
|
|
36626
36817
|
continue;
|
|
36627
36818
|
}
|
|
36628
36819
|
const rectsLineUpVertically = almostEqual(rect1.top, rect2.top, tolerance) && almostEqual(rect1.bottom, rect2.bottom, tolerance);
|
|
@@ -36631,9 +36822,7 @@ function mergeTouchingRects(rects, tolerance, doNotMergeHorizontallyAlignedRects
|
|
|
36631
36822
|
const aligned = rectsLineUpHorizontally && horizontalAllowed || rectsLineUpVertically && !rectsLineUpHorizontally;
|
|
36632
36823
|
const canMerge = aligned && rectsTouchOrOverlap(rect1, rect2, tolerance);
|
|
36633
36824
|
if (canMerge) {
|
|
36634
|
-
|
|
36635
|
-
console.log(`CLIENT RECT: merging two into one, VERTICAL: ${rectsLineUpVertically} HORIZONTAL: ${rectsLineUpHorizontally} (${doNotMergeHorizontallyAlignedRects})`);
|
|
36636
|
-
}
|
|
36825
|
+
import_loglevel3.default.log(`CLIENT RECT: merging two into one, VERTICAL: ${rectsLineUpVertically} HORIZONTAL: ${rectsLineUpHorizontally} (${doNotMergeHorizontallyAlignedRects})`);
|
|
36637
36826
|
const newRects = rects.filter((rect) => {
|
|
36638
36827
|
return rect !== rect1 && rect !== rect2;
|
|
36639
36828
|
});
|
|
@@ -36651,9 +36840,7 @@ function replaceOverlappingRects(rects) {
|
|
|
36651
36840
|
const rect1 = rects[i];
|
|
36652
36841
|
const rect2 = rects[j];
|
|
36653
36842
|
if (rect1 === rect2) {
|
|
36654
|
-
|
|
36655
|
-
console.log("replaceOverlappingRects rect1 === rect2 ??!");
|
|
36656
|
-
}
|
|
36843
|
+
import_loglevel3.default.log("replaceOverlappingRects rect1 === rect2 ??!");
|
|
36657
36844
|
continue;
|
|
36658
36845
|
}
|
|
36659
36846
|
if (rectsTouchOrOverlap(rect1, rect2, -1)) {
|
|
@@ -36677,15 +36864,11 @@ function replaceOverlappingRects(rects) {
|
|
|
36677
36864
|
toPreserve = rect1;
|
|
36678
36865
|
}
|
|
36679
36866
|
}
|
|
36680
|
-
|
|
36681
|
-
|
|
36682
|
-
|
|
36683
|
-
|
|
36684
|
-
|
|
36685
|
-
}
|
|
36686
|
-
if (IS_DEV2) {
|
|
36687
|
-
console.log(`CLIENT RECT: overlap, cut one rect into ${toAdd.length}`);
|
|
36688
|
-
}
|
|
36867
|
+
const toCheck = [];
|
|
36868
|
+
toCheck.push(toPreserve);
|
|
36869
|
+
Array.prototype.push.apply(toCheck, toAdd);
|
|
36870
|
+
checkOverlaps(toCheck);
|
|
36871
|
+
import_loglevel3.default.log(`CLIENT RECT: overlap, cut one rect into ${toAdd.length}`);
|
|
36689
36872
|
const newRects = rects.filter((rect) => {
|
|
36690
36873
|
return rect !== toRemove;
|
|
36691
36874
|
});
|
|
@@ -36707,9 +36890,7 @@ function removeContainedRects(rects, tolerance) {
|
|
|
36707
36890
|
for (const rect of rects) {
|
|
36708
36891
|
const bigEnough = rect.width > 1 && rect.height > 1;
|
|
36709
36892
|
if (!bigEnough) {
|
|
36710
|
-
|
|
36711
|
-
console.log("CLIENT RECT: remove tiny");
|
|
36712
|
-
}
|
|
36893
|
+
import_loglevel3.default.log("CLIENT RECT: remove tiny");
|
|
36713
36894
|
rectsToKeep.delete(rect);
|
|
36714
36895
|
continue;
|
|
36715
36896
|
}
|
|
@@ -36721,9 +36902,7 @@ function removeContainedRects(rects, tolerance) {
|
|
|
36721
36902
|
continue;
|
|
36722
36903
|
}
|
|
36723
36904
|
if (rectContains(possiblyContainingRect, rect, tolerance)) {
|
|
36724
|
-
|
|
36725
|
-
console.log("CLIENT RECT: remove contained");
|
|
36726
|
-
}
|
|
36905
|
+
import_loglevel3.default.log("CLIENT RECT: remove contained");
|
|
36727
36906
|
rectsToKeep.delete(rect);
|
|
36728
36907
|
break;
|
|
36729
36908
|
}
|
|
@@ -36748,46 +36927,38 @@ function checkOverlaps(rects) {
|
|
|
36748
36927
|
if (!has2) {
|
|
36749
36928
|
stillOverlappingRects.push(rect2);
|
|
36750
36929
|
}
|
|
36751
|
-
|
|
36752
|
-
|
|
36753
|
-
|
|
36754
|
-
|
|
36755
|
-
|
|
36756
|
-
|
|
36757
|
-
|
|
36758
|
-
console.log(`yOverlap: ${yOverlap}`);
|
|
36759
|
-
}
|
|
36930
|
+
import_loglevel3.default.log("CLIENT RECT: overlap ---");
|
|
36931
|
+
import_loglevel3.default.log(`#1 TOP:${rect1.top} BOTTOM:${rect1.bottom} LEFT:${rect1.left} RIGHT:${rect1.right} WIDTH:${rect1.width} HEIGHT:${rect1.height}`);
|
|
36932
|
+
import_loglevel3.default.log(`#2 TOP:${rect2.top} BOTTOM:${rect2.bottom} LEFT:${rect2.left} RIGHT:${rect2.right} WIDTH:${rect2.width} HEIGHT:${rect2.height}`);
|
|
36933
|
+
const xOverlap = getRectOverlapX(rect1, rect2);
|
|
36934
|
+
import_loglevel3.default.log(`xOverlap: ${xOverlap}`);
|
|
36935
|
+
const yOverlap = getRectOverlapY(rect1, rect2);
|
|
36936
|
+
import_loglevel3.default.log(`yOverlap: ${yOverlap}`);
|
|
36760
36937
|
}
|
|
36761
36938
|
}
|
|
36762
36939
|
}
|
|
36763
36940
|
}
|
|
36764
36941
|
if (stillOverlappingRects.length) {
|
|
36765
|
-
|
|
36766
|
-
console.log(`CLIENT RECT: overlaps ${stillOverlappingRects.length}`);
|
|
36767
|
-
}
|
|
36942
|
+
import_loglevel3.default.log(`CLIENT RECT: overlaps ${stillOverlappingRects.length}`);
|
|
36768
36943
|
}
|
|
36769
36944
|
}
|
|
36770
36945
|
|
|
36771
36946
|
// src/modules/highlight/renderer/iframe/selection.ts
|
|
36772
36947
|
init_polyfills();
|
|
36773
|
-
var
|
|
36948
|
+
var import_loglevel4 = __toModule(require_loglevel());
|
|
36774
36949
|
function getCurrentSelectionInfo(win, getCssSelector) {
|
|
36775
36950
|
const selection = win ? win.getSelection() : null;
|
|
36776
36951
|
if (!selection) {
|
|
36777
36952
|
return void 0;
|
|
36778
36953
|
}
|
|
36779
36954
|
if (selection.isCollapsed) {
|
|
36780
|
-
|
|
36781
|
-
console.log("^^^ SELECTION COLLAPSED.");
|
|
36782
|
-
}
|
|
36955
|
+
import_loglevel4.default.log("^^^ SELECTION COLLAPSED.");
|
|
36783
36956
|
return void 0;
|
|
36784
36957
|
}
|
|
36785
36958
|
const rawText = selection.toString();
|
|
36786
36959
|
const cleanText = rawText.trim().replace(/\n/g, " ").replace(/\s\s+/g, " ");
|
|
36787
36960
|
if (cleanText.length === 0) {
|
|
36788
|
-
|
|
36789
|
-
console.log("^^^ SELECTION TEXT EMPTY.");
|
|
36790
|
-
}
|
|
36961
|
+
import_loglevel4.default.log("^^^ SELECTION TEXT EMPTY.");
|
|
36791
36962
|
return void 0;
|
|
36792
36963
|
}
|
|
36793
36964
|
if (!selection.anchorNode || !selection.focusNode) {
|
|
@@ -36795,45 +36966,31 @@ function getCurrentSelectionInfo(win, getCssSelector) {
|
|
|
36795
36966
|
}
|
|
36796
36967
|
const r = selection.rangeCount === 1 ? selection.getRangeAt(0) : createOrderedRange(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
|
|
36797
36968
|
if (!r || r.collapsed) {
|
|
36798
|
-
|
|
36799
|
-
console.log("$$$$$$$$$$$$$$$$$ CANNOT GET NON-COLLAPSED SELECTION RANGE?!");
|
|
36800
|
-
}
|
|
36969
|
+
import_loglevel4.default.log("$$$$$$$$$$$$$$$$$ CANNOT GET NON-COLLAPSED SELECTION RANGE?!");
|
|
36801
36970
|
return void 0;
|
|
36802
36971
|
}
|
|
36803
36972
|
const range = normalizeRange(r);
|
|
36804
|
-
if (
|
|
36805
|
-
|
|
36806
|
-
|
|
36807
|
-
|
|
36808
|
-
|
|
36809
|
-
|
|
36810
|
-
|
|
36811
|
-
}
|
|
36812
|
-
|
|
36813
|
-
|
|
36814
|
-
|
|
36815
|
-
|
|
36816
|
-
|
|
36817
|
-
|
|
36818
|
-
|
|
36819
|
-
|
|
36820
|
-
|
|
36821
|
-
console.log(range.endContainer);
|
|
36822
|
-
console.log(r.endContainer);
|
|
36823
|
-
}
|
|
36824
|
-
}
|
|
36825
|
-
if (range.endOffset !== r.endOffset) {
|
|
36826
|
-
if (IS_DEV3) {
|
|
36827
|
-
console.log(">>>>>>>>>>>>>>>>>>>>>>> SELECTION RANGE NORMALIZE diff: endOffset");
|
|
36828
|
-
console.log(`${range.endOffset} !== ${r.endOffset}`);
|
|
36829
|
-
}
|
|
36830
|
-
}
|
|
36973
|
+
if (range.startContainer !== r.startContainer) {
|
|
36974
|
+
import_loglevel4.default.log(">>>>>>>>>>>>>>>>>>>>>>> SELECTION RANGE NORMALIZE diff: startContainer");
|
|
36975
|
+
import_loglevel4.default.log(range.startContainer);
|
|
36976
|
+
import_loglevel4.default.log(r.startContainer);
|
|
36977
|
+
}
|
|
36978
|
+
if (range.startOffset !== r.startOffset) {
|
|
36979
|
+
import_loglevel4.default.log(">>>>>>>>>>>>>>>>>>>>>>> SELECTION RANGE NORMALIZE diff: startOffset");
|
|
36980
|
+
import_loglevel4.default.log(`${range.startOffset} !== ${r.startOffset}`);
|
|
36981
|
+
}
|
|
36982
|
+
if (range.endContainer !== r.endContainer) {
|
|
36983
|
+
import_loglevel4.default.log(">>>>>>>>>>>>>>>>>>>>>>> SELECTION RANGE NORMALIZE diff: endContainer");
|
|
36984
|
+
import_loglevel4.default.log(range.endContainer);
|
|
36985
|
+
import_loglevel4.default.log(r.endContainer);
|
|
36986
|
+
}
|
|
36987
|
+
if (range.endOffset !== r.endOffset) {
|
|
36988
|
+
import_loglevel4.default.log(">>>>>>>>>>>>>>>>>>>>>>> SELECTION RANGE NORMALIZE diff: endOffset");
|
|
36989
|
+
import_loglevel4.default.log(`${range.endOffset} !== ${r.endOffset}`);
|
|
36831
36990
|
}
|
|
36832
36991
|
const rangeInfo = convertRange(range, getCssSelector);
|
|
36833
36992
|
if (!rangeInfo) {
|
|
36834
|
-
|
|
36835
|
-
console.log("^^^ SELECTION RANGE INFO FAIL?!");
|
|
36836
|
-
}
|
|
36993
|
+
import_loglevel4.default.log("^^^ SELECTION RANGE INFO FAIL?!");
|
|
36837
36994
|
return void 0;
|
|
36838
36995
|
}
|
|
36839
36996
|
return { rangeInfo, cleanText, rawText, range };
|
|
@@ -36844,26 +37001,18 @@ function createOrderedRange(startNode, startOffset, endNode, endOffset) {
|
|
|
36844
37001
|
range.setStart(startNode, startOffset);
|
|
36845
37002
|
range.setEnd(endNode, endOffset);
|
|
36846
37003
|
if (!range.collapsed) {
|
|
36847
|
-
|
|
36848
|
-
console.log(">>> createOrderedRange RANGE OK");
|
|
36849
|
-
}
|
|
37004
|
+
import_loglevel4.default.log(">>> createOrderedRange RANGE OK");
|
|
36850
37005
|
return range;
|
|
36851
37006
|
}
|
|
36852
|
-
|
|
36853
|
-
console.log(">>> createOrderedRange COLLAPSED ... RANGE REVERSE?");
|
|
36854
|
-
}
|
|
37007
|
+
import_loglevel4.default.log(">>> createOrderedRange COLLAPSED ... RANGE REVERSE?");
|
|
36855
37008
|
const rangeReverse = new Range();
|
|
36856
37009
|
rangeReverse.setStart(endNode, endOffset);
|
|
36857
37010
|
rangeReverse.setEnd(startNode, startOffset);
|
|
36858
37011
|
if (!rangeReverse.collapsed) {
|
|
36859
|
-
|
|
36860
|
-
console.log(">>> createOrderedRange RANGE REVERSE OK.");
|
|
36861
|
-
}
|
|
37012
|
+
import_loglevel4.default.log(">>> createOrderedRange RANGE REVERSE OK.");
|
|
36862
37013
|
return range;
|
|
36863
37014
|
}
|
|
36864
|
-
|
|
36865
|
-
console.log(">>> createOrderedRange RANGE REVERSE ALSO COLLAPSED?!");
|
|
36866
|
-
}
|
|
37015
|
+
import_loglevel4.default.log(">>> createOrderedRange RANGE REVERSE ALSO COLLAPSED?!");
|
|
36867
37016
|
return void 0;
|
|
36868
37017
|
} catch (err) {
|
|
36869
37018
|
console.warn(err.message);
|
|
@@ -36893,20 +37042,16 @@ function convertRange(range, getCssSelector) {
|
|
|
36893
37042
|
const endContainerElementCssSelector = getCssSelector(endContainerElement);
|
|
36894
37043
|
const commonElementAncestor = getCommonAncestorElement(range.startContainer, range.endContainer);
|
|
36895
37044
|
if (!commonElementAncestor) {
|
|
36896
|
-
|
|
36897
|
-
console.log("^^^ NO RANGE COMMON ANCESTOR?!");
|
|
36898
|
-
}
|
|
37045
|
+
import_loglevel4.default.log("^^^ NO RANGE COMMON ANCESTOR?!");
|
|
36899
37046
|
return void 0;
|
|
36900
37047
|
}
|
|
36901
37048
|
if (range.commonAncestorContainer) {
|
|
36902
37049
|
const rangeCommonAncestorElement = range.commonAncestorContainer.nodeType === Node.ELEMENT_NODE ? range.commonAncestorContainer : range.commonAncestorContainer.parentNode;
|
|
36903
37050
|
if (rangeCommonAncestorElement && rangeCommonAncestorElement.nodeType === Node.ELEMENT_NODE) {
|
|
36904
37051
|
if (commonElementAncestor !== rangeCommonAncestorElement) {
|
|
36905
|
-
|
|
36906
|
-
|
|
36907
|
-
|
|
36908
|
-
console.log(getCssSelector(rangeCommonAncestorElement));
|
|
36909
|
-
}
|
|
37052
|
+
import_loglevel4.default.log(">>>>>> COMMON ANCESTOR CONTAINER DIFF??!");
|
|
37053
|
+
import_loglevel4.default.log(getCssSelector(commonElementAncestor));
|
|
37054
|
+
import_loglevel4.default.log(getCssSelector(rangeCommonAncestorElement));
|
|
36910
37055
|
}
|
|
36911
37056
|
}
|
|
36912
37057
|
}
|
|
@@ -36926,47 +37071,35 @@ function convertRange(range, getCssSelector) {
|
|
|
36926
37071
|
function convertRangeInfo(documant, rangeInfo) {
|
|
36927
37072
|
const startElement = documant.querySelector(rangeInfo.startContainerElementCssSelector);
|
|
36928
37073
|
if (!startElement) {
|
|
36929
|
-
|
|
36930
|
-
console.log("^^^ convertRangeInfo NO START ELEMENT CSS SELECTOR?!");
|
|
36931
|
-
}
|
|
37074
|
+
import_loglevel4.default.log("^^^ convertRangeInfo NO START ELEMENT CSS SELECTOR?!");
|
|
36932
37075
|
return void 0;
|
|
36933
37076
|
}
|
|
36934
37077
|
let startContainer = startElement;
|
|
36935
37078
|
if (rangeInfo.startContainerChildTextNodeIndex >= 0) {
|
|
36936
37079
|
if (rangeInfo.startContainerChildTextNodeIndex >= startElement.childNodes.length) {
|
|
36937
|
-
|
|
36938
|
-
console.log("^^^ convertRangeInfo rangeInfo.startContainerChildTextNodeIndex >= startElement.childNodes.length?!");
|
|
36939
|
-
}
|
|
37080
|
+
import_loglevel4.default.log("^^^ convertRangeInfo rangeInfo.startContainerChildTextNodeIndex >= startElement.childNodes.length?!");
|
|
36940
37081
|
return void 0;
|
|
36941
37082
|
}
|
|
36942
37083
|
startContainer = startElement.childNodes[rangeInfo.startContainerChildTextNodeIndex];
|
|
36943
37084
|
if (startContainer.nodeType !== Node.TEXT_NODE) {
|
|
36944
|
-
|
|
36945
|
-
console.log("^^^ convertRangeInfo startContainer.nodeType !== Node.TEXT_NODE?!");
|
|
36946
|
-
}
|
|
37085
|
+
import_loglevel4.default.log("^^^ convertRangeInfo startContainer.nodeType !== Node.TEXT_NODE?!");
|
|
36947
37086
|
return void 0;
|
|
36948
37087
|
}
|
|
36949
37088
|
}
|
|
36950
37089
|
const endElement = documant.querySelector(rangeInfo.endContainerElementCssSelector);
|
|
36951
37090
|
if (!endElement) {
|
|
36952
|
-
|
|
36953
|
-
console.log("^^^ convertRangeInfo NO END ELEMENT CSS SELECTOR?!");
|
|
36954
|
-
}
|
|
37091
|
+
import_loglevel4.default.log("^^^ convertRangeInfo NO END ELEMENT CSS SELECTOR?!");
|
|
36955
37092
|
return void 0;
|
|
36956
37093
|
}
|
|
36957
37094
|
let endContainer = endElement;
|
|
36958
37095
|
if (rangeInfo.endContainerChildTextNodeIndex >= 0) {
|
|
36959
37096
|
if (rangeInfo.endContainerChildTextNodeIndex >= endElement.childNodes.length) {
|
|
36960
|
-
|
|
36961
|
-
console.log("^^^ convertRangeInfo rangeInfo.endContainerChildTextNodeIndex >= endElement.childNodes.length?!");
|
|
36962
|
-
}
|
|
37097
|
+
import_loglevel4.default.log("^^^ convertRangeInfo rangeInfo.endContainerChildTextNodeIndex >= endElement.childNodes.length?!");
|
|
36963
37098
|
return void 0;
|
|
36964
37099
|
}
|
|
36965
37100
|
endContainer = endElement.childNodes[rangeInfo.endContainerChildTextNodeIndex];
|
|
36966
37101
|
if (endContainer.nodeType !== Node.TEXT_NODE) {
|
|
36967
|
-
|
|
36968
|
-
console.log("^^^ convertRangeInfo endContainer.nodeType !== Node.TEXT_NODE?!");
|
|
36969
|
-
}
|
|
37102
|
+
import_loglevel4.default.log("^^^ convertRangeInfo endContainer.nodeType !== Node.TEXT_NODE?!");
|
|
36970
37103
|
return void 0;
|
|
36971
37104
|
}
|
|
36972
37105
|
}
|
|
@@ -37373,6 +37506,7 @@ var icons = {
|
|
|
37373
37506
|
|
|
37374
37507
|
// src/modules/highlight/TextHighlighter.ts
|
|
37375
37508
|
var lodash = __toModule(require_lodash());
|
|
37509
|
+
var import_loglevel5 = __toModule(require_loglevel());
|
|
37376
37510
|
var HighlightContainer;
|
|
37377
37511
|
(function(HighlightContainer2) {
|
|
37378
37512
|
HighlightContainer2["R2_ID_HIGHLIGHTS_CONTAINER"] = "R2_ID_HIGHLIGHTS_CONTAINER";
|
|
@@ -38150,9 +38284,7 @@ var TextHighlighter = class {
|
|
|
38150
38284
|
anno.highlight.note = prompt("Add your note here:");
|
|
38151
38285
|
}
|
|
38152
38286
|
self3.delegate.annotationModule?.updateAnnotation(anno).then(async () => {
|
|
38153
|
-
|
|
38154
|
-
console.log("update highlight " + anno.id);
|
|
38155
|
-
}
|
|
38287
|
+
import_loglevel5.default.log("update highlight " + anno.id);
|
|
38156
38288
|
});
|
|
38157
38289
|
}
|
|
38158
38290
|
});
|
|
@@ -38339,11 +38471,9 @@ var TextHighlighter = class {
|
|
|
38339
38471
|
range.detach();
|
|
38340
38472
|
return rect;
|
|
38341
38473
|
} catch (error) {
|
|
38342
|
-
|
|
38343
|
-
|
|
38344
|
-
|
|
38345
|
-
console.log(node.textContent);
|
|
38346
|
-
}
|
|
38474
|
+
import_loglevel5.default.log("measureTextNode " + error);
|
|
38475
|
+
import_loglevel5.default.log("measureTextNode " + node);
|
|
38476
|
+
import_loglevel5.default.log(`${node.textContent}`);
|
|
38347
38477
|
}
|
|
38348
38478
|
};
|
|
38349
38479
|
const body = findRequiredIframeElement(doc, "body");
|
|
@@ -38795,9 +38925,7 @@ var TextHighlighter = class {
|
|
|
38795
38925
|
const payload = {
|
|
38796
38926
|
highlight: foundHighlight
|
|
38797
38927
|
};
|
|
38798
|
-
|
|
38799
|
-
console.log(payload);
|
|
38800
|
-
}
|
|
38928
|
+
import_loglevel5.default.log(JSON.stringify(payload));
|
|
38801
38929
|
let self2 = this;
|
|
38802
38930
|
let anno;
|
|
38803
38931
|
if (self2.delegate.rights.enableAnnotations) {
|
|
@@ -38810,9 +38938,7 @@ var TextHighlighter = class {
|
|
|
38810
38938
|
});
|
|
38811
38939
|
}
|
|
38812
38940
|
if (anno?.id) {
|
|
38813
|
-
|
|
38814
|
-
console.log("selected highlight " + anno.id);
|
|
38815
|
-
}
|
|
38941
|
+
import_loglevel5.default.log("selected highlight " + anno.id);
|
|
38816
38942
|
self2.lastSelectedHighlight = anno.id;
|
|
38817
38943
|
let toolbox = document.getElementById("highlight-toolbox");
|
|
38818
38944
|
if (toolbox) {
|
|
@@ -38822,9 +38948,7 @@ var TextHighlighter = class {
|
|
|
38822
38948
|
let noteH = function() {
|
|
38823
38949
|
anno.highlight.note = prompt("Add your note here:");
|
|
38824
38950
|
self2.delegate.annotationModule?.updateAnnotation(anno).then(async () => {
|
|
38825
|
-
|
|
38826
|
-
console.log("update highlight " + anno.id);
|
|
38827
|
-
}
|
|
38951
|
+
import_loglevel5.default.log("update highlight " + anno.id);
|
|
38828
38952
|
if (toolbox) {
|
|
38829
38953
|
toolbox.style.display = "none";
|
|
38830
38954
|
}
|
|
@@ -38838,9 +38962,7 @@ var TextHighlighter = class {
|
|
|
38838
38962
|
}, deleteH = function() {
|
|
38839
38963
|
if (self2.delegate.rights.enableAnnotations) {
|
|
38840
38964
|
self2.delegate.annotationModule?.deleteSelectedHighlight(anno).then(async () => {
|
|
38841
|
-
|
|
38842
|
-
console.log("delete highlight " + anno.id);
|
|
38843
|
-
}
|
|
38965
|
+
import_loglevel5.default.log("delete highlight " + anno.id);
|
|
38844
38966
|
if (toolbox) {
|
|
38845
38967
|
toolbox.style.display = "none";
|
|
38846
38968
|
}
|
|
@@ -38848,9 +38970,7 @@ var TextHighlighter = class {
|
|
|
38848
38970
|
});
|
|
38849
38971
|
} else if (self2.delegate.rights.enableBookmarks) {
|
|
38850
38972
|
self2.delegate.bookmarkModule?.deleteSelectedHighlight(anno).then(async () => {
|
|
38851
|
-
|
|
38852
|
-
console.log("delete highlight " + anno.id);
|
|
38853
|
-
}
|
|
38973
|
+
import_loglevel5.default.log("delete highlight " + anno.id);
|
|
38854
38974
|
if (toolbox) {
|
|
38855
38975
|
toolbox.style.display = "none";
|
|
38856
38976
|
}
|
|
@@ -38919,7 +39039,7 @@ var TextHighlighter = class {
|
|
|
38919
39039
|
popup.showPopup(foundElement.dataset.definition, ev);
|
|
38920
39040
|
}
|
|
38921
39041
|
let result = this.delegate.definitionsModule?.properties?.definitions?.filter((el) => el.order === Number(foundElement?.dataset.order))[0];
|
|
38922
|
-
|
|
39042
|
+
import_loglevel5.default.log(result);
|
|
38923
39043
|
if (this.delegate.definitionsModule?.api?.click) {
|
|
38924
39044
|
this.delegate.definitionsModule.api?.click(lodash.omit(result, "callbacks"), lodash.omit(foundHighlight, "definition"));
|
|
38925
39045
|
this.delegate.emit("definition.click", result, foundHighlight);
|
|
@@ -39289,9 +39409,7 @@ var TextHighlighter = class {
|
|
|
39289
39409
|
} else if (self2.delegate.rights.enableBookmarks) {
|
|
39290
39410
|
anno = await self2.delegate.bookmarkModule?.getAnnotationByID(highlight.id);
|
|
39291
39411
|
}
|
|
39292
|
-
|
|
39293
|
-
console.log("selected highlight " + anno.id);
|
|
39294
|
-
}
|
|
39412
|
+
import_loglevel5.default.log("selected highlight " + anno.id);
|
|
39295
39413
|
self2.lastSelectedHighlight = anno.id;
|
|
39296
39414
|
let toolbox = document.getElementById("highlight-toolbox");
|
|
39297
39415
|
if (toolbox) {
|
|
@@ -39301,9 +39419,7 @@ var TextHighlighter = class {
|
|
|
39301
39419
|
let noteH = function() {
|
|
39302
39420
|
anno.highlight.note = prompt("Add your note here:");
|
|
39303
39421
|
self2.delegate.annotationModule?.updateAnnotation(anno).then(async () => {
|
|
39304
|
-
|
|
39305
|
-
console.log("update highlight " + anno.id);
|
|
39306
|
-
}
|
|
39422
|
+
import_loglevel5.default.log("update highlight " + anno.id);
|
|
39307
39423
|
toolbox.style.display = "none";
|
|
39308
39424
|
self2.selectionMenuClosed();
|
|
39309
39425
|
});
|
|
@@ -39312,17 +39428,13 @@ var TextHighlighter = class {
|
|
|
39312
39428
|
}, deleteH = function() {
|
|
39313
39429
|
if (self2.delegate.rights.enableAnnotations) {
|
|
39314
39430
|
self2.delegate.annotationModule?.deleteSelectedHighlight(anno).then(async () => {
|
|
39315
|
-
|
|
39316
|
-
console.log("delete highlight " + anno.id);
|
|
39317
|
-
}
|
|
39431
|
+
import_loglevel5.default.log("delete highlight " + anno.id);
|
|
39318
39432
|
toolbox.style.display = "none";
|
|
39319
39433
|
self2.selectionMenuClosed();
|
|
39320
39434
|
});
|
|
39321
39435
|
} else if (self2.delegate.rights.enableBookmarks) {
|
|
39322
39436
|
self2.delegate.bookmarkModule?.deleteSelectedHighlight(anno).then(async () => {
|
|
39323
|
-
|
|
39324
|
-
console.log("delete highlight " + anno.id);
|
|
39325
|
-
}
|
|
39437
|
+
import_loglevel5.default.log("delete highlight " + anno.id);
|
|
39326
39438
|
toolbox.style.display = "none";
|
|
39327
39439
|
self2.selectionMenuClosed();
|
|
39328
39440
|
});
|
|
@@ -39441,6 +39553,7 @@ var import_uuid = __toModule(require_uuid());
|
|
|
39441
39553
|
|
|
39442
39554
|
// src/modules/highlight/common/selection.ts
|
|
39443
39555
|
init_polyfills();
|
|
39556
|
+
var import_loglevel6 = __toModule(require_loglevel());
|
|
39444
39557
|
var _getCssSelectorOptions = {
|
|
39445
39558
|
className: (_str) => {
|
|
39446
39559
|
return true;
|
|
@@ -39455,6 +39568,7 @@ var _getCssSelectorOptions = {
|
|
|
39455
39568
|
|
|
39456
39569
|
// src/modules/AnnotationModule.ts
|
|
39457
39570
|
var lodash2 = __toModule(require_lodash());
|
|
39571
|
+
var import_loglevel7 = __toModule(require_loglevel());
|
|
39458
39572
|
var AnnotationModule = class {
|
|
39459
39573
|
constructor(annotator, rights, publication, delegate, initialAnnotations, properties, highlighter, api, headerMenu) {
|
|
39460
39574
|
this.hide = findElement(document, "#menu-button-hide");
|
|
@@ -39475,9 +39589,7 @@ var AnnotationModule = class {
|
|
|
39475
39589
|
return annotations;
|
|
39476
39590
|
}
|
|
39477
39591
|
async stop() {
|
|
39478
|
-
|
|
39479
|
-
console.log("Annotation module stop");
|
|
39480
|
-
}
|
|
39592
|
+
import_loglevel7.default.log("Annotation module stop");
|
|
39481
39593
|
}
|
|
39482
39594
|
async start() {
|
|
39483
39595
|
this.delegate.annotationModule = this;
|
|
@@ -39560,8 +39672,8 @@ var AnnotationModule = class {
|
|
|
39560
39672
|
return "";
|
|
39561
39673
|
}
|
|
39562
39674
|
} catch (err) {
|
|
39563
|
-
|
|
39564
|
-
|
|
39675
|
+
import_loglevel7.default.log("uniqueCssSelector:");
|
|
39676
|
+
import_loglevel7.default.error(err);
|
|
39565
39677
|
return "";
|
|
39566
39678
|
}
|
|
39567
39679
|
};
|
|
@@ -39582,9 +39694,7 @@ var AnnotationModule = class {
|
|
|
39582
39694
|
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);
|
|
39583
39695
|
if (book) {
|
|
39584
39696
|
this.saveAnnotation(book[0]).then((anno) => {
|
|
39585
|
-
|
|
39586
|
-
console.log("saved bookmark " + anno.id);
|
|
39587
|
-
}
|
|
39697
|
+
import_loglevel7.default.log("saved bookmark " + anno.id);
|
|
39588
39698
|
});
|
|
39589
39699
|
}
|
|
39590
39700
|
}
|
|
@@ -39594,9 +39704,7 @@ var AnnotationModule = class {
|
|
|
39594
39704
|
}
|
|
39595
39705
|
}
|
|
39596
39706
|
async scrollToHighlight(id2) {
|
|
39597
|
-
|
|
39598
|
-
console.log("still need to scroll to " + id2);
|
|
39599
|
-
}
|
|
39707
|
+
import_loglevel7.default.log("still need to scroll to " + id2);
|
|
39600
39708
|
var position = await this.annotator?.getAnnotationPosition(id2, this.delegate.iframes[0].contentWindow);
|
|
39601
39709
|
window.scrollTo(0, position - window.innerHeight / 3);
|
|
39602
39710
|
}
|
|
@@ -39604,10 +39712,8 @@ var AnnotationModule = class {
|
|
|
39604
39712
|
if (this.annotator) {
|
|
39605
39713
|
let deleted = await this.annotator.deleteAnnotation(annotation.id);
|
|
39606
39714
|
let added = await this.addAnnotation(annotation);
|
|
39607
|
-
|
|
39608
|
-
|
|
39609
|
-
console.log("Highlight added " + JSON.stringify(added));
|
|
39610
|
-
}
|
|
39715
|
+
import_loglevel7.default.log("Highlight deleted " + JSON.stringify(deleted));
|
|
39716
|
+
import_loglevel7.default.log("Highlight added " + JSON.stringify(added));
|
|
39611
39717
|
await this.showHighlights();
|
|
39612
39718
|
await this.drawHighlights();
|
|
39613
39719
|
return added;
|
|
@@ -39618,9 +39724,7 @@ var AnnotationModule = class {
|
|
|
39618
39724
|
async deleteLocalHighlight(id2) {
|
|
39619
39725
|
if (this.annotator) {
|
|
39620
39726
|
var deleted = await this.annotator.deleteAnnotation(id2);
|
|
39621
|
-
|
|
39622
|
-
console.log("Highlight deleted " + JSON.stringify(deleted));
|
|
39623
|
-
}
|
|
39727
|
+
import_loglevel7.default.log("Highlight deleted " + JSON.stringify(deleted));
|
|
39624
39728
|
await this.showHighlights();
|
|
39625
39729
|
await this.drawHighlights();
|
|
39626
39730
|
return deleted;
|
|
@@ -39983,23 +40087,17 @@ var AnnotationModule = class {
|
|
|
39983
40087
|
this.delegate.stopReadAloud();
|
|
39984
40088
|
this.delegate.navigate(locator);
|
|
39985
40089
|
} else {
|
|
39986
|
-
|
|
39987
|
-
console.log("annotation data missing: ", event);
|
|
39988
|
-
}
|
|
40090
|
+
import_loglevel7.default.log("annotation data missing: ", event);
|
|
39989
40091
|
}
|
|
39990
40092
|
}
|
|
39991
40093
|
handleAnnotationLinkDeleteClick(type, event, locator) {
|
|
39992
|
-
|
|
39993
|
-
console.log("annotation data locator: ", locator);
|
|
39994
|
-
}
|
|
40094
|
+
import_loglevel7.default.log("annotation data locator: ", locator);
|
|
39995
40095
|
if (locator) {
|
|
39996
40096
|
if (type === AnnotationType.Annotation) {
|
|
39997
40097
|
this.deleteHighlight(locator);
|
|
39998
40098
|
}
|
|
39999
40099
|
} else {
|
|
40000
|
-
|
|
40001
|
-
console.log("annotation data missing: ", event);
|
|
40002
|
-
}
|
|
40100
|
+
import_loglevel7.default.log("annotation data missing: ", event);
|
|
40003
40101
|
}
|
|
40004
40102
|
}
|
|
40005
40103
|
static readableTimestamp(timestamp) {
|
|
@@ -40017,6 +40115,7 @@ var AnnotationModule = class {
|
|
|
40017
40115
|
// src/modules/BookmarkModule.ts
|
|
40018
40116
|
init_polyfills();
|
|
40019
40117
|
var import_uuid2 = __toModule(require_uuid());
|
|
40118
|
+
var import_loglevel8 = __toModule(require_loglevel());
|
|
40020
40119
|
var BookmarkModule = class {
|
|
40021
40120
|
static async create(config2) {
|
|
40022
40121
|
const module = new this(config2.annotator, config2.rights || { enableBookmarks: false }, config2.publication, config2.delegate, config2, config2.initialAnnotations, config2.api, config2.headerMenu);
|
|
@@ -40034,9 +40133,7 @@ var BookmarkModule = class {
|
|
|
40034
40133
|
this.api = api;
|
|
40035
40134
|
}
|
|
40036
40135
|
stop() {
|
|
40037
|
-
|
|
40038
|
-
console.log("Bookmark module stop");
|
|
40039
|
-
}
|
|
40136
|
+
import_loglevel8.default.log("Bookmark module stop");
|
|
40040
40137
|
}
|
|
40041
40138
|
async start() {
|
|
40042
40139
|
this.delegate.bookmarkModule = this;
|
|
@@ -40086,17 +40183,13 @@ var BookmarkModule = class {
|
|
|
40086
40183
|
if (this.api?.deleteBookmark) {
|
|
40087
40184
|
await this.api?.deleteBookmark(bookmark);
|
|
40088
40185
|
let deleted = await this.annotator.deleteBookmark(bookmark);
|
|
40089
|
-
|
|
40090
|
-
console.log("Bookmark deleted " + JSON.stringify(deleted));
|
|
40091
|
-
}
|
|
40186
|
+
import_loglevel8.default.log("Bookmark deleted " + JSON.stringify(deleted));
|
|
40092
40187
|
await this.showBookmarks();
|
|
40093
40188
|
await this.drawBookmarks();
|
|
40094
40189
|
return deleted;
|
|
40095
40190
|
} else {
|
|
40096
40191
|
let deleted = await this.annotator.deleteBookmark(bookmark);
|
|
40097
|
-
|
|
40098
|
-
console.log("Bookmark deleted " + JSON.stringify(deleted));
|
|
40099
|
-
}
|
|
40192
|
+
import_loglevel8.default.log("Bookmark deleted " + JSON.stringify(deleted));
|
|
40100
40193
|
await this.showBookmarks();
|
|
40101
40194
|
await this.drawBookmarks();
|
|
40102
40195
|
return deleted;
|
|
@@ -40153,20 +40246,15 @@ var BookmarkModule = class {
|
|
|
40153
40246
|
if (result) {
|
|
40154
40247
|
bookmark = result;
|
|
40155
40248
|
}
|
|
40156
|
-
|
|
40157
|
-
console.log(bookmark);
|
|
40249
|
+
import_loglevel8.default.log(bookmark);
|
|
40158
40250
|
let saved = this.annotator.saveBookmark(bookmark);
|
|
40159
|
-
|
|
40160
|
-
console.log("Bookmark added " + JSON.stringify(saved));
|
|
40161
|
-
}
|
|
40251
|
+
import_loglevel8.default.log("Bookmark added " + JSON.stringify(saved));
|
|
40162
40252
|
this.showBookmarks();
|
|
40163
40253
|
await this.drawBookmarks();
|
|
40164
40254
|
return saved;
|
|
40165
40255
|
} else {
|
|
40166
40256
|
let saved = this.annotator.saveBookmark(bookmark);
|
|
40167
|
-
|
|
40168
|
-
console.log("Bookmark added " + JSON.stringify(saved));
|
|
40169
|
-
}
|
|
40257
|
+
import_loglevel8.default.log("Bookmark added " + JSON.stringify(saved));
|
|
40170
40258
|
this.showBookmarks();
|
|
40171
40259
|
await this.drawBookmarks();
|
|
40172
40260
|
return saved;
|
|
@@ -40262,9 +40350,7 @@ var BookmarkModule = class {
|
|
|
40262
40350
|
this.delegate.iframes[0].contentDocument?.getSelection()?.removeAllRanges();
|
|
40263
40351
|
if (book) {
|
|
40264
40352
|
return this.saveAnnotation(book[0]).then((anno) => {
|
|
40265
|
-
|
|
40266
|
-
console.log("saved bookmark " + anno?.id);
|
|
40267
|
-
}
|
|
40353
|
+
import_loglevel8.default.log("saved bookmark " + anno?.id);
|
|
40268
40354
|
});
|
|
40269
40355
|
}
|
|
40270
40356
|
}
|
|
@@ -40442,9 +40528,7 @@ var BookmarkModule = class {
|
|
|
40442
40528
|
async deleteLocalHighlight(id2) {
|
|
40443
40529
|
if (this.annotator) {
|
|
40444
40530
|
var deleted = await this.annotator.deleteAnnotation(id2);
|
|
40445
|
-
|
|
40446
|
-
console.log("Highlight deleted " + JSON.stringify(deleted));
|
|
40447
|
-
}
|
|
40531
|
+
import_loglevel8.default.log("Highlight deleted " + JSON.stringify(deleted));
|
|
40448
40532
|
await this.showBookmarks();
|
|
40449
40533
|
await this.drawBookmarks();
|
|
40450
40534
|
return deleted;
|
|
@@ -40554,23 +40638,17 @@ var BookmarkModule = class {
|
|
|
40554
40638
|
this.delegate.stopReadAloud();
|
|
40555
40639
|
this.delegate.navigate(locator);
|
|
40556
40640
|
} else {
|
|
40557
|
-
|
|
40558
|
-
console.log("bookmark data missing: ", event);
|
|
40559
|
-
}
|
|
40641
|
+
import_loglevel8.default.log("bookmark data missing: ", event);
|
|
40560
40642
|
}
|
|
40561
40643
|
}
|
|
40562
40644
|
handleAnnotationLinkDeleteClick(type, event, locator) {
|
|
40563
|
-
|
|
40564
|
-
console.log("bookmark data locator: ", locator);
|
|
40565
|
-
}
|
|
40645
|
+
import_loglevel8.default.log("bookmark data locator: ", locator);
|
|
40566
40646
|
if (locator) {
|
|
40567
40647
|
if (type === AnnotationType.Bookmark) {
|
|
40568
40648
|
this.deleteBookmark(locator);
|
|
40569
40649
|
}
|
|
40570
40650
|
} else {
|
|
40571
|
-
|
|
40572
|
-
console.log("bookmark data missing: ", event);
|
|
40573
|
-
}
|
|
40651
|
+
import_loglevel8.default.log("bookmark data missing: ", event);
|
|
40574
40652
|
}
|
|
40575
40653
|
}
|
|
40576
40654
|
static readableTimestamp(timestamp) {
|
|
@@ -40591,6 +40669,7 @@ var import_media_overlay = __toModule(require_media_overlay());
|
|
|
40591
40669
|
|
|
40592
40670
|
// src/modules/mediaoverlays/MediaOverlaySettings.ts
|
|
40593
40671
|
init_polyfills();
|
|
40672
|
+
var import_loglevel9 = __toModule(require_loglevel());
|
|
40594
40673
|
var R2_MO_CLASS_ACTIVE = "r2-mo-active";
|
|
40595
40674
|
var _MEDIAOVERLAYREFS = class {
|
|
40596
40675
|
};
|
|
@@ -40622,7 +40701,7 @@ var MediaOverlaySettings = class {
|
|
|
40622
40701
|
this.api = api;
|
|
40623
40702
|
this.headerMenu = headerMenu;
|
|
40624
40703
|
this.initialise();
|
|
40625
|
-
|
|
40704
|
+
import_loglevel9.default.log(this.api);
|
|
40626
40705
|
}
|
|
40627
40706
|
static create(config2) {
|
|
40628
40707
|
const settings = new this(config2.store, config2.api, config2.headerMenu);
|
|
@@ -40630,42 +40709,34 @@ var MediaOverlaySettings = class {
|
|
|
40630
40709
|
let initialSettings = config2.initialMediaOverlaySettings;
|
|
40631
40710
|
if (initialSettings?.color) {
|
|
40632
40711
|
settings.color = initialSettings.color;
|
|
40633
|
-
|
|
40634
|
-
console.log(settings.color);
|
|
40712
|
+
import_loglevel9.default.log(settings.color);
|
|
40635
40713
|
}
|
|
40636
40714
|
if (initialSettings?.autoScroll) {
|
|
40637
40715
|
settings.autoScroll = initialSettings.autoScroll;
|
|
40638
|
-
|
|
40639
|
-
console.log(settings.autoScroll);
|
|
40716
|
+
import_loglevel9.default.log(settings.autoScroll);
|
|
40640
40717
|
}
|
|
40641
40718
|
if (initialSettings?.autoTurn) {
|
|
40642
40719
|
settings.autoTurn = initialSettings.autoTurn;
|
|
40643
|
-
|
|
40644
|
-
console.log(settings.autoTurn);
|
|
40720
|
+
import_loglevel9.default.log(settings.autoScroll);
|
|
40645
40721
|
}
|
|
40646
40722
|
if (initialSettings?.volume) {
|
|
40647
40723
|
settings.volume = initialSettings.volume;
|
|
40648
|
-
|
|
40649
|
-
console.log(settings.volume);
|
|
40724
|
+
import_loglevel9.default.log(settings.volume);
|
|
40650
40725
|
}
|
|
40651
40726
|
if (initialSettings?.rate) {
|
|
40652
40727
|
settings.rate = initialSettings.rate;
|
|
40653
|
-
|
|
40654
|
-
console.log(settings.rate);
|
|
40728
|
+
import_loglevel9.default.log(settings.rate);
|
|
40655
40729
|
}
|
|
40656
40730
|
if (initialSettings?.wait) {
|
|
40657
40731
|
settings.wait = initialSettings.wait;
|
|
40658
|
-
|
|
40659
|
-
console.log(settings.wait);
|
|
40732
|
+
import_loglevel9.default.log(settings.wait);
|
|
40660
40733
|
}
|
|
40661
40734
|
}
|
|
40662
40735
|
settings.initializeSelections();
|
|
40663
40736
|
return settings;
|
|
40664
40737
|
}
|
|
40665
40738
|
stop() {
|
|
40666
|
-
|
|
40667
|
-
console.log("MediaOverlay settings stop");
|
|
40668
|
-
}
|
|
40739
|
+
import_loglevel9.default.log("MediaOverlay settings stop");
|
|
40669
40740
|
}
|
|
40670
40741
|
initialise() {
|
|
40671
40742
|
this.autoScroll = this.getProperty(MEDIAOVERLAYREFS.AUTO_SCROLL_KEY) != null ? this.getProperty(MEDIAOVERLAYREFS.AUTO_SCROLL_KEY).value : this.autoScroll;
|
|
@@ -40731,9 +40802,7 @@ var MediaOverlaySettings = class {
|
|
|
40731
40802
|
this.applyMediaOverlaySettings(syncSettings);
|
|
40732
40803
|
if (this.api?.updateSettings) {
|
|
40733
40804
|
this.api?.updateSettings(syncSettings).then(async (settings) => {
|
|
40734
|
-
|
|
40735
|
-
console.log("api updated sync settings", settings);
|
|
40736
|
-
}
|
|
40805
|
+
import_loglevel9.default.log("api updated sync settings", settings);
|
|
40737
40806
|
});
|
|
40738
40807
|
}
|
|
40739
40808
|
}
|
|
@@ -40788,8 +40857,7 @@ var MediaOverlaySettings = class {
|
|
|
40788
40857
|
this.settingsChangeCallback();
|
|
40789
40858
|
}
|
|
40790
40859
|
if (mediaOverlaySettings.autoScroll !== void 0) {
|
|
40791
|
-
|
|
40792
|
-
console.log("autoScroll " + this.autoScroll);
|
|
40860
|
+
import_loglevel9.default.log("autoScroll " + this.autoScroll);
|
|
40793
40861
|
this.autoScroll = mediaOverlaySettings.autoScroll;
|
|
40794
40862
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.AUTO_SCROLL_REF);
|
|
40795
40863
|
if (prop) {
|
|
@@ -40799,8 +40867,7 @@ var MediaOverlaySettings = class {
|
|
|
40799
40867
|
this.settingsChangeCallback();
|
|
40800
40868
|
}
|
|
40801
40869
|
if (mediaOverlaySettings.autoTurn !== void 0) {
|
|
40802
|
-
|
|
40803
|
-
console.log("autoTurn " + this.autoTurn);
|
|
40870
|
+
import_loglevel9.default.log("autoTurn " + this.autoTurn);
|
|
40804
40871
|
this.autoTurn = mediaOverlaySettings.autoTurn;
|
|
40805
40872
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.AUTO_TURN_REF);
|
|
40806
40873
|
if (prop) {
|
|
@@ -40810,8 +40877,7 @@ var MediaOverlaySettings = class {
|
|
|
40810
40877
|
this.settingsChangeCallback();
|
|
40811
40878
|
}
|
|
40812
40879
|
if (mediaOverlaySettings.volume) {
|
|
40813
|
-
|
|
40814
|
-
console.log("volume " + this.volume);
|
|
40880
|
+
import_loglevel9.default.log("volume " + this.volume);
|
|
40815
40881
|
this.volume = mediaOverlaySettings.volume;
|
|
40816
40882
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.VOLUME_REF);
|
|
40817
40883
|
if (prop) {
|
|
@@ -40821,8 +40887,7 @@ var MediaOverlaySettings = class {
|
|
|
40821
40887
|
this.settingsChangeCallback();
|
|
40822
40888
|
}
|
|
40823
40889
|
if (mediaOverlaySettings.rate) {
|
|
40824
|
-
|
|
40825
|
-
console.log("rate " + this.rate);
|
|
40890
|
+
import_loglevel9.default.log("rate " + this.rate);
|
|
40826
40891
|
this.rate = mediaOverlaySettings.rate;
|
|
40827
40892
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.RATE_REF);
|
|
40828
40893
|
if (prop) {
|
|
@@ -40900,6 +40965,7 @@ var MediaOverlaySettings = class {
|
|
|
40900
40965
|
};
|
|
40901
40966
|
|
|
40902
40967
|
// src/modules/mediaoverlays/MediaOverlayModule.ts
|
|
40968
|
+
var import_loglevel10 = __toModule(require_loglevel());
|
|
40903
40969
|
var MediaOverlayModule = class {
|
|
40904
40970
|
constructor(delegate, publication, settings, properties) {
|
|
40905
40971
|
this.play = findElement(document, "#menu-button-play");
|
|
@@ -40908,8 +40974,7 @@ var MediaOverlayModule = class {
|
|
|
40908
40974
|
this.pid = void 0;
|
|
40909
40975
|
this.__ontimeupdate = false;
|
|
40910
40976
|
this.ontimeupdate = async (_v) => {
|
|
40911
|
-
|
|
40912
|
-
console.log("ontimeupdate");
|
|
40977
|
+
import_loglevel10.default.log("ontimeupdate");
|
|
40913
40978
|
this.trackCurrentTime();
|
|
40914
40979
|
};
|
|
40915
40980
|
this.ensureOnTimeUpdate = (remove, replace) => {
|
|
@@ -40942,13 +41007,11 @@ var MediaOverlayModule = class {
|
|
|
40942
41007
|
return mediaOverlay;
|
|
40943
41008
|
}
|
|
40944
41009
|
stop() {
|
|
40945
|
-
|
|
40946
|
-
console.log("MediaOverlay module stop");
|
|
41010
|
+
import_loglevel10.default.log("MediaOverlay module stop");
|
|
40947
41011
|
}
|
|
40948
41012
|
start() {
|
|
40949
41013
|
this.delegate.mediaOverlayModule = this;
|
|
40950
|
-
|
|
40951
|
-
console.log("MediaOverlay module start");
|
|
41014
|
+
import_loglevel10.default.log("MediaOverlay module start");
|
|
40952
41015
|
}
|
|
40953
41016
|
async initialize() {
|
|
40954
41017
|
return new Promise(async (resolve) => {
|
|
@@ -40975,14 +41038,13 @@ var MediaOverlayModule = class {
|
|
|
40975
41038
|
const moUrlFull = moUrlObjFull.toString();
|
|
40976
41039
|
let response;
|
|
40977
41040
|
try {
|
|
40978
|
-
response = await fetch(moUrlFull, this.delegate.
|
|
41041
|
+
response = await fetch(moUrlFull, this.delegate.requestConfig);
|
|
40979
41042
|
} catch (e) {
|
|
40980
41043
|
console.error(e, moUrlFull);
|
|
40981
41044
|
return;
|
|
40982
41045
|
}
|
|
40983
41046
|
if (!response.ok) {
|
|
40984
|
-
|
|
40985
|
-
console.log("BAD RESPONSE?!");
|
|
41047
|
+
import_loglevel10.default.log("BAD RESPONSE?!");
|
|
40986
41048
|
}
|
|
40987
41049
|
let moJson;
|
|
40988
41050
|
try {
|
|
@@ -40991,8 +41053,7 @@ var MediaOverlayModule = class {
|
|
|
40991
41053
|
console.error(e);
|
|
40992
41054
|
}
|
|
40993
41055
|
if (!moJson) {
|
|
40994
|
-
|
|
40995
|
-
console.log("## moJson" + moJson);
|
|
41056
|
+
import_loglevel10.default.log("## moJson" + moJson);
|
|
40996
41057
|
return;
|
|
40997
41058
|
}
|
|
40998
41059
|
link.MediaOverlays = TaJsonDeserialize(moJson, import_media_overlay.MediaOverlayNode);
|
|
@@ -41078,8 +41139,7 @@ var MediaOverlayModule = class {
|
|
|
41078
41139
|
}
|
|
41079
41140
|
}
|
|
41080
41141
|
findDepthFirstTextAudioPair(textHref, mo, textFragmentIDChain) {
|
|
41081
|
-
|
|
41082
|
-
console.log("findDepthFirstTextAudioPair()");
|
|
41142
|
+
import_loglevel10.default.log("findDepthFirstTextAudioPair()");
|
|
41083
41143
|
let isTextUrlMatch;
|
|
41084
41144
|
let isFragmentIDMatch;
|
|
41085
41145
|
if (mo.Text) {
|
|
@@ -41100,21 +41160,16 @@ var MediaOverlayModule = class {
|
|
|
41100
41160
|
isTextUrlMatch = false;
|
|
41101
41161
|
}
|
|
41102
41162
|
}
|
|
41103
|
-
|
|
41104
|
-
|
|
41105
|
-
console.log("isTextUrlMatch: " + isTextUrlMatch);
|
|
41106
|
-
}
|
|
41163
|
+
import_loglevel10.default.log("isFragmentIDMatch: " + isFragmentIDMatch);
|
|
41164
|
+
import_loglevel10.default.log("isTextUrlMatch: " + isTextUrlMatch);
|
|
41107
41165
|
if (!mo.Children || !mo.Children.length) {
|
|
41108
|
-
|
|
41109
|
-
console.log("findDepthFirstTextAudioPair() - leaf text/audio pair");
|
|
41166
|
+
import_loglevel10.default.log("findDepthFirstTextAudioPair() - leaf text/audio pair");
|
|
41110
41167
|
if (!isTextUrlMatch) {
|
|
41111
|
-
|
|
41112
|
-
console.log("findDepthFirstTextAudioPair() - leaf - !isTextUrlMatch");
|
|
41168
|
+
import_loglevel10.default.log("findDepthFirstTextAudioPair() - leaf - !isTextUrlMatch");
|
|
41113
41169
|
return void 0;
|
|
41114
41170
|
}
|
|
41115
41171
|
if (isFragmentIDMatch || isTextUrlMatch && !textFragmentIDChain) {
|
|
41116
|
-
|
|
41117
|
-
console.log("findDepthFirstTextAudioPair() - leaf - isFragmentIDMatch || (isTextUrlMatch && !textFragmentIDChain");
|
|
41172
|
+
import_loglevel10.default.log("findDepthFirstTextAudioPair() - leaf - isFragmentIDMatch || (isTextUrlMatch && !textFragmentIDChain");
|
|
41118
41173
|
return mo;
|
|
41119
41174
|
}
|
|
41120
41175
|
return void 0;
|
|
@@ -41122,34 +41177,25 @@ var MediaOverlayModule = class {
|
|
|
41122
41177
|
const textFragmentIDChainOriginal = textFragmentIDChain;
|
|
41123
41178
|
let frags = textFragmentIDChain;
|
|
41124
41179
|
for (const child of mo.Children) {
|
|
41125
|
-
|
|
41126
|
-
|
|
41127
|
-
console.log(JSON.stringify(child));
|
|
41128
|
-
}
|
|
41180
|
+
import_loglevel10.default.log("findDepthFirstTextAudioPair() - child");
|
|
41181
|
+
import_loglevel10.default.log(JSON.stringify(child));
|
|
41129
41182
|
const match = this.findDepthFirstTextAudioPair(textHref, child, frags);
|
|
41130
41183
|
if (match === null) {
|
|
41131
|
-
|
|
41132
|
-
console.log("findDepthFirstTextAudioPair() - child - match null (skip)");
|
|
41133
|
-
}
|
|
41184
|
+
import_loglevel10.default.log("findDepthFirstTextAudioPair() - child - match null (skip)");
|
|
41134
41185
|
frags = void 0;
|
|
41135
41186
|
}
|
|
41136
41187
|
if (match) {
|
|
41137
|
-
|
|
41138
|
-
|
|
41139
|
-
console.log(JSON.stringify(match));
|
|
41140
|
-
}
|
|
41188
|
+
import_loglevel10.default.log("findDepthFirstTextAudioPair() - child - match");
|
|
41189
|
+
import_loglevel10.default.log(JSON.stringify(match));
|
|
41141
41190
|
return match;
|
|
41142
41191
|
}
|
|
41143
41192
|
}
|
|
41144
41193
|
if (isFragmentIDMatch) {
|
|
41145
|
-
|
|
41146
|
-
console.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch");
|
|
41194
|
+
import_loglevel10.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch");
|
|
41147
41195
|
const match = this.findDepthFirstTextAudioPair(textHref, mo, void 0);
|
|
41148
41196
|
if (match) {
|
|
41149
|
-
|
|
41150
|
-
|
|
41151
|
-
console.log(JSON.stringify(match));
|
|
41152
|
-
}
|
|
41197
|
+
import_loglevel10.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch - match");
|
|
41198
|
+
import_loglevel10.default.log(JSON.stringify(match));
|
|
41153
41199
|
return match;
|
|
41154
41200
|
} else {
|
|
41155
41201
|
return match;
|
|
@@ -41165,8 +41211,7 @@ var MediaOverlayModule = class {
|
|
|
41165
41211
|
if (this.mediaOverlayTextAudioPair) {
|
|
41166
41212
|
try {
|
|
41167
41213
|
if (this.currentAudioEnd && this.audioElement.currentTime >= this.currentAudioEnd - 0.05) {
|
|
41168
|
-
|
|
41169
|
-
console.log("ontimeupdate - mediaOverlaysNext()");
|
|
41214
|
+
import_loglevel10.default.log("ontimeupdate - mediaOverlaysNext()");
|
|
41170
41215
|
this.mediaOverlaysNext();
|
|
41171
41216
|
}
|
|
41172
41217
|
const match_i = this.mediaOverlayTextAudioPair.Text.lastIndexOf("#");
|
|
@@ -41178,13 +41223,11 @@ var MediaOverlayModule = class {
|
|
|
41178
41223
|
}
|
|
41179
41224
|
}
|
|
41180
41225
|
mediaOverlaysNext(escape2) {
|
|
41181
|
-
|
|
41182
|
-
console.log("mediaOverlaysNext()");
|
|
41226
|
+
import_loglevel10.default.log("mediaOverlaysNext()");
|
|
41183
41227
|
if (this.mediaOverlayRoot && this.mediaOverlayTextAudioPair) {
|
|
41184
41228
|
const nextTextAudioPair = this.findNextTextAudioPair(this.mediaOverlayRoot, this.mediaOverlayTextAudioPair, { prev: void 0 }, escape2 ? true : false);
|
|
41185
41229
|
if (!nextTextAudioPair) {
|
|
41186
|
-
|
|
41187
|
-
console.log("mediaOverlaysNext() - navLeftOrRight()");
|
|
41230
|
+
import_loglevel10.default.log("mediaOverlaysNext() - navLeftOrRight()");
|
|
41188
41231
|
this.mediaOverlaysStop();
|
|
41189
41232
|
if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
|
|
41190
41233
|
this.currentLinkIndex++;
|
|
@@ -41204,25 +41247,21 @@ var MediaOverlayModule = class {
|
|
|
41204
41247
|
const hrefUrlObj1 = new URL("https://dita.digital/" + this.mediaOverlayTextAudioPair.Text);
|
|
41205
41248
|
const hrefUrlObj2 = new URL("https://dita.digital/" + nextTextAudioPair.Text);
|
|
41206
41249
|
if (hrefUrlObj1.pathname !== hrefUrlObj2.pathname) {
|
|
41207
|
-
|
|
41208
|
-
console.log("mediaOverlaysNext() SWITCH! " + hrefUrlObj1.pathname + " != " + hrefUrlObj2.pathname);
|
|
41209
|
-
}
|
|
41250
|
+
import_loglevel10.default.log("mediaOverlaysNext() SWITCH! " + hrefUrlObj1.pathname + " != " + hrefUrlObj2.pathname);
|
|
41210
41251
|
switchDoc = true;
|
|
41211
41252
|
}
|
|
41212
41253
|
}
|
|
41213
41254
|
if (switchDoc) {
|
|
41214
41255
|
this.mediaOverlaysStop();
|
|
41215
41256
|
} else {
|
|
41216
|
-
|
|
41217
|
-
console.log("mediaOverlaysNext() - playMediaOverlaysAudio()");
|
|
41257
|
+
import_loglevel10.default.log("mediaOverlaysNext() - playMediaOverlaysAudio()");
|
|
41218
41258
|
setTimeout(async () => {
|
|
41219
41259
|
await this.playMediaOverlaysAudio(nextTextAudioPair, void 0, void 0);
|
|
41220
41260
|
}, 0);
|
|
41221
41261
|
}
|
|
41222
41262
|
}
|
|
41223
41263
|
} else {
|
|
41224
|
-
|
|
41225
|
-
console.log("mediaOverlaysNext() - navLeftOrRight() 2");
|
|
41264
|
+
import_loglevel10.default.log("mediaOverlaysNext() - navLeftOrRight() 2");
|
|
41226
41265
|
this.mediaOverlaysStop();
|
|
41227
41266
|
if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
|
|
41228
41267
|
this.currentLinkIndex++;
|
|
@@ -41239,15 +41278,13 @@ var MediaOverlayModule = class {
|
|
|
41239
41278
|
}
|
|
41240
41279
|
}
|
|
41241
41280
|
mediaOverlaysStop() {
|
|
41242
|
-
|
|
41243
|
-
console.log("mediaOverlaysStop()");
|
|
41281
|
+
import_loglevel10.default.log("mediaOverlaysStop()");
|
|
41244
41282
|
this.mediaOverlaysPause();
|
|
41245
41283
|
this.mediaOverlayRoot = void 0;
|
|
41246
41284
|
this.mediaOverlayTextAudioPair = void 0;
|
|
41247
41285
|
}
|
|
41248
41286
|
mediaOverlaysPause() {
|
|
41249
|
-
|
|
41250
|
-
console.log("mediaOverlaysPause()");
|
|
41287
|
+
import_loglevel10.default.log("mediaOverlaysPause()");
|
|
41251
41288
|
this.mediaOverlayHighlight(void 0);
|
|
41252
41289
|
if (this.audioElement) {
|
|
41253
41290
|
this.audioElement.pause();
|
|
@@ -41256,36 +41293,28 @@ var MediaOverlayModule = class {
|
|
|
41256
41293
|
findNextTextAudioPair(mo, moToMatch, previousMo, escape2) {
|
|
41257
41294
|
if (!mo.Children || !mo.Children.length) {
|
|
41258
41295
|
if (previousMo?.prev === moToMatch) {
|
|
41259
|
-
|
|
41260
|
-
console.log("findNextTextAudioPair() - prevMo === moToMatch");
|
|
41296
|
+
import_loglevel10.default.log("findNextTextAudioPair() - prevMo === moToMatch");
|
|
41261
41297
|
return mo;
|
|
41262
41298
|
}
|
|
41263
|
-
|
|
41264
|
-
|
|
41265
|
-
console.log(JSON.stringify(mo));
|
|
41266
|
-
}
|
|
41299
|
+
import_loglevel10.default.log("findNextTextAudioPair() - set previous");
|
|
41300
|
+
import_loglevel10.default.log(JSON.stringify(mo));
|
|
41267
41301
|
previousMo.prev = mo;
|
|
41268
41302
|
return void 0;
|
|
41269
41303
|
}
|
|
41270
41304
|
for (const child of mo.Children) {
|
|
41271
|
-
|
|
41272
|
-
|
|
41273
|
-
console.log(JSON.stringify(child));
|
|
41274
|
-
}
|
|
41305
|
+
import_loglevel10.default.log("findNextTextAudioPair() - child");
|
|
41306
|
+
import_loglevel10.default.log(JSON.stringify(child));
|
|
41275
41307
|
const match = this.findNextTextAudioPair(child, moToMatch, previousMo, escape2);
|
|
41276
41308
|
if (match) {
|
|
41277
|
-
|
|
41278
|
-
|
|
41279
|
-
console.log(JSON.stringify(match));
|
|
41280
|
-
}
|
|
41309
|
+
import_loglevel10.default.log("findNextTextAudioPair() - match");
|
|
41310
|
+
import_loglevel10.default.log(JSON.stringify(match));
|
|
41281
41311
|
return match;
|
|
41282
41312
|
}
|
|
41283
41313
|
}
|
|
41284
41314
|
return void 0;
|
|
41285
41315
|
}
|
|
41286
41316
|
async playMediaOverlaysAudio(moTextAudioPair, begin, end) {
|
|
41287
|
-
|
|
41288
|
-
console.log("playMediaOverlaysAudio()");
|
|
41317
|
+
import_loglevel10.default.log("playMediaOverlaysAudio()");
|
|
41289
41318
|
this.mediaOverlayTextAudioPair = moTextAudioPair;
|
|
41290
41319
|
if (!moTextAudioPair.Audio) {
|
|
41291
41320
|
return;
|
|
@@ -41309,14 +41338,14 @@ var MediaOverlayModule = class {
|
|
|
41309
41338
|
try {
|
|
41310
41339
|
this.currentAudioBegin = parseFloat(b);
|
|
41311
41340
|
} catch (err) {
|
|
41312
|
-
|
|
41341
|
+
import_loglevel10.default.error(err);
|
|
41313
41342
|
}
|
|
41314
41343
|
if (matches.length >= 3) {
|
|
41315
41344
|
const e = matches[3];
|
|
41316
41345
|
try {
|
|
41317
41346
|
this.currentAudioEnd = parseFloat(e);
|
|
41318
41347
|
} catch (err) {
|
|
41319
|
-
|
|
41348
|
+
import_loglevel10.default.error(err);
|
|
41320
41349
|
}
|
|
41321
41350
|
}
|
|
41322
41351
|
}
|
|
@@ -41325,9 +41354,7 @@ var MediaOverlayModule = class {
|
|
|
41325
41354
|
this.currentAudioBegin = begin;
|
|
41326
41355
|
this.currentAudioEnd = end;
|
|
41327
41356
|
}
|
|
41328
|
-
|
|
41329
|
-
console.log(`${urlFull} => [${this.currentAudioBegin}-${this.currentAudioEnd}]`);
|
|
41330
|
-
}
|
|
41357
|
+
import_loglevel10.default.log(`${urlFull} => [${this.currentAudioBegin}-${this.currentAudioEnd}]`);
|
|
41331
41358
|
const playClip = async (initial) => {
|
|
41332
41359
|
if (!this.audioElement) {
|
|
41333
41360
|
return;
|
|
@@ -41335,9 +41362,7 @@ var MediaOverlayModule = class {
|
|
|
41335
41362
|
const timeToSeekTo = this.currentAudioBegin ? this.currentAudioBegin : 0;
|
|
41336
41363
|
if (initial || this.audioElement.paused) {
|
|
41337
41364
|
if (initial && !timeToSeekTo || this.audioElement.currentTime === timeToSeekTo) {
|
|
41338
|
-
|
|
41339
|
-
console.log("playMediaOverlaysAudio() - playClip() - _currentAudioElement.play()");
|
|
41340
|
-
}
|
|
41365
|
+
import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - _currentAudioElement.play()");
|
|
41341
41366
|
this.ensureOnTimeUpdate(false, false);
|
|
41342
41367
|
this.audioElement.playbackRate = this.settings.rate;
|
|
41343
41368
|
this.audioElement.volume = this.settings.volume;
|
|
@@ -41356,14 +41381,10 @@ var MediaOverlayModule = class {
|
|
|
41356
41381
|
checkReady();
|
|
41357
41382
|
}
|
|
41358
41383
|
} else {
|
|
41359
|
-
|
|
41360
|
-
console.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked");
|
|
41361
|
-
}
|
|
41384
|
+
import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked");
|
|
41362
41385
|
const ontimeupdateSeeked = async (_ev) => {
|
|
41363
41386
|
this.audioElement.removeEventListener("timeupdate", ontimeupdateSeeked);
|
|
41364
|
-
|
|
41365
|
-
console.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked - .play()");
|
|
41366
|
-
}
|
|
41387
|
+
import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked - .play()");
|
|
41367
41388
|
this.ensureOnTimeUpdate(false, false);
|
|
41368
41389
|
if (this.audioElement) {
|
|
41369
41390
|
this.audioElement.playbackRate = this.settings.rate;
|
|
@@ -41391,13 +41412,9 @@ var MediaOverlayModule = class {
|
|
|
41391
41412
|
const contiguous = this.previousAudioUrl === this.currentAudioUrl && typeof this.previousAudioEnd !== "undefined" && this.previousAudioEnd > timeToSeekTo - 0.02 && this.previousAudioEnd <= timeToSeekTo && this.audioElement.currentTime >= timeToSeekTo - 0.1;
|
|
41392
41413
|
this.ensureOnTimeUpdate(false, false);
|
|
41393
41414
|
if (contiguous) {
|
|
41394
|
-
|
|
41395
|
-
console.log("playMediaOverlaysAudio() - playClip() - ensureOnTimeUpdate");
|
|
41396
|
-
}
|
|
41415
|
+
import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - ensureOnTimeUpdate");
|
|
41397
41416
|
} else {
|
|
41398
|
-
|
|
41399
|
-
console.log("playMediaOverlaysAudio() - playClip() - currentTime = timeToSeekTo");
|
|
41400
|
-
}
|
|
41417
|
+
import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - currentTime = timeToSeekTo");
|
|
41401
41418
|
this.audioElement.currentTime = timeToSeekTo;
|
|
41402
41419
|
}
|
|
41403
41420
|
}
|
|
@@ -41405,9 +41422,7 @@ var MediaOverlayModule = class {
|
|
|
41405
41422
|
this.previousAudioUrl = this.currentAudioUrl;
|
|
41406
41423
|
if (!this.currentAudioUrl || urlNoQuery !== this.currentAudioUrl) {
|
|
41407
41424
|
this.currentAudioUrl = urlNoQuery;
|
|
41408
|
-
|
|
41409
|
-
console.log("playMediaOverlaysAudio() - RESET: " + this.previousAudioUrl + " => " + this.currentAudioUrl);
|
|
41410
|
-
}
|
|
41425
|
+
import_loglevel10.default.log("playMediaOverlaysAudio() - RESET: " + this.previousAudioUrl + " => " + this.currentAudioUrl);
|
|
41411
41426
|
this.audioElement = document.getElementById("AUDIO_MO_ID");
|
|
41412
41427
|
if (this.audioElement) {
|
|
41413
41428
|
this.audioElement.pause();
|
|
@@ -41424,23 +41439,21 @@ var MediaOverlayModule = class {
|
|
|
41424
41439
|
this.audioElement.playbackRate = this.settings.rate;
|
|
41425
41440
|
document.body.appendChild(this.audioElement);
|
|
41426
41441
|
this.audioElement.addEventListener("error", (ev) => {
|
|
41427
|
-
|
|
41442
|
+
import_loglevel10.default.log("-1) error: " + (this.currentAudioUrl !== ev.currentTarget.src ? this.currentAudioUrl + " -- " : "") + ev.currentTarget.src.substr(ev.currentTarget.src.lastIndexOf("/")));
|
|
41428
41443
|
if (this.audioElement && this.audioElement.error) {
|
|
41429
|
-
|
|
41430
|
-
|
|
41444
|
+
import_loglevel10.default.log(this.audioElement.error.code);
|
|
41445
|
+
import_loglevel10.default.log(this.audioElement.error.message);
|
|
41431
41446
|
}
|
|
41432
41447
|
});
|
|
41433
41448
|
const oncanplaythrough = async (ev) => {
|
|
41434
41449
|
const currentAudioElement = ev.currentTarget;
|
|
41435
41450
|
currentAudioElement.removeEventListener("canplaythrough", oncanplaythrough);
|
|
41436
|
-
|
|
41437
|
-
console.log("oncanplaythrough");
|
|
41451
|
+
import_loglevel10.default.log("oncanplaythrough");
|
|
41438
41452
|
await playClip(true);
|
|
41439
41453
|
};
|
|
41440
41454
|
this.audioElement.addEventListener("canplaythrough", oncanplaythrough);
|
|
41441
41455
|
const onended = async (_ev) => {
|
|
41442
|
-
|
|
41443
|
-
console.log("onended");
|
|
41456
|
+
import_loglevel10.default.log("onended");
|
|
41444
41457
|
if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
|
|
41445
41458
|
this.currentLinkIndex++;
|
|
41446
41459
|
await this.playLink();
|
|
@@ -41457,42 +41470,35 @@ var MediaOverlayModule = class {
|
|
|
41457
41470
|
this.audioElement.playbackRate = this.settings.rate;
|
|
41458
41471
|
this.audioElement.setAttribute("src", this.currentAudioUrl);
|
|
41459
41472
|
} else {
|
|
41460
|
-
|
|
41461
|
-
console.log("playMediaOverlaysAudio() - playClip()");
|
|
41473
|
+
import_loglevel10.default.log("playMediaOverlaysAudio() - playClip()");
|
|
41462
41474
|
await playClip(false);
|
|
41463
41475
|
}
|
|
41464
41476
|
}
|
|
41465
41477
|
async playMediaOverlays(textHref, rootMo, textFragmentIDChain) {
|
|
41466
|
-
|
|
41467
|
-
console.log("playMediaOverlays()");
|
|
41478
|
+
import_loglevel10.default.log("playMediaOverlays()");
|
|
41468
41479
|
let textFragmentIDChain_ = textFragmentIDChain ? textFragmentIDChain.filter((id2) => id2) : void 0;
|
|
41469
41480
|
if (textFragmentIDChain_ && textFragmentIDChain_.length === 0) {
|
|
41470
41481
|
textFragmentIDChain_ = void 0;
|
|
41471
41482
|
}
|
|
41472
41483
|
let moTextAudioPair = this.findDepthFirstTextAudioPair(textHref, rootMo, textFragmentIDChain_);
|
|
41473
41484
|
if (!moTextAudioPair && textFragmentIDChain_) {
|
|
41474
|
-
|
|
41475
|
-
|
|
41476
|
-
|
|
41477
|
-
console.log(JSON.stringify(rootMo, null, 4));
|
|
41478
|
-
}
|
|
41485
|
+
import_loglevel10.default.log("playMediaOverlays() - findDepthFirstTextAudioPair() SECOND CHANCE ");
|
|
41486
|
+
import_loglevel10.default.log(JSON.stringify(textFragmentIDChain_, null, 4));
|
|
41487
|
+
import_loglevel10.default.log(JSON.stringify(rootMo, null, 4));
|
|
41479
41488
|
moTextAudioPair = this.findDepthFirstTextAudioPair(textHref, rootMo, void 0);
|
|
41480
41489
|
}
|
|
41481
41490
|
if (moTextAudioPair) {
|
|
41482
41491
|
if (moTextAudioPair.Audio) {
|
|
41483
|
-
|
|
41484
|
-
console.log("playMediaOverlays() - playMediaOverlaysAudio()");
|
|
41492
|
+
import_loglevel10.default.log("playMediaOverlays() - playMediaOverlaysAudio()");
|
|
41485
41493
|
this.mediaOverlayRoot = rootMo;
|
|
41486
41494
|
await this.playMediaOverlaysAudio(moTextAudioPair, void 0, void 0);
|
|
41487
41495
|
}
|
|
41488
41496
|
} else {
|
|
41489
|
-
|
|
41490
|
-
console.log("playMediaOverlays() - !moTextAudioPair " + textHref);
|
|
41497
|
+
import_loglevel10.default.log("playMediaOverlays() - !moTextAudioPair " + textHref);
|
|
41491
41498
|
}
|
|
41492
41499
|
}
|
|
41493
41500
|
mediaOverlayHighlight(id2) {
|
|
41494
|
-
|
|
41495
|
-
console.log("moHighlight: ## " + id2);
|
|
41501
|
+
import_loglevel10.default.log("moHighlight: ## " + id2);
|
|
41496
41502
|
let classActive = this.publication.Metadata?.MediaOverlay?.ActiveClass;
|
|
41497
41503
|
if (!classActive) {
|
|
41498
41504
|
classActive = this.settings.color;
|
|
@@ -41537,6 +41543,7 @@ var MediaOverlayModule = class {
|
|
|
41537
41543
|
|
|
41538
41544
|
// src/modules/positions/TimelineModule.ts
|
|
41539
41545
|
init_polyfills();
|
|
41546
|
+
var import_loglevel11 = __toModule(require_loglevel());
|
|
41540
41547
|
var TimelineModule = class {
|
|
41541
41548
|
static async create(config2) {
|
|
41542
41549
|
const timeline = new this(config2.delegate, config2.publication);
|
|
@@ -41548,9 +41555,7 @@ var TimelineModule = class {
|
|
|
41548
41555
|
this.publication = publication;
|
|
41549
41556
|
}
|
|
41550
41557
|
async stop() {
|
|
41551
|
-
|
|
41552
|
-
console.log("Timeline module stop");
|
|
41553
|
-
}
|
|
41558
|
+
import_loglevel11.default.log("Timeline module stop");
|
|
41554
41559
|
}
|
|
41555
41560
|
async start() {
|
|
41556
41561
|
this.delegate.timelineModule = this;
|
|
@@ -41619,8 +41624,7 @@ var TimelineModule = class {
|
|
|
41619
41624
|
title: link.Title
|
|
41620
41625
|
};
|
|
41621
41626
|
}
|
|
41622
|
-
|
|
41623
|
-
console.log(position);
|
|
41627
|
+
import_loglevel11.default.log(position);
|
|
41624
41628
|
this.delegate.navigate(position);
|
|
41625
41629
|
});
|
|
41626
41630
|
if (tocHrefAbs === this.delegate.currentChapterLink.href) {
|
|
@@ -41640,8 +41644,22 @@ var TimelineModule = class {
|
|
|
41640
41644
|
// src/modules/protection/ContentProtectionModule.ts
|
|
41641
41645
|
init_polyfills();
|
|
41642
41646
|
var import_debounce3 = __toModule(require_debounce());
|
|
41647
|
+
|
|
41648
|
+
// src/utils/index.ts
|
|
41649
|
+
init_polyfills();
|
|
41650
|
+
var import_loglevel12 = __toModule(require_loglevel());
|
|
41651
|
+
function delay(t, v) {
|
|
41652
|
+
return new Promise(function(resolve) {
|
|
41653
|
+
setTimeout(resolve.bind(null, v), t);
|
|
41654
|
+
});
|
|
41655
|
+
}
|
|
41656
|
+
var IS_DEV = false;
|
|
41657
|
+
import_loglevel12.default.setLevel(IS_DEV ? "trace" : "warn", true);
|
|
41658
|
+
|
|
41659
|
+
// src/modules/protection/ContentProtectionModule.ts
|
|
41643
41660
|
var import_browserslist_useragent_regexp = __toModule(require_lib7());
|
|
41644
41661
|
var import_devtools_detector = __toModule(require_devtools_detector());
|
|
41662
|
+
var import_loglevel13 = __toModule(require_loglevel());
|
|
41645
41663
|
var ContentProtectionModule = class {
|
|
41646
41664
|
constructor(delegate, properties) {
|
|
41647
41665
|
this.hasEventListener = false;
|
|
@@ -41703,18 +41721,14 @@ var ContentProtectionModule = class {
|
|
|
41703
41721
|
var self2 = this;
|
|
41704
41722
|
this.mutationObserver = new MutationObserver(function(mutations) {
|
|
41705
41723
|
mutations.forEach(function(mutation) {
|
|
41706
|
-
|
|
41707
|
-
console.log(mutation.type);
|
|
41708
|
-
}
|
|
41724
|
+
import_loglevel13.default.log(mutation.type);
|
|
41709
41725
|
self2.isHacked = true;
|
|
41710
41726
|
});
|
|
41711
41727
|
});
|
|
41712
41728
|
}
|
|
41713
41729
|
}
|
|
41714
41730
|
async stop() {
|
|
41715
|
-
|
|
41716
|
-
console.log("Protection module stop");
|
|
41717
|
-
}
|
|
41731
|
+
import_loglevel13.default.log("Protection module stop");
|
|
41718
41732
|
this.mutationObserver.disconnect();
|
|
41719
41733
|
if (this.properties?.disableKeys) {
|
|
41720
41734
|
removeEventListenerOptional(this.delegate.mainElement, "keydown", this.disableSave);
|
|
@@ -41946,18 +41960,14 @@ var ContentProtectionModule = class {
|
|
|
41946
41960
|
return true;
|
|
41947
41961
|
}
|
|
41948
41962
|
preventCopy(event) {
|
|
41949
|
-
|
|
41950
|
-
console.log("copy action initiated");
|
|
41951
|
-
}
|
|
41963
|
+
import_loglevel13.default.log("copy action initiated");
|
|
41952
41964
|
event.clipboardData.setData("text/plain", "copy not allowed");
|
|
41953
41965
|
event.stopPropagation();
|
|
41954
41966
|
event.preventDefault();
|
|
41955
41967
|
return false;
|
|
41956
41968
|
}
|
|
41957
41969
|
beforePrint(event) {
|
|
41958
|
-
|
|
41959
|
-
console.log("before print");
|
|
41960
|
-
}
|
|
41970
|
+
import_loglevel13.default.log("before print");
|
|
41961
41971
|
if (this.delegate && this.delegate.headerMenu) {
|
|
41962
41972
|
this.delegate.headerMenu.style.display = "none";
|
|
41963
41973
|
this.delegate.mainElement.style.display = "none";
|
|
@@ -41967,9 +41977,7 @@ var ContentProtectionModule = class {
|
|
|
41967
41977
|
return false;
|
|
41968
41978
|
}
|
|
41969
41979
|
afterPrint(event) {
|
|
41970
|
-
|
|
41971
|
-
console.log("after print");
|
|
41972
|
-
}
|
|
41980
|
+
import_loglevel13.default.log("after print");
|
|
41973
41981
|
if (this.delegate && this.delegate.headerMenu) {
|
|
41974
41982
|
this.delegate.headerMenu.style.removeProperty("display");
|
|
41975
41983
|
this.delegate.mainElement.style.removeProperty("display");
|
|
@@ -42059,14 +42067,12 @@ var ContentProtectionModule = class {
|
|
|
42059
42067
|
rect.width = width;
|
|
42060
42068
|
rect.left = left;
|
|
42061
42069
|
} catch (error) {
|
|
42062
|
-
|
|
42063
|
-
|
|
42064
|
-
|
|
42065
|
-
|
|
42066
|
-
|
|
42067
|
-
|
|
42068
|
-
console.log("isObfuscated " + rect.isObfuscated);
|
|
42069
|
-
}
|
|
42070
|
+
import_loglevel13.default.log("error " + error);
|
|
42071
|
+
import_loglevel13.default.log(rect);
|
|
42072
|
+
import_loglevel13.default.log(rect.node);
|
|
42073
|
+
import_loglevel13.default.log("scrambledTextContent " + rect.scrambledTextContent);
|
|
42074
|
+
import_loglevel13.default.log("textContent " + rect.textContent);
|
|
42075
|
+
import_loglevel13.default.log("isObfuscated " + rect.isObfuscated);
|
|
42070
42076
|
}
|
|
42071
42077
|
});
|
|
42072
42078
|
}
|
|
@@ -42122,17 +42128,14 @@ var ContentProtectionModule = class {
|
|
|
42122
42128
|
range.detach();
|
|
42123
42129
|
return rect;
|
|
42124
42130
|
} catch (error) {
|
|
42125
|
-
|
|
42126
|
-
|
|
42127
|
-
|
|
42128
|
-
console.log(node.textContent);
|
|
42129
|
-
}
|
|
42131
|
+
import_loglevel13.default.log("measureTextNode " + error);
|
|
42132
|
+
import_loglevel13.default.log("measureTextNode " + node);
|
|
42133
|
+
import_loglevel13.default.log(node.textContent);
|
|
42130
42134
|
}
|
|
42131
42135
|
}
|
|
42132
42136
|
isBeingHacked(element) {
|
|
42133
42137
|
if (element.style.animation || element.style.transition || element.style.position || element.hasAttribute("style")) {
|
|
42134
|
-
|
|
42135
|
-
console.log("content being hacked");
|
|
42138
|
+
import_loglevel13.default.log("content being hacked");
|
|
42136
42139
|
return true;
|
|
42137
42140
|
}
|
|
42138
42141
|
return false;
|
|
@@ -42296,8 +42299,9 @@ async function searchDocDomSeek(searchInput, doc, href, title, fullWordSearch =
|
|
|
42296
42299
|
}
|
|
42297
42300
|
|
|
42298
42301
|
// src/modules/search/SearchModule.ts
|
|
42302
|
+
var import_loglevel14 = __toModule(require_loglevel());
|
|
42299
42303
|
var SearchModule = class {
|
|
42300
|
-
constructor(delegate, publication, properties, highlighter, api, headerMenu) {
|
|
42304
|
+
constructor(delegate, publication, properties, highlighter, requestConfig, api, headerMenu) {
|
|
42301
42305
|
this.currentChapterSearchResult = [];
|
|
42302
42306
|
this.bookSearchResult = [];
|
|
42303
42307
|
this.currentSearchHighlights = [];
|
|
@@ -42307,16 +42311,15 @@ var SearchModule = class {
|
|
|
42307
42311
|
this.properties = properties;
|
|
42308
42312
|
this.api = api;
|
|
42309
42313
|
this.highlighter = highlighter;
|
|
42314
|
+
this.requestConfig = requestConfig;
|
|
42310
42315
|
}
|
|
42311
42316
|
static async create(config2) {
|
|
42312
|
-
const search = new this(config2.delegate, config2.publication, config2, config2.highlighter, config2.api, config2.headerMenu);
|
|
42317
|
+
const search = new this(config2.delegate, config2.publication, config2, config2.highlighter, config2.requestConfig, config2.api, config2.headerMenu);
|
|
42313
42318
|
await search.start();
|
|
42314
42319
|
return search;
|
|
42315
42320
|
}
|
|
42316
42321
|
async stop() {
|
|
42317
|
-
|
|
42318
|
-
console.log("Search module stop");
|
|
42319
|
-
}
|
|
42322
|
+
import_loglevel14.default.log("Search module stop");
|
|
42320
42323
|
removeEventListenerOptional(this.searchInput, "keypress", this.handleSearch.bind(this));
|
|
42321
42324
|
removeEventListenerOptional(this.searchGo, "click", this.handleSearch.bind(this));
|
|
42322
42325
|
}
|
|
@@ -42735,9 +42738,9 @@ var SearchModule = class {
|
|
|
42735
42738
|
}
|
|
42736
42739
|
if (tocItem) {
|
|
42737
42740
|
let href = this.publication.getAbsoluteHref(tocItem.Href);
|
|
42738
|
-
await fetch(href, this.
|
|
42741
|
+
await fetch(href, this.requestConfig).then((r) => r.text()).then(async (data) => {
|
|
42739
42742
|
let parser = new DOMParser();
|
|
42740
|
-
let doc = parser.parseFromString(data, "application/xhtml+xml");
|
|
42743
|
+
let doc = parser.parseFromString(this.requestConfig?.encoded ? this.decodeBase64(data) : data, "application/xhtml+xml");
|
|
42741
42744
|
if (tocItem) {
|
|
42742
42745
|
searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
|
|
42743
42746
|
result.forEach((searchItem) => {
|
|
@@ -42753,6 +42756,16 @@ var SearchModule = class {
|
|
|
42753
42756
|
}
|
|
42754
42757
|
}
|
|
42755
42758
|
}
|
|
42759
|
+
decodeBase64(base64) {
|
|
42760
|
+
const text = atob(base64);
|
|
42761
|
+
const length = text.length;
|
|
42762
|
+
const bytes = new Uint8Array(length);
|
|
42763
|
+
for (let i = 0; i < length; i++) {
|
|
42764
|
+
bytes[i] = text.charCodeAt(i);
|
|
42765
|
+
}
|
|
42766
|
+
const decoder = new TextDecoder();
|
|
42767
|
+
return decoder.decode(bytes);
|
|
42768
|
+
}
|
|
42756
42769
|
async searchChapter(term) {
|
|
42757
42770
|
let localSearchResultBook = [];
|
|
42758
42771
|
const linkHref = this.publication.getAbsoluteHref(this.publication.readingOrder[this.delegate.currentResource() ?? 0].Href);
|
|
@@ -42762,9 +42775,9 @@ var SearchModule = class {
|
|
|
42762
42775
|
}
|
|
42763
42776
|
if (tocItem) {
|
|
42764
42777
|
let href = this.publication.getAbsoluteHref(tocItem.Href);
|
|
42765
|
-
await fetch(href).then((r) => r.text()).then(async (data) => {
|
|
42778
|
+
await fetch(href, this.requestConfig).then((r) => r.text()).then(async (data) => {
|
|
42766
42779
|
let parser = new DOMParser();
|
|
42767
|
-
let doc = parser.parseFromString(data, "application/xhtml+xml");
|
|
42780
|
+
let doc = parser.parseFromString(this.requestConfig?.encoded ? this.decodeBase64(data) : data, "application/xhtml+xml");
|
|
42768
42781
|
if (tocItem) {
|
|
42769
42782
|
searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
|
|
42770
42783
|
result.forEach((searchItem) => {
|
|
@@ -42833,6 +42846,7 @@ var SearchModule = class {
|
|
|
42833
42846
|
|
|
42834
42847
|
// src/modules/TTS/TTSSettings.ts
|
|
42835
42848
|
init_polyfills();
|
|
42849
|
+
var import_loglevel15 = __toModule(require_loglevel());
|
|
42836
42850
|
var _TTSREFS = class {
|
|
42837
42851
|
};
|
|
42838
42852
|
var TTSREFS = _TTSREFS;
|
|
@@ -42874,42 +42888,34 @@ var TTSSettings = class {
|
|
|
42874
42888
|
let initialTTSSettings = config2.initialTTSSettings;
|
|
42875
42889
|
if (initialTTSSettings?.rate) {
|
|
42876
42890
|
settings.rate = initialTTSSettings.rate;
|
|
42877
|
-
|
|
42878
|
-
console.log(settings.rate);
|
|
42891
|
+
import_loglevel15.default.log(settings.rate);
|
|
42879
42892
|
}
|
|
42880
42893
|
if (initialTTSSettings?.pitch) {
|
|
42881
42894
|
settings.pitch = initialTTSSettings.pitch;
|
|
42882
|
-
|
|
42883
|
-
console.log(settings.pitch);
|
|
42895
|
+
import_loglevel15.default.log(settings.pitch);
|
|
42884
42896
|
}
|
|
42885
42897
|
if (initialTTSSettings?.volume) {
|
|
42886
42898
|
settings.volume = initialTTSSettings.volume;
|
|
42887
|
-
|
|
42888
|
-
console.log(settings.volume);
|
|
42899
|
+
import_loglevel15.default.log(settings.volume);
|
|
42889
42900
|
}
|
|
42890
42901
|
if (initialTTSSettings?.color) {
|
|
42891
42902
|
settings.color = initialTTSSettings.color;
|
|
42892
|
-
|
|
42893
|
-
console.log(settings.color);
|
|
42903
|
+
import_loglevel15.default.log(settings.color);
|
|
42894
42904
|
}
|
|
42895
42905
|
if (initialTTSSettings?.autoScroll) {
|
|
42896
42906
|
settings.autoScroll = initialTTSSettings.autoScroll;
|
|
42897
|
-
|
|
42898
|
-
console.log(settings.autoScroll);
|
|
42907
|
+
import_loglevel15.default.log(settings.autoScroll);
|
|
42899
42908
|
}
|
|
42900
42909
|
if (initialTTSSettings?.voice) {
|
|
42901
42910
|
settings.voice = initialTTSSettings.voice;
|
|
42902
|
-
|
|
42903
|
-
console.log(settings.voice);
|
|
42911
|
+
import_loglevel15.default.log(settings.voice);
|
|
42904
42912
|
}
|
|
42905
42913
|
}
|
|
42906
42914
|
settings.initializeSelections();
|
|
42907
42915
|
return settings;
|
|
42908
42916
|
}
|
|
42909
42917
|
stop() {
|
|
42910
|
-
|
|
42911
|
-
console.log("tts settings stop");
|
|
42912
|
-
}
|
|
42918
|
+
import_loglevel15.default.log("tts settings stop");
|
|
42913
42919
|
}
|
|
42914
42920
|
initialise() {
|
|
42915
42921
|
this.autoScroll = this.getProperty(TTSREFS.AUTO_SCROLL_KEY) != null ? this.getProperty(TTSREFS.AUTO_SCROLL_KEY).value : this.autoScroll;
|
|
@@ -42982,9 +42988,7 @@ var TTSSettings = class {
|
|
|
42982
42988
|
this.applyTTSSettings(ttsSettings);
|
|
42983
42989
|
if (this.api?.updateSettings) {
|
|
42984
42990
|
this.api?.updateSettings(ttsSettings).then(async (settings) => {
|
|
42985
|
-
|
|
42986
|
-
console.log("api updated tts settings", settings);
|
|
42987
|
-
}
|
|
42991
|
+
import_loglevel15.default.log("api updated tts settings", settings);
|
|
42988
42992
|
});
|
|
42989
42993
|
}
|
|
42990
42994
|
}
|
|
@@ -43032,8 +43036,7 @@ var TTSSettings = class {
|
|
|
43032
43036
|
}
|
|
43033
43037
|
applyTTSSettings(ttsSettings) {
|
|
43034
43038
|
if (ttsSettings.rate) {
|
|
43035
|
-
|
|
43036
|
-
console.log("rate " + this.rate);
|
|
43039
|
+
import_loglevel15.default.log("rate " + this.rate);
|
|
43037
43040
|
this.rate = ttsSettings.rate;
|
|
43038
43041
|
let prop = this.userProperties.getByRef(TTSREFS.RATE_REF);
|
|
43039
43042
|
if (prop) {
|
|
@@ -43044,8 +43047,7 @@ var TTSSettings = class {
|
|
|
43044
43047
|
this.restartCallback();
|
|
43045
43048
|
}
|
|
43046
43049
|
if (ttsSettings.pitch) {
|
|
43047
|
-
|
|
43048
|
-
console.log("pitch " + this.pitch);
|
|
43050
|
+
import_loglevel15.default.log("pitch " + this.pitch);
|
|
43049
43051
|
this.pitch = ttsSettings.pitch;
|
|
43050
43052
|
let prop = this.userProperties.getByRef(TTSREFS.PITCH_REF);
|
|
43051
43053
|
if (prop) {
|
|
@@ -43056,8 +43058,7 @@ var TTSSettings = class {
|
|
|
43056
43058
|
this.restartCallback();
|
|
43057
43059
|
}
|
|
43058
43060
|
if (ttsSettings.volume) {
|
|
43059
|
-
|
|
43060
|
-
console.log("volume " + this.volume);
|
|
43061
|
+
import_loglevel15.default.log("volume " + this.volume);
|
|
43061
43062
|
this.volume = ttsSettings.volume;
|
|
43062
43063
|
let prop = this.userProperties.getByRef(TTSREFS.VOLUME_REF);
|
|
43063
43064
|
if (prop) {
|
|
@@ -43077,8 +43078,7 @@ var TTSSettings = class {
|
|
|
43077
43078
|
this.settingsChangeCallback();
|
|
43078
43079
|
}
|
|
43079
43080
|
if (ttsSettings.autoScroll !== void 0) {
|
|
43080
|
-
|
|
43081
|
-
console.log("autoScroll " + this.autoScroll);
|
|
43081
|
+
import_loglevel15.default.log("autoScroll " + this.autoScroll);
|
|
43082
43082
|
this.autoScroll = ttsSettings.autoScroll;
|
|
43083
43083
|
let prop = this.userProperties.getByRef(TTSREFS.AUTO_SCROLL_REF);
|
|
43084
43084
|
if (prop) {
|
|
@@ -43088,8 +43088,7 @@ var TTSSettings = class {
|
|
|
43088
43088
|
this.settingsChangeCallback();
|
|
43089
43089
|
}
|
|
43090
43090
|
if (ttsSettings.voice) {
|
|
43091
|
-
|
|
43092
|
-
console.log("voice " + this.voice);
|
|
43091
|
+
import_loglevel15.default.log("voice " + this.voice);
|
|
43093
43092
|
this.voice = ttsSettings.voice;
|
|
43094
43093
|
let prop = this.userProperties.getByRef(TTSREFS.VOICE_REF);
|
|
43095
43094
|
if (prop) {
|
|
@@ -43178,9 +43177,6 @@ init_polyfills();
|
|
|
43178
43177
|
|
|
43179
43178
|
// src/utils/HTMLTemplates.ts
|
|
43180
43179
|
init_polyfills();
|
|
43181
|
-
var simpleUpLinkTemplate = (href, _label, ariaLabel) => `
|
|
43182
|
-
<a rel="up" href='${href}' aria-label="${ariaLabel}" style="padding: 0px"><i class="material-icons show-on-large">arrow_back_ios</i></a>
|
|
43183
|
-
`;
|
|
43184
43180
|
var readerLoading = `${icons.loading}`;
|
|
43185
43181
|
var readerError = `
|
|
43186
43182
|
<span>
|
|
@@ -43428,15 +43424,14 @@ var SampleReadEventHandler = class {
|
|
|
43428
43424
|
|
|
43429
43425
|
// src/navigator/IFrameNavigator.ts
|
|
43430
43426
|
var import_eventemitter3 = __toModule(require_eventemitter3());
|
|
43427
|
+
var import_loglevel16 = __toModule(require_loglevel());
|
|
43431
43428
|
var IFrameNavigator = class extends import_eventemitter3.default {
|
|
43432
|
-
constructor(settings, annotator = void 0,
|
|
43429
|
+
constructor(settings, annotator = void 0, initialLastReadingPosition = void 0, publication, api, rights, tts, injectables, attributes, services, sample, requestConfig) {
|
|
43433
43430
|
super();
|
|
43434
43431
|
this.iframes = [];
|
|
43435
43432
|
this.sideNavExpanded = false;
|
|
43436
|
-
this.material = false;
|
|
43437
43433
|
this.currentChapterLink = { href: "" };
|
|
43438
43434
|
this.currentSpreadLinks = {};
|
|
43439
|
-
this.upLink = void 0;
|
|
43440
43435
|
this.rights = {
|
|
43441
43436
|
autoGeneratePositions: false,
|
|
43442
43437
|
enableAnnotations: false,
|
|
@@ -43465,10 +43460,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
43465
43460
|
}
|
|
43466
43461
|
if (lastReadingPosition) {
|
|
43467
43462
|
const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
|
|
43468
|
-
|
|
43469
|
-
|
|
43470
|
-
if (IS_DEV)
|
|
43471
|
-
console.log(linkHref);
|
|
43463
|
+
import_loglevel16.default.log(lastReadingPosition.href);
|
|
43464
|
+
import_loglevel16.default.log(linkHref);
|
|
43472
43465
|
lastReadingPosition.href = linkHref;
|
|
43473
43466
|
await this.navigate(lastReadingPosition);
|
|
43474
43467
|
}
|
|
@@ -43501,10 +43494,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
43501
43494
|
this.eventHandler = new EventHandler(this);
|
|
43502
43495
|
this.touchEventHandler = new TouchEventHandler(this);
|
|
43503
43496
|
this.keyboardEventHandler = new KeyboardEventHandler(this);
|
|
43504
|
-
this.upLinkConfig = upLinkConfig;
|
|
43505
43497
|
this.initialLastReadingPosition = initialLastReadingPosition;
|
|
43506
43498
|
this.publication = publication;
|
|
43507
|
-
this.material = material;
|
|
43508
43499
|
this.api = api;
|
|
43509
43500
|
this.rights = rights ?? {
|
|
43510
43501
|
autoGeneratePositions: false,
|
|
@@ -43527,18 +43518,16 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
43527
43518
|
this.attributes = attributes || { margin: 0 };
|
|
43528
43519
|
this.services = services;
|
|
43529
43520
|
this.sample = sample;
|
|
43530
|
-
this.
|
|
43521
|
+
this.requestConfig = requestConfig;
|
|
43531
43522
|
this.sampleReadEventHandler = new SampleReadEventHandler(this);
|
|
43532
43523
|
}
|
|
43533
43524
|
static async create(config2) {
|
|
43534
|
-
const navigator2 = new this(config2.settings, config2.annotator || void 0, config2.
|
|
43525
|
+
const navigator2 = new this(config2.settings, config2.annotator || void 0, config2.initialLastReadingPosition || void 0, config2.publication, config2.api, config2.rights, config2.tts, config2.injectables, config2.attributes || { margin: 0 }, config2.services, config2.sample);
|
|
43535
43526
|
await navigator2.start(config2.mainElement, config2.headerMenu, config2.footerMenu);
|
|
43536
43527
|
return new Promise((resolve) => resolve(navigator2));
|
|
43537
43528
|
}
|
|
43538
43529
|
stop() {
|
|
43539
|
-
|
|
43540
|
-
console.log("Iframe navigator stop");
|
|
43541
|
-
}
|
|
43530
|
+
import_loglevel16.default.log("Iframe navigator stop");
|
|
43542
43531
|
removeEventListenerOptional(this.previousChapterAnchorElement, "click", this.handlePreviousChapterClick.bind(this));
|
|
43543
43532
|
removeEventListenerOptional(this.nextChapterAnchorElement, "click", this.handleNextChapterClick.bind(this));
|
|
43544
43533
|
removeEventListenerOptional(this.previousChapterTopAnchorElement, "click", this.handlePreviousPageClick.bind(this));
|
|
@@ -43746,7 +43735,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
43746
43735
|
this.setupEvents();
|
|
43747
43736
|
return await this.loadManifest();
|
|
43748
43737
|
} catch (err) {
|
|
43749
|
-
|
|
43738
|
+
import_loglevel16.default.error(err);
|
|
43750
43739
|
this.abortOnError(err);
|
|
43751
43740
|
return Promise.reject(err);
|
|
43752
43741
|
}
|
|
@@ -44029,22 +44018,6 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44029
44018
|
this.landmarksSection.parentElement?.removeChild(this.landmarksSection);
|
|
44030
44019
|
}
|
|
44031
44020
|
}
|
|
44032
|
-
if ((this.links || this.linksTopLeft) && this.upLinkConfig && this.upLinkConfig.url) {
|
|
44033
|
-
const upUrl = this.upLinkConfig.url;
|
|
44034
|
-
const upLabel = this.upLinkConfig.label || "";
|
|
44035
|
-
const upAriaLabel = this.upLinkConfig.ariaLabel || upLabel;
|
|
44036
|
-
var upHTML = simpleUpLinkTemplate(upUrl.href, upLabel, upAriaLabel);
|
|
44037
|
-
const upParent = document.createElement("li");
|
|
44038
|
-
upParent.classList.add("uplink-wrapper");
|
|
44039
|
-
upParent.innerHTML = upHTML;
|
|
44040
|
-
if (this.links) {
|
|
44041
|
-
this.links.insertBefore(upParent, this.links.firstChild);
|
|
44042
|
-
this.upLink = findRequiredElement(this.links, "a[rel=up]");
|
|
44043
|
-
} else {
|
|
44044
|
-
this.linksTopLeft.insertBefore(upParent, this.linksTopLeft.firstChild);
|
|
44045
|
-
this.upLink = findRequiredElement(this.linksTopLeft, "a[rel=up]");
|
|
44046
|
-
}
|
|
44047
|
-
}
|
|
44048
44021
|
let lastReadingPosition = void 0;
|
|
44049
44022
|
if (this.annotator) {
|
|
44050
44023
|
lastReadingPosition = await this.annotator.getLastReadingPosition();
|
|
@@ -44056,10 +44029,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44056
44029
|
}
|
|
44057
44030
|
if (lastReadingPosition) {
|
|
44058
44031
|
const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
|
|
44059
|
-
|
|
44060
|
-
|
|
44061
|
-
if (IS_DEV)
|
|
44062
|
-
console.log(linkHref);
|
|
44032
|
+
import_loglevel16.default.log(lastReadingPosition.href);
|
|
44033
|
+
import_loglevel16.default.log(linkHref);
|
|
44063
44034
|
lastReadingPosition.href = linkHref;
|
|
44064
44035
|
await this.navigate(lastReadingPosition);
|
|
44065
44036
|
} else if (startUrl) {
|
|
@@ -44075,7 +44046,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44075
44046
|
}
|
|
44076
44047
|
return new Promise((resolve) => resolve());
|
|
44077
44048
|
} catch (err) {
|
|
44078
|
-
|
|
44049
|
+
import_loglevel16.default.error(err);
|
|
44079
44050
|
this.abortOnError(err);
|
|
44080
44051
|
return new Promise((_, reject) => reject(err)).catch(() => {
|
|
44081
44052
|
});
|
|
@@ -44257,7 +44228,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44257
44228
|
}, 200);
|
|
44258
44229
|
return new Promise((resolve) => resolve());
|
|
44259
44230
|
} catch (err) {
|
|
44260
|
-
|
|
44231
|
+
import_loglevel16.default.error(err);
|
|
44261
44232
|
this.abortOnError(err);
|
|
44262
44233
|
return Promise.reject(err);
|
|
44263
44234
|
}
|
|
@@ -44384,7 +44355,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44384
44355
|
if (isSameOrigin) {
|
|
44385
44356
|
this.iframes[0].src = this.currentChapterLink.href;
|
|
44386
44357
|
} else {
|
|
44387
|
-
fetch(this.currentChapterLink.href, this.
|
|
44358
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content2) => {
|
|
44388
44359
|
writeIframeDoc.call(this, content2, this.currentChapterLink.href);
|
|
44389
44360
|
});
|
|
44390
44361
|
}
|
|
@@ -44405,7 +44376,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44405
44376
|
if (isSameOrigin) {
|
|
44406
44377
|
this.iframes[1].src = href;
|
|
44407
44378
|
} else {
|
|
44408
|
-
fetch(href, this.
|
|
44379
|
+
fetch(href, this.requestConfig).then((r) => r.text()).then(async (content2) => {
|
|
44409
44380
|
writeIframe2Doc.call(this, content2, href);
|
|
44410
44381
|
this.currentSpreadLinks.right = {
|
|
44411
44382
|
href
|
|
@@ -44434,7 +44405,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44434
44405
|
if (isSameOrigin) {
|
|
44435
44406
|
this.iframes[0].src = href;
|
|
44436
44407
|
} else {
|
|
44437
|
-
fetch(href, this.
|
|
44408
|
+
fetch(href, this.requestConfig).then((r) => r.text()).then(async (content2) => {
|
|
44438
44409
|
writeIframeDoc.call(this, content2, href);
|
|
44439
44410
|
});
|
|
44440
44411
|
}
|
|
@@ -44455,7 +44426,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44455
44426
|
if (isSameOrigin) {
|
|
44456
44427
|
this.iframes[1].src = this.currentChapterLink.href;
|
|
44457
44428
|
} else {
|
|
44458
|
-
fetch(this.currentChapterLink.href, this.
|
|
44429
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content2) => {
|
|
44459
44430
|
writeIframe2Doc.call(this, content2, this.currentChapterLink.href);
|
|
44460
44431
|
});
|
|
44461
44432
|
}
|
|
@@ -44474,7 +44445,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44474
44445
|
if (isSameOrigin) {
|
|
44475
44446
|
this.iframes[0].src = this.currentChapterLink.href;
|
|
44476
44447
|
} else {
|
|
44477
|
-
fetch(this.currentChapterLink.href, this.
|
|
44448
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content2) => {
|
|
44478
44449
|
writeIframeDoc.call(this, content2, this.currentChapterLink.href);
|
|
44479
44450
|
});
|
|
44480
44451
|
}
|
|
@@ -44492,7 +44463,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44492
44463
|
if (isSameOrigin) {
|
|
44493
44464
|
this.iframes[0].src = this.currentChapterLink.href;
|
|
44494
44465
|
} else {
|
|
44495
|
-
fetch(this.currentChapterLink.href, this.
|
|
44466
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content2) => {
|
|
44496
44467
|
writeIframeDoc.call(this, content2, this.currentChapterLink.href);
|
|
44497
44468
|
});
|
|
44498
44469
|
}
|
|
@@ -44525,7 +44496,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44525
44496
|
}
|
|
44526
44497
|
}
|
|
44527
44498
|
} else {
|
|
44528
|
-
fetch(this.currentChapterLink.href, this.
|
|
44499
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44529
44500
|
writeIframeDoc.call(this, content, this.currentChapterLink.href);
|
|
44530
44501
|
});
|
|
44531
44502
|
if (this.iframes.length === 2) {
|
|
@@ -44536,7 +44507,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44536
44507
|
this.currentSpreadLinks.right = {
|
|
44537
44508
|
href
|
|
44538
44509
|
};
|
|
44539
|
-
fetch(href, this.
|
|
44510
|
+
fetch(href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44540
44511
|
writeIframe2Doc.call(this, content, href);
|
|
44541
44512
|
});
|
|
44542
44513
|
}
|
|
@@ -44559,14 +44530,14 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44559
44530
|
this.iframes[1].src = this.currentChapterLink.href;
|
|
44560
44531
|
}
|
|
44561
44532
|
} else {
|
|
44562
|
-
fetch(href, this.
|
|
44533
|
+
fetch(href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44563
44534
|
writeIframeDoc.call(this, content, href);
|
|
44564
44535
|
});
|
|
44565
44536
|
if (this.iframes.length === 2) {
|
|
44566
44537
|
this.currentSpreadLinks.right = {
|
|
44567
44538
|
href: this.currentChapterLink.href
|
|
44568
44539
|
};
|
|
44569
|
-
fetch(this.currentChapterLink.href, this.
|
|
44540
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44570
44541
|
writeIframe2Doc.call(this, content, this.currentChapterLink.href);
|
|
44571
44542
|
});
|
|
44572
44543
|
}
|
|
@@ -44582,7 +44553,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44582
44553
|
if (isSameOrigin) {
|
|
44583
44554
|
this.iframes[1].src = this.currentChapterLink.href;
|
|
44584
44555
|
} else {
|
|
44585
|
-
fetch(this.currentChapterLink.href, this.
|
|
44556
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44586
44557
|
writeIframe2Doc.call(this, content, this.currentChapterLink.href);
|
|
44587
44558
|
});
|
|
44588
44559
|
}
|
|
@@ -44595,7 +44566,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44595
44566
|
if (isSameOrigin) {
|
|
44596
44567
|
this.iframes[0].src = this.currentChapterLink.href;
|
|
44597
44568
|
} else {
|
|
44598
|
-
fetch(this.currentChapterLink.href, this.
|
|
44569
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44599
44570
|
writeIframeDoc.call(this, content, this.currentChapterLink.href);
|
|
44600
44571
|
});
|
|
44601
44572
|
}
|
|
@@ -44607,7 +44578,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44607
44578
|
if (isSameOrigin) {
|
|
44608
44579
|
this.iframes[0].src = this.currentChapterLink.href;
|
|
44609
44580
|
} else {
|
|
44610
|
-
fetch(this.currentChapterLink.href, this.
|
|
44581
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
44611
44582
|
writeIframeDoc.call(this, content, this.currentChapterLink.href);
|
|
44612
44583
|
});
|
|
44613
44584
|
}
|
|
@@ -44792,10 +44763,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44792
44763
|
const position = __spreadValues({}, locator);
|
|
44793
44764
|
position.locations = locations;
|
|
44794
44765
|
const linkHref = this.publication.getAbsoluteHref(locator.href);
|
|
44795
|
-
|
|
44796
|
-
|
|
44797
|
-
if (IS_DEV)
|
|
44798
|
-
console.log(linkHref);
|
|
44766
|
+
import_loglevel16.default.log(locator.href);
|
|
44767
|
+
import_loglevel16.default.log(linkHref);
|
|
44799
44768
|
position.href = linkHref;
|
|
44800
44769
|
this.stopReadAloud();
|
|
44801
44770
|
this.navigate(position);
|
|
@@ -44846,7 +44815,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
44846
44815
|
snapToSelector(selector2) {
|
|
44847
44816
|
const doc = this.iframes[0].contentDocument;
|
|
44848
44817
|
if (doc) {
|
|
44849
|
-
|
|
44818
|
+
import_loglevel16.default.log(selector2);
|
|
44850
44819
|
let result = doc.querySelectorAll(selector2);
|
|
44851
44820
|
if (result.length > 0)
|
|
44852
44821
|
this.view?.snap(result[0]);
|
|
@@ -45542,15 +45511,11 @@ var IFrameNavigator = class extends import_eventemitter3.default {
|
|
|
45542
45511
|
}
|
|
45543
45512
|
if (this.api?.updateCurrentLocation) {
|
|
45544
45513
|
this.api?.updateCurrentLocation(position).then(async (_) => {
|
|
45545
|
-
|
|
45546
|
-
console.log("api updated current location", position);
|
|
45547
|
-
}
|
|
45514
|
+
import_loglevel16.default.log("api updated current location", position);
|
|
45548
45515
|
return this.annotator?.saveLastReadingPosition(position);
|
|
45549
45516
|
});
|
|
45550
45517
|
} else {
|
|
45551
|
-
|
|
45552
|
-
console.log("save last reading position", position);
|
|
45553
|
-
}
|
|
45518
|
+
import_loglevel16.default.log("save last reading position", position);
|
|
45554
45519
|
this.annotator.saveLastReadingPosition(position);
|
|
45555
45520
|
}
|
|
45556
45521
|
}
|
|
@@ -46021,6 +45986,7 @@ function convertAndCamel(o) {
|
|
|
46021
45986
|
|
|
46022
45987
|
// src/modules/highlight/LayerSettings.ts
|
|
46023
45988
|
init_polyfills();
|
|
45989
|
+
var import_loglevel17 = __toModule(require_loglevel());
|
|
46024
45990
|
var LayerSettings = class {
|
|
46025
45991
|
constructor(store) {
|
|
46026
45992
|
this.LAYERSETTINGS = "layerSetting";
|
|
@@ -46032,9 +45998,7 @@ var LayerSettings = class {
|
|
|
46032
45998
|
return new Promise((resolve) => resolve(settings));
|
|
46033
45999
|
}
|
|
46034
46000
|
async stop() {
|
|
46035
|
-
|
|
46036
|
-
console.log("MediaOverlay settings stop");
|
|
46037
|
-
}
|
|
46001
|
+
import_loglevel17.default.log("MediaOverlay settings stop");
|
|
46038
46002
|
}
|
|
46039
46003
|
async initialize() {
|
|
46040
46004
|
this.userProperties = await this.getLayerSettings();
|
|
@@ -46078,6 +46042,7 @@ var LayerSettings = class {
|
|
|
46078
46042
|
|
|
46079
46043
|
// src/modules/pagebreak/PageBreakModule.ts
|
|
46080
46044
|
init_polyfills();
|
|
46045
|
+
var import_loglevel18 = __toModule(require_loglevel());
|
|
46081
46046
|
var PageBreakModule = class {
|
|
46082
46047
|
static async create(config2) {
|
|
46083
46048
|
const pageBreak = new this(config2.delegate, config2.publication, config2, config2.headerMenu);
|
|
@@ -46091,9 +46056,7 @@ var PageBreakModule = class {
|
|
|
46091
46056
|
this.properties = properties;
|
|
46092
46057
|
}
|
|
46093
46058
|
async stop() {
|
|
46094
|
-
|
|
46095
|
-
console.log("Page Break module stop");
|
|
46096
|
-
}
|
|
46059
|
+
import_loglevel18.default.log("Page Break module stop");
|
|
46097
46060
|
}
|
|
46098
46061
|
async start() {
|
|
46099
46062
|
this.delegate.pageBreakModule = this;
|
|
@@ -46159,16 +46122,15 @@ var PageBreakModule = class {
|
|
|
46159
46122
|
return "";
|
|
46160
46123
|
}
|
|
46161
46124
|
} catch (err) {
|
|
46162
|
-
|
|
46163
|
-
|
|
46125
|
+
import_loglevel18.default.log("uniqueCssSelector:");
|
|
46126
|
+
import_loglevel18.default.error(err);
|
|
46164
46127
|
return "";
|
|
46165
46128
|
}
|
|
46166
46129
|
}
|
|
46167
46130
|
if (pageBreaks) {
|
|
46168
46131
|
for (let i = 0; i < pageBreaks.length; i++) {
|
|
46169
46132
|
let img = pageBreaks[i];
|
|
46170
|
-
|
|
46171
|
-
console.log(img);
|
|
46133
|
+
import_loglevel18.default.log(img);
|
|
46172
46134
|
let title = img.innerHTML;
|
|
46173
46135
|
let hide = false;
|
|
46174
46136
|
if (img.innerHTML.length === 0) {
|
|
@@ -46241,6 +46203,7 @@ var PageBreakModule = class {
|
|
|
46241
46203
|
init_polyfills();
|
|
46242
46204
|
var import_sanitize_html2 = __toModule(require_sanitize_html());
|
|
46243
46205
|
var import_debounce6 = __toModule(require_debounce());
|
|
46206
|
+
var import_loglevel19 = __toModule(require_loglevel());
|
|
46244
46207
|
var TTSModule2 = class {
|
|
46245
46208
|
constructor(delegate, tts, rights, highlighter, properties, api, headerMenu) {
|
|
46246
46209
|
this.voices = [];
|
|
@@ -46358,16 +46321,14 @@ var TTSModule2 = class {
|
|
|
46358
46321
|
}
|
|
46359
46322
|
let s = setSpeech();
|
|
46360
46323
|
s.then(async (voices) => {
|
|
46361
|
-
|
|
46362
|
-
console.log(voices);
|
|
46324
|
+
import_loglevel19.default.log(voices);
|
|
46363
46325
|
this.voices = [];
|
|
46364
46326
|
voices.forEach((voice) => {
|
|
46365
46327
|
if (voice.localService === true) {
|
|
46366
46328
|
this.voices.push(voice);
|
|
46367
46329
|
}
|
|
46368
46330
|
});
|
|
46369
|
-
|
|
46370
|
-
console.log(this.voices);
|
|
46331
|
+
import_loglevel19.default.log(this.voices);
|
|
46371
46332
|
if (first) {
|
|
46372
46333
|
if (this.headerMenu) {
|
|
46373
46334
|
var preferredLanguageSelector = findElement(this.headerMenu, "#preferred-languages");
|
|
@@ -46463,8 +46424,7 @@ var TTSModule2 = class {
|
|
|
46463
46424
|
utterance.rate = this.tts.rate;
|
|
46464
46425
|
utterance.pitch = this.tts.pitch;
|
|
46465
46426
|
utterance.volume = this.tts.volume;
|
|
46466
|
-
|
|
46467
|
-
console.log("this.tts.voice.lang", this.tts.voice.lang);
|
|
46427
|
+
import_loglevel19.default.log("this.tts.voice.lang", this.tts.voice.lang);
|
|
46468
46428
|
var initialVoiceHasHyphen = true;
|
|
46469
46429
|
if (this.tts.voice && this.tts.voice.lang) {
|
|
46470
46430
|
initialVoiceHasHyphen = this.tts.voice.lang.indexOf("-") !== -1;
|
|
@@ -46473,10 +46433,8 @@ var TTSModule2 = class {
|
|
|
46473
46433
|
initialVoiceHasHyphen = true;
|
|
46474
46434
|
}
|
|
46475
46435
|
}
|
|
46476
|
-
|
|
46477
|
-
|
|
46478
|
-
if (IS_DEV)
|
|
46479
|
-
console.log("voices", this.voices);
|
|
46436
|
+
import_loglevel19.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
|
|
46437
|
+
import_loglevel19.default.log("voices", this.voices);
|
|
46480
46438
|
var initialVoice;
|
|
46481
46439
|
if (initialVoiceHasHyphen === true) {
|
|
46482
46440
|
initialVoice = this.tts.voice && this.tts.voice.lang && this.tts.voice.name ? this.voices.filter((v) => {
|
|
@@ -46494,11 +46452,9 @@ var TTSModule2 = class {
|
|
|
46494
46452
|
initialVoice = this.tts.voice && this.tts.voice.lang ? this.voices.filter((v) => v.lang === this.tts.voice.lang)[0] : void 0;
|
|
46495
46453
|
}
|
|
46496
46454
|
}
|
|
46497
|
-
|
|
46498
|
-
console.log("initialVoice", initialVoice);
|
|
46455
|
+
import_loglevel19.default.log("initialVoice", initialVoice);
|
|
46499
46456
|
var publicationVoiceHasHyphen = self2.delegate.publication.Metadata.Language[0].indexOf("-") !== -1;
|
|
46500
|
-
|
|
46501
|
-
console.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
|
|
46457
|
+
import_loglevel19.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
|
|
46502
46458
|
var publicationVoice;
|
|
46503
46459
|
if (publicationVoiceHasHyphen === true) {
|
|
46504
46460
|
publicationVoice = this.tts.voice && this.tts.voice.usePublication ? this.voices.filter((v) => {
|
|
@@ -46510,11 +46466,9 @@ var TTSModule2 = class {
|
|
|
46510
46466
|
return v.lang.startsWith(self2.delegate.publication.Metadata.Language[0]) || v.lang.endsWith(self2.delegate.publication.Metadata.Language[0].toUpperCase());
|
|
46511
46467
|
})[0] : void 0;
|
|
46512
46468
|
}
|
|
46513
|
-
|
|
46514
|
-
console.log("publicationVoice", publicationVoice);
|
|
46469
|
+
import_loglevel19.default.log("publicationVoice", publicationVoice);
|
|
46515
46470
|
var defaultVoiceHasHyphen = navigator.language.indexOf("-") !== -1;
|
|
46516
|
-
|
|
46517
|
-
console.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
|
|
46471
|
+
import_loglevel19.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
|
|
46518
46472
|
var defaultVoice;
|
|
46519
46473
|
if (defaultVoiceHasHyphen === true) {
|
|
46520
46474
|
defaultVoice = this.voices.filter((voice) => {
|
|
@@ -46533,30 +46487,23 @@ var TTSModule2 = class {
|
|
|
46533
46487
|
return lang.includes(navigator.language) && voice.localService === true;
|
|
46534
46488
|
})[0];
|
|
46535
46489
|
}
|
|
46536
|
-
|
|
46537
|
-
console.log("defaultVoice", defaultVoice);
|
|
46490
|
+
import_loglevel19.default.log("defaultVoice", defaultVoice);
|
|
46538
46491
|
if (initialVoice) {
|
|
46539
|
-
|
|
46540
|
-
console.log("initialVoice");
|
|
46492
|
+
import_loglevel19.default.log("initialVoice");
|
|
46541
46493
|
utterance.voice = initialVoice;
|
|
46542
46494
|
} else if (publicationVoice) {
|
|
46543
|
-
|
|
46544
|
-
console.log("publicationVoice");
|
|
46495
|
+
import_loglevel19.default.log("publicationVoice");
|
|
46545
46496
|
utterance.voice = publicationVoice;
|
|
46546
46497
|
} else if (defaultVoice) {
|
|
46547
|
-
|
|
46548
|
-
console.log("defaultVoice");
|
|
46498
|
+
import_loglevel19.default.log("defaultVoice");
|
|
46549
46499
|
utterance.voice = defaultVoice;
|
|
46550
46500
|
}
|
|
46551
46501
|
if (utterance.voice !== void 0 && utterance.voice !== null) {
|
|
46552
46502
|
utterance.lang = utterance.voice.lang;
|
|
46553
|
-
|
|
46554
|
-
|
|
46555
|
-
if (IS_DEV)
|
|
46556
|
-
console.log("utterance.lang", utterance.lang);
|
|
46503
|
+
import_loglevel19.default.log("utterance.voice.lang", utterance.voice.lang);
|
|
46504
|
+
import_loglevel19.default.log("utterance.lang", utterance.lang);
|
|
46557
46505
|
}
|
|
46558
|
-
|
|
46559
|
-
console.log("navigator.language", navigator.language);
|
|
46506
|
+
import_loglevel19.default.log("navigator.language", navigator.language);
|
|
46560
46507
|
setTimeout(() => {
|
|
46561
46508
|
window.speechSynthesis.speak(utterance);
|
|
46562
46509
|
}, 0);
|
|
@@ -46591,16 +46538,14 @@ var TTSModule2 = class {
|
|
|
46591
46538
|
onend();
|
|
46592
46539
|
}
|
|
46593
46540
|
if (idx > idxEnd) {
|
|
46594
|
-
|
|
46595
|
-
console.log("utterance ended");
|
|
46541
|
+
import_loglevel19.default.log("utterance ended");
|
|
46596
46542
|
self2.highlighter.doneSpeaking();
|
|
46597
46543
|
self2.api?.finished();
|
|
46598
46544
|
self2.delegate.emit("readaloud.finished", "finished");
|
|
46599
46545
|
}
|
|
46600
46546
|
}
|
|
46601
46547
|
} else {
|
|
46602
|
-
|
|
46603
|
-
console.log("utterance ended");
|
|
46548
|
+
import_loglevel19.default.log("utterance ended");
|
|
46604
46549
|
self2.highlighter.doneSpeaking();
|
|
46605
46550
|
self2.api?.finished();
|
|
46606
46551
|
self2.delegate.emit("readaloud.finished", "finished");
|
|
@@ -46717,9 +46662,7 @@ var TTSModule2 = class {
|
|
|
46717
46662
|
}
|
|
46718
46663
|
}
|
|
46719
46664
|
stop() {
|
|
46720
|
-
|
|
46721
|
-
console.log("TTS module stop");
|
|
46722
|
-
}
|
|
46665
|
+
import_loglevel19.default.log("TTS module stop");
|
|
46723
46666
|
removeEventListenerOptional(document, "wheel", this.wheel.bind(this));
|
|
46724
46667
|
removeEventListenerOptional(this.body, "wheel", this.wheel.bind(this));
|
|
46725
46668
|
removeEventListenerOptional(document, "keydown", this.wheel.bind(this));
|
|
@@ -46877,8 +46820,7 @@ var TTSModule2 = class {
|
|
|
46877
46820
|
utterance.rate = this.tts.rate;
|
|
46878
46821
|
utterance.pitch = this.tts.pitch;
|
|
46879
46822
|
utterance.volume = this.tts.volume;
|
|
46880
|
-
|
|
46881
|
-
console.log("this.tts.voice.lang", this.tts.voice.lang);
|
|
46823
|
+
import_loglevel19.default.log("this.tts.voice.lang", this.tts.voice.lang);
|
|
46882
46824
|
var initialVoiceHasHyphen = true;
|
|
46883
46825
|
if (this.tts.voice && this.tts.voice.lang) {
|
|
46884
46826
|
initialVoiceHasHyphen = this.tts.voice.lang.indexOf("-") !== -1;
|
|
@@ -46887,10 +46829,8 @@ var TTSModule2 = class {
|
|
|
46887
46829
|
initialVoiceHasHyphen = true;
|
|
46888
46830
|
}
|
|
46889
46831
|
}
|
|
46890
|
-
|
|
46891
|
-
|
|
46892
|
-
if (IS_DEV)
|
|
46893
|
-
console.log("voices", this.voices);
|
|
46832
|
+
import_loglevel19.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
|
|
46833
|
+
import_loglevel19.default.log("voices", this.voices);
|
|
46894
46834
|
var initialVoice;
|
|
46895
46835
|
if (initialVoiceHasHyphen === true) {
|
|
46896
46836
|
initialVoice = this.tts.voice && this.tts.voice.lang && this.tts.voice.name ? this.voices.filter((v) => {
|
|
@@ -46908,12 +46848,10 @@ var TTSModule2 = class {
|
|
|
46908
46848
|
initialVoice = this.tts.voice && this.tts.voice.lang ? this.voices.filter((v) => v.lang === this.tts.voice.lang)[0] : void 0;
|
|
46909
46849
|
}
|
|
46910
46850
|
}
|
|
46911
|
-
|
|
46912
|
-
console.log("initialVoice", initialVoice);
|
|
46851
|
+
import_loglevel19.default.log("initialVoice", initialVoice);
|
|
46913
46852
|
var self2 = this;
|
|
46914
46853
|
var publicationVoiceHasHyphen = self2.delegate.publication.Metadata.Language[0].indexOf("-") !== -1;
|
|
46915
|
-
|
|
46916
|
-
console.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
|
|
46854
|
+
import_loglevel19.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
|
|
46917
46855
|
var publicationVoice;
|
|
46918
46856
|
if (publicationVoiceHasHyphen === true) {
|
|
46919
46857
|
publicationVoice = this.tts.voice && this.tts.voice.usePublication ? this.voices.filter((v) => {
|
|
@@ -46925,11 +46863,9 @@ var TTSModule2 = class {
|
|
|
46925
46863
|
return v.lang.startsWith(self2.delegate.publication.Metadata.Language[0]) || v.lang.endsWith(self2.delegate.publication.Metadata.Language[0].toUpperCase());
|
|
46926
46864
|
})[0] : void 0;
|
|
46927
46865
|
}
|
|
46928
|
-
|
|
46929
|
-
console.log("publicationVoice", publicationVoice);
|
|
46866
|
+
import_loglevel19.default.log("publicationVoice", publicationVoice);
|
|
46930
46867
|
var defaultVoiceHasHyphen = navigator.language.indexOf("-") !== -1;
|
|
46931
|
-
|
|
46932
|
-
console.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
|
|
46868
|
+
import_loglevel19.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
|
|
46933
46869
|
var defaultVoice;
|
|
46934
46870
|
if (defaultVoiceHasHyphen === true) {
|
|
46935
46871
|
defaultVoice = this.voices.filter((voice) => {
|
|
@@ -46948,32 +46884,25 @@ var TTSModule2 = class {
|
|
|
46948
46884
|
return lang.includes(navigator.language) && voice.localService === true;
|
|
46949
46885
|
})[0];
|
|
46950
46886
|
}
|
|
46951
|
-
|
|
46952
|
-
console.log("defaultVoice", defaultVoice);
|
|
46887
|
+
import_loglevel19.default.log("defaultVoice", defaultVoice);
|
|
46953
46888
|
if (initialVoice) {
|
|
46954
|
-
|
|
46955
|
-
console.log("initialVoice");
|
|
46889
|
+
import_loglevel19.default.log("initialVoice");
|
|
46956
46890
|
utterance.voice = initialVoice;
|
|
46957
46891
|
} else if (publicationVoice) {
|
|
46958
|
-
|
|
46959
|
-
console.log("publicationVoice");
|
|
46892
|
+
import_loglevel19.default.log("publicationVoice");
|
|
46960
46893
|
utterance.voice = publicationVoice;
|
|
46961
46894
|
} else if (defaultVoice) {
|
|
46962
|
-
|
|
46963
|
-
console.log("defaultVoice");
|
|
46895
|
+
import_loglevel19.default.log("defaultVoice");
|
|
46964
46896
|
utterance.voice = defaultVoice;
|
|
46965
46897
|
}
|
|
46966
46898
|
if (utterance.voice !== void 0 && utterance.voice !== null) {
|
|
46967
46899
|
utterance.lang = utterance.voice.lang;
|
|
46968
|
-
|
|
46969
|
-
|
|
46970
|
-
if (IS_DEV)
|
|
46971
|
-
console.log("utterance.lang", utterance.lang);
|
|
46900
|
+
import_loglevel19.default.log("utterance.voice.lang", utterance.voice.lang);
|
|
46901
|
+
import_loglevel19.default.log("utterance.lang", utterance.lang);
|
|
46972
46902
|
}
|
|
46973
|
-
|
|
46974
|
-
console.log("navigator.language", navigator.language);
|
|
46903
|
+
import_loglevel19.default.log("navigator.language", navigator.language);
|
|
46975
46904
|
utterance.onboundary = (ev) => {
|
|
46976
|
-
|
|
46905
|
+
import_loglevel19.default.log(ev.name);
|
|
46977
46906
|
this.updateTTSInfo(ttsQueueItem, ev.charIndex, ev.charLength, utterance.text);
|
|
46978
46907
|
};
|
|
46979
46908
|
setTimeout(() => {
|
|
@@ -47017,14 +46946,12 @@ var TTSModule2 = class {
|
|
|
47017
46946
|
const ttsQueueItem = ttsQueueItemRef.item;
|
|
47018
46947
|
let txtToCheck = ttsQueueItemRef.item.combinedText;
|
|
47019
46948
|
let charIndexAdjusted = charIndex;
|
|
47020
|
-
if (
|
|
47021
|
-
|
|
47022
|
-
|
|
47023
|
-
|
|
47024
|
-
|
|
47025
|
-
|
|
47026
|
-
console.log("TTS word DIFF?? ", `[[${ttsWord}]]`, `[[${word}]]`, `${charIndex}--${charLength}`, `${start}--${end - start}`);
|
|
47027
|
-
}
|
|
46949
|
+
if (utteranceText !== txtToCheck) {
|
|
46950
|
+
import_loglevel19.default.log("TTS utteranceText DIFF?? ", `[[${utteranceText}]]`, `[[${txtToCheck}]]`);
|
|
46951
|
+
}
|
|
46952
|
+
const ttsWord = utteranceText.substr(charIndex, charLength);
|
|
46953
|
+
if (ttsWord !== word) {
|
|
46954
|
+
import_loglevel19.default.log("TTS word DIFF?? ", `[[${ttsWord}]]`, `[[${word}]]`, `${charIndex}--${charLength}`, `${start}--${end - start}`);
|
|
47028
46955
|
}
|
|
47029
46956
|
let acc = 0;
|
|
47030
46957
|
let rangeStartNode;
|
|
@@ -47062,8 +46989,8 @@ var TTSModule2 = class {
|
|
|
47062
46989
|
return "";
|
|
47063
46990
|
}
|
|
47064
46991
|
} catch (err) {
|
|
47065
|
-
|
|
47066
|
-
|
|
46992
|
+
import_loglevel19.default.log("uniqueCssSelector:");
|
|
46993
|
+
import_loglevel19.default.error(err);
|
|
47067
46994
|
return "";
|
|
47068
46995
|
}
|
|
47069
46996
|
};
|
|
@@ -47170,6 +47097,7 @@ function getTtsQueueItemRefText(obj) {
|
|
|
47170
47097
|
init_polyfills();
|
|
47171
47098
|
var lodash3 = __toModule(require_lodash());
|
|
47172
47099
|
var import_debounce7 = __toModule(require_debounce());
|
|
47100
|
+
var import_loglevel20 = __toModule(require_loglevel());
|
|
47173
47101
|
var DefinitionsModule = class {
|
|
47174
47102
|
constructor(delegate, publication, properties, highlighter, api) {
|
|
47175
47103
|
this.currentChapterPopupResult = [];
|
|
@@ -47194,9 +47122,7 @@ var DefinitionsModule = class {
|
|
|
47194
47122
|
return search;
|
|
47195
47123
|
}
|
|
47196
47124
|
async stop() {
|
|
47197
|
-
|
|
47198
|
-
console.log("Definitions module stop");
|
|
47199
|
-
}
|
|
47125
|
+
import_loglevel20.default.log("Definitions module stop");
|
|
47200
47126
|
}
|
|
47201
47127
|
async start() {
|
|
47202
47128
|
this.delegate.definitionsModule = this;
|
|
@@ -47318,6 +47244,7 @@ var DefinitionsModule = class {
|
|
|
47318
47244
|
|
|
47319
47245
|
// src/modules/linefocus/LineFocusModule.ts
|
|
47320
47246
|
init_polyfills();
|
|
47247
|
+
var import_loglevel21 = __toModule(require_loglevel());
|
|
47321
47248
|
var DEFAULT_BACKGROUND_COLOR_OPACITY2 = 0.5;
|
|
47322
47249
|
var LineFocusModule = class {
|
|
47323
47250
|
constructor(delegate, properties, highlighter, api) {
|
|
@@ -47342,9 +47269,7 @@ var LineFocusModule = class {
|
|
|
47342
47269
|
return search;
|
|
47343
47270
|
}
|
|
47344
47271
|
async stop() {
|
|
47345
|
-
|
|
47346
|
-
console.log("Definitions module stop");
|
|
47347
|
-
}
|
|
47272
|
+
import_loglevel21.default.log("Definitions module stop");
|
|
47348
47273
|
this.hasEventListener = false;
|
|
47349
47274
|
removeEventListenerOptional(document, "keydown", this.keydown.bind(this));
|
|
47350
47275
|
removeEventListenerOptional(document, "keyup", this.keyup.bind(this));
|
|
@@ -47739,11 +47664,9 @@ var LineFocusModule = class {
|
|
|
47739
47664
|
range.detach();
|
|
47740
47665
|
return rect;
|
|
47741
47666
|
} catch (error) {
|
|
47742
|
-
|
|
47743
|
-
|
|
47744
|
-
|
|
47745
|
-
console.log(node.textContent);
|
|
47746
|
-
}
|
|
47667
|
+
import_loglevel21.default.log("measureTextNode " + error);
|
|
47668
|
+
import_loglevel21.default.log("measureTextNode " + node);
|
|
47669
|
+
import_loglevel21.default.log(`${node.textContent}`);
|
|
47747
47670
|
}
|
|
47748
47671
|
}
|
|
47749
47672
|
measureImageNodes(node) {
|
|
@@ -47754,17 +47677,16 @@ var LineFocusModule = class {
|
|
|
47754
47677
|
range.detach();
|
|
47755
47678
|
return rect;
|
|
47756
47679
|
} catch (error) {
|
|
47757
|
-
|
|
47758
|
-
|
|
47759
|
-
|
|
47760
|
-
console.log(node.textContent);
|
|
47761
|
-
}
|
|
47680
|
+
import_loglevel21.default.log("measureTextNode " + error);
|
|
47681
|
+
import_loglevel21.default.log("measureTextNode " + node);
|
|
47682
|
+
import_loglevel21.default.log(`${node.textContent}`);
|
|
47762
47683
|
}
|
|
47763
47684
|
}
|
|
47764
47685
|
};
|
|
47765
47686
|
|
|
47766
47687
|
// src/modules/history/HistoryModule.ts
|
|
47767
47688
|
init_polyfills();
|
|
47689
|
+
var import_loglevel22 = __toModule(require_loglevel());
|
|
47768
47690
|
var HistoryModule = class {
|
|
47769
47691
|
constructor(annotator, delegate, publication, properties, headerMenu) {
|
|
47770
47692
|
this.history = [];
|
|
@@ -47780,9 +47702,7 @@ var HistoryModule = class {
|
|
|
47780
47702
|
return pageBreak;
|
|
47781
47703
|
}
|
|
47782
47704
|
async stop() {
|
|
47783
|
-
|
|
47784
|
-
console.log("Page Break module stop");
|
|
47785
|
-
}
|
|
47705
|
+
import_loglevel22.default.log("Page Break module stop");
|
|
47786
47706
|
removeEventListenerOptional(this.historyForwardAnchorElement, "click", this.handleHistoryForwardClick.bind(this));
|
|
47787
47707
|
removeEventListenerOptional(this.historyBackAnchorElement, "click", this.handleHistoryBackClick.bind(this));
|
|
47788
47708
|
}
|
|
@@ -47820,10 +47740,8 @@ var HistoryModule = class {
|
|
|
47820
47740
|
lastInHistory = this.history[this.history.length - 1];
|
|
47821
47741
|
if (lastInHistory && lastInHistory.href !== lastReadingPosition.href || lastInHistory === void 0) {
|
|
47822
47742
|
const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
|
|
47823
|
-
|
|
47824
|
-
|
|
47825
|
-
if (IS_DEV)
|
|
47826
|
-
console.log(linkHref);
|
|
47743
|
+
import_loglevel22.default.log(lastReadingPosition.href);
|
|
47744
|
+
import_loglevel22.default.log(linkHref);
|
|
47827
47745
|
lastReadingPosition.href = linkHref;
|
|
47828
47746
|
this.history.push(lastReadingPosition);
|
|
47829
47747
|
this.historyCurrentIndex = this.history.length - 1;
|
|
@@ -47873,6 +47791,7 @@ var HistoryModule = class {
|
|
|
47873
47791
|
|
|
47874
47792
|
// src/modules/citation/CitationModule.ts
|
|
47875
47793
|
init_polyfills();
|
|
47794
|
+
var import_loglevel23 = __toModule(require_loglevel());
|
|
47876
47795
|
var CitationStyle;
|
|
47877
47796
|
(function(CitationStyle2) {
|
|
47878
47797
|
CitationStyle2[CitationStyle2["Chicago"] = 0] = "Chicago";
|
|
@@ -47899,9 +47818,7 @@ var CitationModule = class {
|
|
|
47899
47818
|
return module;
|
|
47900
47819
|
}
|
|
47901
47820
|
async stop() {
|
|
47902
|
-
|
|
47903
|
-
console.log("Timeline module stop");
|
|
47904
|
-
}
|
|
47821
|
+
import_loglevel23.default.log("Timeline module stop");
|
|
47905
47822
|
}
|
|
47906
47823
|
copyToClipboard(textToClipboard) {
|
|
47907
47824
|
let success = true;
|
|
@@ -48322,7 +48239,7 @@ var D2Reader = class {
|
|
|
48322
48239
|
publication = TaJsonDeserialize(initialConfig.publication, Publication);
|
|
48323
48240
|
publication.manifestUrl = new URL(webPubManifestUrl);
|
|
48324
48241
|
} else {
|
|
48325
|
-
publication = await Publication.fromUrl(webPubManifestUrl, initialConfig.
|
|
48242
|
+
publication = await Publication.fromUrl(webPubManifestUrl, initialConfig.requestConfig);
|
|
48326
48243
|
}
|
|
48327
48244
|
const store = new LocalStorageStore({
|
|
48328
48245
|
prefix: publication.manifestUrl,
|
|
@@ -48337,17 +48254,16 @@ var D2Reader = class {
|
|
|
48337
48254
|
useLocalStorage: initialConfig.useLocalStorage ?? false
|
|
48338
48255
|
});
|
|
48339
48256
|
const annotator = new LocalAnnotator({ store });
|
|
48340
|
-
const upLink = initialConfig.upLinkUrl ?? void 0;
|
|
48341
48257
|
publication.sample = initialConfig.sample;
|
|
48342
48258
|
rights = updateConfig(rights, publication);
|
|
48343
48259
|
if (rights.autoGeneratePositions) {
|
|
48344
|
-
await publication.autoGeneratePositions(initialConfig.
|
|
48260
|
+
await publication.autoGeneratePositions(initialConfig.requestConfig);
|
|
48345
48261
|
} else {
|
|
48346
48262
|
if (initialConfig.services?.positions) {
|
|
48347
|
-
await publication.fetchPositionsFromService(initialConfig.services?.positions.href, initialConfig.
|
|
48263
|
+
await publication.fetchPositionsFromService(initialConfig.services?.positions.href, initialConfig.requestConfig);
|
|
48348
48264
|
}
|
|
48349
48265
|
if (initialConfig.services?.weight) {
|
|
48350
|
-
await publication.fetchWeightsFromService(initialConfig.services?.weight.href, initialConfig.
|
|
48266
|
+
await publication.fetchWeightsFromService(initialConfig.services?.weight.href, initialConfig.requestConfig);
|
|
48351
48267
|
}
|
|
48352
48268
|
}
|
|
48353
48269
|
const layers = await LayerSettings.create({ store: layerStore });
|
|
@@ -48355,7 +48271,6 @@ var D2Reader = class {
|
|
|
48355
48271
|
store: settingsStore,
|
|
48356
48272
|
initialUserSettings: initialConfig.userSettings,
|
|
48357
48273
|
headerMenu,
|
|
48358
|
-
material: initialConfig.material,
|
|
48359
48274
|
api: initialConfig.api,
|
|
48360
48275
|
injectables: (publication.Metadata.Rendition?.Layout ?? "unknown") === "fixed" ? initialConfig.injectablesFixed : initialConfig.injectables,
|
|
48361
48276
|
layout: (publication.Metadata.Rendition?.Layout ?? "unknown") === "fixed" ? "fixed" : "reflowable"
|
|
@@ -48367,15 +48282,13 @@ var D2Reader = class {
|
|
|
48367
48282
|
publication,
|
|
48368
48283
|
settings,
|
|
48369
48284
|
annotator,
|
|
48370
|
-
upLink,
|
|
48371
48285
|
initialLastReadingPosition: initialConfig.lastReadingPosition,
|
|
48372
|
-
material: initialConfig.material,
|
|
48373
48286
|
api: initialConfig.api,
|
|
48374
48287
|
rights,
|
|
48375
48288
|
tts: initialConfig.tts,
|
|
48376
48289
|
sample: initialConfig.sample,
|
|
48377
|
-
|
|
48378
|
-
injectables: (publication.Metadata.Rendition?.Layout ?? "unknown") === "fixed" ? initialConfig.injectablesFixed : initialConfig.injectables,
|
|
48290
|
+
requestConfig: initialConfig.requestConfig,
|
|
48291
|
+
injectables: (publication.Metadata.Rendition?.Layout ?? "unknown") === "fixed" ? initialConfig.injectablesFixed ?? [] : initialConfig.injectables,
|
|
48379
48292
|
attributes: initialConfig.attributes,
|
|
48380
48293
|
services: initialConfig.services
|
|
48381
48294
|
});
|
|
@@ -48420,7 +48333,8 @@ var D2Reader = class {
|
|
|
48420
48333
|
headerMenu,
|
|
48421
48334
|
delegate: navigator2,
|
|
48422
48335
|
publication,
|
|
48423
|
-
highlighter
|
|
48336
|
+
highlighter,
|
|
48337
|
+
requestConfig: initialConfig.requestConfig
|
|
48424
48338
|
}, initialConfig.search)) : void 0;
|
|
48425
48339
|
const definitionsModule = rights.enableDefinitions ? await DefinitionsModule.create(__spreadValues({
|
|
48426
48340
|
delegate: navigator2,
|