@d-i-t-a/reader 2.4.4 → 2.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +377 -241
- package/dist/esm/index.js.map +3 -3
- package/dist/reader.js +55 -55
- package/dist/reader.js.map +3 -3
- package/dist/types/model/user-settings/ReadiumCSS.d.ts +2 -0
- package/dist/types/model/user-settings/UserSettings.d.ts +5 -0
- package/dist/types/modules/AnnotationModule.d.ts +1 -1
- package/dist/types/modules/consumption/ConsumptionModule.d.ts +1 -1
- package/dist/types/modules/highlight/TextHighlighter.d.ts +1 -1
- package/dist/types/modules/linefocus/LineFocusModule.d.ts +1 -1
- package/dist/types/modules/protection/ContentProtectionModule.d.ts +1 -1
- package/dist/types/navigator/IFrameNavigator.d.ts +3 -0
- package/dist/types/reader.d.ts +1 -0
- package/dist/types/store/LocalStorageStore.d.ts +2 -0
- package/dist/types/utils/KeyboardEventHandler.d.ts +1 -0
- package/package.json +6 -3
package/dist/esm/index.js
CHANGED
|
@@ -5225,7 +5225,7 @@ var require_metadata_encrypted = __commonJS({
|
|
|
5225
5225
|
exports2.Encrypted = void 0;
|
|
5226
5226
|
var tslib_1 = (init_tslib_es62(), __toCommonJS(tslib_es6_exports2));
|
|
5227
5227
|
var ta_json_x_1 = require_cjs();
|
|
5228
|
-
var Encrypted =
|
|
5228
|
+
var Encrypted = class Encrypted {
|
|
5229
5229
|
constructor() {
|
|
5230
5230
|
this.DecryptedLengthBeforeInflate = -1;
|
|
5231
5231
|
this.CypherBlockPadding = -1;
|
|
@@ -5240,6 +5240,7 @@ var require_metadata_encrypted = __commonJS({
|
|
|
5240
5240
|
}
|
|
5241
5241
|
}
|
|
5242
5242
|
};
|
|
5243
|
+
exports2.Encrypted = Encrypted;
|
|
5243
5244
|
tslib_1.__decorate([
|
|
5244
5245
|
(0, ta_json_x_1.JsonProperty)("scheme"),
|
|
5245
5246
|
tslib_1.__metadata("design:type", String)
|
|
@@ -5312,8 +5313,9 @@ var require_metadata_properties = __commonJS({
|
|
|
5312
5313
|
SpreadEnum2["Landscape"] = "landscape";
|
|
5313
5314
|
})(SpreadEnum || (exports2.SpreadEnum = SpreadEnum = {}));
|
|
5314
5315
|
exports2.PropertiesSupportedKeys = ["contains", "layout", "orientation", "overflow", "page", "spread", "encrypted", "media-overlay"];
|
|
5315
|
-
var Properties =
|
|
5316
|
+
var Properties = class Properties {
|
|
5316
5317
|
};
|
|
5318
|
+
exports2.Properties = Properties;
|
|
5317
5319
|
tslib_1.__decorate([
|
|
5318
5320
|
(0, ta_json_x_1.JsonProperty)("contains"),
|
|
5319
5321
|
(0, ta_json_x_1.JsonElementType)(String),
|
|
@@ -5358,7 +5360,6 @@ var require_publication_link = __commonJS({
|
|
|
5358
5360
|
"node_modules/r2-shared-js/dist/es6-es2015/src/models/publication-link.js"(exports2) {
|
|
5359
5361
|
"use strict";
|
|
5360
5362
|
init_polyfills();
|
|
5361
|
-
var Link_1;
|
|
5362
5363
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
5363
5364
|
exports2.Link = void 0;
|
|
5364
5365
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
@@ -5369,7 +5370,7 @@ var require_publication_link = __commonJS({
|
|
|
5369
5370
|
var PROPERTIES_JSON_PROP = "properties";
|
|
5370
5371
|
var CHILDREN_JSON_PROP = "children";
|
|
5371
5372
|
var ALTERNATE_JSON_PROP = "alternate";
|
|
5372
|
-
var Link2 =
|
|
5373
|
+
var Link2 = class Link {
|
|
5373
5374
|
get Href() {
|
|
5374
5375
|
return this.Href1;
|
|
5375
5376
|
}
|
|
@@ -5422,6 +5423,7 @@ var require_publication_link = __commonJS({
|
|
|
5422
5423
|
}
|
|
5423
5424
|
}
|
|
5424
5425
|
};
|
|
5426
|
+
exports2.Link = Link2;
|
|
5425
5427
|
tslib_1.__decorate([
|
|
5426
5428
|
(0, ta_json_x_1.JsonProperty)("type"),
|
|
5427
5429
|
tslib_1.__metadata("design:type", String)
|
|
@@ -5456,12 +5458,12 @@ var require_publication_link = __commonJS({
|
|
|
5456
5458
|
], Link2.prototype, "Templated", void 0);
|
|
5457
5459
|
tslib_1.__decorate([
|
|
5458
5460
|
(0, ta_json_x_1.JsonProperty)(CHILDREN_JSON_PROP),
|
|
5459
|
-
(0, ta_json_x_1.JsonElementType)(
|
|
5461
|
+
(0, ta_json_x_1.JsonElementType)(Link2),
|
|
5460
5462
|
tslib_1.__metadata("design:type", Array)
|
|
5461
5463
|
], Link2.prototype, "Children", void 0);
|
|
5462
5464
|
tslib_1.__decorate([
|
|
5463
5465
|
(0, ta_json_x_1.JsonProperty)(ALTERNATE_JSON_PROP),
|
|
5464
|
-
(0, ta_json_x_1.JsonElementType)(
|
|
5466
|
+
(0, ta_json_x_1.JsonElementType)(Link2),
|
|
5465
5467
|
tslib_1.__metadata("design:type", Array)
|
|
5466
5468
|
], Link2.prototype, "Alternate", void 0);
|
|
5467
5469
|
tslib_1.__decorate([
|
|
@@ -5480,7 +5482,7 @@ var require_publication_link = __commonJS({
|
|
|
5480
5482
|
tslib_1.__metadata("design:paramtypes", []),
|
|
5481
5483
|
tslib_1.__metadata("design:returntype", void 0)
|
|
5482
5484
|
], Link2.prototype, "_OnDeserialized", null);
|
|
5483
|
-
exports2.Link = Link2 =
|
|
5485
|
+
exports2.Link = Link2 = tslib_1.__decorate([
|
|
5484
5486
|
(0, ta_json_x_1.JsonObject)()
|
|
5485
5487
|
], Link2);
|
|
5486
5488
|
}
|
|
@@ -5498,7 +5500,7 @@ var require_metadata_contributor = __commonJS({
|
|
|
5498
5500
|
var ta_json_string_converter_1 = require_ta_json_string_converter();
|
|
5499
5501
|
var publication_link_1 = require_publication_link();
|
|
5500
5502
|
var LINKS_JSON_PROP = "links";
|
|
5501
|
-
var Contributor =
|
|
5503
|
+
var Contributor = class Contributor {
|
|
5502
5504
|
get SortAs() {
|
|
5503
5505
|
return this.SortAs2 ? this.SortAs2 : this.SortAs1;
|
|
5504
5506
|
}
|
|
@@ -5514,6 +5516,7 @@ var require_metadata_contributor = __commonJS({
|
|
|
5514
5516
|
}
|
|
5515
5517
|
}
|
|
5516
5518
|
};
|
|
5519
|
+
exports2.Contributor = Contributor;
|
|
5517
5520
|
tslib_1.__decorate([
|
|
5518
5521
|
(0, ta_json_x_1.JsonProperty)("name"),
|
|
5519
5522
|
tslib_1.__metadata("design:type", Object)
|
|
@@ -5624,8 +5627,9 @@ var require_metadata_belongsto = __commonJS({
|
|
|
5624
5627
|
var metadata_contributor_json_converter_1 = require_metadata_contributor_json_converter();
|
|
5625
5628
|
var SERIES_JSON_PROP = "series";
|
|
5626
5629
|
var COLLECTION_JSON_PROP = "collection";
|
|
5627
|
-
var BelongsTo =
|
|
5630
|
+
var BelongsTo = class BelongsTo {
|
|
5628
5631
|
};
|
|
5632
|
+
exports2.BelongsTo = BelongsTo;
|
|
5629
5633
|
tslib_1.__decorate([
|
|
5630
5634
|
(0, ta_json_x_1.JsonProperty)(SERIES_JSON_PROP),
|
|
5631
5635
|
(0, ta_json_x_1.JsonElementType)(metadata_contributor_1.Contributor),
|
|
@@ -5653,8 +5657,9 @@ var require_metadata_media_overlay = __commonJS({
|
|
|
5653
5657
|
exports2.MediaOverlay = void 0;
|
|
5654
5658
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
5655
5659
|
var ta_json_x_1 = require_cjs();
|
|
5656
|
-
var MediaOverlay =
|
|
5660
|
+
var MediaOverlay = class MediaOverlay {
|
|
5657
5661
|
};
|
|
5662
|
+
exports2.MediaOverlay = MediaOverlay;
|
|
5658
5663
|
tslib_1.__decorate([
|
|
5659
5664
|
(0, ta_json_x_1.JsonProperty)("active-class"),
|
|
5660
5665
|
tslib_1.__metadata("design:type", String)
|
|
@@ -5680,7 +5685,7 @@ var require_metadata_subject = __commonJS({
|
|
|
5680
5685
|
var ta_json_x_1 = require_cjs();
|
|
5681
5686
|
var publication_link_1 = require_publication_link();
|
|
5682
5687
|
var LINKS_JSON_PROP = "links";
|
|
5683
|
-
var Subject =
|
|
5688
|
+
var Subject = class Subject {
|
|
5684
5689
|
get SortAs() {
|
|
5685
5690
|
return this.SortAs2 ? this.SortAs2 : this.SortAs1;
|
|
5686
5691
|
}
|
|
@@ -5696,6 +5701,7 @@ var require_metadata_subject = __commonJS({
|
|
|
5696
5701
|
}
|
|
5697
5702
|
}
|
|
5698
5703
|
};
|
|
5704
|
+
exports2.Subject = Subject;
|
|
5699
5705
|
tslib_1.__decorate([
|
|
5700
5706
|
(0, ta_json_x_1.JsonProperty)("name"),
|
|
5701
5707
|
tslib_1.__metadata("design:type", Object)
|
|
@@ -5777,8 +5783,9 @@ var require_metadata_accessibility_certification = __commonJS({
|
|
|
5777
5783
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
5778
5784
|
var ta_json_x_1 = require_cjs();
|
|
5779
5785
|
var ta_json_string_converter_1 = require_ta_json_string_converter();
|
|
5780
|
-
var AccessibilityCertification =
|
|
5786
|
+
var AccessibilityCertification = class AccessibilityCertification {
|
|
5781
5787
|
};
|
|
5788
|
+
exports2.AccessibilityCertification = AccessibilityCertification;
|
|
5782
5789
|
tslib_1.__decorate([
|
|
5783
5790
|
(0, ta_json_x_1.JsonProperty)("certifiedBy"),
|
|
5784
5791
|
(0, ta_json_x_1.JsonConverter)(ta_json_string_converter_1.JsonStringConverter),
|
|
@@ -5814,8 +5821,9 @@ var require_metadata_accessibility = __commonJS({
|
|
|
5814
5821
|
var ta_json_x_1 = require_cjs();
|
|
5815
5822
|
var ta_json_string_converter_1 = require_ta_json_string_converter();
|
|
5816
5823
|
var metadata_accessibility_certification_1 = require_metadata_accessibility_certification();
|
|
5817
|
-
var AccessibilityMetadata =
|
|
5824
|
+
var AccessibilityMetadata = class AccessibilityMetadata {
|
|
5818
5825
|
};
|
|
5826
|
+
exports2.AccessibilityMetadata = AccessibilityMetadata;
|
|
5819
5827
|
tslib_1.__decorate([
|
|
5820
5828
|
(0, ta_json_x_1.JsonProperty)("certification"),
|
|
5821
5829
|
tslib_1.__metadata("design:type", metadata_accessibility_certification_1.AccessibilityCertification)
|
|
@@ -5935,7 +5943,7 @@ var require_metadata = __commonJS({
|
|
|
5935
5943
|
"source",
|
|
5936
5944
|
"subject"
|
|
5937
5945
|
];
|
|
5938
|
-
var Metadata =
|
|
5946
|
+
var Metadata = class Metadata {
|
|
5939
5947
|
get SortAs() {
|
|
5940
5948
|
return this.SortAs2 ? this.SortAs2 : this.SortAs1;
|
|
5941
5949
|
}
|
|
@@ -5969,6 +5977,7 @@ var require_metadata = __commonJS({
|
|
|
5969
5977
|
}
|
|
5970
5978
|
}
|
|
5971
5979
|
};
|
|
5980
|
+
exports2.Metadata = Metadata;
|
|
5972
5981
|
tslib_1.__decorate([
|
|
5973
5982
|
(0, ta_json_x_1.JsonProperty)("accessibility"),
|
|
5974
5983
|
tslib_1.__metadata("design:type", metadata_accessibility_1.AccessibilityMetadata)
|
|
@@ -6241,7 +6250,7 @@ var require_publication = __commonJS({
|
|
|
6241
6250
|
var LOA_JSON_PROP = "loa";
|
|
6242
6251
|
var LOV_JSON_PROP = "lov";
|
|
6243
6252
|
var LOT_JSON_PROP = "lot";
|
|
6244
|
-
var Publication2 =
|
|
6253
|
+
var Publication2 = class Publication {
|
|
6245
6254
|
get Spine() {
|
|
6246
6255
|
return this.Spine2 ? this.Spine2 : this.Spine1;
|
|
6247
6256
|
}
|
|
@@ -6348,6 +6357,7 @@ var require_publication = __commonJS({
|
|
|
6348
6357
|
}
|
|
6349
6358
|
}
|
|
6350
6359
|
};
|
|
6360
|
+
exports2.Publication = Publication2;
|
|
6351
6361
|
tslib_1.__decorate([
|
|
6352
6362
|
(0, ta_json_x_1.JsonProperty)("@context"),
|
|
6353
6363
|
(0, ta_json_x_1.JsonElementType)(String),
|
|
@@ -15309,6 +15319,8 @@ var require_loglevel = __commonJS({
|
|
|
15309
15319
|
"warn",
|
|
15310
15320
|
"error"
|
|
15311
15321
|
];
|
|
15322
|
+
var _loggersByName = {};
|
|
15323
|
+
var defaultLogger = null;
|
|
15312
15324
|
function bindMethod(obj, methodName) {
|
|
15313
15325
|
var method = obj[methodName];
|
|
15314
15326
|
if (typeof method.bind === "function") {
|
|
@@ -15350,28 +15362,33 @@ var require_loglevel = __commonJS({
|
|
|
15350
15362
|
return noop;
|
|
15351
15363
|
}
|
|
15352
15364
|
}
|
|
15353
|
-
function replaceLoggingMethods(
|
|
15365
|
+
function replaceLoggingMethods() {
|
|
15366
|
+
var level = this.getLevel();
|
|
15354
15367
|
for (var i = 0; i < logMethods.length; i++) {
|
|
15355
15368
|
var methodName = logMethods[i];
|
|
15356
|
-
this[methodName] = i < level ? noop : this.methodFactory(methodName, level,
|
|
15369
|
+
this[methodName] = i < level ? noop : this.methodFactory(methodName, level, this.name);
|
|
15357
15370
|
}
|
|
15358
15371
|
this.log = this.debug;
|
|
15372
|
+
if (typeof console === undefinedType && level < this.levels.SILENT) {
|
|
15373
|
+
return "No console available for logging";
|
|
15374
|
+
}
|
|
15359
15375
|
}
|
|
15360
|
-
function enableLoggingWhenConsoleArrives(methodName
|
|
15376
|
+
function enableLoggingWhenConsoleArrives(methodName) {
|
|
15361
15377
|
return function() {
|
|
15362
15378
|
if (typeof console !== undefinedType) {
|
|
15363
|
-
replaceLoggingMethods.call(this
|
|
15379
|
+
replaceLoggingMethods.call(this);
|
|
15364
15380
|
this[methodName].apply(this, arguments);
|
|
15365
15381
|
}
|
|
15366
15382
|
};
|
|
15367
15383
|
}
|
|
15368
|
-
function defaultMethodFactory(methodName,
|
|
15384
|
+
function defaultMethodFactory(methodName, _level, _loggerName) {
|
|
15369
15385
|
return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments);
|
|
15370
15386
|
}
|
|
15371
|
-
function Logger(name,
|
|
15387
|
+
function Logger(name, factory) {
|
|
15372
15388
|
var self2 = this;
|
|
15373
|
-
var
|
|
15374
|
-
|
|
15389
|
+
var inheritedLevel;
|
|
15390
|
+
var defaultLevel;
|
|
15391
|
+
var userLevel;
|
|
15375
15392
|
var storageKey = "loglevel";
|
|
15376
15393
|
if (typeof name === "string") {
|
|
15377
15394
|
storageKey += ":" + name;
|
|
@@ -15403,11 +15420,12 @@ var require_loglevel = __commonJS({
|
|
|
15403
15420
|
if (typeof storedLevel === undefinedType) {
|
|
15404
15421
|
try {
|
|
15405
15422
|
var cookie = window.document.cookie;
|
|
15406
|
-
var
|
|
15407
|
-
|
|
15408
|
-
);
|
|
15423
|
+
var cookieName = encodeURIComponent(storageKey);
|
|
15424
|
+
var location = cookie.indexOf(cookieName + "=");
|
|
15409
15425
|
if (location !== -1) {
|
|
15410
|
-
storedLevel = /^([^;]+)/.exec(
|
|
15426
|
+
storedLevel = /^([^;]+)/.exec(
|
|
15427
|
+
cookie.slice(location + cookieName.length + 1)
|
|
15428
|
+
)[1];
|
|
15411
15429
|
}
|
|
15412
15430
|
} catch (ignore) {
|
|
15413
15431
|
}
|
|
@@ -15422,7 +15440,6 @@ var require_loglevel = __commonJS({
|
|
|
15422
15440
|
return;
|
|
15423
15441
|
try {
|
|
15424
15442
|
window.localStorage.removeItem(storageKey);
|
|
15425
|
-
return;
|
|
15426
15443
|
} catch (ignore) {
|
|
15427
15444
|
}
|
|
15428
15445
|
try {
|
|
@@ -15430,6 +15447,17 @@ var require_loglevel = __commonJS({
|
|
|
15430
15447
|
} catch (ignore) {
|
|
15431
15448
|
}
|
|
15432
15449
|
}
|
|
15450
|
+
function normalizeLevel(input) {
|
|
15451
|
+
var level = input;
|
|
15452
|
+
if (typeof level === "string" && self2.levels[level.toUpperCase()] !== void 0) {
|
|
15453
|
+
level = self2.levels[level.toUpperCase()];
|
|
15454
|
+
}
|
|
15455
|
+
if (typeof level === "number" && level >= 0 && level <= self2.levels.SILENT) {
|
|
15456
|
+
return level;
|
|
15457
|
+
} else {
|
|
15458
|
+
throw new TypeError("log.setLevel() called with invalid level: " + input);
|
|
15459
|
+
}
|
|
15460
|
+
}
|
|
15433
15461
|
self2.name = name;
|
|
15434
15462
|
self2.levels = {
|
|
15435
15463
|
"TRACE": 0,
|
|
@@ -15441,34 +15469,31 @@ var require_loglevel = __commonJS({
|
|
|
15441
15469
|
};
|
|
15442
15470
|
self2.methodFactory = factory || defaultMethodFactory;
|
|
15443
15471
|
self2.getLevel = function() {
|
|
15444
|
-
|
|
15472
|
+
if (userLevel != null) {
|
|
15473
|
+
return userLevel;
|
|
15474
|
+
} else if (defaultLevel != null) {
|
|
15475
|
+
return defaultLevel;
|
|
15476
|
+
} else {
|
|
15477
|
+
return inheritedLevel;
|
|
15478
|
+
}
|
|
15445
15479
|
};
|
|
15446
15480
|
self2.setLevel = function(level, persist) {
|
|
15447
|
-
|
|
15448
|
-
|
|
15449
|
-
|
|
15450
|
-
if (typeof level === "number" && level >= 0 && level <= self2.levels.SILENT) {
|
|
15451
|
-
currentLevel = level;
|
|
15452
|
-
if (persist !== false) {
|
|
15453
|
-
persistLevelIfPossible(level);
|
|
15454
|
-
}
|
|
15455
|
-
replaceLoggingMethods.call(self2, level, name);
|
|
15456
|
-
if (typeof console === undefinedType && level < self2.levels.SILENT) {
|
|
15457
|
-
return "No console available for logging";
|
|
15458
|
-
}
|
|
15459
|
-
} else {
|
|
15460
|
-
throw "log.setLevel() called with invalid level: " + level;
|
|
15481
|
+
userLevel = normalizeLevel(level);
|
|
15482
|
+
if (persist !== false) {
|
|
15483
|
+
persistLevelIfPossible(userLevel);
|
|
15461
15484
|
}
|
|
15485
|
+
return replaceLoggingMethods.call(self2);
|
|
15462
15486
|
};
|
|
15463
15487
|
self2.setDefaultLevel = function(level) {
|
|
15464
|
-
defaultLevel = level;
|
|
15488
|
+
defaultLevel = normalizeLevel(level);
|
|
15465
15489
|
if (!getPersistedLevel()) {
|
|
15466
15490
|
self2.setLevel(level, false);
|
|
15467
15491
|
}
|
|
15468
15492
|
};
|
|
15469
15493
|
self2.resetLevel = function() {
|
|
15470
|
-
|
|
15494
|
+
userLevel = null;
|
|
15471
15495
|
clearPersistedLevel();
|
|
15496
|
+
replaceLoggingMethods.call(self2);
|
|
15472
15497
|
};
|
|
15473
15498
|
self2.enableAll = function(persist) {
|
|
15474
15499
|
self2.setLevel(self2.levels.TRACE, persist);
|
|
@@ -15476,14 +15501,27 @@ var require_loglevel = __commonJS({
|
|
|
15476
15501
|
self2.disableAll = function(persist) {
|
|
15477
15502
|
self2.setLevel(self2.levels.SILENT, persist);
|
|
15478
15503
|
};
|
|
15504
|
+
self2.rebuild = function() {
|
|
15505
|
+
if (defaultLogger !== self2) {
|
|
15506
|
+
inheritedLevel = normalizeLevel(defaultLogger.getLevel());
|
|
15507
|
+
}
|
|
15508
|
+
replaceLoggingMethods.call(self2);
|
|
15509
|
+
if (defaultLogger === self2) {
|
|
15510
|
+
for (var childName in _loggersByName) {
|
|
15511
|
+
_loggersByName[childName].rebuild();
|
|
15512
|
+
}
|
|
15513
|
+
}
|
|
15514
|
+
};
|
|
15515
|
+
inheritedLevel = normalizeLevel(
|
|
15516
|
+
defaultLogger ? defaultLogger.getLevel() : "WARN"
|
|
15517
|
+
);
|
|
15479
15518
|
var initialLevel = getPersistedLevel();
|
|
15480
|
-
if (initialLevel
|
|
15481
|
-
|
|
15519
|
+
if (initialLevel != null) {
|
|
15520
|
+
userLevel = normalizeLevel(initialLevel);
|
|
15482
15521
|
}
|
|
15483
|
-
|
|
15522
|
+
replaceLoggingMethods.call(self2);
|
|
15484
15523
|
}
|
|
15485
|
-
|
|
15486
|
-
var _loggersByName = {};
|
|
15524
|
+
defaultLogger = new Logger();
|
|
15487
15525
|
defaultLogger.getLogger = function getLogger(name) {
|
|
15488
15526
|
if (typeof name !== "symbol" && typeof name !== "string" || name === "") {
|
|
15489
15527
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
@@ -15492,7 +15530,6 @@ var require_loglevel = __commonJS({
|
|
|
15492
15530
|
if (!logger) {
|
|
15493
15531
|
logger = _loggersByName[name] = new Logger(
|
|
15494
15532
|
name,
|
|
15495
|
-
defaultLogger.getLevel(),
|
|
15496
15533
|
defaultLogger.methodFactory
|
|
15497
15534
|
);
|
|
15498
15535
|
}
|
|
@@ -21344,7 +21381,6 @@ var require_media_overlay = __commonJS({
|
|
|
21344
21381
|
"node_modules/r2-shared-js/dist/es6-es2015/src/models/media-overlay.js"(exports2) {
|
|
21345
21382
|
"use strict";
|
|
21346
21383
|
init_polyfills();
|
|
21347
|
-
var MediaOverlayNode_1;
|
|
21348
21384
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
21349
21385
|
exports2.MediaOverlayNode = exports2.timeStrToSeconds = void 0;
|
|
21350
21386
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
@@ -21407,11 +21443,12 @@ var require_media_overlay = __commonJS({
|
|
|
21407
21443
|
return hours * 3600 + minutes * 60 + seconds;
|
|
21408
21444
|
}
|
|
21409
21445
|
exports2.timeStrToSeconds = timeStrToSeconds;
|
|
21410
|
-
var MediaOverlayNode2 =
|
|
21446
|
+
var MediaOverlayNode2 = class MediaOverlayNode {
|
|
21411
21447
|
constructor() {
|
|
21412
21448
|
this.initialized = false;
|
|
21413
21449
|
}
|
|
21414
21450
|
};
|
|
21451
|
+
exports2.MediaOverlayNode = MediaOverlayNode2;
|
|
21415
21452
|
tslib_1.__decorate([
|
|
21416
21453
|
(0, ta_json_x_1.JsonProperty)("text"),
|
|
21417
21454
|
tslib_1.__metadata("design:type", String)
|
|
@@ -21428,10 +21465,10 @@ var require_media_overlay = __commonJS({
|
|
|
21428
21465
|
], MediaOverlayNode2.prototype, "Role", void 0);
|
|
21429
21466
|
tslib_1.__decorate([
|
|
21430
21467
|
(0, ta_json_x_1.JsonProperty)("narration"),
|
|
21431
|
-
(0, ta_json_x_1.JsonElementType)(
|
|
21468
|
+
(0, ta_json_x_1.JsonElementType)(MediaOverlayNode2),
|
|
21432
21469
|
tslib_1.__metadata("design:type", Array)
|
|
21433
21470
|
], MediaOverlayNode2.prototype, "Children", void 0);
|
|
21434
|
-
exports2.MediaOverlayNode = MediaOverlayNode2 =
|
|
21471
|
+
exports2.MediaOverlayNode = MediaOverlayNode2 = tslib_1.__decorate([
|
|
21435
21472
|
(0, ta_json_x_1.JsonObject)()
|
|
21436
21473
|
], MediaOverlayNode2);
|
|
21437
21474
|
}
|
|
@@ -46067,6 +46104,7 @@ _ReadiumCSS.SCROLL_REF = "scroll";
|
|
|
46067
46104
|
// static readonly PUBLISHER_DEFAULT_REF = "advancedSettings";
|
|
46068
46105
|
_ReadiumCSS.TEXT_ALIGNMENT_REF = "textAlign";
|
|
46069
46106
|
_ReadiumCSS.COLUMN_COUNT_REF = "colCount";
|
|
46107
|
+
_ReadiumCSS.DIRECTION_REF = "direction";
|
|
46070
46108
|
_ReadiumCSS.WORD_SPACING_REF = "wordSpacing";
|
|
46071
46109
|
_ReadiumCSS.LETTER_SPACING_REF = "letterSpacing";
|
|
46072
46110
|
_ReadiumCSS.PAGE_MARGINS_REF = "pageMargins";
|
|
@@ -46080,6 +46118,7 @@ _ReadiumCSS.SCROLL_KEY = "--USER__" + _ReadiumCSS.SCROLL_REF;
|
|
|
46080
46118
|
// "--USER__" + ReadiumCSS.PUBLISHER_DEFAULT_REF;
|
|
46081
46119
|
_ReadiumCSS.TEXT_ALIGNMENT_KEY = "--USER__" + _ReadiumCSS.TEXT_ALIGNMENT_REF;
|
|
46082
46120
|
_ReadiumCSS.COLUMN_COUNT_KEY = "--USER__" + _ReadiumCSS.COLUMN_COUNT_REF;
|
|
46121
|
+
_ReadiumCSS.DIRECTION_KEY = "--USER__" + _ReadiumCSS.DIRECTION_REF;
|
|
46083
46122
|
_ReadiumCSS.WORD_SPACING_KEY = "--USER__" + _ReadiumCSS.WORD_SPACING_REF;
|
|
46084
46123
|
_ReadiumCSS.LETTER_SPACING_KEY = "--USER__" + _ReadiumCSS.LETTER_SPACING_REF;
|
|
46085
46124
|
_ReadiumCSS.PAGE_MARGINS_KEY = "--USER__" + _ReadiumCSS.PAGE_MARGINS_REF;
|
|
@@ -47019,6 +47058,7 @@ var _UserSettings = class _UserSettings {
|
|
|
47019
47058
|
// publisherDefaults = true;
|
|
47020
47059
|
this.textAlignment = 0;
|
|
47021
47060
|
this.columnCount = 0;
|
|
47061
|
+
this.direction = 0;
|
|
47022
47062
|
this.wordSpacing = 0;
|
|
47023
47063
|
this.letterSpacing = 0;
|
|
47024
47064
|
this.pageMargins = 2;
|
|
@@ -47141,6 +47181,17 @@ var _UserSettings = class _UserSettings {
|
|
|
47141
47181
|
}
|
|
47142
47182
|
import_loglevel2.default.log(settings.columnCount);
|
|
47143
47183
|
}
|
|
47184
|
+
if (initialUserSettings.direction) {
|
|
47185
|
+
settings.direction = _UserSettings.directionValues.findIndex(
|
|
47186
|
+
(el) => el === initialUserSettings.direction
|
|
47187
|
+
);
|
|
47188
|
+
let prop = settings.userProperties.getByRef(ReadiumCSS.DIRECTION_REF);
|
|
47189
|
+
if (prop) {
|
|
47190
|
+
prop.value = settings.direction;
|
|
47191
|
+
await settings.saveProperty(prop);
|
|
47192
|
+
}
|
|
47193
|
+
import_loglevel2.default.log(settings.direction);
|
|
47194
|
+
}
|
|
47144
47195
|
if (initialUserSettings.wordSpacing) {
|
|
47145
47196
|
settings.wordSpacing = initialUserSettings.wordSpacing;
|
|
47146
47197
|
let prop = settings.userProperties.getByRef(
|
|
@@ -47216,6 +47267,10 @@ var _UserSettings = class _UserSettings {
|
|
|
47216
47267
|
"columnCount",
|
|
47217
47268
|
ReadiumCSS.COLUMN_COUNT_KEY
|
|
47218
47269
|
);
|
|
47270
|
+
this.direction = await this.getPropertyAndFallback(
|
|
47271
|
+
"direction",
|
|
47272
|
+
ReadiumCSS.DIRECTION_KEY
|
|
47273
|
+
);
|
|
47219
47274
|
this.fontSize = await this.getPropertyAndFallback(
|
|
47220
47275
|
"fontSize",
|
|
47221
47276
|
ReadiumCSS.FONT_SIZE_KEY
|
|
@@ -47246,6 +47301,7 @@ var _UserSettings = class _UserSettings {
|
|
|
47246
47301
|
this.fontFamily = 0;
|
|
47247
47302
|
this.textAlignment = 0;
|
|
47248
47303
|
this.columnCount = 0;
|
|
47304
|
+
this.direction = 0;
|
|
47249
47305
|
this.wordSpacing = 0;
|
|
47250
47306
|
this.letterSpacing = 0;
|
|
47251
47307
|
this.pageMargins = 2;
|
|
@@ -47258,18 +47314,21 @@ var _UserSettings = class _UserSettings {
|
|
|
47258
47314
|
"html"
|
|
47259
47315
|
);
|
|
47260
47316
|
if (html) {
|
|
47261
|
-
const rootElement = document.documentElement;
|
|
47262
|
-
const body =
|
|
47317
|
+
const rootElement = findElement(document, "#root") || document.documentElement;
|
|
47318
|
+
const body = findElement(html, "body");
|
|
47263
47319
|
html.style.removeProperty(ReadiumCSS.FONT_SIZE_KEY);
|
|
47264
47320
|
html.style.removeProperty(ReadiumCSS.WORD_SPACING_KEY);
|
|
47265
47321
|
html.style.removeProperty(ReadiumCSS.LETTER_SPACING_KEY);
|
|
47266
47322
|
html.style.removeProperty(ReadiumCSS.COLUMN_COUNT_KEY);
|
|
47323
|
+
html.style.removeProperty(ReadiumCSS.DIRECTION_KEY);
|
|
47267
47324
|
html.style.removeProperty(ReadiumCSS.TEXT_ALIGNMENT_KEY);
|
|
47268
47325
|
html.style.removeProperty(ReadiumCSS.LINE_HEIGHT_KEY);
|
|
47269
47326
|
html.style.removeProperty(ReadiumCSS.PAGE_MARGINS_KEY);
|
|
47270
47327
|
html.style.removeProperty(ReadiumCSS.APPEARANCE_KEY);
|
|
47271
|
-
|
|
47272
|
-
|
|
47328
|
+
if (rootElement)
|
|
47329
|
+
setAttr(rootElement, "data-viewer-theme", "day");
|
|
47330
|
+
if (body)
|
|
47331
|
+
setAttr(body, "data-viewer-theme", "day");
|
|
47273
47332
|
html.style.removeProperty(ReadiumCSS.FONT_FAMILY_KEY);
|
|
47274
47333
|
setAttr(html, "data-viewer-font", "publisher");
|
|
47275
47334
|
html.style.setProperty(
|
|
@@ -47288,7 +47347,7 @@ var _UserSettings = class _UserSettings {
|
|
|
47288
47347
|
);
|
|
47289
47348
|
}
|
|
47290
47349
|
async applyProperties() {
|
|
47291
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
47350
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
47292
47351
|
this.userProperties = this.getUserSettings();
|
|
47293
47352
|
let doc = this.iframe.contentDocument;
|
|
47294
47353
|
if (doc) {
|
|
@@ -47297,8 +47356,8 @@ var _UserSettings = class _UserSettings {
|
|
|
47297
47356
|
"html"
|
|
47298
47357
|
);
|
|
47299
47358
|
if (html) {
|
|
47300
|
-
const rootElement = document.documentElement;
|
|
47301
|
-
const body =
|
|
47359
|
+
const rootElement = findElement(document, "#root") || document.documentElement;
|
|
47360
|
+
const body = findElement(html, "body");
|
|
47302
47361
|
if ((_a = this.view) == null ? void 0 : _a.navigator.publication.isReflowable) {
|
|
47303
47362
|
if (await this.getProperty(ReadiumCSS.FONT_SIZE_KEY)) {
|
|
47304
47363
|
html.style.setProperty(
|
|
@@ -47355,42 +47414,57 @@ var _UserSettings = class _UserSettings {
|
|
|
47355
47414
|
((_k = this.userProperties.getByRef(ReadiumCSS.APPEARANCE_REF)) == null ? void 0 : _k.toString()) ?? null
|
|
47356
47415
|
);
|
|
47357
47416
|
if (((_l = this.userProperties.getByRef(ReadiumCSS.APPEARANCE_REF)) == null ? void 0 : _l.value) === 0) {
|
|
47358
|
-
|
|
47359
|
-
|
|
47417
|
+
if (rootElement)
|
|
47418
|
+
setAttr(rootElement, "data-viewer-theme", "day");
|
|
47419
|
+
if (body)
|
|
47420
|
+
setAttr(body, "data-viewer-theme", "day");
|
|
47360
47421
|
} else if (((_m = this.userProperties.getByRef(ReadiumCSS.APPEARANCE_REF)) == null ? void 0 : _m.value) === 1) {
|
|
47361
|
-
|
|
47362
|
-
|
|
47422
|
+
if (rootElement)
|
|
47423
|
+
setAttr(rootElement, "data-viewer-theme", "sepia");
|
|
47424
|
+
if (body)
|
|
47425
|
+
setAttr(body, "data-viewer-theme", "sepia");
|
|
47363
47426
|
} else if (((_n = this.userProperties.getByRef(ReadiumCSS.APPEARANCE_REF)) == null ? void 0 : _n.value) === 2) {
|
|
47364
|
-
|
|
47365
|
-
|
|
47427
|
+
if (rootElement)
|
|
47428
|
+
setAttr(rootElement, "data-viewer-theme", "night");
|
|
47429
|
+
if (body)
|
|
47430
|
+
setAttr(body, "data-viewer-theme", "night");
|
|
47366
47431
|
}
|
|
47367
47432
|
} else {
|
|
47368
47433
|
html.style.setProperty(
|
|
47369
47434
|
ReadiumCSS.APPEARANCE_KEY,
|
|
47370
47435
|
((_o = this.userProperties.getByRef(ReadiumCSS.APPEARANCE_REF)) == null ? void 0 : _o.toString()) ?? null
|
|
47371
47436
|
);
|
|
47372
|
-
|
|
47373
|
-
|
|
47437
|
+
if (rootElement)
|
|
47438
|
+
setAttr(rootElement, "data-viewer-theme", "day");
|
|
47439
|
+
if (body)
|
|
47440
|
+
setAttr(body, "data-viewer-theme", "day");
|
|
47374
47441
|
}
|
|
47375
|
-
if ((_p = this.view) == null ? void 0 : _p.navigator.publication.
|
|
47442
|
+
if ((_p = this.view) == null ? void 0 : _p.navigator.publication.isFixedLayout) {
|
|
47443
|
+
if (await this.getProperty(ReadiumCSS.DIRECTION_KEY)) {
|
|
47444
|
+
let value = ((_q = this.userProperties.getByRef(ReadiumCSS.DIRECTION_REF)) == null ? void 0 : _q.toString()) ?? null;
|
|
47445
|
+
html.style.setProperty(ReadiumCSS.DIRECTION_KEY, value);
|
|
47446
|
+
this.view.navigator.setDirection(value);
|
|
47447
|
+
}
|
|
47448
|
+
}
|
|
47449
|
+
if ((_r = this.view) == null ? void 0 : _r.navigator.publication.isReflowable) {
|
|
47376
47450
|
if (await this.getProperty(ReadiumCSS.FONT_FAMILY_KEY)) {
|
|
47377
47451
|
html.style.setProperty(
|
|
47378
47452
|
ReadiumCSS.FONT_FAMILY_KEY,
|
|
47379
|
-
((
|
|
47453
|
+
((_s = this.userProperties.getByRef(ReadiumCSS.FONT_FAMILY_REF)) == null ? void 0 : _s.toString()) ?? null
|
|
47380
47454
|
);
|
|
47381
|
-
if (((
|
|
47455
|
+
if (((_t = this.userProperties.getByRef(ReadiumCSS.FONT_FAMILY_REF)) == null ? void 0 : _t.value) === 0) {
|
|
47382
47456
|
setAttr(html, "data-viewer-font", "publisher");
|
|
47383
47457
|
html.style.setProperty(
|
|
47384
47458
|
ReadiumCSS.FONT_OVERRIDE_KEY,
|
|
47385
47459
|
"readium-font-off"
|
|
47386
47460
|
);
|
|
47387
|
-
} else if (((
|
|
47461
|
+
} else if (((_u = this.userProperties.getByRef(ReadiumCSS.FONT_FAMILY_REF)) == null ? void 0 : _u.value) === 1) {
|
|
47388
47462
|
setAttr(html, "data-viewer-font", "serif");
|
|
47389
47463
|
html.style.setProperty(
|
|
47390
47464
|
ReadiumCSS.FONT_OVERRIDE_KEY,
|
|
47391
47465
|
"readium-font-on"
|
|
47392
47466
|
);
|
|
47393
|
-
} else if (((
|
|
47467
|
+
} else if (((_v = this.userProperties.getByRef(ReadiumCSS.FONT_FAMILY_REF)) == null ? void 0 : _v.value) === 2) {
|
|
47394
47468
|
setAttr(html, "data-viewer-font", "sans");
|
|
47395
47469
|
html.style.setProperty(
|
|
47396
47470
|
ReadiumCSS.FONT_OVERRIDE_KEY,
|
|
@@ -47415,7 +47489,7 @@ var _UserSettings = class _UserSettings {
|
|
|
47415
47489
|
} else {
|
|
47416
47490
|
html.style.setProperty(
|
|
47417
47491
|
ReadiumCSS.FONT_FAMILY_KEY,
|
|
47418
|
-
((
|
|
47492
|
+
((_w = this.userProperties.getByRef(ReadiumCSS.FONT_FAMILY_REF)) == null ? void 0 : _w.toString()) ?? null
|
|
47419
47493
|
);
|
|
47420
47494
|
setAttr(html, "data-viewer-font", "publisher");
|
|
47421
47495
|
html.style.setProperty(
|
|
@@ -47424,7 +47498,7 @@ var _UserSettings = class _UserSettings {
|
|
|
47424
47498
|
);
|
|
47425
47499
|
}
|
|
47426
47500
|
if (await this.getProperty(ReadiumCSS.SCROLL_KEY)) {
|
|
47427
|
-
if (((
|
|
47501
|
+
if (((_x = this.userProperties.getByRef(ReadiumCSS.SCROLL_REF)) == null ? void 0 : _x.value) === true) {
|
|
47428
47502
|
html.style.setProperty("--USER__scroll", "readium-scroll-on");
|
|
47429
47503
|
} else {
|
|
47430
47504
|
html.style.setProperty("--USER__scroll", "readium-scroll-off");
|
|
@@ -47491,24 +47565,25 @@ var _UserSettings = class _UserSettings {
|
|
|
47491
47565
|
this.applyProperties();
|
|
47492
47566
|
}
|
|
47493
47567
|
async updateUserSettings() {
|
|
47494
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
47568
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
47495
47569
|
let userSettings = {
|
|
47496
47570
|
fontFamily: _UserSettings.fontFamilyValues[await ((_b = (_a = this.userProperties) == null ? void 0 : _a.getByRef(ReadiumCSS.FONT_FAMILY_REF)) == null ? void 0 : _b.value)],
|
|
47497
47571
|
fontSize: (_d = (_c = this.userProperties) == null ? void 0 : _c.getByRef(ReadiumCSS.FONT_SIZE_REF)) == null ? void 0 : _d.value,
|
|
47498
47572
|
appearance: _UserSettings.appearanceValues[await ((_f = (_e = this.userProperties) == null ? void 0 : _e.getByRef(ReadiumCSS.APPEARANCE_REF)) == null ? void 0 : _f.value)],
|
|
47499
47573
|
textAlignment: _UserSettings.textAlignmentValues[await ((_h = (_g = this.userProperties) == null ? void 0 : _g.getByRef(ReadiumCSS.TEXT_ALIGNMENT_REF)) == null ? void 0 : _h.value)],
|
|
47500
47574
|
columnCount: _UserSettings.columnCountValues[await ((_j = (_i = this.userProperties) == null ? void 0 : _i.getByRef(ReadiumCSS.COLUMN_COUNT_REF)) == null ? void 0 : _j.value)],
|
|
47501
|
-
|
|
47502
|
-
|
|
47575
|
+
direction: _UserSettings.directionValues[await ((_l = (_k = this.userProperties) == null ? void 0 : _k.getByRef(ReadiumCSS.DIRECTION_REF)) == null ? void 0 : _l.value)],
|
|
47576
|
+
wordSpacing: (_n = (_m = this.userProperties) == null ? void 0 : _m.getByRef(ReadiumCSS.WORD_SPACING_REF)) == null ? void 0 : _n.value,
|
|
47577
|
+
letterSpacing: (_p = (_o = this.userProperties) == null ? void 0 : _o.getByRef(
|
|
47503
47578
|
ReadiumCSS.LETTER_SPACING_REF
|
|
47504
|
-
)) == null ? void 0 :
|
|
47579
|
+
)) == null ? void 0 : _p.value,
|
|
47505
47580
|
// publisherDefault: this.userProperties.getByRef(
|
|
47506
47581
|
// ReadiumCSS.PUBLISHER_DEFAULT_REF
|
|
47507
47582
|
// ).value,
|
|
47508
|
-
verticalScroll: (
|
|
47583
|
+
verticalScroll: (_r = (_q = this.userProperties) == null ? void 0 : _q.getByRef(ReadiumCSS.SCROLL_REF)) == null ? void 0 : _r.value
|
|
47509
47584
|
};
|
|
47510
|
-
if ((
|
|
47511
|
-
(
|
|
47585
|
+
if ((_s = this.api) == null ? void 0 : _s.updateSettings) {
|
|
47586
|
+
(_t = this.api) == null ? void 0 : _t.updateSettings(userSettings).then((_) => {
|
|
47512
47587
|
import_loglevel2.default.log("api updated user settings", JSON.stringify(userSettings));
|
|
47513
47588
|
});
|
|
47514
47589
|
}
|
|
@@ -47528,6 +47603,12 @@ var _UserSettings = class _UserSettings {
|
|
|
47528
47603
|
ReadiumCSS.COLUMN_COUNT_REF,
|
|
47529
47604
|
ReadiumCSS.COLUMN_COUNT_KEY
|
|
47530
47605
|
);
|
|
47606
|
+
userProperties.addEnumerable(
|
|
47607
|
+
this.direction,
|
|
47608
|
+
_UserSettings.directionValues,
|
|
47609
|
+
ReadiumCSS.DIRECTION_REF,
|
|
47610
|
+
ReadiumCSS.DIRECTION_KEY
|
|
47611
|
+
);
|
|
47531
47612
|
userProperties.addEnumerable(
|
|
47532
47613
|
this.appearance,
|
|
47533
47614
|
_UserSettings.appearanceValues,
|
|
@@ -47642,7 +47723,7 @@ var _UserSettings = class _UserSettings {
|
|
|
47642
47723
|
this.settingsChangeCallback();
|
|
47643
47724
|
}
|
|
47644
47725
|
get currentSettings() {
|
|
47645
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
47726
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
47646
47727
|
return {
|
|
47647
47728
|
appearance: _UserSettings.appearanceValues[(_b = (_a = this.userProperties) == null ? void 0 : _a.getByRef(ReadiumCSS.APPEARANCE_REF)) == null ? void 0 : _b.value],
|
|
47648
47729
|
//readium-default-on, readium-night-on, readium-sepia-on
|
|
@@ -47652,6 +47733,8 @@ var _UserSettings = class _UserSettings {
|
|
|
47652
47733
|
//"auto", "justify", "start"
|
|
47653
47734
|
columnCount: _UserSettings.columnCountValues[(_h = (_g = this.userProperties) == null ? void 0 : _g.getByRef(ReadiumCSS.COLUMN_COUNT_REF)) == null ? void 0 : _h.value],
|
|
47654
47735
|
// "auto", "1", "2"
|
|
47736
|
+
direction: _UserSettings.directionValues[(_j = (_i = this.userProperties) == null ? void 0 : _i.getByRef(ReadiumCSS.DIRECTION_REF)) == null ? void 0 : _j.value],
|
|
47737
|
+
// "auto", "ltr", "rtl"
|
|
47655
47738
|
verticalScroll: this.verticalScroll,
|
|
47656
47739
|
fontSize: this.fontSize,
|
|
47657
47740
|
wordSpacing: this.wordSpacing,
|
|
@@ -47661,7 +47744,7 @@ var _UserSettings = class _UserSettings {
|
|
|
47661
47744
|
};
|
|
47662
47745
|
}
|
|
47663
47746
|
async applyUserSettings(userSettings) {
|
|
47664
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
47747
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
47665
47748
|
if (userSettings.appearance) {
|
|
47666
47749
|
this.appearance = _UserSettings.parseAppearanceSetting(
|
|
47667
47750
|
userSettings.appearance
|
|
@@ -47717,11 +47800,21 @@ var _UserSettings = class _UserSettings {
|
|
|
47717
47800
|
}
|
|
47718
47801
|
this.settingsColumnsChangeCallback();
|
|
47719
47802
|
}
|
|
47803
|
+
if (userSettings.direction) {
|
|
47804
|
+
this.direction = _UserSettings.directionValues.findIndex(
|
|
47805
|
+
(el) => el === userSettings.direction
|
|
47806
|
+
);
|
|
47807
|
+
let prop = (_g = this.userProperties) == null ? void 0 : _g.getByRef(ReadiumCSS.DIRECTION_REF);
|
|
47808
|
+
if (prop) {
|
|
47809
|
+
prop.value = this.direction;
|
|
47810
|
+
await this.storeProperty(prop);
|
|
47811
|
+
}
|
|
47812
|
+
}
|
|
47720
47813
|
if (userSettings.textAlignment) {
|
|
47721
47814
|
this.textAlignment = _UserSettings.textAlignmentValues.findIndex(
|
|
47722
47815
|
(el) => el === userSettings.textAlignment
|
|
47723
47816
|
);
|
|
47724
|
-
let prop = (
|
|
47817
|
+
let prop = (_h = this.userProperties) == null ? void 0 : _h.getByRef(ReadiumCSS.TEXT_ALIGNMENT_REF);
|
|
47725
47818
|
if (prop) {
|
|
47726
47819
|
prop.value = this.textAlignment;
|
|
47727
47820
|
await this.storeProperty(prop);
|
|
@@ -47729,7 +47822,7 @@ var _UserSettings = class _UserSettings {
|
|
|
47729
47822
|
}
|
|
47730
47823
|
if (userSettings.lineHeight) {
|
|
47731
47824
|
this.lineHeight = userSettings.lineHeight;
|
|
47732
|
-
let prop = (
|
|
47825
|
+
let prop = (_i = this.userProperties) == null ? void 0 : _i.getByRef(ReadiumCSS.LINE_HEIGHT_REF);
|
|
47733
47826
|
if (prop) {
|
|
47734
47827
|
prop.value = this.lineHeight;
|
|
47735
47828
|
await this.storeProperty(prop);
|
|
@@ -47737,25 +47830,25 @@ var _UserSettings = class _UserSettings {
|
|
|
47737
47830
|
}
|
|
47738
47831
|
if (userSettings.pageMargins) {
|
|
47739
47832
|
this.pageMargins = userSettings.pageMargins;
|
|
47740
|
-
let prop = (
|
|
47833
|
+
let prop = (_j = this.userProperties) == null ? void 0 : _j.getByRef(ReadiumCSS.PAGE_MARGINS_REF);
|
|
47741
47834
|
if (prop) {
|
|
47742
47835
|
prop.value = this.pageMargins;
|
|
47743
47836
|
await this.storeProperty(prop);
|
|
47744
47837
|
}
|
|
47745
47838
|
}
|
|
47746
47839
|
if (userSettings.verticalScroll !== void 0) {
|
|
47747
|
-
const position = (
|
|
47840
|
+
const position = (_k = this.view) == null ? void 0 : _k.getCurrentPosition();
|
|
47748
47841
|
this.verticalScroll = _UserSettings.parseScrollSetting(
|
|
47749
47842
|
userSettings.verticalScroll
|
|
47750
47843
|
);
|
|
47751
|
-
let prop = (
|
|
47844
|
+
let prop = (_l = this.userProperties) == null ? void 0 : _l.getByRef(ReadiumCSS.SCROLL_REF);
|
|
47752
47845
|
if (prop) {
|
|
47753
47846
|
prop.value = this.verticalScroll;
|
|
47754
47847
|
await this.saveProperty(prop);
|
|
47755
47848
|
}
|
|
47756
|
-
(
|
|
47849
|
+
(_n = (_m = this.view) == null ? void 0 : _m.setMode) == null ? void 0 : _n.call(_m, this.verticalScroll);
|
|
47757
47850
|
if (position) {
|
|
47758
|
-
(
|
|
47851
|
+
(_o = this.view) == null ? void 0 : _o.goToProgression(position);
|
|
47759
47852
|
}
|
|
47760
47853
|
this.viewChangeCallback();
|
|
47761
47854
|
}
|
|
@@ -47916,6 +48009,7 @@ _UserSettings.appearanceValues = [
|
|
|
47916
48009
|
_UserSettings.fontFamilyValues = ["Original", "serif", "sans-serif"];
|
|
47917
48010
|
_UserSettings.textAlignmentValues = ["auto", "justify", "start"];
|
|
47918
48011
|
_UserSettings.columnCountValues = ["auto", "1", "2"];
|
|
48012
|
+
_UserSettings.directionValues = ["auto", "ltr", "rtl"];
|
|
47919
48013
|
var UserSettings = _UserSettings;
|
|
47920
48014
|
|
|
47921
48015
|
// src/modules/AnnotationModule.ts
|
|
@@ -49649,17 +49743,13 @@ var TextHighlighter = class _TextHighlighter {
|
|
|
49649
49743
|
);
|
|
49650
49744
|
return new Promise((resolve) => resolve(module2));
|
|
49651
49745
|
}
|
|
49652
|
-
async initialize() {
|
|
49746
|
+
async initialize(iframe) {
|
|
49653
49747
|
var _a;
|
|
49654
|
-
let doc =
|
|
49748
|
+
let doc = iframe.contentDocument;
|
|
49655
49749
|
if (doc) {
|
|
49656
49750
|
this.dom(doc.body).addClass(this.options.contextClass);
|
|
49657
49751
|
}
|
|
49658
|
-
this.bindEvents(
|
|
49659
|
-
(_a = this.navigator.iframes[0].contentDocument) == null ? void 0 : _a.body,
|
|
49660
|
-
this,
|
|
49661
|
-
this.hasEventListener
|
|
49662
|
-
);
|
|
49752
|
+
this.bindEvents((_a = iframe.contentDocument) == null ? void 0 : _a.body, this, this.hasEventListener);
|
|
49663
49753
|
this.initializeToolbox();
|
|
49664
49754
|
lastMouseDownX = -1;
|
|
49665
49755
|
lastMouseDownY = -1;
|
|
@@ -49672,7 +49762,7 @@ var TextHighlighter = class _TextHighlighter {
|
|
|
49672
49762
|
}
|
|
49673
49763
|
setTimeout(async () => {
|
|
49674
49764
|
var _a2;
|
|
49675
|
-
let doc2 =
|
|
49765
|
+
let doc2 = iframe.contentDocument;
|
|
49676
49766
|
if (doc2) {
|
|
49677
49767
|
await ((_a2 = doc2.body) == null ? void 0 : _a2.addEventListener("click", unselect));
|
|
49678
49768
|
}
|
|
@@ -52301,8 +52391,8 @@ var ConsumptionModule = class {
|
|
|
52301
52391
|
import_loglevel7.default.log("Consumption module stop");
|
|
52302
52392
|
this.endResearchSession();
|
|
52303
52393
|
}
|
|
52304
|
-
initialize() {
|
|
52305
|
-
let win =
|
|
52394
|
+
initialize(iframe) {
|
|
52395
|
+
let win = iframe.contentWindow;
|
|
52306
52396
|
if (win) {
|
|
52307
52397
|
const self2 = this;
|
|
52308
52398
|
win.onload = function() {
|
|
@@ -52536,7 +52626,7 @@ var AnnotationModule = class _AnnotationModule {
|
|
|
52536
52626
|
await this.showHighlights();
|
|
52537
52627
|
}, 200);
|
|
52538
52628
|
}
|
|
52539
|
-
initialize() {
|
|
52629
|
+
initialize(iframe) {
|
|
52540
52630
|
return new Promise(async (resolve) => {
|
|
52541
52631
|
await document.fonts.ready;
|
|
52542
52632
|
if (this.rights.enableAnnotations) {
|
|
@@ -52545,7 +52635,7 @@ var AnnotationModule = class _AnnotationModule {
|
|
|
52545
52635
|
this.drawHighlights();
|
|
52546
52636
|
this.showHighlights();
|
|
52547
52637
|
addEventListenerOptional(
|
|
52548
|
-
(_a =
|
|
52638
|
+
(_a = iframe.contentDocument) == null ? void 0 : _a.body,
|
|
52549
52639
|
"click",
|
|
52550
52640
|
this.click.bind(this)
|
|
52551
52641
|
);
|
|
@@ -54267,7 +54357,9 @@ var MediaOverlaySettings = class {
|
|
|
54267
54357
|
var _a, _b;
|
|
54268
54358
|
if (incremental === "mo_volume") {
|
|
54269
54359
|
this.userProperties.getByRef(MEDIAOVERLAYREFS.VOLUME_REF).increment();
|
|
54270
|
-
this.volume = (_a = this.userProperties.getByRef(
|
|
54360
|
+
this.volume = (_a = this.userProperties.getByRef(
|
|
54361
|
+
MEDIAOVERLAYREFS.VOLUME_REF
|
|
54362
|
+
)) == null ? void 0 : _a.value;
|
|
54271
54363
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.VOLUME_REF);
|
|
54272
54364
|
if (prop) {
|
|
54273
54365
|
this.storeProperty(prop);
|
|
@@ -54275,7 +54367,9 @@ var MediaOverlaySettings = class {
|
|
|
54275
54367
|
this.settingsChangeCallback();
|
|
54276
54368
|
} else if (incremental === "mo_rate") {
|
|
54277
54369
|
this.userProperties.getByRef(MEDIAOVERLAYREFS.RATE_REF).increment();
|
|
54278
|
-
this.rate = (_b = this.userProperties.getByRef(
|
|
54370
|
+
this.rate = (_b = this.userProperties.getByRef(
|
|
54371
|
+
MEDIAOVERLAYREFS.RATE_REF
|
|
54372
|
+
)) == null ? void 0 : _b.value;
|
|
54279
54373
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.RATE_REF);
|
|
54280
54374
|
if (prop) {
|
|
54281
54375
|
this.storeProperty(prop);
|
|
@@ -54287,7 +54381,9 @@ var MediaOverlaySettings = class {
|
|
|
54287
54381
|
var _a, _b;
|
|
54288
54382
|
if (incremental === "mo_volume") {
|
|
54289
54383
|
this.userProperties.getByRef(MEDIAOVERLAYREFS.VOLUME_REF).decrement();
|
|
54290
|
-
this.volume = (_a = this.userProperties.getByRef(
|
|
54384
|
+
this.volume = (_a = this.userProperties.getByRef(
|
|
54385
|
+
MEDIAOVERLAYREFS.VOLUME_REF
|
|
54386
|
+
)) == null ? void 0 : _a.value;
|
|
54291
54387
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.VOLUME_REF);
|
|
54292
54388
|
if (prop) {
|
|
54293
54389
|
this.storeProperty(prop);
|
|
@@ -54295,7 +54391,9 @@ var MediaOverlaySettings = class {
|
|
|
54295
54391
|
this.settingsChangeCallback();
|
|
54296
54392
|
} else if (incremental === "mo_rate") {
|
|
54297
54393
|
this.userProperties.getByRef(MEDIAOVERLAYREFS.RATE_REF).decrement();
|
|
54298
|
-
this.rate = (_b = this.userProperties.getByRef(
|
|
54394
|
+
this.rate = (_b = this.userProperties.getByRef(
|
|
54395
|
+
MEDIAOVERLAYREFS.RATE_REF
|
|
54396
|
+
)) == null ? void 0 : _b.value;
|
|
54299
54397
|
let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.RATE_REF);
|
|
54300
54398
|
if (prop) {
|
|
54301
54399
|
this.storeProperty(prop);
|
|
@@ -57087,35 +57185,33 @@ var ContentProtectionModule = class {
|
|
|
57087
57185
|
this.preventDrag(true);
|
|
57088
57186
|
}
|
|
57089
57187
|
}
|
|
57090
|
-
async initialize() {
|
|
57188
|
+
async initialize(iframe) {
|
|
57091
57189
|
var _a;
|
|
57092
57190
|
if ((_a = this.properties) == null ? void 0 : _a.enableObfuscation) {
|
|
57093
57191
|
return new Promise(async (resolve) => {
|
|
57094
57192
|
await document.fonts.ready;
|
|
57095
|
-
|
|
57096
|
-
|
|
57097
|
-
|
|
57098
|
-
|
|
57099
|
-
|
|
57193
|
+
if (iframe.contentDocument) {
|
|
57194
|
+
const body = findRequiredIframeElement(
|
|
57195
|
+
iframe.contentDocument,
|
|
57196
|
+
"body"
|
|
57197
|
+
);
|
|
57198
|
+
this.observe();
|
|
57199
|
+
setTimeout(() => {
|
|
57200
|
+
this.rects = this.findRects(body);
|
|
57201
|
+
this.rects.forEach(
|
|
57202
|
+
(rect) => this.toggleRect(rect, this.securityContainer, this.isHacked)
|
|
57100
57203
|
);
|
|
57101
|
-
this.
|
|
57102
|
-
|
|
57103
|
-
this.
|
|
57104
|
-
|
|
57105
|
-
|
|
57204
|
+
this.setupEvents();
|
|
57205
|
+
if (!this.hasEventListener) {
|
|
57206
|
+
this.hasEventListener = true;
|
|
57207
|
+
addEventListenerOptional(
|
|
57208
|
+
this.wrapper,
|
|
57209
|
+
"scroll",
|
|
57210
|
+
this.handleScroll.bind(this)
|
|
57106
57211
|
);
|
|
57107
|
-
|
|
57108
|
-
|
|
57109
|
-
|
|
57110
|
-
addEventListenerOptional(
|
|
57111
|
-
this.wrapper,
|
|
57112
|
-
"scroll",
|
|
57113
|
-
this.handleScroll.bind(this)
|
|
57114
|
-
);
|
|
57115
|
-
}
|
|
57116
|
-
resolve();
|
|
57117
|
-
}, 10);
|
|
57118
|
-
}
|
|
57212
|
+
}
|
|
57213
|
+
resolve();
|
|
57214
|
+
}, 10);
|
|
57119
57215
|
}
|
|
57120
57216
|
});
|
|
57121
57217
|
}
|
|
@@ -58915,6 +59011,7 @@ var KeyboardEventHandler = class {
|
|
|
58915
59011
|
// when removing the event listeners
|
|
58916
59012
|
this.handlers = {};
|
|
58917
59013
|
this.navigator = navigator2;
|
|
59014
|
+
this.rtl = false;
|
|
58918
59015
|
}
|
|
58919
59016
|
onFocusIn(self2) {
|
|
58920
59017
|
return this.handlers["onFocusIn"] || (this.handlers["onFocusIn"] = function(event) {
|
|
@@ -58937,10 +59034,10 @@ var KeyboardEventHandler = class {
|
|
|
58937
59034
|
const key = event.key;
|
|
58938
59035
|
switch (key) {
|
|
58939
59036
|
case "ArrowRight":
|
|
58940
|
-
self2.onForwardSwipe(event);
|
|
59037
|
+
self2.rtl ? self2.onBackwardSwipe(event) : self2.onForwardSwipe(event);
|
|
58941
59038
|
break;
|
|
58942
59039
|
case "ArrowLeft":
|
|
58943
|
-
self2.onBackwardSwipe(event);
|
|
59040
|
+
self2.rtl ? self2.onForwardSwipe(event) : self2.onBackwardSwipe(event);
|
|
58944
59041
|
break;
|
|
58945
59042
|
}
|
|
58946
59043
|
switch (event.code) {
|
|
@@ -60530,7 +60627,7 @@ var LineFocusModule = class {
|
|
|
60530
60627
|
}
|
|
60531
60628
|
}
|
|
60532
60629
|
}
|
|
60533
|
-
initialize() {
|
|
60630
|
+
initialize(iframe) {
|
|
60534
60631
|
return new Promise(async (resolve) => {
|
|
60535
60632
|
await document.fonts.ready;
|
|
60536
60633
|
if (!this.hasEventListener) {
|
|
@@ -60538,12 +60635,12 @@ var LineFocusModule = class {
|
|
|
60538
60635
|
addEventListenerOptional(document, "keydown", this.keydown.bind(this));
|
|
60539
60636
|
addEventListenerOptional(document, "keyup", this.keyup.bind(this));
|
|
60540
60637
|
addEventListenerOptional(
|
|
60541
|
-
|
|
60638
|
+
iframe.contentDocument,
|
|
60542
60639
|
"keydown",
|
|
60543
60640
|
this.keydown.bind(this)
|
|
60544
60641
|
);
|
|
60545
60642
|
addEventListenerOptional(
|
|
60546
|
-
|
|
60643
|
+
iframe.contentDocument,
|
|
60547
60644
|
"keyup",
|
|
60548
60645
|
this.keyup.bind(this)
|
|
60549
60646
|
);
|
|
@@ -61039,7 +61136,6 @@ var HistoryModule = class {
|
|
|
61039
61136
|
}
|
|
61040
61137
|
}
|
|
61041
61138
|
async push(locator, history) {
|
|
61042
|
-
let lastInHistory;
|
|
61043
61139
|
if (history && this.annotator) {
|
|
61044
61140
|
let lastReadingPosition = await this.annotator.getLastReadingPosition();
|
|
61045
61141
|
if (lastReadingPosition) {
|
|
@@ -61054,12 +61150,18 @@ var HistoryModule = class {
|
|
|
61054
61150
|
} else if ((lastReadingPosition == null ? void 0 : lastReadingPosition.locations.progression) && (lastReadingPosition == null ? void 0 : lastReadingPosition.locations.progression) > 0) {
|
|
61055
61151
|
this.history.push(lastReadingPosition);
|
|
61056
61152
|
this.historyCurrentIndex = this.history.length - 1;
|
|
61153
|
+
} else {
|
|
61154
|
+
const lastInHistory2 = this.history[this.history.length - 1];
|
|
61155
|
+
if (lastInHistory2 && lastInHistory2.href !== locator.href && lastInHistory2.locations !== locator.locations || lastInHistory2 === void 0) {
|
|
61156
|
+
this.history.push(lastReadingPosition);
|
|
61157
|
+
this.historyCurrentIndex = this.history.length - 1;
|
|
61158
|
+
}
|
|
61057
61159
|
}
|
|
61058
61160
|
}
|
|
61059
61161
|
if (this.historyCurrentIndex < this.history.length - 1) {
|
|
61060
61162
|
this.history = this.history.slice(0, this.historyCurrentIndex);
|
|
61061
61163
|
}
|
|
61062
|
-
lastInHistory = this.history[this.history.length - 1];
|
|
61164
|
+
const lastInHistory = this.history[this.history.length - 1];
|
|
61063
61165
|
if (lastInHistory && lastInHistory.href !== locator.href || lastInHistory === void 0) {
|
|
61064
61166
|
this.history.push(locator);
|
|
61065
61167
|
this.historyCurrentIndex = this.history.length - 1;
|
|
@@ -61604,6 +61706,24 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
|
|
|
61604
61706
|
if (this.didInitKeyboardEventHandler)
|
|
61605
61707
|
this.keyboardEventHandler.removeEvents(document);
|
|
61606
61708
|
}
|
|
61709
|
+
setDirection(direction) {
|
|
61710
|
+
var _a, _b;
|
|
61711
|
+
let dir = "";
|
|
61712
|
+
if (direction === "rtl" || direction === "ltr")
|
|
61713
|
+
dir = direction;
|
|
61714
|
+
if (direction === "auto")
|
|
61715
|
+
dir = this.publication.Metadata.Direction2;
|
|
61716
|
+
if (dir) {
|
|
61717
|
+
if (dir === "rtl")
|
|
61718
|
+
this.spreads.style.flexDirection = "row-reverse";
|
|
61719
|
+
if (dir === "ltr")
|
|
61720
|
+
this.spreads.style.flexDirection = "row";
|
|
61721
|
+
this.keyboardEventHandler.rtl = dir === "rtl";
|
|
61722
|
+
if ((_a = this.api) == null ? void 0 : _a.direction)
|
|
61723
|
+
(_b = this.api) == null ? void 0 : _b.direction(dir);
|
|
61724
|
+
this.emit("direction", dir);
|
|
61725
|
+
}
|
|
61726
|
+
}
|
|
61607
61727
|
async start(mainElement, headerMenu, footerMenu) {
|
|
61608
61728
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
61609
61729
|
this.headerMenu = headerMenu;
|
|
@@ -61643,6 +61763,19 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
|
|
|
61643
61763
|
this.spreads.appendChild(this.firstSpread);
|
|
61644
61764
|
this.firstSpread.appendChild(this.iframes[0]);
|
|
61645
61765
|
wrapper.appendChild(this.spreads);
|
|
61766
|
+
let dir = "";
|
|
61767
|
+
switch (this.settings.direction) {
|
|
61768
|
+
case 0:
|
|
61769
|
+
dir = "auto";
|
|
61770
|
+
break;
|
|
61771
|
+
case 1:
|
|
61772
|
+
dir = "ltr";
|
|
61773
|
+
break;
|
|
61774
|
+
case 2:
|
|
61775
|
+
dir = "rtl";
|
|
61776
|
+
break;
|
|
61777
|
+
}
|
|
61778
|
+
this.setDirection(dir);
|
|
61646
61779
|
} else {
|
|
61647
61780
|
iframe3.setAttribute("height", "100%");
|
|
61648
61781
|
iframe3.setAttribute("width", "100%");
|
|
@@ -61914,7 +62047,7 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
|
|
|
61914
62047
|
addEventListenerOptional(
|
|
61915
62048
|
iframe,
|
|
61916
62049
|
"load",
|
|
61917
|
-
this.handleIFrameLoad.bind(this)
|
|
62050
|
+
this.handleIFrameLoad.bind(this, iframe)
|
|
61918
62051
|
);
|
|
61919
62052
|
}
|
|
61920
62053
|
addEventListenerOptional(
|
|
@@ -62286,8 +62419,8 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
|
|
|
62286
62419
|
});
|
|
62287
62420
|
}
|
|
62288
62421
|
}
|
|
62289
|
-
async handleIFrameLoad() {
|
|
62290
|
-
var _a, _b, _c, _d, _e, _f;
|
|
62422
|
+
async handleIFrameLoad(iframe) {
|
|
62423
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
62291
62424
|
if (this.errorMessage)
|
|
62292
62425
|
this.errorMessage.style.display = "none";
|
|
62293
62426
|
this.showLoadingMessageAfterDelay();
|
|
@@ -62377,54 +62510,52 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
|
|
|
62377
62510
|
if (this.chapterTitle)
|
|
62378
62511
|
this.chapterTitle.innerHTML = "(Current Chapter)";
|
|
62379
62512
|
}
|
|
62380
|
-
await this.injectInjectablesIntoIframeHead();
|
|
62381
|
-
if (this.highlighter !== void 0) {
|
|
62382
|
-
await this.highlighter.initialize();
|
|
62513
|
+
await this.injectInjectablesIntoIframeHead(iframe);
|
|
62514
|
+
if (((_a = this.view) == null ? void 0 : _a.layout) !== "fixed" && this.highlighter !== void 0) {
|
|
62515
|
+
await this.highlighter.initialize(iframe);
|
|
62383
62516
|
}
|
|
62384
|
-
const body = (
|
|
62517
|
+
const body = (_b = iframe.contentDocument) == null ? void 0 : _b.body;
|
|
62385
62518
|
let details = body == null ? void 0 : body.querySelector("details");
|
|
62386
62519
|
if (details) {
|
|
62387
62520
|
let self2 = this;
|
|
62388
62521
|
details.addEventListener("toggle", async (_event) => {
|
|
62389
62522
|
var _a2, _b2;
|
|
62390
|
-
await ((_b2 = (_a2 = self2.view) == null ? void 0 : _a2.setIframeHeight) == null ? void 0 : _b2.call(_a2,
|
|
62523
|
+
await ((_b2 = (_a2 = self2.view) == null ? void 0 : _a2.setIframeHeight) == null ? void 0 : _b2.call(_a2, iframe));
|
|
62391
62524
|
});
|
|
62392
62525
|
}
|
|
62393
62526
|
if (this.eventHandler) {
|
|
62394
|
-
|
|
62395
|
-
|
|
62396
|
-
|
|
62397
|
-
this.keyboardEventHandler.setupEvents(iframe.contentDocument);
|
|
62398
|
-
}
|
|
62527
|
+
this.eventHandler.setupEvents(iframe.contentDocument);
|
|
62528
|
+
this.touchEventHandler.setupEvents(iframe.contentDocument);
|
|
62529
|
+
this.keyboardEventHandler.setupEvents(iframe.contentDocument);
|
|
62399
62530
|
this.touchEventHandler.setupEvents(this.errorMessage);
|
|
62400
62531
|
if (!this.didInitKeyboardEventHandler) {
|
|
62401
62532
|
this.keyboardEventHandler.keydown(document);
|
|
62402
62533
|
this.didInitKeyboardEventHandler = true;
|
|
62403
62534
|
}
|
|
62404
62535
|
}
|
|
62405
|
-
if (((
|
|
62406
|
-
if ((
|
|
62407
|
-
|
|
62408
|
-
(
|
|
62536
|
+
if (((_c = this.view) == null ? void 0 : _c.layout) !== "fixed") {
|
|
62537
|
+
if ((_d = this.view) == null ? void 0 : _d.isScrollMode()) {
|
|
62538
|
+
iframe.height = "0";
|
|
62539
|
+
(_f = (_e = this.view) == null ? void 0 : _e.setIframeHeight) == null ? void 0 : _f.call(_e, iframe);
|
|
62409
62540
|
}
|
|
62410
62541
|
}
|
|
62411
62542
|
if (this.rights.enableContentProtection && this.contentProtectionModule) {
|
|
62412
|
-
await this.contentProtectionModule.initialize();
|
|
62543
|
+
await this.contentProtectionModule.initialize(iframe);
|
|
62413
62544
|
}
|
|
62414
62545
|
if (this.rights.enableConsumption && this.consumptionModule) {
|
|
62415
|
-
await this.consumptionModule.initialize();
|
|
62546
|
+
await this.consumptionModule.initialize(iframe);
|
|
62416
62547
|
}
|
|
62417
62548
|
if (this.rights.enableAnnotations && this.annotationModule) {
|
|
62418
|
-
await this.annotationModule.initialize();
|
|
62549
|
+
await this.annotationModule.initialize(iframe);
|
|
62419
62550
|
}
|
|
62420
62551
|
if (this.rights.enableBookmarks && this.bookmarkModule) {
|
|
62421
62552
|
await this.bookmarkModule.initialize();
|
|
62422
62553
|
}
|
|
62423
62554
|
if (this.rights.enableLineFocus && this.lineFocusModule) {
|
|
62424
|
-
await this.lineFocusModule.initialize();
|
|
62555
|
+
await this.lineFocusModule.initialize(iframe);
|
|
62425
62556
|
}
|
|
62426
62557
|
if (this.rights.enableTTS && this.ttsModule) {
|
|
62427
|
-
const body2 = (
|
|
62558
|
+
const body2 = (_g = iframe.contentDocument) == null ? void 0 : _g.body;
|
|
62428
62559
|
const ttsModule = this.ttsModule;
|
|
62429
62560
|
await ttsModule.initialize(body2);
|
|
62430
62561
|
}
|
|
@@ -62435,9 +62566,11 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
|
|
|
62435
62566
|
await this.mediaOverlayModule.initialize();
|
|
62436
62567
|
}
|
|
62437
62568
|
setTimeout(async () => {
|
|
62438
|
-
var _a2, _b2, _c2, _d2, _e2, _f2,
|
|
62569
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h;
|
|
62439
62570
|
if (this.newElementId) {
|
|
62440
|
-
const element =
|
|
62571
|
+
const element = iframe.contentDocument.getElementById(
|
|
62572
|
+
this.newElementId
|
|
62573
|
+
);
|
|
62441
62574
|
(_b2 = (_a2 = this.view) == null ? void 0 : _a2.goToElement) == null ? void 0 : _b2.call(_a2, element);
|
|
62442
62575
|
this.newElementId = void 0;
|
|
62443
62576
|
} else if (this.newPosition && this.newPosition.highlight) {
|
|
@@ -62455,10 +62588,10 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
|
|
|
62455
62588
|
}
|
|
62456
62589
|
}
|
|
62457
62590
|
this.hideLoadingMessage();
|
|
62458
|
-
this.showIframeContents();
|
|
62591
|
+
this.showIframeContents(iframe);
|
|
62459
62592
|
if (this.rights.enableMediaOverlays && this.mediaOverlayModule && this.hasMediaOverlays) {
|
|
62460
62593
|
let link = this.currentLink();
|
|
62461
|
-
await ((
|
|
62594
|
+
await ((_g2 = this.mediaOverlayModule) == null ? void 0 : _g2.initializeResource(link));
|
|
62462
62595
|
}
|
|
62463
62596
|
await this.updatePositionInfo();
|
|
62464
62597
|
await ((_h = this.view) == null ? void 0 : _h.setSize());
|
|
@@ -62475,7 +62608,7 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
|
|
|
62475
62608
|
return Promise.reject(err);
|
|
62476
62609
|
}
|
|
62477
62610
|
}
|
|
62478
|
-
async injectInjectablesIntoIframeHead() {
|
|
62611
|
+
async injectInjectablesIntoIframeHead(iframe) {
|
|
62479
62612
|
var _a, _b;
|
|
62480
62613
|
const injectablesToLoad = [];
|
|
62481
62614
|
const addLoadingInjectable = (injectable) => {
|
|
@@ -62490,55 +62623,53 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
|
|
|
62490
62623
|
});
|
|
62491
62624
|
injectablesToLoad.push(loadPromise);
|
|
62492
62625
|
};
|
|
62493
|
-
|
|
62494
|
-
|
|
62495
|
-
|
|
62496
|
-
|
|
62497
|
-
|
|
62498
|
-
|
|
62499
|
-
|
|
62500
|
-
|
|
62501
|
-
|
|
62502
|
-
|
|
62503
|
-
(
|
|
62504
|
-
if (injectable.
|
|
62505
|
-
|
|
62506
|
-
|
|
62507
|
-
if (!injectable.systemFont && injectable.url) {
|
|
62508
|
-
const link = _IFrameNavigator.createCssLink(injectable.url);
|
|
62509
|
-
head.appendChild(link);
|
|
62510
|
-
addLoadingInjectable(link);
|
|
62511
|
-
}
|
|
62512
|
-
} else if (injectable.r2before && injectable.url) {
|
|
62513
|
-
const link = _IFrameNavigator.createCssLink(injectable.url);
|
|
62514
|
-
head.insertBefore(link, head.firstChild);
|
|
62515
|
-
addLoadingInjectable(link);
|
|
62516
|
-
} else if (injectable.r2default && injectable.url) {
|
|
62517
|
-
const link = _IFrameNavigator.createCssLink(injectable.url);
|
|
62518
|
-
head.insertBefore(link, head.childNodes[1]);
|
|
62519
|
-
addLoadingInjectable(link);
|
|
62520
|
-
} else if (injectable.r2after && injectable.url) {
|
|
62521
|
-
if (injectable.appearance) {
|
|
62522
|
-
this.settings.initAddedAppearance();
|
|
62523
|
-
}
|
|
62524
|
-
const link = _IFrameNavigator.createCssLink(injectable.url);
|
|
62525
|
-
head.appendChild(link);
|
|
62526
|
-
addLoadingInjectable(link);
|
|
62527
|
-
} else if (injectable.url) {
|
|
62626
|
+
const head = (_a = iframe.contentDocument) == null ? void 0 : _a.head;
|
|
62627
|
+
if (head) {
|
|
62628
|
+
const bases = iframe.contentDocument.getElementsByTagName("base");
|
|
62629
|
+
if (bases.length === 0) {
|
|
62630
|
+
head.insertBefore(
|
|
62631
|
+
_IFrameNavigator.createBase(this.currentChapterLink.href),
|
|
62632
|
+
head.firstChild
|
|
62633
|
+
);
|
|
62634
|
+
}
|
|
62635
|
+
(_b = this.injectables) == null ? void 0 : _b.forEach((injectable) => {
|
|
62636
|
+
if (injectable.type === "style") {
|
|
62637
|
+
if (injectable.fontFamily) {
|
|
62638
|
+
this.settings.initAddedFont();
|
|
62639
|
+
if (!injectable.systemFont && injectable.url) {
|
|
62528
62640
|
const link = _IFrameNavigator.createCssLink(injectable.url);
|
|
62529
62641
|
head.appendChild(link);
|
|
62530
62642
|
addLoadingInjectable(link);
|
|
62531
62643
|
}
|
|
62532
|
-
} else if (injectable.
|
|
62533
|
-
const
|
|
62534
|
-
|
|
62535
|
-
|
|
62536
|
-
|
|
62537
|
-
|
|
62538
|
-
|
|
62539
|
-
|
|
62540
|
-
|
|
62541
|
-
|
|
62644
|
+
} else if (injectable.r2before && injectable.url) {
|
|
62645
|
+
const link = _IFrameNavigator.createCssLink(injectable.url);
|
|
62646
|
+
head.insertBefore(link, head.firstChild);
|
|
62647
|
+
addLoadingInjectable(link);
|
|
62648
|
+
} else if (injectable.r2default && injectable.url) {
|
|
62649
|
+
const link = _IFrameNavigator.createCssLink(injectable.url);
|
|
62650
|
+
head.insertBefore(link, head.childNodes[1]);
|
|
62651
|
+
addLoadingInjectable(link);
|
|
62652
|
+
} else if (injectable.r2after && injectable.url) {
|
|
62653
|
+
if (injectable.appearance) {
|
|
62654
|
+
this.settings.initAddedAppearance();
|
|
62655
|
+
}
|
|
62656
|
+
const link = _IFrameNavigator.createCssLink(injectable.url);
|
|
62657
|
+
head.appendChild(link);
|
|
62658
|
+
addLoadingInjectable(link);
|
|
62659
|
+
} else if (injectable.url) {
|
|
62660
|
+
const link = _IFrameNavigator.createCssLink(injectable.url);
|
|
62661
|
+
head.appendChild(link);
|
|
62662
|
+
addLoadingInjectable(link);
|
|
62663
|
+
}
|
|
62664
|
+
} else if (injectable.type === "script" && injectable.url) {
|
|
62665
|
+
const script = _IFrameNavigator.createJavascriptLink(
|
|
62666
|
+
injectable.url,
|
|
62667
|
+
injectable.async ?? false
|
|
62668
|
+
);
|
|
62669
|
+
head.appendChild(script);
|
|
62670
|
+
addLoadingInjectable(script);
|
|
62671
|
+
}
|
|
62672
|
+
});
|
|
62542
62673
|
}
|
|
62543
62674
|
if (injectablesToLoad.length === 0) {
|
|
62544
62675
|
return;
|
|
@@ -62856,21 +62987,21 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
|
|
|
62856
62987
|
}
|
|
62857
62988
|
} else {
|
|
62858
62989
|
this.iframes[0].src = "about:blank";
|
|
62859
|
-
|
|
62860
|
-
|
|
62861
|
-
|
|
62862
|
-
|
|
62863
|
-
|
|
62864
|
-
|
|
62865
|
-
|
|
62866
|
-
|
|
62867
|
-
|
|
62868
|
-
|
|
62869
|
-
|
|
62870
|
-
|
|
62871
|
-
|
|
62872
|
-
);
|
|
62873
|
-
}
|
|
62990
|
+
if (this.iframes.length === 2) {
|
|
62991
|
+
this.currentSpreadLinks.right = {
|
|
62992
|
+
href: this.currentChapterLink.href
|
|
62993
|
+
};
|
|
62994
|
+
if (isSameOrigin) {
|
|
62995
|
+
this.iframes[1].src = this.currentChapterLink.href;
|
|
62996
|
+
} else {
|
|
62997
|
+
fetch(this.currentChapterLink.href, this.requestConfig).then((r) => r.text()).then(async (content) => {
|
|
62998
|
+
writeIframe2Doc.call(
|
|
62999
|
+
this,
|
|
63000
|
+
content,
|
|
63001
|
+
this.currentChapterLink.href
|
|
63002
|
+
);
|
|
63003
|
+
});
|
|
63004
|
+
}
|
|
62874
63005
|
}
|
|
62875
63006
|
}
|
|
62876
63007
|
}
|
|
@@ -63797,15 +63928,13 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
|
|
|
63797
63928
|
}
|
|
63798
63929
|
}
|
|
63799
63930
|
}
|
|
63800
|
-
showIframeContents() {
|
|
63931
|
+
showIframeContents(iframe) {
|
|
63801
63932
|
this.isBeingStyled = false;
|
|
63802
63933
|
setTimeout(() => {
|
|
63803
63934
|
if (!this.isBeingStyled) {
|
|
63804
|
-
|
|
63805
|
-
|
|
63806
|
-
|
|
63807
|
-
iframe.style.overflow = "hidden";
|
|
63808
|
-
});
|
|
63935
|
+
iframe.style.opacity = "1";
|
|
63936
|
+
iframe.style.border = "none";
|
|
63937
|
+
iframe.style.overflow = "hidden";
|
|
63809
63938
|
}
|
|
63810
63939
|
}, 150);
|
|
63811
63940
|
}
|
|
@@ -64426,16 +64555,20 @@ var LocalStorageStore = class {
|
|
|
64426
64555
|
constructor(config2) {
|
|
64427
64556
|
this.prefix = config2.prefix;
|
|
64428
64557
|
this.useLocalStorage = config2.useLocalStorage;
|
|
64558
|
+
this.useStorageType = config2.useStorageType;
|
|
64429
64559
|
try {
|
|
64430
64560
|
const testKey = config2.prefix + "-" + String(Math.random());
|
|
64431
|
-
if (this.
|
|
64561
|
+
if (this.useStorageType === "memory") {
|
|
64562
|
+
this.fallbackStore = new MemoryStore();
|
|
64563
|
+
} else if (this.useStorageType === "local" || this.useLocalStorage) {
|
|
64432
64564
|
window.localStorage.setItem(testKey, "test");
|
|
64433
64565
|
window.localStorage.removeItem(testKey);
|
|
64434
|
-
|
|
64566
|
+
this.fallbackStore = null;
|
|
64567
|
+
} else if (this.useStorageType === "session" || !this.useLocalStorage) {
|
|
64435
64568
|
window.sessionStorage.setItem(testKey, "test");
|
|
64436
64569
|
window.sessionStorage.removeItem(testKey);
|
|
64570
|
+
this.fallbackStore = null;
|
|
64437
64571
|
}
|
|
64438
|
-
this.fallbackStore = null;
|
|
64439
64572
|
} catch (e) {
|
|
64440
64573
|
this.fallbackStore = new MemoryStore();
|
|
64441
64574
|
}
|
|
@@ -64446,7 +64579,7 @@ var LocalStorageStore = class {
|
|
|
64446
64579
|
get(key) {
|
|
64447
64580
|
let value;
|
|
64448
64581
|
if (!this.fallbackStore) {
|
|
64449
|
-
if (this.useLocalStorage) {
|
|
64582
|
+
if (this.useStorageType === "local" || this.useLocalStorage) {
|
|
64450
64583
|
value = window.localStorage.getItem(this.getLocalStorageKey(key));
|
|
64451
64584
|
} else {
|
|
64452
64585
|
value = window.sessionStorage.getItem(this.getLocalStorageKey(key));
|
|
@@ -64458,7 +64591,7 @@ var LocalStorageStore = class {
|
|
|
64458
64591
|
}
|
|
64459
64592
|
set(key, value) {
|
|
64460
64593
|
if (!this.fallbackStore) {
|
|
64461
|
-
if (this.useLocalStorage) {
|
|
64594
|
+
if (this.useStorageType === "local" || this.useLocalStorage) {
|
|
64462
64595
|
window.localStorage.setItem(this.getLocalStorageKey(key), value);
|
|
64463
64596
|
} else {
|
|
64464
64597
|
window.sessionStorage.setItem(this.getLocalStorageKey(key), value);
|
|
@@ -64469,7 +64602,7 @@ var LocalStorageStore = class {
|
|
|
64469
64602
|
}
|
|
64470
64603
|
remove(key) {
|
|
64471
64604
|
if (!this.fallbackStore) {
|
|
64472
|
-
if (this.useLocalStorage) {
|
|
64605
|
+
if (this.useStorageType === "local" || this.useLocalStorage) {
|
|
64473
64606
|
window.localStorage.removeItem(this.getLocalStorageKey(key));
|
|
64474
64607
|
} else {
|
|
64475
64608
|
window.sessionStorage.removeItem(this.getLocalStorageKey(key));
|
|
@@ -65416,15 +65549,18 @@ var D2Reader = class _D2Reader {
|
|
|
65416
65549
|
}
|
|
65417
65550
|
const store = new LocalStorageStore({
|
|
65418
65551
|
prefix: publication.manifestUrl,
|
|
65419
|
-
useLocalStorage: initialConfig.useLocalStorage ?? false
|
|
65552
|
+
useLocalStorage: initialConfig.useLocalStorage ?? false,
|
|
65553
|
+
useStorageType: initialConfig.useStorageType
|
|
65420
65554
|
});
|
|
65421
65555
|
const settingsStore = new LocalStorageStore({
|
|
65422
65556
|
prefix: "r2d2bc-reader",
|
|
65423
|
-
useLocalStorage: initialConfig.useLocalStorage ?? false
|
|
65557
|
+
useLocalStorage: initialConfig.useLocalStorage ?? false,
|
|
65558
|
+
useStorageType: initialConfig.useStorageType
|
|
65424
65559
|
});
|
|
65425
65560
|
const layerStore = new LocalStorageStore({
|
|
65426
65561
|
prefix: "r2d2bc-layers",
|
|
65427
|
-
useLocalStorage: initialConfig.useLocalStorage ?? false
|
|
65562
|
+
useLocalStorage: initialConfig.useLocalStorage ?? false,
|
|
65563
|
+
useStorageType: initialConfig.useStorageType
|
|
65428
65564
|
});
|
|
65429
65565
|
const annotator = new LocalAnnotator({ store });
|
|
65430
65566
|
publication.sample = initialConfig.sample;
|