@internetarchive/bookreader 5.0.0-36 → 5.0.0-37
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/.github/workflows/node.js.yml +3 -3
- package/.github/workflows/npm-publish.yml +2 -16
- package/BookReader/BookReader.js +1 -1
- package/BookReader/BookReader.js.LICENSE.txt +8 -29
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/ia-bookreader-bundle.js +101 -100
- package/BookReader/ia-bookreader-bundle.js.LICENSE.txt +15 -12
- package/BookReader/ia-bookreader-bundle.js.map +1 -1
- package/BookReader/plugins/plugin.chapters.js +1 -1
- package/BookReader/plugins/plugin.chapters.js.map +1 -1
- package/BookReader/plugins/plugin.search.js +1 -1
- package/BookReader/plugins/plugin.search.js.map +1 -1
- package/BookReader/plugins/plugin.text_selection.js +1 -1
- package/BookReader/plugins/plugin.text_selection.js.map +1 -1
- package/BookReader/plugins/plugin.tts.js +1 -1
- package/BookReader/plugins/plugin.tts.js.map +1 -1
- package/CHANGELOG.md +9 -0
- package/README.md +1 -1
- package/package.json +7 -10
- package/src/BookNavigator/assets/bookmark-colors.js +1 -1
- package/src/BookNavigator/assets/button-base.js +1 -1
- package/src/BookNavigator/assets/ia-logo.js +1 -1
- package/src/BookNavigator/assets/icon_checkmark.js +1 -1
- package/src/BookNavigator/assets/icon_close.js +1 -1
- package/src/BookNavigator/assets/icon_sort_asc.js +1 -1
- package/src/BookNavigator/assets/icon_sort_desc.js +1 -1
- package/src/BookNavigator/assets/icon_sort_neutral.js +1 -1
- package/src/BookNavigator/assets/icon_volumes.js +1 -1
- package/src/BookNavigator/book-navigator.js +1 -2
- package/src/BookNavigator/bookmarks/bookmark-button.js +1 -1
- package/src/BookNavigator/bookmarks/bookmark-edit.js +2 -3
- package/src/BookNavigator/bookmarks/bookmarks-list.js +2 -3
- package/src/BookNavigator/bookmarks/bookmarks-loginCTA.js +1 -1
- package/src/BookNavigator/bookmarks/bookmarks-provider.js +1 -1
- package/src/BookNavigator/bookmarks/ia-bookmarks.js +4 -7
- package/src/BookNavigator/delete-modal-actions.js +1 -1
- package/src/BookNavigator/downloads/downloads-provider.js +1 -1
- package/src/BookNavigator/downloads/downloads.js +1 -2
- package/src/BookNavigator/search/a-search-result.js +2 -3
- package/src/BookNavigator/search/search-provider.js +1 -2
- package/src/BookNavigator/search/search-results.js +1 -2
- package/src/BookNavigator/sharing.js +1 -1
- package/src/BookNavigator/visual-adjustments/visual-adjustments-provider.js +1 -1
- package/src/BookNavigator/visual-adjustments/visual-adjustments.js +3 -3
- package/src/BookNavigator/volumes/volumes-provider.js +1 -1
- package/src/BookNavigator/volumes/volumes.js +2 -3
- package/src/BookReader/Mode1Up.js +2 -1
- package/src/BookReader/Mode1UpLit.js +3 -2
- package/src/BookReader.js +4 -2
- package/src/ia-bookreader/ia-bookreader.js +1 -1
- package/src/plugins/plugin.chapters.js +11 -15
- package/src/plugins/plugin.text_selection.js +9 -10
- package/src/plugins/search/plugin.search.js +3 -3
- package/src/plugins/tts/FestivalTTSEngine.js +10 -11
- package/src/plugins/tts/PageChunk.js +11 -20
- package/src/plugins/tts/WebTTSEngine.js +22 -26
- package/tests/jest/BookReader/Mode1UpLit.test.js +2 -1
- package/tests/jest/plugins/plugin.text_selection.test.js +25 -23
- package/tests/jest/plugins/search/plugin.search.test.js +12 -20
- package/tests/jest/plugins/tts/AbstractTTSEngine.test.js +3 -3
- package/tests/karma/BookNavigator/bookmarks/bookmarks-list.test.js +2 -2
- package/tests/karma/BookNavigator/downloads/downloads.test.js +1 -1
- package/tests/karma/BookNavigator/volumes/volumes-provider.test.js +3 -3
- package/webpack.config.js +1 -1
- package/BookReaderDemo/bookreader-template-bundle.js +0 -7178
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
# 5.0.0-37
|
|
2
|
+
Fix: Update all `.then()` to async/await @sancodes
|
|
3
|
+
Fix: Upgrade to Lit 2 @Aadilhassan
|
|
4
|
+
Dev: Update to Node v16.x @duggiefresh
|
|
5
|
+
Dev: Remove unused demo bundle @cdrini
|
|
6
|
+
Dev: Fix README broken link for plugin directory @duggiefresh
|
|
7
|
+
Dev: Update sharing options menu to lit2 @iisa
|
|
8
|
+
Dev: Remove package publishing from GHA @cdrini
|
|
9
|
+
|
|
1
10
|
# 5.0.0-36
|
|
2
11
|
Fix: Readaloud scrolls along with dext @cdrini
|
|
3
12
|
Dev: ES6 var to let/const updates @sancodes
|
package/README.md
CHANGED
|
@@ -123,7 +123,7 @@ A peek in how to use/extend core functionality:
|
|
|
123
123
|
- plugin.url.js - automatically updates the browser url
|
|
124
124
|
- plugin.resume.js - uses cookies to remember the current page
|
|
125
125
|
- plugin.vendor-fullscreen.js - replaces fullscreen mode with vendor native fullscreen
|
|
126
|
-
- see plugin directory for current plugin files
|
|
126
|
+
- see [plugin directory for current plugin files](https://github.com/internetarchive/bookreader/tree/master/src/plugins)
|
|
127
127
|
|
|
128
128
|
### Embedding BookReader in an iFrame
|
|
129
129
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internetarchive/bookreader",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-37",
|
|
4
4
|
"description": "The Internet Archive BookReader.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,13 +26,11 @@
|
|
|
26
26
|
"private": false,
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@internetarchive/ia-activity-indicator": "^0.0.1",
|
|
29
|
-
"@internetarchive/ia-item-navigator": "0.0
|
|
30
|
-
"@internetarchive/ia-
|
|
31
|
-
"@internetarchive/ia-sharing-options": "^0.1.4",
|
|
29
|
+
"@internetarchive/ia-item-navigator": "^1.0.0",
|
|
30
|
+
"@internetarchive/ia-sharing-options": "^1.0.1",
|
|
32
31
|
"@internetarchive/icon-bookmark": "^1.1.3",
|
|
33
|
-
"@internetarchive/icon-collapse-sidebar": "^1.1.0",
|
|
34
32
|
"@internetarchive/icon-dl": "^1.1.3",
|
|
35
|
-
"@internetarchive/icon-edit-pencil": "1.
|
|
33
|
+
"@internetarchive/icon-edit-pencil": "1.3.2",
|
|
36
34
|
"@internetarchive/icon-magnify-minus": "^1.2.3",
|
|
37
35
|
"@internetarchive/icon-magnify-plus": "^1.2.3",
|
|
38
36
|
"@internetarchive/icon-search": "^1.2.3",
|
|
@@ -40,8 +38,7 @@
|
|
|
40
38
|
"@internetarchive/icon-visual-adjustment": "^1.1.3",
|
|
41
39
|
"@internetarchive/modal-manager": "^0.1.0",
|
|
42
40
|
"@internetarchive/shared-resize-observer": "^0.0.1",
|
|
43
|
-
"lit
|
|
44
|
-
"lit-html": "^1.3.0"
|
|
41
|
+
"lit": "^2.1.3"
|
|
45
42
|
},
|
|
46
43
|
"devDependencies": {
|
|
47
44
|
"@babel/core": "7.15.0",
|
|
@@ -49,7 +46,7 @@
|
|
|
49
46
|
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
|
50
47
|
"@babel/plugin-proposal-decorators": "^7.14.5",
|
|
51
48
|
"@babel/preset-env": "7.15.0",
|
|
52
|
-
"@open-wc/testing": "^
|
|
49
|
+
"@open-wc/testing": "^3.0.4",
|
|
53
50
|
"@open-wc/testing-karma": "^4.0.9",
|
|
54
51
|
"@types/jest": "^27.4.0",
|
|
55
52
|
"@webcomponents/webcomponentsjs": "^2.6.0",
|
|
@@ -87,7 +84,7 @@
|
|
|
87
84
|
"jest": {
|
|
88
85
|
"testEnvironment": "jsdom",
|
|
89
86
|
"transformIgnorePatterns": [
|
|
90
|
-
"node_modules/(?!(lit-html|lit-element|lit)/)"
|
|
87
|
+
"node_modules/(?!(lit-html|lit-element|lit|@lit|@internetarchive)/)"
|
|
91
88
|
],
|
|
92
89
|
"moduleNameMapper": {
|
|
93
90
|
"^@/(.*)$": "<rootDir>/$1"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css } from 'lit
|
|
1
|
+
import { css } from 'lit';
|
|
2
2
|
|
|
3
3
|
// Original SVG object for reference
|
|
4
4
|
// <svg height="10" viewBox="0 0 13 10" width="13" xmlns="http://www.w3.org/2000/svg"><path d="m4.33333333 10-4.33333333-4.16666667 1.73333333-1.66666666 2.6 2.5 6.93333337-6.66666667 1.7333333 1.66666667z" fill="#fff" fill-rule="evenodd"/></svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { css } from 'lit
|
|
1
|
+
import { css } from 'lit';
|
|
2
2
|
|
|
3
3
|
export default css`data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNDAgNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgYXJpYS1sYWJlbGxlZGJ5PSJjbG9zZVRpdGxlSUQgY2xvc2VEZXNjSUQiPjxwYXRoIGQ9Ik0yOS4xOTIgMTAuODA4YTEuNSAxLjUgMCAwMTAgMi4xMkwyMi4xMjIgMjBsNy4wNyA3LjA3MmExLjUgMS41IDAgMDEtMi4xMiAyLjEyMWwtNy4wNzMtNy4wNy03LjA3IDcuMDdhMS41IDEuNSAwIDAxLTIuMTIxLTIuMTJsNy4wNy03LjA3My03LjA3LTcuMDdhMS41IDEuNSAwIDAxMi4xMi0yLjEyMUwyMCAxNy44NzhsNy4wNzItNy4wN2ExLjUgMS41IDAgMDEyLjEyMSAweiIgY2xhc3M9ImZpbGwtY29sb3IiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
2
|
|
|
3
3
|
export default html`
|
|
4
4
|
<svg name="sort-asc" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill="#fff" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill="#fff" fill-rule="nonzero"/><path d="m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.661538" transform="matrix(1 0 0 -1 0 18.692308)"/></g></svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
2
|
|
|
3
3
|
export default html`
|
|
4
4
|
<svg name="sort-desc" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill="#fff" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill="#fff" fill-rule="nonzero"/><path d="m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.661538"/></g></svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
2
|
|
|
3
3
|
export default html`
|
|
4
4
|
<svg name="sort-neutral" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="#fff" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill-rule="nonzero"/><circle cx="13" cy="9" r="2"/></g></svg>
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
|
3
3
|
// eslint-disable-next-line no-unused-vars
|
|
4
4
|
import { ModalManager } from '@internetarchive/modal-manager';
|
|
5
|
-
import { css, html, LitElement } from 'lit
|
|
6
|
-
import { nothing } from 'lit-html';
|
|
5
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
7
6
|
import SearchProvider from './search/search-provider.js';
|
|
8
7
|
import DownloadProvider from './downloads/downloads-provider.js';
|
|
9
8
|
import VisualAdjustmentProvider from './visual-adjustments/visual-adjustments-provider.js';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { css, html, LitElement } from 'lit-element';
|
|
1
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
2
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
4
3
|
import bookmarkColorsCSS from '../assets/bookmark-colors.js';
|
|
5
4
|
import buttonCSS from '../assets/button-base.js';
|
|
6
5
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { css, html, LitElement } from 'lit-element';
|
|
1
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
2
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
4
3
|
import './bookmark-edit.js';
|
|
5
4
|
import '@internetarchive/icon-edit-pencil/icon-edit-pencil.js';
|
|
6
5
|
import bookmarkColorsCSS from '../assets/bookmark-colors.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { render } from 'lit
|
|
2
|
-
import { LitElement, html, css } from 'lit-element';
|
|
1
|
+
import { LitElement, html, css, render } from 'lit';
|
|
3
2
|
// eslint-disable-next-line no-unused-vars
|
|
4
3
|
import { ModalConfig, ModalManager } from '@internetarchive/modal-manager';
|
|
5
4
|
import buttonStyles from '../assets/button-base.js';
|
|
@@ -152,14 +151,12 @@ class IABookmarks extends LitElement {
|
|
|
152
151
|
}
|
|
153
152
|
}
|
|
154
153
|
|
|
155
|
-
fetchUserBookmarks() {
|
|
154
|
+
async fetchUserBookmarks() {
|
|
156
155
|
if (!this.api.identifier) {
|
|
157
156
|
return;
|
|
158
157
|
}
|
|
159
|
-
this.fetchBookmarks()
|
|
160
|
-
|
|
161
|
-
this.initializeBookmarks();
|
|
162
|
-
});
|
|
158
|
+
await this.fetchBookmarks();
|
|
159
|
+
this.initializeBookmarks();
|
|
163
160
|
}
|
|
164
161
|
|
|
165
162
|
setBREventListeners() {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { css, html, LitElement } from 'lit
|
|
2
|
-
import { nothing } from 'lit-html';
|
|
1
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
3
2
|
import buttonStyles from '../assets/button-base.js';
|
|
4
3
|
export class IABookDownloads extends LitElement {
|
|
5
4
|
static get properties() {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { nothing } from 'lit
|
|
2
|
-
import {
|
|
3
|
-
import { unsafeHTML } from 'lit-html/directives/unsafe-html';
|
|
1
|
+
import { html, LitElement, nothing } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
4
3
|
|
|
5
4
|
export class BookSearchResult extends LitElement {
|
|
6
5
|
static get properties() {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable class-methods-use-this */
|
|
2
|
-
import { nothing } from 'lit
|
|
3
|
-
import { css, html, LitElement } from 'lit-element';
|
|
2
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
4
3
|
import '@internetarchive/ia-activity-indicator/ia-activity-indicator';
|
|
5
4
|
import './a-search-result.js';
|
|
6
5
|
import checkmarkIcon from '../assets/icon_checkmark.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { css, html, LitElement } from "lit
|
|
2
|
-
import { repeat } from "lit
|
|
3
|
-
import { nothing } from "lit
|
|
1
|
+
import { css, html, LitElement } from "lit";
|
|
2
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
3
|
+
import { nothing } from "lit";
|
|
4
4
|
import checkmarkIcon from '../assets/icon_checkmark.js';
|
|
5
5
|
import "@internetarchive/icon-magnify-minus/icon-magnify-minus";
|
|
6
6
|
import "@internetarchive/icon-magnify-plus/icon-magnify-plus";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { css, html, LitElement } from 'lit
|
|
2
|
-
import {
|
|
3
|
-
import { repeat } from 'lit-html/directives/repeat';
|
|
1
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
2
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
4
3
|
|
|
5
4
|
export class Volumes extends LitElement {
|
|
6
5
|
static get properties() {
|
|
@@ -46,7 +46,8 @@ export class Mode1Up {
|
|
|
46
46
|
if (!this.everShown) {
|
|
47
47
|
this.mode1UpLit.initFirstRender(startLeaf);
|
|
48
48
|
this.everShown = true;
|
|
49
|
-
|
|
49
|
+
this.mode1UpLit.requestUpdate();
|
|
50
|
+
await this.mode1UpLit.updateComplete;
|
|
50
51
|
new DragScrollable(this.mode1UpLit, {
|
|
51
52
|
preventDefault: true,
|
|
52
53
|
dragSelector: '.br-mode-1up__visible-world',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { customElement,
|
|
3
|
-
import {
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import {LitElement, html} from 'lit';
|
|
4
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
4
5
|
import { ModeSmoothZoom } from './ModeSmoothZoom';
|
|
5
6
|
import { arrChanged, calcScreenDPI, genToArray, sum, throttle } from './utils';
|
|
6
7
|
import { HTMLDimensionsCacher } from "./utils/HTMLDimensionsCacher";
|
package/src/BookReader.js
CHANGED
|
@@ -1192,7 +1192,8 @@ BookReader.prototype.enterFullscreen = async function(bindKeyboardControls = tru
|
|
|
1192
1192
|
if (this.activeMode instanceof Mode1Up) {
|
|
1193
1193
|
this.activeMode.mode1UpLit.scale = this.activeMode.mode1UpLit.computeDefaultScale(this._models.book.getPage(currentIndex));
|
|
1194
1194
|
// Need the new scale to be applied before calling jumpToIndex
|
|
1195
|
-
|
|
1195
|
+
this.activeMode.mode1UpLit.requestUpdate();
|
|
1196
|
+
await this.activeMode.mode1UpLit.updateComplete;
|
|
1196
1197
|
}
|
|
1197
1198
|
this.jumpToIndex(currentIndex);
|
|
1198
1199
|
this.animating = false;
|
|
@@ -1241,7 +1242,8 @@ BookReader.prototype.exitFullScreen = async function () {
|
|
|
1241
1242
|
|
|
1242
1243
|
if (this.activeMode instanceof Mode1Up) {
|
|
1243
1244
|
this.activeMode.mode1UpLit.scale = this.activeMode.mode1UpLit.computeDefaultScale(this._models.book.getPage(this.currentIndex()));
|
|
1244
|
-
|
|
1245
|
+
this.activeMode.mode1UpLit.requestUpdate();
|
|
1246
|
+
await this.activeMode.mode1UpLit.updateComplete;
|
|
1245
1247
|
}
|
|
1246
1248
|
|
|
1247
1249
|
this.animating = false;
|
|
@@ -174,7 +174,7 @@ BookReader.prototype.addChapterFromEntry = function(tocEntryObject) {
|
|
|
174
174
|
* This makes a call to OL API and calls the given callback function with the
|
|
175
175
|
* response from the API.
|
|
176
176
|
*/
|
|
177
|
-
BookReader.prototype.getOpenLibraryRecord = function () {
|
|
177
|
+
BookReader.prototype.getOpenLibraryRecord = async function () {
|
|
178
178
|
// Try looking up by ocaid first, then by source_record
|
|
179
179
|
const baseURL = `${this.olHost}/query.json?type=/type/edition&*=`;
|
|
180
180
|
const fetchUrlByBookId = `${baseURL}&ocaid=${this.bookId}`;
|
|
@@ -190,20 +190,16 @@ BookReader.prototype.getOpenLibraryRecord = function () {
|
|
|
190
190
|
}
|
|
191
191
|
};
|
|
192
192
|
|
|
193
|
-
$.ajax({ url: fetchUrlByBookId, dataType: 'jsonp' })
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if (data && data.length > 0) {
|
|
204
|
-
setUpChapterMarkers(data[0]);
|
|
205
|
-
}
|
|
206
|
-
});
|
|
193
|
+
let data = await $.ajax({ url: fetchUrlByBookId, dataType: 'jsonp' });
|
|
194
|
+
|
|
195
|
+
if (!data || !data.length) {
|
|
196
|
+
// try sourceid
|
|
197
|
+
data = await $.ajax({ url: `${baseURL}&source_records=ia:${this.bookId}`, dataType: 'jsonp' });
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (data && data.length > 0) {
|
|
201
|
+
setUpChapterMarkers(data[0]);
|
|
202
|
+
}
|
|
207
203
|
};
|
|
208
204
|
|
|
209
205
|
// Extend buildMobileDrawerElement with table of contents list
|
|
@@ -96,21 +96,20 @@ export class TextSelectionPlugin {
|
|
|
96
96
|
if (cachedEntry) {
|
|
97
97
|
return cachedEntry.response;
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
const res = await $.ajax({
|
|
100
100
|
type: "GET",
|
|
101
101
|
url: applyVariables(this.options.singlePageDjvuXmlUrl, this.optionVariables, { pageIndex: index }),
|
|
102
102
|
dataType: "html",
|
|
103
103
|
error: (e) => undefined,
|
|
104
|
-
}).then((res) => {
|
|
105
|
-
try {
|
|
106
|
-
const xmlDoc = $.parseXML(res);
|
|
107
|
-
const result = xmlDoc && $(xmlDoc).find("OBJECT")[0];
|
|
108
|
-
this.pageTextCache.add({ index, response: result });
|
|
109
|
-
return result;
|
|
110
|
-
} catch (e) {
|
|
111
|
-
return undefined;
|
|
112
|
-
}
|
|
113
104
|
});
|
|
105
|
+
try {
|
|
106
|
+
const xmlDoc = $.parseXML(res);
|
|
107
|
+
const result = xmlDoc && $(xmlDoc).find("OBJECT")[0];
|
|
108
|
+
this.pageTextCache.add({ index, response: result });
|
|
109
|
+
return result;
|
|
110
|
+
} catch (e) {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
114
113
|
} else {
|
|
115
114
|
const XMLpagesArr = await this.djvuPagesPromise;
|
|
116
115
|
if (XMLpagesArr) return XMLpagesArr[index];
|
|
@@ -132,7 +132,7 @@ BookReader.prototype._createPageContainer = (function (super_) {
|
|
|
132
132
|
* @param {string} term
|
|
133
133
|
* @param {SearchOptions} overrides
|
|
134
134
|
*/
|
|
135
|
-
BookReader.prototype.search = function(term = '', overrides = {}) {
|
|
135
|
+
BookReader.prototype.search = async function(term = '', overrides = {}) {
|
|
136
136
|
/** @type {SearchOptions} */
|
|
137
137
|
const defaultOptions = {
|
|
138
138
|
goToFirstResult: false, /* jump to the first result (default=false) */
|
|
@@ -210,13 +210,13 @@ BookReader.prototype.search = function(term = '', overrides = {}) {
|
|
|
210
210
|
};
|
|
211
211
|
|
|
212
212
|
this.trigger('SearchStarted', { term: this.searchTerm, instance: this });
|
|
213
|
-
return $.ajax({
|
|
213
|
+
return processSearchResults(await $.ajax({
|
|
214
214
|
url: url,
|
|
215
215
|
dataType: 'jsonp',
|
|
216
216
|
cache: true,
|
|
217
217
|
beforeSend,
|
|
218
218
|
jsonpCallback: 'BRSearchInProgress'
|
|
219
|
-
})
|
|
219
|
+
}));
|
|
220
220
|
};
|
|
221
221
|
|
|
222
222
|
/**
|
|
@@ -91,10 +91,10 @@ export default class FestivalTTSEngine extends AbstractTTSEngine {
|
|
|
91
91
|
* See https://stackoverflow.com/questions/12206631/html5-audio-cant-play-through-javascript-unless-triggered-manually-once
|
|
92
92
|
* @return {PromiseLike}
|
|
93
93
|
*/
|
|
94
|
-
iOSCaptureUserIntentHack() {
|
|
94
|
+
async iOSCaptureUserIntentHack() {
|
|
95
95
|
const sound = soundManager.createSound({ url: SILENCE_1MS[this.audioFormat] });
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
await new Promise(res => sound.play({onfinish: res}));
|
|
97
|
+
sound.destruct();
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -122,21 +122,20 @@ class FestivalTTSSound {
|
|
|
122
122
|
if (this.rate != 1) this.sound.setPlaybackRate(this.rate);
|
|
123
123
|
onload();
|
|
124
124
|
},
|
|
125
|
-
onresume: () => {
|
|
126
|
-
sleep(25)
|
|
127
|
-
|
|
128
|
-
});
|
|
125
|
+
onresume: async () => {
|
|
126
|
+
await sleep(25);
|
|
127
|
+
if (this.rate != 1) this.sound.setPlaybackRate(this.rate);
|
|
129
128
|
}
|
|
130
129
|
});
|
|
131
130
|
return this.sound.load();
|
|
132
131
|
}
|
|
133
132
|
|
|
134
|
-
play() {
|
|
135
|
-
|
|
133
|
+
async play() {
|
|
134
|
+
await new Promise(res => {
|
|
136
135
|
this._finishResolver = res;
|
|
137
136
|
this.sound.play({ onfinish: res });
|
|
138
|
-
})
|
|
139
|
-
|
|
137
|
+
});
|
|
138
|
+
this.sound.destruct();
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
/** @override */
|
|
@@ -21,27 +21,18 @@ export default class PageChunk {
|
|
|
21
21
|
* @param {number} leafIndex
|
|
22
22
|
* @return {Promise<PageChunk[]>}
|
|
23
23
|
*/
|
|
24
|
-
static fetch(server, bookPath, leafIndex) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
cache: true,
|
|
35
|
-
data: {
|
|
36
|
-
path: `${bookPath}_djvu.xml`,
|
|
37
|
-
page: leafIndex
|
|
38
|
-
},
|
|
39
|
-
error: rej,
|
|
40
|
-
})
|
|
41
|
-
.then(chunks => {
|
|
42
|
-
res(PageChunk._fromTextWrapperResponse(leafIndex, chunks));
|
|
43
|
-
});
|
|
24
|
+
static async fetch(server, bookPath, leafIndex) {
|
|
25
|
+
const chunks = await $.ajax({
|
|
26
|
+
type: 'GET',
|
|
27
|
+
url: `https://${server}/BookReader/BookReaderGetTextWrapper.php`,
|
|
28
|
+
dataType:'jsonp',
|
|
29
|
+
cache: true,
|
|
30
|
+
data: {
|
|
31
|
+
path: `${bookPath}_djvu.xml`,
|
|
32
|
+
page: leafIndex
|
|
33
|
+
}
|
|
44
34
|
});
|
|
35
|
+
return PageChunk._fromTextWrapperResponse(leafIndex, chunks);
|
|
45
36
|
}
|
|
46
37
|
|
|
47
38
|
/**
|