@internetarchive/bookreader 5.0.0-11-multiple-files → 5.0.0-110
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/BookReader/474.js +2 -0
- package/BookReader/474.js.map +1 -0
- package/BookReader/BookReader.css +616 -1467
- package/BookReader/BookReader.js +2 -21564
- package/BookReader/BookReader.js.LICENSE.txt +20 -20
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/bergamot-translator-worker.js +2966 -0
- package/BookReader/bergamot-translator-worker.wasm +0 -0
- package/BookReader/hypothesis/LICENSE +50 -0
- package/BookReader/hypothesis/README.md +55 -0
- package/BookReader/hypothesis/build/boot.js +1 -0
- package/BookReader/hypothesis/build/manifest.json +20 -0
- package/BookReader/hypothesis/build/scripts/annotator.bundle.js +184 -0
- package/BookReader/hypothesis/build/scripts/annotator.bundle.js.map +1 -0
- package/BookReader/hypothesis/build/scripts/sidebar.bundle.js +798 -0
- package/BookReader/hypothesis/build/scripts/sidebar.bundle.js.map +1 -0
- package/BookReader/hypothesis/build/scripts/ui-playground.bundle.js +711 -0
- package/BookReader/hypothesis/build/scripts/ui-playground.bundle.js.map +1 -0
- package/BookReader/hypothesis/build/styles/annotator.css +2235 -0
- package/BookReader/hypothesis/build/styles/annotator.css.map +1 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/highlights.css +2 -0
- package/BookReader/hypothesis/build/styles/highlights.css.map +1 -0
- package/BookReader/hypothesis/build/styles/katex.min.css +2 -0
- package/BookReader/hypothesis/build/styles/katex.min.css.map +1 -0
- package/BookReader/hypothesis/build/styles/pdfjs-overrides.css +2 -0
- package/BookReader/hypothesis/build/styles/pdfjs-overrides.css.map +1 -0
- package/BookReader/hypothesis/build/styles/sidebar.css +2731 -0
- package/BookReader/hypothesis/build/styles/sidebar.css.map +1 -0
- package/BookReader/hypothesis/build/styles/ui-playground.css +2659 -0
- package/BookReader/hypothesis/build/styles/ui-playground.css.map +1 -0
- package/BookReader/hypothesis/package.json +126 -0
- package/BookReader/ia-bookreader-bundle.js +1907 -0
- package/BookReader/ia-bookreader-bundle.js.LICENSE.txt +19 -0
- package/BookReader/ia-bookreader-bundle.js.map +1 -0
- package/BookReader/icons/1up.svg +1 -12
- package/BookReader/icons/2up.svg +1 -15
- package/BookReader/icons/advance.svg +3 -26
- package/BookReader/icons/chevron-right.svg +1 -1
- package/BookReader/icons/close-circle-dark.svg +1 -0
- package/BookReader/icons/close-circle.svg +1 -1
- package/BookReader/icons/fullscreen.svg +1 -17
- package/BookReader/icons/fullscreen_exit.svg +1 -17
- package/BookReader/icons/hamburger.svg +1 -15
- package/BookReader/icons/left-arrow.svg +1 -12
- package/BookReader/icons/magnify-minus.svg +1 -16
- package/BookReader/icons/magnify-plus.svg +1 -17
- package/BookReader/icons/magnify.svg +1 -15
- package/BookReader/icons/pause.svg +1 -23
- package/BookReader/icons/play.svg +1 -22
- package/BookReader/icons/playback-speed.svg +1 -34
- package/BookReader/icons/read-aloud.svg +1 -22
- package/BookReader/icons/review.svg +3 -22
- package/BookReader/icons/slider-toggle.svg +1 -0
- package/BookReader/icons/thumbnails.svg +1 -17
- package/BookReader/icons/voice.svg +1 -0
- package/BookReader/icons/volume-full.svg +1 -22
- package/BookReader/images/BRicons.svg +5 -94
- package/BookReader/images/books_graphic.svg +1 -177
- package/BookReader/images/hypothesis.ico +0 -0
- package/BookReader/images/icon_book.svg +1 -12
- package/BookReader/images/icon_bookmark.svg +1 -12
- package/BookReader/images/icon_experiment.svg +1 -0
- package/BookReader/images/icon_gear.svg +1 -14
- package/BookReader/images/icon_hamburger.svg +1 -20
- package/BookReader/images/icon_home.svg +1 -21
- package/BookReader/images/icon_info.svg +1 -11
- package/BookReader/images/icon_one_page.svg +1 -8
- package/BookReader/images/icon_pause.svg +1 -1
- package/BookReader/images/icon_play.svg +1 -1
- package/BookReader/images/icon_playback-rate.svg +1 -15
- package/BookReader/images/icon_search_button.svg +1 -8
- package/BookReader/images/icon_share.svg +1 -9
- package/BookReader/images/icon_skip-ahead.svg +1 -6
- package/BookReader/images/icon_skip-back.svg +2 -13
- package/BookReader/images/icon_speaker.svg +1 -18
- package/BookReader/images/icon_speaker_open.svg +1 -10
- package/BookReader/images/icon_thumbnails.svg +1 -12
- package/BookReader/images/icon_toc.svg +1 -5
- package/BookReader/images/icon_two_pages.svg +1 -9
- package/BookReader/images/marker_chap-off.svg +1 -11
- package/BookReader/images/marker_chap-on.svg +1 -11
- package/BookReader/images/marker_srch-on.svg +1 -11
- package/BookReader/images/translate.svg +1 -0
- package/BookReader/images/unviewable_page.png +0 -0
- package/BookReader/jquery-3.js +2 -0
- package/BookReader/jquery-3.js.LICENSE.txt +24 -0
- package/BookReader/plugins/plugin.archive_analytics.js +1 -172
- package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
- package/BookReader/plugins/plugin.autoplay.js +1 -165
- package/BookReader/plugins/plugin.autoplay.js.map +1 -1
- package/BookReader/plugins/plugin.chapters.js +19 -301
- package/BookReader/plugins/plugin.chapters.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.chapters.js.map +1 -1
- package/BookReader/plugins/plugin.experiments.js +3 -0
- package/BookReader/plugins/plugin.experiments.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.experiments.js.map +1 -0
- package/BookReader/plugins/plugin.iframe.js +1 -74
- package/BookReader/plugins/plugin.iframe.js.map +1 -1
- package/BookReader/plugins/plugin.iiif.js +2 -0
- package/BookReader/plugins/plugin.iiif.js.map +1 -0
- package/BookReader/plugins/plugin.resume.js +1 -368
- package/BookReader/plugins/plugin.resume.js.map +1 -1
- package/BookReader/plugins/plugin.search.js +2 -1420
- package/BookReader/plugins/plugin.search.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.search.js.map +1 -1
- package/BookReader/plugins/plugin.text_selection.js +2 -1080
- package/BookReader/plugins/plugin.text_selection.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.text_selection.js.map +1 -1
- package/BookReader/plugins/plugin.translate.js +137 -0
- package/BookReader/plugins/plugin.translate.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.translate.js.map +1 -0
- package/BookReader/plugins/plugin.tts.js +2 -9193
- package/BookReader/plugins/plugin.tts.js.LICENSE.txt +2 -0
- package/BookReader/plugins/plugin.tts.js.map +1 -1
- package/BookReader/plugins/plugin.url.js +1 -269
- package/BookReader/plugins/plugin.url.js.map +1 -1
- package/BookReader/plugins/plugin.vendor-fullscreen.js +1 -379
- package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
- package/BookReader/plugins/translator-worker.js +2 -0
- package/BookReader/plugins/translator-worker.js.map +1 -0
- package/BookReader/silence.mp3 +0 -0
- package/BookReader/translator-worker.js +475 -0
- package/BookReader/webcomponents-bundle.js +3 -0
- package/BookReader/webcomponents-bundle.js.LICENSE.txt +9 -0
- package/BookReader/webcomponents-bundle.js.map +1 -0
- package/README.md +14 -3
- package/jsconfig.json +19 -0
- package/package.json +92 -70
- package/src/BookReader/BookModel.js +92 -46
- package/src/BookReader/DragScrollable.js +233 -0
- package/src/BookReader/ImageCache.js +49 -16
- package/src/BookReader/Mode1Up.js +66 -356
- package/src/BookReader/Mode1UpLit.js +392 -0
- package/src/BookReader/Mode2Up.js +87 -1315
- package/src/BookReader/Mode2UpLit.js +788 -0
- package/src/BookReader/ModeAbstract.js +43 -0
- package/src/BookReader/ModeCoordinateSpace.js +29 -0
- package/src/BookReader/ModeSmoothZoom.js +312 -0
- package/src/BookReader/ModeThumb.js +30 -16
- package/src/BookReader/Navbar/Navbar.js +201 -76
- package/src/BookReader/PageContainer.js +120 -23
- package/src/BookReader/ReduceSet.js +3 -3
- package/src/BookReader/Toolbar/Toolbar.js +19 -41
- package/src/BookReader/events.js +3 -3
- package/src/BookReader/options.js +94 -17
- package/src/BookReader/utils/HTMLDimensionsCacher.js +44 -0
- package/src/BookReader/utils/ScrollClassAdder.js +31 -0
- package/src/BookReader/utils/SelectionObserver.js +45 -0
- package/src/BookReader/utils/classes.js +1 -1
- package/src/BookReader/utils.js +141 -13
- package/src/BookReader.js +711 -1241
- package/src/BookReaderPlugin.js +52 -0
- package/src/assets/icons/close-circle-dark.svg +1 -0
- package/src/assets/icons/magnify-minus.svg +3 -7
- package/src/assets/icons/magnify-plus.svg +3 -7
- package/src/assets/icons/slider-toggle.svg +1 -0
- package/src/assets/icons/voice.svg +1 -0
- package/src/assets/images/hypothesis.ico +0 -0
- package/src/assets/images/icon_experiment.svg +1 -0
- package/src/assets/images/translate.svg +1 -0
- package/src/assets/images/unviewable_page.png +0 -0
- package/src/assets/silence.mp3 +0 -0
- package/src/css/BookReader.scss +1 -17
- package/src/css/_BRBookmarks.scss +1 -1
- package/src/css/_BRComponent.scss +1 -1
- package/src/css/_BRicon.scss +8 -2
- package/src/css/_BRmain.scss +33 -27
- package/src/css/_BRnav.scss +74 -70
- package/src/css/_BRpages.scss +171 -42
- package/src/css/_BRsearch.scss +69 -235
- package/src/css/_BRtoolbar.scss +5 -5
- package/src/css/_TextSelection.scss +129 -24
- package/src/css/_colorbox.scss +2 -2
- package/src/css/_controls.scss +24 -7
- package/src/css/_icons.scss +14 -1
- package/src/{BookNavigator/assets → css}/button-base.js +10 -3
- package/src/css/icon_checkmark.js +9 -0
- package/src/css/sharedStyles.js +15 -0
- package/src/ia-bookreader/downloads/downloads-provider.js +81 -0
- package/src/{BookNavigator → ia-bookreader}/downloads/downloads.js +29 -25
- package/src/ia-bookreader/ia-bookreader.js +666 -0
- package/src/ia-bookreader/sharing.js +27 -0
- package/src/ia-bookreader/viewable-files.js +98 -0
- package/src/{BookNavigator → ia-bookreader}/visual-adjustments/visual-adjustments-provider.js +17 -17
- package/src/{BookNavigator → ia-bookreader}/visual-adjustments/visual-adjustments.js +75 -67
- package/src/{BookNavigator → plugins}/bookmarks/bookmark-button.js +4 -3
- package/src/{BookNavigator/assets → plugins/bookmarks}/bookmark-colors.js +1 -1
- package/src/{BookNavigator → plugins}/bookmarks/bookmark-edit.js +44 -32
- package/src/{BookNavigator → plugins}/bookmarks/bookmarks-list.js +48 -49
- package/src/{BookNavigator → plugins}/bookmarks/bookmarks-loginCTA.js +5 -10
- package/src/plugins/bookmarks/bookmarks-provider.js +63 -0
- package/src/{BookNavigator → plugins/bookmarks}/delete-modal-actions.js +1 -1
- package/src/{BookNavigator → plugins}/bookmarks/ia-bookmarks.js +117 -68
- package/src/plugins/plugin.archive_analytics.js +84 -78
- package/src/plugins/plugin.autoplay.js +99 -104
- package/src/plugins/plugin.chapters.js +310 -201
- package/src/plugins/plugin.experiments.js +321 -0
- package/src/plugins/plugin.iframe.js +1 -1
- package/src/plugins/plugin.iiif.js +141 -0
- package/src/plugins/plugin.resume.js +53 -50
- package/src/plugins/plugin.text_selection.js +522 -219
- package/src/plugins/plugin.vendor-fullscreen.js +7 -7
- package/src/plugins/search/plugin.search.js +380 -360
- package/src/{BookNavigator → plugins}/search/search-provider.js +94 -32
- package/src/{BookNavigator → plugins}/search/search-results.js +108 -90
- package/src/plugins/search/utils.js +50 -0
- package/src/plugins/search/view.js +79 -210
- package/src/plugins/translate/TranslationManager.js +164 -0
- package/src/plugins/translate/plugin.translate.js +512 -0
- package/src/plugins/tts/AbstractTTSEngine.js +78 -49
- package/src/plugins/tts/FestivalTTSEngine.js +21 -31
- package/src/plugins/tts/PageChunk.js +33 -21
- package/src/plugins/tts/PageChunkIterator.js +11 -17
- package/src/plugins/tts/WebTTSEngine.js +131 -91
- package/src/plugins/tts/plugin.tts.js +345 -350
- package/src/plugins/tts/utils.js +77 -49
- package/src/plugins/url/UrlPlugin.js +191 -0
- package/src/plugins/{plugin.url.js → url/plugin.url.js} +47 -18
- package/src/util/TextSelectionManager.js +282 -0
- package/src/util/browserSniffing.js +33 -1
- package/src/util/cache.js +20 -0
- package/src/util/docCookies.js +21 -2
- package/src/util/lit.js +15 -0
- package/src/util/strings.js +1 -0
- package/.babelrc +0 -12
- package/.dependabot/config.yml +0 -6
- package/.eslintrc.js +0 -49
- package/.gitattributes +0 -2
- package/.github/ISSUE_TEMPLATE/bug.md +0 -32
- package/.github/ISSUE_TEMPLATE/feature-request.md +0 -30
- package/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -15
- package/.github/workflows/node.js.yml +0 -28
- package/.github/workflows/npm-publish.yml +0 -47
- package/.testcaferc.json +0 -5
- package/BookReader/bookreader-component-bundle.js +0 -14330
- package/BookReader/bookreader-component-bundle.js.LICENSE.txt +0 -38
- package/BookReader/bookreader-component-bundle.js.map +0 -1
- package/BookReader/icons/sort-ascending.svg +0 -1
- package/BookReader/icons/sort-descending.svg +0 -1
- package/BookReader/jquery-1.10.1.js +0 -108
- package/BookReader/jquery-1.10.1.js.LICENSE.txt +0 -24
- package/BookReader/plugins/plugin.menu_toggle.js +0 -369
- package/BookReader/plugins/plugin.menu_toggle.js.map +0 -1
- package/BookReader/plugins/plugin.mobile_nav.js +0 -335
- package/BookReader/plugins/plugin.mobile_nav.js.map +0 -1
- package/BookReaderDemo/BookReaderDemo.css +0 -41
- package/BookReaderDemo/BookReaderJSAdvanced.js +0 -115
- package/BookReaderDemo/BookReaderJSAutoplay.js +0 -56
- package/BookReaderDemo/BookReaderJSSimple.js +0 -55
- package/BookReaderDemo/IIIFBookReader.js +0 -207
- package/BookReaderDemo/assets/v5/Bookreader-logo-cool-grad.svg +0 -1
- package/BookReaderDemo/assets/v5/Bookreader-logo-flat.svg +0 -1
- package/BookReaderDemo/assets/v5/Bookreader-logo-hex-cool-grad.png +0 -0
- package/BookReaderDemo/assets/v5/Bookreader-logo-hex-flat.png +0 -0
- package/BookReaderDemo/assets/v5/Bookreader-logo-lines.png +0 -0
- package/BookReaderDemo/assets/v5/Bookreader-logo-lines.svg +0 -1
- package/BookReaderDemo/assets/v5/Bookreader-logo-warm.svg +0 -1
- package/BookReaderDemo/assets/v5/bookreader-logo-renders@1x.png +0 -0
- package/BookReaderDemo/assets/v5/bookreader-logo-renders@2x.png +0 -0
- package/BookReaderDemo/assets/v5/bookreader-v5-screenshot.png +0 -0
- package/BookReaderDemo/bookreader-template-bundle.js +0 -7178
- package/BookReaderDemo/demo-advanced.html +0 -33
- package/BookReaderDemo/demo-autoplay.html +0 -38
- package/BookReaderDemo/demo-embed-iframe-src.html +0 -84
- package/BookReaderDemo/demo-embed.html +0 -26
- package/BookReaderDemo/demo-fullscreen-mobile.html +0 -36
- package/BookReaderDemo/demo-fullscreen.html +0 -33
- package/BookReaderDemo/demo-iiif.html +0 -34
- package/BookReaderDemo/demo-iiif.js +0 -26
- package/BookReaderDemo/demo-internetarchive.html +0 -74
- package/BookReaderDemo/demo-multiple.html +0 -43
- package/BookReaderDemo/demo-plugin-menu-toggle.html +0 -34
- package/BookReaderDemo/demo-preview-pages.html +0 -1092
- package/BookReaderDemo/demo-simple.html +0 -34
- package/BookReaderDemo/demo-vendor-fullscreen.html +0 -36
- package/BookReaderDemo/immersion-1up.html +0 -64
- package/BookReaderDemo/immersion-mode.html +0 -35
- package/BookReaderDemo/toggle_controls.html +0 -53
- package/BookReaderDemo/view_mode.html +0 -39
- package/BookReaderDemo/viewmode-cycle.html +0 -41
- package/CHANGELOG.md +0 -476
- package/CONTRIBUTING.md +0 -7
- package/codecov.yml +0 -17
- package/index.html +0 -31
- package/karma.conf.js +0 -23
- package/screenshot.png +0 -0
- package/scripts/postversion.js +0 -10
- package/scripts/preversion.js +0 -14
- package/scripts/version.js +0 -26
- package/src/BookNavigator/BookModel.js +0 -14
- package/src/BookNavigator/BookNavigator.js +0 -451
- package/src/BookNavigator/assets/book-loader.js +0 -27
- package/src/BookNavigator/assets/icon_checkmark.js +0 -6
- package/src/BookNavigator/assets/icon_close.js +0 -3
- package/src/BookNavigator/assets/icon_sort_ascending.js +0 -5
- package/src/BookNavigator/assets/icon_sort_descending.js +0 -5
- package/src/BookNavigator/bookmarks/bookmarks-provider.js +0 -53
- package/src/BookNavigator/br-fullscreen-mgr.js +0 -83
- package/src/BookNavigator/downloads/downloads-provider.js +0 -66
- package/src/BookNavigator/search/a-search-result.js +0 -55
- package/src/BookNavigator/volumes/volumes-provider.js +0 -75
- package/src/BookNavigator/volumes/volumes.js +0 -161
- package/src/BookReader/DebugConsole.js +0 -54
- package/src/BookReaderComponent/BookReaderComponent.js +0 -112
- package/src/ItemNavigator/ItemNavigator.js +0 -372
- package/src/ItemNavigator/providers/sharing.js +0 -29
- package/src/assets/icons/sort-ascending.svg +0 -1
- package/src/assets/icons/sort-descending.svg +0 -1
- package/src/css/_MobileNav.scss +0 -194
- package/src/dragscrollable-br.js +0 -261
- package/src/plugins/menu_toggle/plugin.menu_toggle.js +0 -324
- package/src/plugins/plugin.mobile_nav.js +0 -287
- package/tests/BookReader/BookModel.test.js +0 -312
- package/tests/BookReader/BookReaderPublicFunctions.test.js +0 -171
- package/tests/BookReader/DebugConsole.test.js +0 -25
- package/tests/BookReader/ImageCache.test.js +0 -150
- package/tests/BookReader/Mode1Up.test.js +0 -164
- package/tests/BookReader/Mode2Up.test.js +0 -247
- package/tests/BookReader/Navbar/Navbar.test.js +0 -169
- package/tests/BookReader/PageContainer.test.js +0 -115
- package/tests/BookReader/ReduceSet.test.js +0 -38
- package/tests/BookReader/Toolbar/Toolbar.test.js +0 -26
- package/tests/BookReader/utils/classes.test.js +0 -88
- package/tests/BookReader/utils.test.js +0 -109
- package/tests/BookReader.options.test.js +0 -39
- package/tests/BookReader.test.js +0 -301
- package/tests/e2e/README.md +0 -75
- package/tests/e2e/autoplay.test.js +0 -13
- package/tests/e2e/base.test.js +0 -35
- package/tests/e2e/helpers/base.js +0 -258
- package/tests/e2e/helpers/debug.js +0 -13
- package/tests/e2e/helpers/desktopSearch.js +0 -72
- package/tests/e2e/helpers/mobileSearch.js +0 -85
- package/tests/e2e/helpers/mockSearch.js +0 -93
- package/tests/e2e/helpers/rightToLeft.js +0 -29
- package/tests/e2e/ia-production/ia-prod-base.js +0 -17
- package/tests/e2e/models/BookReader.js +0 -11
- package/tests/e2e/models/Navigation.js +0 -56
- package/tests/e2e/rightToLeft.test.js +0 -20
- package/tests/e2e/viewmode.test.js +0 -37
- package/tests/karma/BookNavigator/book-navigator.test.js +0 -132
- package/tests/karma/BookNavigator/bookmarks/bookmark-edit.test.js +0 -133
- package/tests/karma/BookNavigator/bookmarks/bookmarks-list.test.js +0 -222
- package/tests/karma/BookNavigator/search-results.test.js +0 -240
- package/tests/karma/BookNavigator/visual-adjustments.test.js +0 -201
- package/tests/karma/BookNavigator/volumes.test.js +0 -133
- package/tests/plugins/menu_toggle/plugin.menu_toggle.test.js +0 -68
- package/tests/plugins/plugin.archive_analytics.test.js +0 -23
- package/tests/plugins/plugin.autoplay.test.js +0 -52
- package/tests/plugins/plugin.chapters.test.js +0 -130
- package/tests/plugins/plugin.iframe.test.js +0 -42
- package/tests/plugins/plugin.mobile_nav.test.js +0 -66
- package/tests/plugins/plugin.resume.test.js +0 -98
- package/tests/plugins/plugin.text_selection.test.js +0 -203
- package/tests/plugins/plugin.url.test.js +0 -129
- package/tests/plugins/plugin.vendor-fullscreen.test.js +0 -65
- package/tests/plugins/search/plugin.search.test.js +0 -166
- package/tests/plugins/search/plugin.search.view.test.js +0 -106
- package/tests/plugins/tts/AbstractTTSEngine.test.js +0 -153
- package/tests/plugins/tts/FestivalTTSEngine.test.js +0 -59
- package/tests/plugins/tts/PageChunk.test.js +0 -57
- package/tests/plugins/tts/PageChunkIterator.test.js +0 -179
- package/tests/plugins/tts/WebTTSEngine.test.js +0 -126
- package/tests/plugins/tts/utils.test.js +0 -133
- package/tests/util/browserSniffing.test.js +0 -56
- package/tests/util/docCookies.test.js +0 -15
- package/tests/util/strings.test.js +0 -63
- package/tests/utils.js +0 -42
- package/webpack.config.js +0 -86
|
@@ -1,9 +1,8 @@
|
|
|
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
|
-
import bookmarkColorsCSS from '
|
|
5
|
+
import bookmarkColorsCSS from './bookmark-colors.js';
|
|
7
6
|
|
|
8
7
|
export class IABookmarksList extends LitElement {
|
|
9
8
|
static get properties() {
|
|
@@ -100,24 +99,23 @@ export class IABookmarksList extends LitElement {
|
|
|
100
99
|
const { className } = this.bookmarkColorInfo(bookmark.color);
|
|
101
100
|
const activeClass = bookmark.id === this.activeBookmarkID ? 'active' : '';
|
|
102
101
|
return html`
|
|
103
|
-
<li
|
|
104
|
-
@click=${() => this.emitSelectedEvent(bookmark)}
|
|
105
|
-
tabindex="0"
|
|
106
|
-
data-pageIndex=${bookmark.id}
|
|
107
|
-
>
|
|
102
|
+
<li data-pageIndex=${bookmark.id}>
|
|
108
103
|
<div class="separator"></div>
|
|
109
|
-
<div class="
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
104
|
+
<div class="bookmark-card ${activeClass}">
|
|
105
|
+
<div class="bookmark-header" @click=${() => this.emitSelectedEvent(bookmark)}>
|
|
106
|
+
<button>
|
|
107
|
+
<icon-bookmark class=${className} aria-label="${className} bookmark"></icon-bookmark>
|
|
108
|
+
<span> Page ${bookmark.page}</span>
|
|
109
|
+
</button>
|
|
110
|
+
<button
|
|
111
|
+
class="edit"
|
|
112
|
+
@click=${e => this.editBookmark(e, bookmark)}
|
|
113
|
+
title="Edit this bookmark"
|
|
114
|
+
aria-expanded=${editMode ? 'true' : 'false'}
|
|
115
|
+
>
|
|
116
|
+
<ia-icon-edit-pencil aria-hidden="true"></ia-icon-edit-pencil>
|
|
117
|
+
</button>
|
|
118
|
+
</div>
|
|
121
119
|
${!editMode && bookmark.note ? html`<p>${bookmark.note}</p>` : nothing}
|
|
122
120
|
${editMode ? this.editBookmarkComponent : nothing}
|
|
123
121
|
</div>
|
|
@@ -209,19 +207,24 @@ export class IABookmarksList extends LitElement {
|
|
|
209
207
|
font-style: italic;
|
|
210
208
|
}
|
|
211
209
|
|
|
212
|
-
|
|
210
|
+
.bookmark-header {
|
|
211
|
+
display: flex;
|
|
212
|
+
align-items: center;
|
|
213
213
|
margin: 0;
|
|
214
214
|
font-size: 1.4rem;
|
|
215
|
+
font-weight: bold;
|
|
215
216
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
217
|
+
|
|
218
|
+
.bookmark-header > button:first-child {
|
|
219
|
+
flex: 1;
|
|
220
|
+
display: flex;
|
|
221
|
+
align-items: center;
|
|
222
|
+
gap: 4px;
|
|
223
|
+
padding: 4px;
|
|
221
224
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
+
|
|
226
|
+
ia-icon-edit-pencil {
|
|
227
|
+
pointer-events: none;
|
|
225
228
|
}
|
|
226
229
|
|
|
227
230
|
p {
|
|
@@ -244,38 +247,34 @@ export class IABookmarksList extends LitElement {
|
|
|
244
247
|
display: none;
|
|
245
248
|
}
|
|
246
249
|
li {
|
|
247
|
-
cursor: pointer;
|
|
248
|
-
outline: none;
|
|
249
250
|
position: relative;
|
|
250
251
|
}
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
|
|
253
|
+
li .bookmark-card {
|
|
253
254
|
border: var(--activeBorderWidth) solid transparent;
|
|
254
|
-
|
|
255
|
+
border-radius: 4px;
|
|
255
256
|
}
|
|
256
|
-
|
|
257
|
+
|
|
258
|
+
li .bookmark-card.active {
|
|
257
259
|
border: var(--activeBorderWidth) solid #538bc5;
|
|
258
260
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
+
|
|
262
|
+
.bookmark-header button {
|
|
261
263
|
background: transparent;
|
|
262
264
|
cursor: pointer;
|
|
263
|
-
height: 40px;
|
|
264
|
-
width: 40px;
|
|
265
|
-
position: absolute;
|
|
266
|
-
right: 2px;
|
|
267
|
-
top: 2px;
|
|
268
|
-
text-align: right;
|
|
269
265
|
-webkit-appearance: none;
|
|
270
266
|
appearance: none;
|
|
271
|
-
outline: none;
|
|
272
267
|
box-sizing: border-box;
|
|
273
268
|
border: none;
|
|
269
|
+
padding: 0;
|
|
270
|
+
text-align: left;
|
|
274
271
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
height:
|
|
278
|
-
width:
|
|
272
|
+
|
|
273
|
+
li button.edit {
|
|
274
|
+
height: 34px;
|
|
275
|
+
width: 34px;
|
|
276
|
+
flex-shrink: 0;
|
|
277
|
+
text-align: center;
|
|
279
278
|
}
|
|
280
279
|
`;
|
|
281
280
|
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import { LitElement, html
|
|
2
|
-
import buttonStyles from '
|
|
1
|
+
import { LitElement, html } from 'lit';
|
|
2
|
+
import buttonStyles from '../../css/button-base.js';
|
|
3
3
|
|
|
4
4
|
class BookmarksLogin extends LitElement {
|
|
5
5
|
static get properties() {
|
|
6
6
|
return {
|
|
7
|
-
url: { type: String }
|
|
8
|
-
}
|
|
7
|
+
url: { type: String },
|
|
8
|
+
};
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
static get styles() {
|
|
12
|
-
|
|
13
|
-
a {
|
|
14
|
-
text-decoration: none;
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
return [buttonStyles, mainCss];
|
|
12
|
+
return buttonStyles;
|
|
18
13
|
}
|
|
19
14
|
|
|
20
15
|
constructor() {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import './delete-modal-actions.js';
|
|
3
|
+
import './bookmark-button.js';
|
|
4
|
+
import './ia-bookmarks.js';
|
|
5
|
+
|
|
6
|
+
import './bookmark-edit.js';
|
|
7
|
+
import './bookmarks-list.js';
|
|
8
|
+
import '@internetarchive/icon-bookmark';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export default class BookmarksProvider {
|
|
12
|
+
constructor(options) {
|
|
13
|
+
const {
|
|
14
|
+
baseHost,
|
|
15
|
+
signedIn,
|
|
16
|
+
bookreader,
|
|
17
|
+
modal,
|
|
18
|
+
onProviderChange,
|
|
19
|
+
} = options;
|
|
20
|
+
|
|
21
|
+
const referrerStr = `referer=${encodeURIComponent(location.href)}`;
|
|
22
|
+
const loginUrl = `https://${baseHost}/account/login?${referrerStr}`;
|
|
23
|
+
|
|
24
|
+
this.component = document.createElement('ia-bookmarks');
|
|
25
|
+
this.component.bookreader = bookreader;
|
|
26
|
+
this.component.displayMode = signedIn ? 'bookmarks' : 'login';
|
|
27
|
+
this.component.modal = modal;
|
|
28
|
+
this.component.loginOptions = {
|
|
29
|
+
loginClicked: this.bookmarksLoginClicked,
|
|
30
|
+
loginUrl,
|
|
31
|
+
};
|
|
32
|
+
this.bindEvents();
|
|
33
|
+
|
|
34
|
+
this.icon = html`<icon-bookmark aria-hidden="true" role="presentation" state="hollow" style="--iconWidth: 16px; --iconHeight: 24px;"></icon-bookmark>`;
|
|
35
|
+
this.label = 'Bookmarks';
|
|
36
|
+
this.id = 'bookmarks';
|
|
37
|
+
this.onProviderChange = onProviderChange;
|
|
38
|
+
this.component.setup();
|
|
39
|
+
this.updateMenu(this.component.bookmarks.length);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
updateMenu(count) {
|
|
43
|
+
this.menuDetails = `(${count})`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
bindEvents() {
|
|
47
|
+
this.component.addEventListener('bookmarksChanged', this.bookmarksChanged.bind(this));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
bookmarksChanged({ detail }) {
|
|
51
|
+
const bookmarksLength = Object.keys(detail.bookmarks).length;
|
|
52
|
+
this.updateMenu(bookmarksLength);
|
|
53
|
+
this.onProviderChange(detail.bookmarks, detail.showSidePanel);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
bookmarksLoginClicked() {
|
|
57
|
+
window.archive_analytics?.send_event_no_sampling(
|
|
58
|
+
'BookReader',
|
|
59
|
+
`BookmarksLogin`,
|
|
60
|
+
window.location.path,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import
|
|
1
|
+
import { LitElement, html, css, render } from 'lit';
|
|
2
|
+
// eslint-disable-next-line no-unused-vars
|
|
3
|
+
import { ModalConfig, ModalManager } from '@internetarchive/modal-manager';
|
|
4
|
+
import buttonStyles from '../../css/button-base.js';
|
|
4
5
|
import './bookmarks-loginCTA.js';
|
|
5
6
|
|
|
6
7
|
const api = {
|
|
@@ -57,9 +58,11 @@ class IABookmarks extends LitElement {
|
|
|
57
58
|
activeBookmarkID: { type: String },
|
|
58
59
|
bookmarks: { type: Array },
|
|
59
60
|
bookreader: { type: Object },
|
|
60
|
-
options: { type: Object },
|
|
61
61
|
displayMode: { type: String },
|
|
62
62
|
editedBookmark: { type: Object },
|
|
63
|
+
deleteModalConfig: { type: Object},
|
|
64
|
+
modal: { attribute: false },
|
|
65
|
+
loginOptions: { type: Object, attribute: false },
|
|
63
66
|
};
|
|
64
67
|
}
|
|
65
68
|
|
|
@@ -92,7 +95,12 @@ class IABookmarks extends LitElement {
|
|
|
92
95
|
this.bookmarks = [];
|
|
93
96
|
this.bookreader = {};
|
|
94
97
|
this.editedBookmark = {};
|
|
95
|
-
|
|
98
|
+
/** @type {ModalManager} */
|
|
99
|
+
this.modal = undefined;
|
|
100
|
+
this.loginOptions = {
|
|
101
|
+
loginClicked: () => {},
|
|
102
|
+
loginUrl: '',
|
|
103
|
+
};
|
|
96
104
|
/**
|
|
97
105
|
* Toggles display to either bookmarks or login cta
|
|
98
106
|
* @param {('bookmarks'|'login')} displayMode
|
|
@@ -101,6 +109,7 @@ class IABookmarks extends LitElement {
|
|
|
101
109
|
|
|
102
110
|
this.bookmarkColors = [{
|
|
103
111
|
id: 0,
|
|
112
|
+
// FIXME: This is also used as the aria-label
|
|
104
113
|
className: 'red',
|
|
105
114
|
}, {
|
|
106
115
|
id: 1,
|
|
@@ -113,21 +122,58 @@ class IABookmarks extends LitElement {
|
|
|
113
122
|
// eslint-disable-next-line
|
|
114
123
|
this.defaultColor = this.bookmarkColors[0];
|
|
115
124
|
this.api = api;
|
|
125
|
+
this.deleteModalConfig = new ModalConfig({
|
|
126
|
+
title: 'Delete Bookmark',
|
|
127
|
+
headline: 'This bookmark contains a note. Deleting it will permanently delete the note. Are you sure?',
|
|
128
|
+
headerColor: '#194880',
|
|
129
|
+
});
|
|
116
130
|
}
|
|
117
131
|
|
|
118
|
-
updated() {
|
|
132
|
+
updated(changed) {
|
|
133
|
+
if (changed.has('displayMode')) {
|
|
134
|
+
this.updateDisplay();
|
|
135
|
+
}
|
|
136
|
+
|
|
119
137
|
this.emitBookmarksChanged();
|
|
120
138
|
}
|
|
121
139
|
|
|
122
140
|
setup() {
|
|
123
|
-
this.api.identifier = this.
|
|
124
|
-
this.
|
|
125
|
-
|
|
126
|
-
|
|
141
|
+
this.api.identifier = this.getIdentifier();
|
|
142
|
+
if (this.displayMode === 'login') {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
this.fetchUserBookmarks();
|
|
146
|
+
this.setBREventListeners();
|
|
127
147
|
}
|
|
128
148
|
|
|
129
|
-
|
|
130
|
-
|
|
149
|
+
/**
|
|
150
|
+
* get identifier for current book including sub-files
|
|
151
|
+
*
|
|
152
|
+
* @returns Identifer
|
|
153
|
+
*/
|
|
154
|
+
getIdentifier() {
|
|
155
|
+
if (this.bookreader.bookId !== this.bookreader.subPrefix) {
|
|
156
|
+
return `${this.bookreader.bookId}/${this.bookreader.subPrefix}`;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return this.bookreader.bookId;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
updateDisplay() {
|
|
163
|
+
if (this.displayMode === 'bookmarks') {
|
|
164
|
+
this.fetchUserBookmarks();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async fetchUserBookmarks() {
|
|
169
|
+
if (!this.api.identifier) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
await this.fetchBookmarks();
|
|
173
|
+
this.initializeBookmarks();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
setBREventListeners() {
|
|
131
177
|
['3PageViewSelected'].forEach((event) => {
|
|
132
178
|
window.addEventListener(`BookReader:${event}`, (e) => {
|
|
133
179
|
setTimeout(() => {
|
|
@@ -147,12 +193,12 @@ class IABookmarks extends LitElement {
|
|
|
147
193
|
});
|
|
148
194
|
['zoomOut', 'zoomIn', 'resize'].forEach((event) => {
|
|
149
195
|
window.addEventListener(`BookReader:${event}`, () => {
|
|
150
|
-
|
|
151
|
-
this.renderBookmarkButtons();
|
|
152
|
-
}
|
|
196
|
+
this.renderBookmarkButtons();
|
|
153
197
|
});
|
|
154
198
|
});
|
|
199
|
+
}
|
|
155
200
|
|
|
201
|
+
initializeBookmarks() {
|
|
156
202
|
this.renderBookmarkButtons();
|
|
157
203
|
this.markActiveBookmark(true);
|
|
158
204
|
this.emitBookmarksChanged();
|
|
@@ -181,8 +227,8 @@ class IABookmarks extends LitElement {
|
|
|
181
227
|
color: this.getBookmarkColor(color) ? color : this.defaultColor.id,
|
|
182
228
|
};
|
|
183
229
|
|
|
184
|
-
const page = IABookmarks.formatPage(this.bookreader.getPageNum(leafNum));
|
|
185
|
-
const thumbnail = this.bookreader.getPageURI(`${leafNum}`.replace(/\D/g, ''), 32); // Request thumbnail 1/32 the size of original image
|
|
230
|
+
const page = IABookmarks.formatPage(this.bookreader.book.getPageNum(leafNum));
|
|
231
|
+
const thumbnail = this.bookreader.book.getPageURI(`${leafNum}`.replace(/\D/g, ''), 32); // Request thumbnail 1/32 the size of original image
|
|
186
232
|
const bookmark = {
|
|
187
233
|
...nomalizedParams,
|
|
188
234
|
id: leafNum,
|
|
@@ -194,27 +240,35 @@ class IABookmarks extends LitElement {
|
|
|
194
240
|
return bookmark;
|
|
195
241
|
}
|
|
196
242
|
|
|
197
|
-
fetchBookmarks() {
|
|
198
|
-
|
|
243
|
+
async fetchBookmarks() {
|
|
244
|
+
const resText = await this.api.getAll().then(r=> r.text());
|
|
245
|
+
let parsedResponse;
|
|
246
|
+
try {
|
|
247
|
+
parsedResponse = JSON.parse(resText);
|
|
248
|
+
} catch (e) {
|
|
249
|
+
parsedResponse = {error : e.message};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const {
|
|
199
253
|
success,
|
|
200
254
|
error = 'Something happened while fetching bookmarks.',
|
|
201
255
|
value: bkmrks = [],
|
|
202
|
-
}
|
|
203
|
-
if (!success) {
|
|
204
|
-
throw new Error(`Failed to load bookmarks: ${error}`);
|
|
205
|
-
}
|
|
256
|
+
} = parsedResponse;
|
|
206
257
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const formattedLeafNum = parseInt(leafNum, 10);
|
|
211
|
-
const formattedBookmark = this.formatBookmark({ ...bookmark, leafNum: formattedLeafNum });
|
|
212
|
-
bookmarks[leafNum] = formattedBookmark;
|
|
213
|
-
});
|
|
258
|
+
if (!success) {
|
|
259
|
+
console?.warn('Error fetching bookmarks', error);
|
|
260
|
+
}
|
|
214
261
|
|
|
215
|
-
|
|
216
|
-
|
|
262
|
+
const bookmarks = {};
|
|
263
|
+
Object.keys(bkmrks).forEach((leafNum) => {
|
|
264
|
+
const bookmark = bkmrks[leafNum];
|
|
265
|
+
const formattedLeafNum = parseInt(leafNum, 10);
|
|
266
|
+
const formattedBookmark = this.formatBookmark({ ...bookmark, leafNum: formattedLeafNum });
|
|
267
|
+
bookmarks[leafNum] = formattedBookmark;
|
|
217
268
|
});
|
|
269
|
+
|
|
270
|
+
this.bookmarks = bookmarks;
|
|
271
|
+
return bookmarks;
|
|
218
272
|
}
|
|
219
273
|
|
|
220
274
|
emitBookmarksChanged() {
|
|
@@ -250,12 +304,14 @@ class IABookmarks extends LitElement {
|
|
|
250
304
|
|
|
251
305
|
pages.forEach((pageEl) => {
|
|
252
306
|
const existingButton = pageEl.querySelector('.bookmark-button');
|
|
253
|
-
if (existingButton) {
|
|
307
|
+
if (existingButton) {
|
|
308
|
+
existingButton.remove();
|
|
309
|
+
}
|
|
254
310
|
const pageID = +pageEl.classList.value.match(/pagediv\d+/)[0].replace(/\D/g, '');
|
|
255
311
|
const pageBookmark = this.getBookmark(pageID);
|
|
256
312
|
const bookmarkState = pageBookmark ? 'filled' : 'hollow';
|
|
257
313
|
// eslint-disable-next-line
|
|
258
|
-
const pageData = this.bookreader.
|
|
314
|
+
const pageData = this.bookreader.book.getPage(pageID);
|
|
259
315
|
const { isViewable } = pageData;
|
|
260
316
|
|
|
261
317
|
if (!isViewable) { return; }
|
|
@@ -375,7 +431,7 @@ class IABookmarks extends LitElement {
|
|
|
375
431
|
|
|
376
432
|
bookmarkSelected({ detail }) {
|
|
377
433
|
const { leafNum } = detail.bookmark;
|
|
378
|
-
this.bookreader.jumpToPage(`${this.bookreader.getPageNum(`${leafNum}`.replace(/\D/g, ''))}`);
|
|
434
|
+
this.bookreader.jumpToPage(`${this.bookreader.book.getPageNum(`${leafNum}`.replace(/\D/g, ''))}`);
|
|
379
435
|
this.activeBookmarkID = leafNum;
|
|
380
436
|
}
|
|
381
437
|
|
|
@@ -390,33 +446,26 @@ class IABookmarks extends LitElement {
|
|
|
390
446
|
confirmDeletion(pageID) {
|
|
391
447
|
const existingBookmark = this.getBookmark(pageID);
|
|
392
448
|
if (existingBookmark.note) {
|
|
393
|
-
this.
|
|
449
|
+
this.displayDeletionModal(pageID);
|
|
394
450
|
return;
|
|
395
451
|
}
|
|
396
452
|
this.deleteBookmark({ detail: { id: `${pageID}` } });
|
|
397
453
|
}
|
|
398
454
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
.cancelAction=${() => this.emitCloseModal()}
|
|
408
|
-
.pageID=${pageID}
|
|
409
|
-
></delete-modal-actions>
|
|
410
|
-
`,
|
|
411
|
-
},
|
|
412
|
-
}));
|
|
413
|
-
}
|
|
455
|
+
displayDeletionModal(pageID) {
|
|
456
|
+
const customModalContent = html`
|
|
457
|
+
<delete-modal-actions
|
|
458
|
+
.deleteAction=${() => this.deleteBookmark({ detail: { id: `${pageID}` } })}
|
|
459
|
+
.cancelAction=${() => this.modal.closeModal()}
|
|
460
|
+
.pageID=${pageID}
|
|
461
|
+
></delete-modal-actions>
|
|
462
|
+
`;
|
|
414
463
|
|
|
415
|
-
|
|
416
|
-
this.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
})
|
|
464
|
+
|
|
465
|
+
this.modal.showModal({
|
|
466
|
+
config: this.deleteModalConfig,
|
|
467
|
+
customModalContent,
|
|
468
|
+
});
|
|
420
469
|
}
|
|
421
470
|
|
|
422
471
|
deleteBookmark({ detail }) {
|
|
@@ -427,18 +476,10 @@ class IABookmarks extends LitElement {
|
|
|
427
476
|
|
|
428
477
|
this.api.delete(detail.id);
|
|
429
478
|
this.editedBookmark = {};
|
|
430
|
-
this.
|
|
479
|
+
this.modal.closeModal();
|
|
431
480
|
this.renderBookmarkButtons();
|
|
432
481
|
}
|
|
433
482
|
|
|
434
|
-
/**
|
|
435
|
-
* call `loginClicked` callback
|
|
436
|
-
*/
|
|
437
|
-
loginClick() {
|
|
438
|
-
const { loginClicked = () => {} } = this.options;
|
|
439
|
-
loginClicked();
|
|
440
|
-
}
|
|
441
|
-
|
|
442
483
|
/**
|
|
443
484
|
* Tells us if we should allow user to add bookmark via menu panel
|
|
444
485
|
* returns { Boolean }
|
|
@@ -483,15 +524,23 @@ class IABookmarks extends LitElement {
|
|
|
483
524
|
`;
|
|
484
525
|
}
|
|
485
526
|
|
|
527
|
+
get bookmarkHelperMessage() {
|
|
528
|
+
return html`<p>Please use 1up or 2up view modes to add bookmark.</p>`;
|
|
529
|
+
}
|
|
530
|
+
|
|
486
531
|
render() {
|
|
487
|
-
const { loginUrl } = this.options;
|
|
488
532
|
const bookmarks = html`
|
|
489
533
|
${this.bookmarksList}
|
|
490
|
-
${this.allowAddingBookmark ? this.addBookmarkButton :
|
|
534
|
+
${this.allowAddingBookmark ? this.addBookmarkButton : this.bookmarkHelperMessage}
|
|
491
535
|
`;
|
|
492
536
|
return html`
|
|
493
537
|
<section class="bookmarks">
|
|
494
|
-
|
|
538
|
+
${ this.displayMode === 'login'
|
|
539
|
+
? html`<bookmarks-login
|
|
540
|
+
@click=${() => this.loginOptions.loginClicked()}
|
|
541
|
+
.url=${this.loginOptions.loginUrl}></bookmarks-login>`
|
|
542
|
+
: bookmarks
|
|
543
|
+
}
|
|
495
544
|
</section>
|
|
496
545
|
`;
|
|
497
546
|
}
|