@internetarchive/bookreader 5.0.0-36 → 5.0.0-39
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 +69 -7
- package/.github/workflows/npm-publish.yml +2 -16
- package/BookReader/BookReader.css +8 -0
- 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 +144 -119
- package/BookReader/ia-bookreader-bundle.js.LICENSE.txt +15 -12
- package/BookReader/ia-bookreader-bundle.js.map +1 -1
- package/BookReader/icons/magnify-minus.svg +1 -1
- package/BookReader/icons/magnify-plus.svg +1 -1
- package/BookReader/plugins/plugin.autoplay.js +1 -1
- package/BookReader/plugins/plugin.autoplay.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.mobile_nav.js +1 -1
- package/BookReader/plugins/plugin.mobile_nav.js.map +1 -1
- package/BookReader/plugins/plugin.resume.js +1 -1
- package/BookReader/plugins/plugin.resume.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/BookReader/plugins/plugin.url.js +1 -1
- package/BookReader/plugins/plugin.url.js.map +1 -1
- package/CHANGELOG.md +26 -0
- package/README.md +14 -1
- package/codecov.yml +6 -0
- package/package.json +30 -33
- package/renovate.json +43 -0
- 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 +10 -3
- package/src/BookReader/Mode2Up.js +11 -0
- package/src/BookReader/ModeSmoothZoom.js +2 -0
- package/src/BookReader/PageContainer.js +10 -4
- package/src/BookReader/utils/ScrollClassAdder.js +31 -0
- package/src/BookReader.js +4 -2
- package/src/assets/icons/magnify-minus.svg +3 -7
- package/src/assets/icons/magnify-plus.svg +3 -7
- package/src/css/_TextSelection.scss +13 -0
- 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 +8 -18
- package/src/plugins/search/view.js +2 -0
- package/src/plugins/tts/AbstractTTSEngine.js +9 -4
- 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/e2e/base.test.js +4 -5
- package/tests/e2e/helpers/desktopSearch.js +13 -12
- package/tests/e2e/models/Navigation.js +12 -3
- package/tests/e2e/rightToLeft.test.js +1 -1
- package/tests/e2e/viewmode.test.js +37 -31
- package/tests/jest/BookReader/Mode1UpLit.test.js +2 -1
- package/tests/jest/BookReader/PageContainer.test.js +5 -4
- package/tests/jest/BookReader/utils/ScrollClassAdder.test.js +49 -0
- 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/.github/dependabot.yml +0 -8
- package/.husky/_/husky.sh +0 -30
- package/BookReaderDemo/bookreader-template-bundle.js +0 -7178
- package/stat/BookNavigator/BookModel.js +0 -14
- package/stat/BookNavigator/BookNavigator.js +0 -482
- package/stat/BookNavigator/assets/bookmark-colors.js +0 -15
- package/stat/BookNavigator/assets/button-base.js +0 -61
- package/stat/BookNavigator/assets/ia-logo.js +0 -17
- package/stat/BookNavigator/assets/icon_checkmark.js +0 -6
- package/stat/BookNavigator/assets/icon_close.js +0 -3
- package/stat/BookNavigator/assets/icon_sort_asc.js +0 -5
- package/stat/BookNavigator/assets/icon_sort_desc.js +0 -5
- package/stat/BookNavigator/assets/icon_sort_neutral.js +0 -5
- package/stat/BookNavigator/assets/icon_volumes.js +0 -11
- package/stat/BookNavigator/bookmarks/bookmark-button.js +0 -64
- package/stat/BookNavigator/bookmarks/bookmark-edit.js +0 -215
- package/stat/BookNavigator/bookmarks/bookmarks-list.js +0 -285
- package/stat/BookNavigator/bookmarks/bookmarks-loginCTA.js +0 -28
- package/stat/BookNavigator/bookmarks/bookmarks-provider.js +0 -56
- package/stat/BookNavigator/bookmarks/ia-bookmarks.js +0 -523
- package/stat/BookNavigator/br-fullscreen-mgr.js +0 -82
- package/stat/BookNavigator/delete-modal-actions.js +0 -49
- package/stat/BookNavigator/downloads/downloads-provider.js +0 -72
- package/stat/BookNavigator/downloads/downloads.js +0 -139
- package/stat/BookNavigator/provider-config.js +0 -0
- package/stat/BookNavigator/search/a-search-result.js +0 -55
- package/stat/BookNavigator/search/search-provider.js +0 -180
- package/stat/BookNavigator/search/search-results.js +0 -360
- package/stat/BookNavigator/sharing.js +0 -31
- package/stat/BookNavigator/visual-adjustments/visual-adjustments-provider.js +0 -94
- package/stat/BookNavigator/visual-adjustments/visual-adjustments.js +0 -280
- package/stat/BookNavigator/volumes/volumes-provider.js +0 -83
- package/stat/BookNavigator/volumes/volumes.js +0 -178
- package/stat/BookReader/BookModel.js +0 -518
- package/stat/BookReader/DebugConsole.js +0 -54
- package/stat/BookReader/DragScrollable.js +0 -233
- package/stat/BookReader/ImageCache.js +0 -116
- package/stat/BookReader/Mode1Up.js +0 -102
- package/stat/BookReader/Mode1UpLit.js +0 -434
- package/stat/BookReader/Mode2Up.js +0 -1372
- package/stat/BookReader/ModeSmoothZoom.js +0 -177
- package/stat/BookReader/ModeThumb.js +0 -344
- package/stat/BookReader/Navbar/Navbar.js +0 -310
- package/stat/BookReader/PageContainer.js +0 -120
- package/stat/BookReader/ReduceSet.js +0 -26
- package/stat/BookReader/Toolbar/Toolbar.js +0 -384
- package/stat/BookReader/events.js +0 -20
- package/stat/BookReader/options.js +0 -324
- package/stat/BookReader/utils/HTMLDimensionsCacher.js +0 -44
- package/stat/BookReader/utils/classes.js +0 -36
- package/stat/BookReader/utils.js +0 -240
- package/stat/BookReader.js +0 -2550
- package/stat/BookReaderComponent/BookReaderComponent.js +0 -117
- package/stat/assets/icons/1up.svg +0 -12
- package/stat/assets/icons/2up.svg +0 -15
- package/stat/assets/icons/advance.svg +0 -26
- package/stat/assets/icons/chevron-right.svg +0 -1
- package/stat/assets/icons/close-circle-dark.svg +0 -1
- package/stat/assets/icons/close-circle.svg +0 -1
- package/stat/assets/icons/fullscreen.svg +0 -17
- package/stat/assets/icons/fullscreen_exit.svg +0 -17
- package/stat/assets/icons/hamburger.svg +0 -15
- package/stat/assets/icons/left-arrow.svg +0 -12
- package/stat/assets/icons/magnify-minus.svg +0 -16
- package/stat/assets/icons/magnify-plus.svg +0 -17
- package/stat/assets/icons/magnify.svg +0 -15
- package/stat/assets/icons/pause.svg +0 -23
- package/stat/assets/icons/play.svg +0 -22
- package/stat/assets/icons/playback-speed.svg +0 -34
- package/stat/assets/icons/read-aloud.svg +0 -22
- package/stat/assets/icons/review.svg +0 -22
- package/stat/assets/icons/thumbnails.svg +0 -17
- package/stat/assets/icons/voice.svg +0 -1
- package/stat/assets/icons/volume-full.svg +0 -22
- package/stat/assets/images/BRicons.png +0 -0
- package/stat/assets/images/BRicons.svg +0 -94
- package/stat/assets/images/BRicons_ia.png +0 -0
- package/stat/assets/images/back_pages.png +0 -0
- package/stat/assets/images/book_bottom_icon.png +0 -0
- package/stat/assets/images/book_down_icon.png +0 -0
- package/stat/assets/images/book_left_icon.png +0 -0
- package/stat/assets/images/book_leftmost_icon.png +0 -0
- package/stat/assets/images/book_right_icon.png +0 -0
- package/stat/assets/images/book_rightmost_icon.png +0 -0
- package/stat/assets/images/book_top_icon.png +0 -0
- package/stat/assets/images/book_up_icon.png +0 -0
- package/stat/assets/images/books_graphic.svg +0 -177
- package/stat/assets/images/booksplit.png +0 -0
- package/stat/assets/images/control_pause_icon.png +0 -0
- package/stat/assets/images/control_play_icon.png +0 -0
- package/stat/assets/images/embed_icon.png +0 -0
- package/stat/assets/images/icon-home-ia.png +0 -0
- package/stat/assets/images/icon_OL-logo-xs.png +0 -0
- package/stat/assets/images/icon_alert-xs.png +0 -0
- package/stat/assets/images/icon_book.svg +0 -12
- package/stat/assets/images/icon_bookmark.svg +0 -12
- package/stat/assets/images/icon_close-pop.png +0 -0
- package/stat/assets/images/icon_download.png +0 -0
- package/stat/assets/images/icon_gear.svg +0 -14
- package/stat/assets/images/icon_hamburger.svg +0 -20
- package/stat/assets/images/icon_home.png +0 -0
- package/stat/assets/images/icon_home.svg +0 -21
- package/stat/assets/images/icon_home_ia.png +0 -0
- package/stat/assets/images/icon_indicator.png +0 -0
- package/stat/assets/images/icon_info.svg +0 -11
- package/stat/assets/images/icon_one_page.svg +0 -8
- package/stat/assets/images/icon_pause.svg +0 -1
- package/stat/assets/images/icon_play.svg +0 -1
- package/stat/assets/images/icon_playback-rate.svg +0 -15
- package/stat/assets/images/icon_return.png +0 -0
- package/stat/assets/images/icon_search_button.svg +0 -8
- package/stat/assets/images/icon_share.svg +0 -9
- package/stat/assets/images/icon_skip-ahead.svg +0 -6
- package/stat/assets/images/icon_skip-back.svg +0 -13
- package/stat/assets/images/icon_speaker.svg +0 -18
- package/stat/assets/images/icon_speaker_open.svg +0 -10
- package/stat/assets/images/icon_thumbnails.svg +0 -12
- package/stat/assets/images/icon_toc.svg +0 -5
- package/stat/assets/images/icon_two_pages.svg +0 -9
- package/stat/assets/images/icon_zoomer.png +0 -0
- package/stat/assets/images/loading.gif +0 -0
- package/stat/assets/images/logo_icon.png +0 -0
- package/stat/assets/images/marker_chap-off.png +0 -0
- package/stat/assets/images/marker_chap-off.svg +0 -11
- package/stat/assets/images/marker_chap-off_ia.png +0 -0
- package/stat/assets/images/marker_chap-on.png +0 -0
- package/stat/assets/images/marker_chap-on.svg +0 -11
- package/stat/assets/images/marker_srch-on.svg +0 -11
- package/stat/assets/images/marker_srchchap-off.png +0 -0
- package/stat/assets/images/marker_srchchap-on.png +0 -0
- package/stat/assets/images/nav_control-dn.png +0 -0
- package/stat/assets/images/nav_control-dn_ia.png +0 -0
- package/stat/assets/images/nav_control-up.png +0 -0
- package/stat/assets/images/nav_control-up_ia.png +0 -0
- package/stat/assets/images/nav_control.png +0 -0
- package/stat/assets/images/one_page_mode_icon.png +0 -0
- package/stat/assets/images/paper-badge.png +0 -0
- package/stat/assets/images/print_icon.png +0 -0
- package/stat/assets/images/progressbar.gif +0 -0
- package/stat/assets/images/right_edges.png +0 -0
- package/stat/assets/images/slider.png +0 -0
- package/stat/assets/images/slider_ia.png +0 -0
- package/stat/assets/images/thumbnail_mode_icon.png +0 -0
- package/stat/assets/images/transparent.png +0 -0
- package/stat/assets/images/two_page_mode_icon.png +0 -0
- package/stat/assets/images/zoom_in_icon.png +0 -0
- package/stat/assets/images/zoom_out_icon.png +0 -0
- package/stat/css/BookReader.scss +0 -89
- package/stat/css/_BRBookmarks.scss +0 -29
- package/stat/css/_BRComponent.scss +0 -13
- package/stat/css/_BRfloat.scss +0 -197
- package/stat/css/_BRicon.scss +0 -48
- package/stat/css/_BRmain.scss +0 -251
- package/stat/css/_BRnav.scss +0 -359
- package/stat/css/_BRpages.scss +0 -139
- package/stat/css/_BRsearch.scss +0 -226
- package/stat/css/_BRtoolbar.scss +0 -84
- package/stat/css/_BRvendor.scss +0 -5
- package/stat/css/_MobileNav.scss +0 -194
- package/stat/css/_TextSelection.scss +0 -32
- package/stat/css/_colorbox.scss +0 -52
- package/stat/css/_controls.scss +0 -253
- package/stat/css/_icons.scss +0 -121
- package/stat/jquery-wrapper.js +0 -4
- package/stat/plugins/plugin.archive_analytics.js +0 -86
- package/stat/plugins/plugin.autoplay.js +0 -129
- package/stat/plugins/plugin.chapters.js +0 -248
- package/stat/plugins/plugin.iframe.js +0 -48
- package/stat/plugins/plugin.mobile_nav.js +0 -288
- package/stat/plugins/plugin.resume.js +0 -68
- package/stat/plugins/plugin.text_selection.js +0 -291
- package/stat/plugins/plugin.url.js +0 -198
- package/stat/plugins/plugin.vendor-fullscreen.js +0 -247
- package/stat/plugins/search/plugin.search.js +0 -439
- package/stat/plugins/search/view.js +0 -439
- package/stat/plugins/tts/AbstractTTSEngine.js +0 -249
- package/stat/plugins/tts/FestivalTTSEngine.js +0 -169
- package/stat/plugins/tts/PageChunk.js +0 -107
- package/stat/plugins/tts/PageChunkIterator.js +0 -163
- package/stat/plugins/tts/WebTTSEngine.js +0 -357
- package/stat/plugins/tts/plugin.tts.js +0 -357
- package/stat/plugins/tts/tooltip_dict.js +0 -15
- package/stat/plugins/tts/utils.js +0 -91
- package/stat/util/browserSniffing.js +0 -30
- package/stat/util/debouncer.js +0 -26
- package/stat/util/docCookies.js +0 -67
- package/stat/util/strings.js +0 -34
package/renovate.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": [
|
|
3
|
+
"config:base"
|
|
4
|
+
],
|
|
5
|
+
"packageRules": [
|
|
6
|
+
{
|
|
7
|
+
"matchPackageNames": [
|
|
8
|
+
"@babel/eslint-parser",
|
|
9
|
+
"@open-wc/testing",
|
|
10
|
+
"@open-wc/testing-karma",
|
|
11
|
+
"@types/jest",
|
|
12
|
+
"codecov",
|
|
13
|
+
"eslint",
|
|
14
|
+
"eslint-plugin-no-jquery",
|
|
15
|
+
"eslint-plugin-testcafe",
|
|
16
|
+
"jest",
|
|
17
|
+
"karma-coverage",
|
|
18
|
+
"sinon",
|
|
19
|
+
"testcafe"
|
|
20
|
+
],
|
|
21
|
+
"automerge": true
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"matchPackageNames": [
|
|
25
|
+
"concurrently",
|
|
26
|
+
"http-server",
|
|
27
|
+
"live-server",
|
|
28
|
+
"node-fetch"
|
|
29
|
+
],
|
|
30
|
+
"matchUpdateTypes": ["minor", "patch"],
|
|
31
|
+
"automerge": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"matchPackagePatterns": ["^@internetarchive/icon-"],
|
|
35
|
+
"groupName": "@internetarchive icons",
|
|
36
|
+
"rangeStrategy": "bump"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"matchPackagePatterns": ["*"],
|
|
40
|
+
"rangeStrategy": "bump"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
@@ -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,9 +1,11 @@
|
|
|
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";
|
|
8
|
+
import { ScrollClassAdder } from './utils/ScrollClassAdder';
|
|
7
9
|
/** @typedef {import('./BookModel').BookModel} BookModel */
|
|
8
10
|
/** @typedef {import('./BookModel').PageIndex} PageIndex */
|
|
9
11
|
/** @typedef {import('./BookModel').PageModel} PageModel */
|
|
@@ -114,6 +116,8 @@ export class Mode1UpLit extends LitElement {
|
|
|
114
116
|
|
|
115
117
|
smoothZoomer = new ModeSmoothZoom(this);
|
|
116
118
|
|
|
119
|
+
scrollClassAdder = new ScrollClassAdder(this, 'BRscrolling-active');
|
|
120
|
+
|
|
117
121
|
/************** CONSTANT PROPERTIES **************/
|
|
118
122
|
|
|
119
123
|
/** Vertical space between/around the pages in inches */
|
|
@@ -301,6 +305,7 @@ export class Mode1UpLit extends LitElement {
|
|
|
301
305
|
}).$container[0];
|
|
302
306
|
|
|
303
307
|
pageContainerEl.style.transform = transform;
|
|
308
|
+
pageContainerEl.classList.toggle('BRpage-visible', this.visiblePages.includes(page));
|
|
304
309
|
return pageContainerEl;
|
|
305
310
|
}
|
|
306
311
|
|
|
@@ -425,10 +430,12 @@ export class Mode1UpLit extends LitElement {
|
|
|
425
430
|
/************** INPUT HANDLERS **************/
|
|
426
431
|
|
|
427
432
|
attachScrollListeners = () => {
|
|
428
|
-
this.addEventListener("scroll", this.updateVisibleRegion
|
|
433
|
+
this.addEventListener("scroll", this.updateVisibleRegion);
|
|
434
|
+
this.scrollClassAdder.attach();
|
|
429
435
|
}
|
|
430
436
|
|
|
431
437
|
detachScrollListeners = () => {
|
|
432
438
|
this.removeEventListener("scroll", this.updateVisibleRegion);
|
|
439
|
+
this.scrollClassAdder.detach();
|
|
433
440
|
}
|
|
434
441
|
}
|
|
@@ -6,6 +6,7 @@ import { EVENTS } from './events.js';
|
|
|
6
6
|
import { ModeSmoothZoom } from "./ModeSmoothZoom.js";
|
|
7
7
|
import { HTMLDimensionsCacher } from './utils/HTMLDimensionsCacher.js';
|
|
8
8
|
import { DragScrollable } from './DragScrollable.js';
|
|
9
|
+
import { ScrollClassAdder } from './utils/ScrollClassAdder.js';
|
|
9
10
|
|
|
10
11
|
/** @typedef {import('../BookReader.js').default} BookReader */
|
|
11
12
|
/** @typedef {import('./BookModel.js').BookModel} BookModel */
|
|
@@ -36,6 +37,9 @@ export class Mode2Up {
|
|
|
36
37
|
this.smoothZoomer = null;
|
|
37
38
|
this._scale = 1;
|
|
38
39
|
this.scaleCenter = { x: 0.5, y: 0.5 };
|
|
40
|
+
|
|
41
|
+
/** @type {ScrollClassAdder} */
|
|
42
|
+
this.scrollClassAdder = null;
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
get $container() {
|
|
@@ -242,6 +246,12 @@ export class Mode2Up {
|
|
|
242
246
|
|
|
243
247
|
this.smoothZoomer = this.smoothZoomer || new ModeSmoothZoom(this);
|
|
244
248
|
this.smoothZoomer.attach();
|
|
249
|
+
if (!this.scrollClassAdder) {
|
|
250
|
+
this.scrollClassAdder = new ScrollClassAdder(this.$container, 'BRscrolling-active');
|
|
251
|
+
}
|
|
252
|
+
this.scrollClassAdder.detach();
|
|
253
|
+
this.scrollClassAdder.element = this.$container;
|
|
254
|
+
this.scrollClassAdder.attach();
|
|
245
255
|
|
|
246
256
|
this.htmlDimensionsCacher = this.htmlDimensionsCacher || new HTMLDimensionsCacher(this.$container);
|
|
247
257
|
}
|
|
@@ -250,6 +260,7 @@ export class Mode2Up {
|
|
|
250
260
|
// Mode2Up attaches these listeners to the main BR container, so we need to
|
|
251
261
|
// detach these or it will cause issues for the other modes.
|
|
252
262
|
this.smoothZoomer.detach();
|
|
263
|
+
this.scrollClassAdder.detach();
|
|
253
264
|
}
|
|
254
265
|
|
|
255
266
|
/**
|
|
@@ -89,6 +89,7 @@ export class ModeSmoothZoom {
|
|
|
89
89
|
_pinchStart = () => {
|
|
90
90
|
// Do this in case the pinchend hasn't fired yet.
|
|
91
91
|
this.oldScale = 1;
|
|
92
|
+
this.mode.$visibleWorld.classList.add("BRsmooth-zooming");
|
|
92
93
|
this.mode.$visibleWorld.style.willChange = "transform";
|
|
93
94
|
this.detachCtrlZoom();
|
|
94
95
|
this.mode.detachScrollListeners?.();
|
|
@@ -124,6 +125,7 @@ export class ModeSmoothZoom {
|
|
|
124
125
|
await this.pinchMoveFramePromise;
|
|
125
126
|
this.mode.scaleCenter = { x: 0.5, y: 0.5 };
|
|
126
127
|
this.oldScale = 1;
|
|
128
|
+
this.mode.$visibleWorld.classList.remove("BRsmooth-zooming");
|
|
127
129
|
this.mode.$visibleWorld.style.willChange = "auto";
|
|
128
130
|
this.attachCtrlZoom();
|
|
129
131
|
this.mode.attachScrollListeners?.();
|
|
@@ -46,11 +46,17 @@ export class PageContainer {
|
|
|
46
46
|
const alreadyLoaded = this.imageCache.imageLoaded(this.page.index, reduce);
|
|
47
47
|
const nextBestLoadedReduce = !alreadyLoaded && this.imageCache.getBestLoadedReduce(this.page.index, reduce);
|
|
48
48
|
|
|
49
|
-
//
|
|
49
|
+
// Create high res image
|
|
50
|
+
const $newImg = this.imageCache.image(this.page.index, reduce);
|
|
51
|
+
|
|
52
|
+
// Avoid removing/re-adding the image if it's already there
|
|
53
|
+
// This can be called quite a bit, so we need to be fast
|
|
54
|
+
if (this.$img?.[0].src == $newImg[0].src) {
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
|
|
50
58
|
this.$img?.remove();
|
|
51
|
-
this.$img = this
|
|
52
|
-
.image(this.page.index, reduce)
|
|
53
|
-
.prependTo(this.$container);
|
|
59
|
+
this.$img = $newImg.prependTo(this.$container);
|
|
54
60
|
|
|
55
61
|
const backgroundLayers = [];
|
|
56
62
|
if (!alreadyLoaded) {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Adds a class while the given element is experiencing scrolling */
|
|
2
|
+
export class ScrollClassAdder {
|
|
3
|
+
/**
|
|
4
|
+
* @param {HTMLElement} element
|
|
5
|
+
* @param {string} className
|
|
6
|
+
*/
|
|
7
|
+
constructor(element, className) {
|
|
8
|
+
/** @type {HTMLElement} */
|
|
9
|
+
this.element = element;
|
|
10
|
+
/** @type {string} */
|
|
11
|
+
this.className = className;
|
|
12
|
+
this.timeout = null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
attach() {
|
|
16
|
+
this.element.addEventListener('scroll', this.onScroll);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
detach() {
|
|
20
|
+
this.element.removeEventListener('scroll', this.onScroll);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onScroll = () => {
|
|
24
|
+
this.element.classList.add(this.className);
|
|
25
|
+
clearTimeout(this.timeout);
|
|
26
|
+
// TODO: Also remove class on mousemove, touch, click, etc.
|
|
27
|
+
this.timeout = setTimeout(() => {
|
|
28
|
+
this.element.classList.remove(this.className);
|
|
29
|
+
}, 600);
|
|
30
|
+
}
|
|
31
|
+
}
|
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;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
<svg
|
|
2
|
-
|
|
3
|
-
height="18"
|
|
4
|
-
viewBox="0 0 18 18"
|
|
2
|
+
viewBox="0 0 100 100"
|
|
5
3
|
version="1.1"
|
|
6
4
|
xmlns="http://www.w3.org/2000/svg"
|
|
7
5
|
aria-labelledby="magnify-minusTitleID magnify-minusDescID"
|
|
8
6
|
>
|
|
9
7
|
<title id="magnify-minusTitleID">Zoom out</title>
|
|
10
8
|
<desc id="magnify-minusDescID">An icon of a minus symbol</desc>
|
|
11
|
-
<g fill="
|
|
12
|
-
<
|
|
13
|
-
<path d="m12 12 4.335213 4.335213" stroke="#fff" stroke-linecap="round" stroke-width="2" />
|
|
14
|
-
<path d="m10 7.75v-1.5h-6v1.5z" fill="#fff" fill-rule="nonzero" />
|
|
9
|
+
<g fill="#fff" fill-rule="evenodd">
|
|
10
|
+
<path d="m2.3239824 87.3815869 25.8938394-23.8143095c-4.5929593-6.6937643-6.889439-14.1059452-6.889439-22.2365428 0-7.1360431 1.7567382-13.7186647 5.2702146-19.7478649 3.5134763-6.0292002 8.2852035-10.8003118 14.3151815-14.31333499 6.029978-3.51302314 12.6134488-5.26953471 19.7504125-5.26953471s13.7204346 1.75651157 19.7504126 5.26953471c6.029978 3.51302319 10.8017051 8.28413479 14.3151815 14.31333499 3.5134763 6.0292002 5.2702145 12.6118218 5.2702145 19.7478649s-1.7567382 13.7324143-5.2702145 19.7891137c-3.5134764 6.0566994-8.2852035 10.8415607-14.3151815 14.3545838-6.029978 3.5130232-12.6134489 5.2695347-19.7504126 5.2695347-8.5762743 0-16.3217363-2.5723212-23.2363861-7.7169637l-26.3063807 24.2302349c-1.27200216 1.1618413-2.76631826 1.742762-4.48294825 1.742762-1.826641 0-3.38971397-.6496687-4.68921892-1.949006s-1.94925743-2.8622087-1.94925743-4.688614c0-1.9364022.7746608-3.5955208 2.3239824-4.9773557zm58.3436469-19.9162976c7.1919692 0 13.3331041-2.5585716 18.4234048-7.6757149s7.635451-11.2712357 7.635451-18.4622772-2.5451503-13.3313843-7.635451-18.4210284-11.2314356-7.6344661-18.4234048-7.6344661-13.3331042 2.544822-18.4234049 7.6344661-7.635451 11.2299869-7.635451 18.4210284 2.5451503 13.3451339 7.635451 18.4622772 11.2314357 7.6757149 18.4234049 7.6757149zm-14.9374313-21.3256316h31.2878163v-9.5422233h-31.2878163z"/>
|
|
15
11
|
</g>
|
|
16
12
|
</svg>
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
<svg
|
|
2
|
-
|
|
3
|
-
height="18"
|
|
4
|
-
viewBox="0 0 18 18"
|
|
2
|
+
viewBox="0 0 100 100"
|
|
5
3
|
version="1.1"
|
|
6
4
|
xmlns="http://www.w3.org/2000/svg"
|
|
7
5
|
aria-labelledby="magnify-plusTitleID magnify-plusDescID"
|
|
8
6
|
>
|
|
9
7
|
<title id="magnify-plusTitleID">Zoom in</title>
|
|
10
8
|
<desc id="magnify-plusDescID">An icon of a plus symbol</desc>
|
|
11
|
-
<g fill="
|
|
12
|
-
<
|
|
13
|
-
<path d="m12 12 4.335213 4.335213" stroke="#fff" stroke-linecap="round" stroke-width="2" />
|
|
14
|
-
<path d="m7.75 4v2.25h2.25v1.5h-2.25v2.25h-1.5v-2.25h-2.25v-1.5h2.25v-2.25z" fill="#fff" fill-rule="nonzero" />
|
|
9
|
+
<g fill="#fff" fill-rule="evenodd">
|
|
10
|
+
<path d="m2.40305276 87.4017263 25.81133064-23.7730295c-4.5356618-6.5723551-6.8034928-14.000283-6.8034928-22.2837838 0-7.1236734 1.7429868-13.6948847 5.2289603-19.7136338 3.4859736-6.0187491 8.2577006-10.7953163 14.3151813-14.32970144 6.0574806-3.53438517 12.6547027-5.30157776 19.7916662-5.30157776 10.8429591 0 20.0964884 3.85236545 27.760588 11.5570964 7.6640996 7.7047309 11.4950036 16.9684802 11.4927136 27.791248 0 10.8799585-3.8309059 20.1574336-11.4927136 27.8324254-7.6618077 7.6749917-16.915337 11.5124876-27.760588 11.5124876-8.6312796 0-16.431747-2.5678624-23.4014021-7.7035871l-26.1413636 24.188234c-1.21699671 1.2147305-2.73881553 1.8220957-4.56545649 1.8220957s-3.3897139-.6485425-4.68921882-1.9456276c-1.29950493-1.297085-1.94925739-2.8572473-1.94925739-4.6804867 0-1.8781426.80216353-3.5343852 2.4064906-4.9687279zm58.34020784-19.878343c7.1369635 0 13.264347-2.5678623 18.3821503-7.7035871 5.1178034-5.1357247 7.676705-11.2928753 7.676705-18.4714518s-2.5589016-13.3082755-7.676705-18.3890972c-5.1178033-5.0808217-11.2451868-7.6212325-18.3821503-7.6212325-7.2469746 0-13.4156121 2.5404108-18.5059127 7.6212325s-7.6354509 11.2105207-7.6354509 18.3890972 2.5589016 13.3357271 7.676705 18.4714518c5.1178033 5.1357248 11.2726895 7.7035871 18.4646586 7.7035871zm-13.3594607-21.8685793h10.206958v10.1879511h7.2194718v-10.1879511h10.206958v-7.206028h-10.206958v-10.187951h-7.2194718v10.187951h-10.206958z"/>
|
|
15
11
|
</g>
|
|
16
12
|
|
|
17
13
|
</svg>
|
|
@@ -24,6 +24,19 @@
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
// Hide text layer for performance during zooming & scrolling
|
|
28
|
+
.BRsmooth-zooming, .BRscrolling-active {
|
|
29
|
+
.textSelectionSVG {
|
|
30
|
+
display: none;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Hide text selection layers of off-screen pages, and only display
|
|
35
|
+
// 2 text layers regardless of zoom level
|
|
36
|
+
.BRmode1up .BRpagecontainer:not(.BRpage-visible) .textSelectionSVG {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
27
40
|
// Makes page image unselectable
|
|
28
41
|
.BRpagecontainer img {
|
|
29
42
|
-webkit-user-select: none;
|
|
@@ -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];
|