@readium/shared 2.3.0 → 2.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +28 -0
- package/README.MD +7 -8
- package/dist/ar-DyHX_uy2.js +7 -0
- package/dist/da-Dct0PS3E.js +7 -0
- package/dist/fr-C5HEel98.js +7 -0
- package/dist/index.js +4993 -1
- package/dist/index.umd.cjs +3 -0
- package/dist/it-DFOBoXGy.js +7 -0
- package/dist/pt_PT-Di3sVjze.js +7 -0
- package/dist/sv-BfzAFsVN.js +7 -0
- package/package.json +26 -33
- package/src/fetcher/HttpFetcher.ts +5 -5
- package/src/fetcher/Resource.ts +10 -5
- package/src/publication/Link.ts +6 -2
- package/src/publication/Locator.ts +3 -21
- package/src/publication/Manifest.ts +10 -10
- package/src/publication/Publication.ts +1 -2
- package/src/publication/accessibility/Localization.ts +14 -12
- package/src/publication/accessibility/SupportedLanguages.ts +1 -1
- package/src/publication/encryption/Properties.ts +15 -3
- package/src/publication/epub/Metadata.ts +12 -6
- package/src/publication/epub/Properties.ts +13 -3
- package/src/publication/epub/Publication.ts +39 -18
- package/src/publication/html/Locations.ts +101 -54
- package/src/publication/opds/Properties.ts +66 -21
- package/src/publication/opds/Publication.ts +9 -3
- package/src/publication/services/content/iterators/HTMLResourceContentIterator.ts +1 -3
- package/src/publication/services/timeline/Timeline.ts +59 -268
- package/src/publication/services/timeline/TimelineItem.ts +3 -3
- package/src/publication/services/timeline/index.ts +0 -12
- package/src/util/npt.ts +0 -19
- package/types/src/fetcher/HttpFetcher.d.ts +3 -3
- package/types/src/fetcher/Resource.d.ts +6 -2
- package/types/src/publication/encryption/Properties.d.ts +9 -2
- package/types/src/publication/epub/Metadata.d.ts +6 -3
- package/types/src/publication/epub/Properties.d.ts +10 -2
- package/types/src/publication/epub/Publication.d.ts +18 -7
- package/types/src/publication/html/Locations.d.ts +44 -15
- package/types/src/publication/opds/Properties.d.ts +36 -8
- package/types/src/publication/opds/Publication.d.ts +5 -2
- package/types/src/publication/services/timeline/Timeline.d.ts +12 -78
- package/types/src/publication/services/timeline/TimelineItem.d.ts +3 -3
- package/types/src/publication/services/timeline/index.d.ts +0 -6
- package/types/src/util/npt.d.ts +0 -10
- package/dist/_virtual/preload-helper.js +0 -1
- package/dist/fetcher/Fetcher.js +0 -1
- package/dist/fetcher/HttpFetcher.js +0 -1
- package/dist/fetcher/Resource.js +0 -1
- package/dist/locales/publication-metadata/ar.json.js +0 -1
- package/dist/locales/publication-metadata/da.json.js +0 -1
- package/dist/locales/publication-metadata/el.json.js +0 -1
- package/dist/locales/publication-metadata/en.json.js +0 -1
- package/dist/locales/publication-metadata/es.json.js +0 -1
- package/dist/locales/publication-metadata/et.json.js +0 -1
- package/dist/locales/publication-metadata/fi.json.js +0 -1
- package/dist/locales/publication-metadata/fr.json.js +0 -1
- package/dist/locales/publication-metadata/it.json.js +0 -1
- package/dist/locales/publication-metadata/pl.json.js +0 -1
- package/dist/locales/publication-metadata/pt_PT.json.js +0 -1
- package/dist/locales/publication-metadata/sv.json.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/constants.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/index.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-attribute.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-class.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-fallback.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-id.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-nth-child.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-nth-of-type.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/selector-tag.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/types.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-cartesian.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-data.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-dom.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-element-data.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-iselement.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-messages.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-options.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-powerset.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-selectors.js +0 -1
- package/dist/node_modules/.pnpm/css-selector-generator@3.8.0/node_modules/css-selector-generator/esm/utilities-typescript.js +0 -1
- package/dist/opds/Acquisition.js +0 -1
- package/dist/opds/Availability.js +0 -1
- package/dist/opds/Copies.js +0 -1
- package/dist/opds/Holds.js +0 -1
- package/dist/opds/Price.js +0 -1
- package/dist/publication/AltIdentifier.js +0 -1
- package/dist/publication/BelongsTo.js +0 -1
- package/dist/publication/Contributor.js +0 -1
- package/dist/publication/GuidedNavigation.js +0 -1
- package/dist/publication/Layout.js +0 -1
- package/dist/publication/Link.js +0 -1
- package/dist/publication/LocalizedString.js +0 -1
- package/dist/publication/Locator.js +0 -1
- package/dist/publication/LocatorCollection.js +0 -1
- package/dist/publication/Manifest.js +0 -1
- package/dist/publication/Metadata.js +0 -1
- package/dist/publication/Profiles.js +0 -1
- package/dist/publication/Properties.js +0 -1
- package/dist/publication/Publication.js +0 -1
- package/dist/publication/PublicationCollection.js +0 -1
- package/dist/publication/ReadingProgression.js +0 -1
- package/dist/publication/Subject.js +0 -1
- package/dist/publication/TDM.js +0 -1
- package/dist/publication/accessibility/Accessibility.js +0 -1
- package/dist/publication/accessibility/AccessibilityMetadataDisplayGuide.js +0 -1
- package/dist/publication/accessibility/Localization.js +0 -1
- package/dist/publication/accessibility/SupportedLanguages.js +0 -1
- package/dist/publication/encryption/Encryption.js +0 -1
- package/dist/publication/encryption/Properties.js +0 -1
- package/dist/publication/encryption/index.js +0 -1
- package/dist/publication/epub/MediaOverlay.js +0 -1
- package/dist/publication/epub/Metadata.js +0 -1
- package/dist/publication/epub/Properties.js +0 -1
- package/dist/publication/epub/Publication.js +0 -1
- package/dist/publication/epub/index.js +0 -1
- package/dist/publication/html/DomRange.js +0 -1
- package/dist/publication/html/DomRangePoint.js +0 -1
- package/dist/publication/html/Locations.js +0 -1
- package/dist/publication/html/index.js +0 -1
- package/dist/publication/opds/Properties.js +0 -1
- package/dist/publication/opds/Publication.js +0 -1
- package/dist/publication/opds/index.js +0 -1
- package/dist/publication/services/content/Content.js +0 -2
- package/dist/publication/services/content/ContentTokenizer.js +0 -1
- package/dist/publication/services/content/Iterator.js +0 -1
- package/dist/publication/services/content/element/attributes.js +0 -1
- package/dist/publication/services/content/element/element.js +0 -1
- package/dist/publication/services/content/element/text_role.js +0 -1
- package/dist/publication/services/content/iterators/HTMLResourceContentIterator.js +0 -1
- package/dist/publication/services/content/iterators/PDFTextContentIterator.js +0 -1
- package/dist/publication/services/content/iterators/PublicationContentIterator.js +0 -1
- package/dist/publication/services/content/iterators/helpers.js +0 -1
- package/dist/publication/services/timeline/Timeline.js +0 -1
- package/dist/publication/services/timeline/audio.js +0 -1
- package/dist/publication/services/timeline/html.js +0 -1
- package/dist/publication/services/timeline/index.js +0 -1
- package/dist/util/JSONParse.js +0 -1
- package/dist/util/URITemplate.js +0 -1
- package/dist/util/mediatype/MediaType.js +0 -1
- package/dist/util/npt.js +0 -1
- package/dist/util/tokenizer/TextTokenizer.js +0 -1
- package/dist/util/tokenizer/tokenize-english/abbreviations.js +0 -1
- package/dist/util/tokenizer/tokenize-english/index.js +0 -2
- package/dist/util/tokenizer/tokenize-english/utils.js +0 -1
- package/dist/util/tokenizer/tokenize-text/index.js +0 -1
- package/dist/util/tokenizer/tokenize-text/tokens.js +0 -1
- package/src/locales/publication-metadata/ar.json +0 -402
- package/src/locales/publication-metadata/brh.json +0 -1
- package/src/locales/publication-metadata/da.json +0 -310
- package/src/locales/publication-metadata/el.json +0 -310
- package/src/locales/publication-metadata/en.json +0 -310
- package/src/locales/publication-metadata/es.json +0 -333
- package/src/locales/publication-metadata/et.json +0 -310
- package/src/locales/publication-metadata/fi.json +0 -310
- package/src/locales/publication-metadata/fr.json +0 -333
- package/src/locales/publication-metadata/he.json +0 -9
- package/src/locales/publication-metadata/it.json +0 -333
- package/src/locales/publication-metadata/lt.json +0 -8
- package/src/locales/publication-metadata/pl.json +0 -333
- package/src/locales/publication-metadata/pt_PT.json +0 -329
- package/src/locales/publication-metadata/sv.json +0 -310
- package/src/locales/publication-metadata/tr.json +0 -51
- package/src/locales/publication-metadata/uk.json +0 -1
- package/src/publication/services/timeline/audio.ts +0 -31
- package/src/publication/services/timeline/html.ts +0 -5
- package/types/src/publication/services/timeline/audio.d.ts +0 -4
- package/types/src/publication/services/timeline/html.d.ts +0 -4
|
@@ -2,81 +2,128 @@ import { LocatorLocations } from '../Locator.ts';
|
|
|
2
2
|
import { DomRange } from './DomRange.ts';
|
|
3
3
|
import { parseNptTime } from '../../util/npt.ts';
|
|
4
4
|
|
|
5
|
-
// HTML extensions for
|
|
5
|
+
// HTML extensions for [Locations].
|
|
6
6
|
// https://github.com/readium/architecture/blob/master/models/locators/extensions/html.md
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
declare module '../Locator' {
|
|
9
|
+
export interface LocatorLocations {
|
|
10
|
+
/**
|
|
11
|
+
* A CSS Selector.
|
|
12
|
+
*/
|
|
13
|
+
getCssSelector(): string | undefined;
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
/**
|
|
16
|
+
* [partialCfi] is an expression conforming to the "right-hand" side of the EPUB CFI syntax, that is
|
|
17
|
+
* to say: without the EPUB-specific OPF spine item reference that precedes the first ! exclamation
|
|
18
|
+
* mark (which denotes the "step indirection" into a publication document). Note that the wrapping
|
|
19
|
+
* epubcfi(***) syntax is not used for the [partialCfi] string, i.e. the "fragment" part of the CFI
|
|
20
|
+
* grammar is ignored.
|
|
21
|
+
*/
|
|
22
|
+
getPartialCfi(): string | undefined;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* An HTML DOM range.
|
|
26
|
+
*/
|
|
27
|
+
getDomRange(): DomRange | undefined;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* All named parameters found in the fragments, such as `p=5`.
|
|
31
|
+
*/
|
|
32
|
+
fragmentParameters(): Map<string, string>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* HTML ID fragment identifier.
|
|
36
|
+
*/
|
|
37
|
+
htmlId(): string | undefined;
|
|
15
38
|
|
|
16
|
-
|
|
17
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Page fragment identifier, used for example in PDF.
|
|
41
|
+
*/
|
|
42
|
+
page(): number | undefined;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Temporal Dimension media fragment, used for example in audiobooks.
|
|
46
|
+
*
|
|
47
|
+
* https://www.w3.org/TR/media-frags/
|
|
48
|
+
*/
|
|
49
|
+
time(): number | undefined;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Spatial Dimension media fragment, used for example in audiobooks.
|
|
53
|
+
*
|
|
54
|
+
* https://www.w3.org/TR/media-frags/
|
|
55
|
+
*/
|
|
56
|
+
space(): [number, number, number, number] | undefined;
|
|
57
|
+
}
|
|
18
58
|
}
|
|
19
59
|
|
|
20
|
-
|
|
60
|
+
LocatorLocations.prototype.getCssSelector = function(): string | undefined {
|
|
61
|
+
return this.otherLocations?.get('cssSelector');
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
LocatorLocations.prototype.getPartialCfi = function(): string | undefined {
|
|
65
|
+
return this.otherLocations?.get('partialCfi');
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
LocatorLocations.prototype.getDomRange = function(): DomRange | undefined {
|
|
69
|
+
return DomRange.deserialize(this.otherLocations?.get('domRange'));
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Below is technically part of the Navigator's Locator extensions, we're putting it here for now
|
|
73
|
+
|
|
74
|
+
// Reference: https://www.w3.org/TR/fragid-best-practices
|
|
75
|
+
LocatorLocations.prototype.fragmentParameters = function(): Map<string, string> {
|
|
21
76
|
return new Map(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
.
|
|
77
|
+
this.fragments
|
|
78
|
+
// Concatenates fragments together, after dropping any #
|
|
79
|
+
.map(f => f.startsWith("#") ? f.slice(1) : f)
|
|
80
|
+
.join("&")
|
|
81
|
+
// Splits parameters
|
|
82
|
+
.split("&")
|
|
83
|
+
.filter(f => !f.startsWith("#"))
|
|
84
|
+
.map(f => f.split("="))
|
|
85
|
+
// Only keep named parameters
|
|
28
86
|
.filter(f => f.length === 2)
|
|
29
|
-
.map(f => [
|
|
87
|
+
.map(f => [
|
|
88
|
+
f[0].trim().toLowerCase(),
|
|
89
|
+
f[1].trim()
|
|
90
|
+
])
|
|
30
91
|
);
|
|
31
|
-
}
|
|
92
|
+
};
|
|
32
93
|
|
|
33
|
-
|
|
94
|
+
LocatorLocations.prototype.htmlId = function(): string | undefined {
|
|
34
95
|
/*
|
|
35
96
|
The HTML 5 specification (used for WebPub) allows any character in an HTML ID, except spaces.
|
|
36
97
|
This is an issue to differentiate with named parameters, so we ignore any ID containing `=`.
|
|
37
98
|
*/
|
|
38
|
-
if
|
|
39
|
-
let f =
|
|
40
|
-
if
|
|
41
|
-
const fp =
|
|
42
|
-
if
|
|
43
|
-
else if
|
|
99
|
+
if(!this.fragments.length) return;
|
|
100
|
+
let f = this.fragments.find(f => f.length && !f.includes("="));
|
|
101
|
+
if(!f) {
|
|
102
|
+
const fp = this.fragmentParameters();
|
|
103
|
+
if(fp.has("id")) f = fp.get("id");
|
|
104
|
+
else if(fp.has("name")) f = fp.get("name");
|
|
44
105
|
}
|
|
45
|
-
return f?.startsWith(
|
|
46
|
-
}
|
|
106
|
+
return f?.startsWith("#") ? f.slice(1) : f;
|
|
107
|
+
};
|
|
47
108
|
|
|
48
|
-
|
|
49
|
-
const i = parseInt(
|
|
50
|
-
if
|
|
109
|
+
LocatorLocations.prototype.page = function(): number | undefined {
|
|
110
|
+
const i = parseInt(this.fragmentParameters().get("page")!);
|
|
111
|
+
if(!isNaN(i) && i >= 0) return i;
|
|
51
112
|
return undefined;
|
|
52
113
|
}
|
|
53
114
|
|
|
54
|
-
|
|
55
|
-
const raw =
|
|
115
|
+
LocatorLocations.prototype.time = function(): number | undefined {
|
|
116
|
+
const raw = this.fragmentParameters().get("t");
|
|
56
117
|
if (!raw) return undefined;
|
|
57
118
|
return parseNptTime(raw);
|
|
58
119
|
}
|
|
59
120
|
|
|
60
|
-
|
|
61
|
-
const fp =
|
|
62
|
-
if
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const normalizedRaw = raw.toLowerCase();
|
|
69
|
-
if (normalizedRaw.startsWith("pixel:")) {
|
|
70
|
-
coords = raw.slice(6);
|
|
71
|
-
} else if (normalizedRaw.startsWith("percent:")) {
|
|
72
|
-
unit = "percent";
|
|
73
|
-
coords = raw.slice(8);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const parse = unit === "percent" ? parseFloat : (s: string) => parseInt(s, 10);
|
|
77
|
-
const parts = coords.split(",").map(parse);
|
|
78
|
-
if (parts.length !== 4 || parts.some(isNaN)) return;
|
|
79
|
-
|
|
80
|
-
const [x, y, width, height] = parts;
|
|
81
|
-
return { unit, x, y, width, height };
|
|
121
|
+
LocatorLocations.prototype.space = function(): [number, number, number, number] | undefined {
|
|
122
|
+
const fp = this.fragmentParameters();
|
|
123
|
+
if(!fp.has("xywh")) return;
|
|
124
|
+
// TODO more sophiticated parsing to handle the format
|
|
125
|
+
const xywh = fp.get("xywh")!.split(",").map(s => parseInt(s));
|
|
126
|
+
if(xywh.length !== 4) return; // Must have four parts
|
|
127
|
+
if(xywh.some(isNaN)) return; // All parts must be numbers
|
|
128
|
+
return xywh as [number, number, number, number];
|
|
82
129
|
}
|
|
@@ -3,37 +3,82 @@ import { positiveNumberfromJSON } from '../../util/JSONParse.ts';
|
|
|
3
3
|
import { Link } from '../Link.ts';
|
|
4
4
|
import { Properties } from '../Properties.ts';
|
|
5
5
|
|
|
6
|
-
// OPDS extensions for link Properties.
|
|
6
|
+
// OPDS extensions for link [Properties].
|
|
7
7
|
// https://specs.opds.io/schema/properties.schema.json
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
declare module '../Properties' {
|
|
10
|
+
export interface Properties {
|
|
11
|
+
/**
|
|
12
|
+
* Provides a hint about the expected number of items returned.
|
|
13
|
+
*/
|
|
14
|
+
getNumberOfItems(): number | undefined;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The price of a publication is tied to its acquisition link.
|
|
18
|
+
*/
|
|
19
|
+
getPrice(): Price | undefined;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Indirect acquisition provides a hint for the expected media type that will be acquired after
|
|
23
|
+
* additional steps.
|
|
24
|
+
*/
|
|
25
|
+
getIndirectAcquisitions(): Array<Acquisition> | undefined;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Library-specific features when a specific book is unavailable but provides a hold list.
|
|
29
|
+
*/
|
|
30
|
+
getHolds(): Holds | undefined;
|
|
12
31
|
|
|
13
|
-
|
|
14
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Library-specific feature that contains information about the copies that a library has acquired.
|
|
34
|
+
*/
|
|
35
|
+
getCopies(): Copies | undefined;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Indicated the availability of a given resource.
|
|
39
|
+
*/
|
|
40
|
+
getAvailability(): Availability | undefined;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Indicates that the linked resource supports authentication with the associated Authentication
|
|
44
|
+
* Document.
|
|
45
|
+
*
|
|
46
|
+
* See https://specs.opds.io/authentication-for-opds-1.0.html
|
|
47
|
+
*/
|
|
48
|
+
getAuthenticate(): Link | undefined;
|
|
49
|
+
}
|
|
15
50
|
}
|
|
16
51
|
|
|
17
|
-
|
|
18
|
-
|
|
52
|
+
Properties.prototype.getNumberOfItems = function(): number | undefined {
|
|
53
|
+
return positiveNumberfromJSON(this.otherProperties['numberOfItems']);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
Properties.prototype.getPrice = function(): Price | undefined {
|
|
57
|
+
return Price.deserialize(this.otherProperties['price']);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
Properties.prototype.getIndirectAcquisitions = function():
|
|
61
|
+
| Array<Acquisition>
|
|
62
|
+
| undefined {
|
|
63
|
+
const json = this.otherProperties['indirectAcquisition'];
|
|
19
64
|
if (!(json && Array.isArray(json))) return;
|
|
20
65
|
return json
|
|
21
66
|
.map<Acquisition>(item => Acquisition.deserialize(item) as Acquisition)
|
|
22
67
|
.filter(x => x !== undefined);
|
|
23
|
-
}
|
|
68
|
+
};
|
|
24
69
|
|
|
25
|
-
|
|
26
|
-
return Holds.deserialize(
|
|
27
|
-
}
|
|
70
|
+
Properties.prototype.getHolds = function(): Holds | undefined {
|
|
71
|
+
return Holds.deserialize(this.otherProperties['holds']);
|
|
72
|
+
};
|
|
28
73
|
|
|
29
|
-
|
|
30
|
-
return Copies.deserialize(
|
|
31
|
-
}
|
|
74
|
+
Properties.prototype.getCopies = function(): Copies | undefined {
|
|
75
|
+
return Copies.deserialize(this.otherProperties['copies']);
|
|
76
|
+
};
|
|
32
77
|
|
|
33
|
-
|
|
34
|
-
return Availability.deserialize(
|
|
35
|
-
}
|
|
78
|
+
Properties.prototype.getAvailability = function(): Availability | undefined {
|
|
79
|
+
return Availability.deserialize(this.otherProperties['availability']);
|
|
80
|
+
};
|
|
36
81
|
|
|
37
|
-
|
|
38
|
-
return Link.deserialize(
|
|
39
|
-
}
|
|
82
|
+
Properties.prototype.getAuthenticate = function(): Link | undefined {
|
|
83
|
+
return Link.deserialize(this.otherProperties['authenticate']);
|
|
84
|
+
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { Links } from '../Link.ts';
|
|
2
2
|
import { Publication } from '../Publication.ts';
|
|
3
3
|
|
|
4
|
-
// OPDS extensions for Publication
|
|
4
|
+
// OPDS extensions for [Publication]
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
declare module '../Publication' {
|
|
7
|
+
export interface Publication {
|
|
8
|
+
getImages(): Links | undefined;
|
|
9
|
+
}
|
|
8
10
|
}
|
|
11
|
+
|
|
12
|
+
Publication.prototype.getImages = function(): Links | undefined {
|
|
13
|
+
return this.linksWithRole('images');
|
|
14
|
+
};
|
|
@@ -5,7 +5,6 @@ import { IllegalStateError, Iterator } from "../Iterator.ts";
|
|
|
5
5
|
import { Attribute, AttributeKeys, AudioElement, Body, ContentElement, Footnote, Heading, ImageElement, TextElement, TextQuote, TextRole, TextSegment, VideoElement } from "../element/index.ts";
|
|
6
6
|
import { appendNormalizedWhitespace, elementLanguage, isBlank, isInlineTag, srcRelativeToHref, trimUnicodeSpace, trimUnicodeSpaceEnd, trimUnicodeSpaceStart, trimmingTextLocator } from "./helpers.ts";
|
|
7
7
|
import { getCssSelector } from "css-selector-generator";
|
|
8
|
-
import { getCssSelector as locatorCssSelector } from "../../../html/Locations.ts";
|
|
9
8
|
|
|
10
9
|
interface ElementWithDelta {
|
|
11
10
|
element: ContentElement;
|
|
@@ -94,11 +93,10 @@ export class HTMLResourceContentIterator extends Iterator {
|
|
|
94
93
|
private async parseElements(): Promise<ParsedElementRecipes> {
|
|
95
94
|
const raw = await this.resource.readAsString();
|
|
96
95
|
const doc = (new DOMParser()).parseFromString(raw!, this.locator.type as DOMParserSupportedType);
|
|
97
|
-
const startSel = locatorCssSelector(this.locator.locations);
|
|
98
96
|
this.parser = new ContentParser(
|
|
99
97
|
doc,
|
|
100
98
|
this.locator,
|
|
101
|
-
|
|
99
|
+
this.locator.locations.getCssSelector() ? doc.querySelector(this.locator.locations.getCssSelector()!) as Element : null,
|
|
102
100
|
this.beforeMaxLength
|
|
103
101
|
);
|
|
104
102
|
|