@internetarchive/bookreader 5.0.0-10-alpha-3 → 5.0.0-101

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.
Files changed (374) hide show
  1. package/BookReader/474.js +2 -0
  2. package/BookReader/474.js.map +1 -0
  3. package/BookReader/BookReader.css +431 -1134
  4. package/BookReader/BookReader.js +1 -1
  5. package/BookReader/BookReader.js.LICENSE.txt +20 -20
  6. package/BookReader/BookReader.js.map +1 -1
  7. package/BookReader/bergamot-translator-worker.js +2966 -0
  8. package/BookReader/bergamot-translator-worker.wasm +0 -0
  9. package/BookReader/hypothesis/LICENSE +50 -0
  10. package/BookReader/hypothesis/README.md +55 -0
  11. package/BookReader/hypothesis/build/boot.js +1 -0
  12. package/BookReader/hypothesis/build/manifest.json +20 -0
  13. package/BookReader/hypothesis/build/scripts/annotator.bundle.js +184 -0
  14. package/BookReader/hypothesis/build/scripts/annotator.bundle.js.map +1 -0
  15. package/BookReader/hypothesis/build/scripts/sidebar.bundle.js +798 -0
  16. package/BookReader/hypothesis/build/scripts/sidebar.bundle.js.map +1 -0
  17. package/BookReader/hypothesis/build/scripts/ui-playground.bundle.js +711 -0
  18. package/BookReader/hypothesis/build/scripts/ui-playground.bundle.js.map +1 -0
  19. package/BookReader/hypothesis/build/styles/annotator.css +2235 -0
  20. package/BookReader/hypothesis/build/styles/annotator.css.map +1 -0
  21. package/BookReader/hypothesis/build/styles/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  22. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  23. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  24. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  25. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  26. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Bold.woff2 +0 -0
  27. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  28. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Italic.woff2 +0 -0
  29. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Regular.woff2 +0 -0
  30. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  31. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Math-Italic.woff2 +0 -0
  32. package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  33. package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  34. package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  35. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Script-Regular.woff2 +0 -0
  36. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  37. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  38. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  39. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  40. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  41. package/BookReader/hypothesis/build/styles/highlights.css +2 -0
  42. package/BookReader/hypothesis/build/styles/highlights.css.map +1 -0
  43. package/BookReader/hypothesis/build/styles/katex.min.css +2 -0
  44. package/BookReader/hypothesis/build/styles/katex.min.css.map +1 -0
  45. package/BookReader/hypothesis/build/styles/pdfjs-overrides.css +2 -0
  46. package/BookReader/hypothesis/build/styles/pdfjs-overrides.css.map +1 -0
  47. package/BookReader/hypothesis/build/styles/sidebar.css +2731 -0
  48. package/BookReader/hypothesis/build/styles/sidebar.css.map +1 -0
  49. package/BookReader/hypothesis/build/styles/ui-playground.css +2659 -0
  50. package/BookReader/hypothesis/build/styles/ui-playground.css.map +1 -0
  51. package/BookReader/hypothesis/package.json +126 -0
  52. package/BookReader/ia-bookreader-bundle.js +1782 -0
  53. package/BookReader/ia-bookreader-bundle.js.LICENSE.txt +7 -0
  54. package/BookReader/ia-bookreader-bundle.js.map +1 -0
  55. package/BookReader/icons/1up.svg +1 -1
  56. package/BookReader/icons/2up.svg +1 -1
  57. package/BookReader/icons/advance.svg +1 -1
  58. package/BookReader/icons/chevron-right.svg +1 -1
  59. package/BookReader/icons/close-circle-dark.svg +1 -1
  60. package/BookReader/icons/close-circle.svg +1 -1
  61. package/BookReader/icons/fullscreen.svg +1 -1
  62. package/BookReader/icons/fullscreen_exit.svg +1 -1
  63. package/BookReader/icons/hamburger.svg +1 -1
  64. package/BookReader/icons/left-arrow.svg +1 -1
  65. package/BookReader/icons/magnify-minus.svg +1 -1
  66. package/BookReader/icons/magnify-plus.svg +1 -1
  67. package/BookReader/icons/magnify.svg +1 -1
  68. package/BookReader/icons/pause.svg +1 -1
  69. package/BookReader/icons/play.svg +1 -1
  70. package/BookReader/icons/playback-speed.svg +1 -1
  71. package/BookReader/icons/read-aloud.svg +1 -1
  72. package/BookReader/icons/review.svg +1 -1
  73. package/BookReader/icons/thumbnails.svg +1 -1
  74. package/BookReader/icons/voice.svg +1 -0
  75. package/BookReader/icons/volume-full.svg +1 -1
  76. package/BookReader/images/BRicons.svg +3 -3
  77. package/BookReader/images/books_graphic.svg +1 -1
  78. package/BookReader/images/hypothesis.ico +0 -0
  79. package/BookReader/images/icon_book.svg +1 -1
  80. package/BookReader/images/icon_bookmark.svg +1 -1
  81. package/BookReader/images/icon_experiment.svg +1 -0
  82. package/BookReader/images/icon_gear.svg +1 -1
  83. package/BookReader/images/icon_hamburger.svg +1 -1
  84. package/BookReader/images/icon_home.svg +1 -1
  85. package/BookReader/images/icon_info.svg +1 -1
  86. package/BookReader/images/icon_one_page.svg +1 -1
  87. package/BookReader/images/icon_pause.svg +1 -1
  88. package/BookReader/images/icon_play.svg +1 -1
  89. package/BookReader/images/icon_playback-rate.svg +1 -1
  90. package/BookReader/images/icon_search_button.svg +1 -1
  91. package/BookReader/images/icon_share.svg +1 -1
  92. package/BookReader/images/icon_skip-ahead.svg +1 -1
  93. package/BookReader/images/icon_skip-back.svg +1 -1
  94. package/BookReader/images/icon_speaker.svg +1 -1
  95. package/BookReader/images/icon_speaker_open.svg +1 -1
  96. package/BookReader/images/icon_thumbnails.svg +1 -1
  97. package/BookReader/images/icon_toc.svg +1 -1
  98. package/BookReader/images/icon_two_pages.svg +1 -1
  99. package/BookReader/images/marker_chap-off.svg +1 -1
  100. package/BookReader/images/marker_chap-on.svg +1 -1
  101. package/BookReader/images/marker_srch-on.svg +1 -1
  102. package/BookReader/images/translate.svg +1 -0
  103. package/BookReader/images/unviewable_page.png +0 -0
  104. package/BookReader/jquery-3.js +2 -0
  105. package/BookReader/jquery-3.js.LICENSE.txt +24 -0
  106. package/BookReader/plugins/plugin.archive_analytics.js +1 -1
  107. package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
  108. package/BookReader/plugins/plugin.autoplay.js +1 -1
  109. package/BookReader/plugins/plugin.autoplay.js.map +1 -1
  110. package/BookReader/plugins/plugin.chapters.js +25 -1
  111. package/BookReader/plugins/plugin.chapters.js.LICENSE.txt +1 -0
  112. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  113. package/BookReader/plugins/plugin.experiments.js +3 -0
  114. package/BookReader/plugins/plugin.experiments.js.LICENSE.txt +1 -0
  115. package/BookReader/plugins/plugin.experiments.js.map +1 -0
  116. package/BookReader/plugins/plugin.iframe.js +1 -1
  117. package/BookReader/plugins/plugin.iframe.js.map +1 -1
  118. package/BookReader/plugins/plugin.iiif.js +2 -0
  119. package/BookReader/plugins/plugin.iiif.js.map +1 -0
  120. package/BookReader/plugins/plugin.resume.js +1 -1
  121. package/BookReader/plugins/plugin.resume.js.map +1 -1
  122. package/BookReader/plugins/plugin.search.js +2 -1
  123. package/BookReader/plugins/plugin.search.js.LICENSE.txt +1 -0
  124. package/BookReader/plugins/plugin.search.js.map +1 -1
  125. package/BookReader/plugins/plugin.text_selection.js +2 -1
  126. package/BookReader/plugins/plugin.text_selection.js.LICENSE.txt +1 -0
  127. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  128. package/BookReader/plugins/plugin.translate.js +137 -0
  129. package/BookReader/plugins/plugin.translate.js.LICENSE.txt +1 -0
  130. package/BookReader/plugins/plugin.translate.js.map +1 -0
  131. package/BookReader/plugins/plugin.tts.js +1 -1
  132. package/BookReader/plugins/plugin.tts.js.LICENSE.txt +2 -0
  133. package/BookReader/plugins/plugin.tts.js.map +1 -1
  134. package/BookReader/plugins/plugin.url.js +1 -1
  135. package/BookReader/plugins/plugin.url.js.map +1 -1
  136. package/BookReader/plugins/plugin.vendor-fullscreen.js +1 -1
  137. package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
  138. package/BookReader/plugins/translator-worker.js +2 -0
  139. package/BookReader/plugins/translator-worker.js.map +1 -0
  140. package/BookReader/silence.mp3 +0 -0
  141. package/BookReader/translator-worker.js +475 -0
  142. package/BookReader/webcomponents-bundle.js +3 -0
  143. package/BookReader/webcomponents-bundle.js.LICENSE.txt +9 -0
  144. package/BookReader/webcomponents-bundle.js.map +1 -0
  145. package/README.md +14 -3
  146. package/jsconfig.json +19 -0
  147. package/package.json +84 -64
  148. package/src/BookNavigator/assets/bookmark-colors.js +1 -1
  149. package/src/BookNavigator/assets/button-base.js +2 -1
  150. package/src/BookNavigator/assets/ia-logo.js +17 -0
  151. package/src/BookNavigator/assets/icon_checkmark.js +1 -1
  152. package/src/BookNavigator/assets/icon_close.js +1 -1
  153. package/src/BookNavigator/book-navigator.js +620 -0
  154. package/src/BookNavigator/bookmarks/bookmark-button.js +3 -2
  155. package/src/BookNavigator/bookmarks/bookmark-edit.js +2 -3
  156. package/src/BookNavigator/bookmarks/bookmarks-list.js +2 -3
  157. package/src/BookNavigator/bookmarks/bookmarks-loginCTA.js +2 -2
  158. package/src/BookNavigator/bookmarks/bookmarks-provider.js +27 -17
  159. package/src/BookNavigator/bookmarks/ia-bookmarks.js +116 -67
  160. package/src/BookNavigator/delete-modal-actions.js +1 -1
  161. package/src/BookNavigator/downloads/downloads-provider.js +36 -21
  162. package/src/BookNavigator/downloads/downloads.js +24 -4
  163. package/src/BookNavigator/search/search-provider.js +55 -27
  164. package/src/BookNavigator/search/search-results.js +25 -11
  165. package/src/BookNavigator/sharing.js +27 -0
  166. package/src/BookNavigator/viewable-files.js +95 -0
  167. package/src/BookNavigator/visual-adjustments/visual-adjustments-provider.js +13 -12
  168. package/src/BookNavigator/visual-adjustments/visual-adjustments.js +9 -9
  169. package/src/BookReader/BookModel.js +92 -46
  170. package/src/BookReader/DragScrollable.js +233 -0
  171. package/src/BookReader/ImageCache.js +49 -16
  172. package/src/BookReader/Mode1Up.js +58 -360
  173. package/src/BookReader/Mode1UpLit.js +393 -0
  174. package/src/BookReader/Mode2Up.js +75 -1318
  175. package/src/BookReader/Mode2UpLit.js +787 -0
  176. package/src/BookReader/ModeCoordinateSpace.js +29 -0
  177. package/src/BookReader/ModeSmoothZoom.js +312 -0
  178. package/src/BookReader/ModeThumb.js +20 -12
  179. package/src/BookReader/Navbar/Navbar.js +130 -53
  180. package/src/BookReader/PageContainer.js +120 -23
  181. package/src/BookReader/ReduceSet.js +2 -2
  182. package/src/BookReader/Toolbar/Toolbar.js +18 -40
  183. package/src/BookReader/events.js +2 -3
  184. package/src/BookReader/options.js +87 -16
  185. package/src/BookReader/utils/HTMLDimensionsCacher.js +44 -0
  186. package/src/BookReader/utils/ScrollClassAdder.js +31 -0
  187. package/src/BookReader/utils/SelectionObserver.js +45 -0
  188. package/src/BookReader/utils/classes.js +1 -1
  189. package/src/BookReader/utils.js +136 -12
  190. package/src/BookReader.js +641 -1192
  191. package/src/BookReaderPlugin.js +52 -0
  192. package/src/assets/icons/magnify-minus.svg +3 -7
  193. package/src/assets/icons/magnify-plus.svg +3 -7
  194. package/src/assets/icons/voice.svg +1 -0
  195. package/src/assets/images/hypothesis.ico +0 -0
  196. package/src/assets/images/icon_experiment.svg +1 -0
  197. package/src/assets/images/translate.svg +1 -0
  198. package/src/assets/images/unviewable_page.png +0 -0
  199. package/src/assets/silence.mp3 +0 -0
  200. package/src/css/BookReader.scss +1 -5
  201. package/src/css/_BRBookmarks.scss +1 -1
  202. package/src/css/_BRComponent.scss +1 -1
  203. package/src/css/_BRicon.scss +8 -2
  204. package/src/css/_BRmain.scss +16 -3
  205. package/src/css/_BRnav.scss +12 -66
  206. package/src/css/_BRpages.scss +171 -42
  207. package/src/css/_BRsearch.scss +69 -30
  208. package/src/css/_BRtoolbar.scss +5 -5
  209. package/src/css/_TextSelection.scss +129 -24
  210. package/src/css/_colorbox.scss +2 -2
  211. package/src/css/_controls.scss +24 -7
  212. package/src/css/_icons.scss +1 -1
  213. package/src/ia-bookreader/ia-bookreader.js +224 -0
  214. package/src/plugins/plugin.archive_analytics.js +84 -78
  215. package/src/plugins/plugin.autoplay.js +99 -104
  216. package/src/plugins/plugin.chapters.js +314 -205
  217. package/src/plugins/plugin.experiments.js +321 -0
  218. package/src/plugins/plugin.iframe.js +1 -1
  219. package/src/plugins/plugin.iiif.js +141 -0
  220. package/src/plugins/plugin.resume.js +54 -51
  221. package/src/plugins/plugin.text_selection.js +510 -219
  222. package/src/plugins/plugin.vendor-fullscreen.js +5 -5
  223. package/src/plugins/search/plugin.search.js +370 -392
  224. package/src/plugins/search/utils.js +43 -0
  225. package/src/plugins/search/view.js +49 -67
  226. package/src/plugins/translate/TranslationManager.js +162 -0
  227. package/src/plugins/translate/plugin.translate.js +523 -0
  228. package/src/plugins/tts/AbstractTTSEngine.js +78 -49
  229. package/src/plugins/tts/FestivalTTSEngine.js +20 -30
  230. package/src/plugins/tts/PageChunk.js +33 -21
  231. package/src/plugins/tts/PageChunkIterator.js +11 -17
  232. package/src/plugins/tts/WebTTSEngine.js +131 -91
  233. package/src/plugins/tts/plugin.tts.js +344 -350
  234. package/src/plugins/tts/utils.js +49 -47
  235. package/src/plugins/url/UrlPlugin.js +191 -0
  236. package/src/plugins/{plugin.url.js → url/plugin.url.js} +44 -15
  237. package/src/util/TextSelectionManager.js +282 -0
  238. package/src/util/browserSniffing.js +33 -1
  239. package/src/util/cache.js +20 -0
  240. package/src/util/docCookies.js +21 -2
  241. package/src/util/strings.js +1 -0
  242. package/.babelrc +0 -12
  243. package/.dependabot/config.yml +0 -6
  244. package/.eslintrc.js +0 -50
  245. package/.gitattributes +0 -2
  246. package/.github/ISSUE_TEMPLATE/bug.md +0 -32
  247. package/.github/ISSUE_TEMPLATE/feature-request.md +0 -30
  248. package/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -15
  249. package/.github/workflows/node.js.yml +0 -37
  250. package/.github/workflows/npm-publish.yml +0 -47
  251. package/.testcaferc.json +0 -5
  252. package/BookReader/bookreader-component-bundle.js +0 -1450
  253. package/BookReader/bookreader-component-bundle.js.LICENSE.txt +0 -38
  254. package/BookReader/bookreader-component-bundle.js.map +0 -1
  255. package/BookReader/jquery-1.10.1.js +0 -2
  256. package/BookReader/jquery-1.10.1.js.LICENSE.txt +0 -24
  257. package/BookReader/plugins/plugin.menu_toggle.js +0 -2
  258. package/BookReader/plugins/plugin.menu_toggle.js.map +0 -1
  259. package/BookReader/plugins/plugin.mobile_nav.js +0 -2
  260. package/BookReader/plugins/plugin.mobile_nav.js.map +0 -1
  261. package/BookReaderDemo/BookReaderDemo.css +0 -41
  262. package/BookReaderDemo/BookReaderJSAdvanced.js +0 -115
  263. package/BookReaderDemo/BookReaderJSAutoplay.js +0 -56
  264. package/BookReaderDemo/BookReaderJSSimple.js +0 -55
  265. package/BookReaderDemo/IIIFBookReader.js +0 -207
  266. package/BookReaderDemo/assets/v5/Bookreader-logo-cool-grad.svg +0 -1
  267. package/BookReaderDemo/assets/v5/Bookreader-logo-flat.svg +0 -1
  268. package/BookReaderDemo/assets/v5/Bookreader-logo-hex-cool-grad.png +0 -0
  269. package/BookReaderDemo/assets/v5/Bookreader-logo-hex-flat.png +0 -0
  270. package/BookReaderDemo/assets/v5/Bookreader-logo-lines.png +0 -0
  271. package/BookReaderDemo/assets/v5/Bookreader-logo-lines.svg +0 -1
  272. package/BookReaderDemo/assets/v5/Bookreader-logo-warm.svg +0 -1
  273. package/BookReaderDemo/assets/v5/bookreader-logo-renders@1x.png +0 -0
  274. package/BookReaderDemo/assets/v5/bookreader-logo-renders@2x.png +0 -0
  275. package/BookReaderDemo/assets/v5/bookreader-v5-screenshot.png +0 -0
  276. package/BookReaderDemo/bookreader-template-bundle.js +0 -7178
  277. package/BookReaderDemo/demo-advanced.html +0 -33
  278. package/BookReaderDemo/demo-autoplay.html +0 -38
  279. package/BookReaderDemo/demo-embed-iframe-src.html +0 -84
  280. package/BookReaderDemo/demo-embed.html +0 -26
  281. package/BookReaderDemo/demo-fullscreen-mobile.html +0 -36
  282. package/BookReaderDemo/demo-fullscreen.html +0 -33
  283. package/BookReaderDemo/demo-iiif.html +0 -34
  284. package/BookReaderDemo/demo-iiif.js +0 -26
  285. package/BookReaderDemo/demo-internetarchive.html +0 -74
  286. package/BookReaderDemo/demo-multiple.html +0 -43
  287. package/BookReaderDemo/demo-plugin-menu-toggle.html +0 -34
  288. package/BookReaderDemo/demo-preview-pages.html +0 -1092
  289. package/BookReaderDemo/demo-simple.html +0 -34
  290. package/BookReaderDemo/demo-vendor-fullscreen.html +0 -36
  291. package/BookReaderDemo/immersion-1up.html +0 -64
  292. package/BookReaderDemo/immersion-mode.html +0 -35
  293. package/BookReaderDemo/toggle_controls.html +0 -53
  294. package/BookReaderDemo/view_mode.html +0 -39
  295. package/BookReaderDemo/viewmode-cycle.html +0 -41
  296. package/CHANGELOG.md +0 -493
  297. package/CONTRIBUTING.md +0 -7
  298. package/codecov.yml +0 -17
  299. package/index.html +0 -31
  300. package/karma.conf.js +0 -23
  301. package/screenshot.png +0 -0
  302. package/scripts/postversion.js +0 -10
  303. package/scripts/preversion.js +0 -14
  304. package/scripts/version.js +0 -26
  305. package/src/BookNavigator/BookModel.js +0 -14
  306. package/src/BookNavigator/BookNavigator.js +0 -446
  307. package/src/BookNavigator/assets/book-loader.js +0 -27
  308. package/src/BookNavigator/br-fullscreen-mgr.js +0 -83
  309. package/src/BookNavigator/search/a-search-result.js +0 -55
  310. package/src/BookReader/DebugConsole.js +0 -54
  311. package/src/BookReaderComponent/BookReaderComponent.js +0 -112
  312. package/src/ItemNavigator/ItemNavigator.js +0 -376
  313. package/src/ItemNavigator/providers/sharing.js +0 -29
  314. package/src/css/_MobileNav.scss +0 -194
  315. package/src/dragscrollable-br.js +0 -261
  316. package/src/plugins/menu_toggle/plugin.menu_toggle.js +0 -324
  317. package/src/plugins/plugin.mobile_nav.js +0 -287
  318. package/tests/BookReader/BookModel.test.js +0 -312
  319. package/tests/BookReader/BookReaderPublicFunctions.test.js +0 -171
  320. package/tests/BookReader/DebugConsole.test.js +0 -25
  321. package/tests/BookReader/ImageCache.test.js +0 -150
  322. package/tests/BookReader/Mode1Up.test.js +0 -164
  323. package/tests/BookReader/Mode2Up.test.js +0 -247
  324. package/tests/BookReader/Navbar/Navbar.test.js +0 -169
  325. package/tests/BookReader/PageContainer.test.js +0 -115
  326. package/tests/BookReader/ReduceSet.test.js +0 -38
  327. package/tests/BookReader/Toolbar/Toolbar.test.js +0 -26
  328. package/tests/BookReader/utils/classes.test.js +0 -88
  329. package/tests/BookReader/utils.test.js +0 -109
  330. package/tests/BookReader.options.test.js +0 -39
  331. package/tests/BookReader.test.js +0 -301
  332. package/tests/e2e/README.md +0 -75
  333. package/tests/e2e/autoplay.test.js +0 -13
  334. package/tests/e2e/base.test.js +0 -35
  335. package/tests/e2e/helpers/base.js +0 -263
  336. package/tests/e2e/helpers/debug.js +0 -13
  337. package/tests/e2e/helpers/desktopSearch.js +0 -72
  338. package/tests/e2e/helpers/mobileSearch.js +0 -85
  339. package/tests/e2e/helpers/mockSearch.js +0 -93
  340. package/tests/e2e/helpers/rightToLeft.js +0 -29
  341. package/tests/e2e/ia-production/ia-prod-base.js +0 -17
  342. package/tests/e2e/models/BookReader.js +0 -11
  343. package/tests/e2e/models/Navigation.js +0 -56
  344. package/tests/e2e/rightToLeft.test.js +0 -20
  345. package/tests/e2e/viewmode.test.js +0 -37
  346. package/tests/karma/BookNavigator/book-navigator.test.js +0 -132
  347. package/tests/karma/BookNavigator/bookmarks/bookmark-edit.test.js +0 -133
  348. package/tests/karma/BookNavigator/bookmarks/bookmarks-list.test.js +0 -222
  349. package/tests/karma/BookNavigator/search/search-provider.test.js +0 -23
  350. package/tests/karma/BookNavigator/search/search-results.test.js +0 -240
  351. package/tests/karma/BookNavigator/visual-adjustments.test.js +0 -201
  352. package/tests/plugins/menu_toggle/plugin.menu_toggle.test.js +0 -68
  353. package/tests/plugins/plugin.archive_analytics.test.js +0 -23
  354. package/tests/plugins/plugin.autoplay.test.js +0 -52
  355. package/tests/plugins/plugin.chapters.test.js +0 -130
  356. package/tests/plugins/plugin.iframe.test.js +0 -42
  357. package/tests/plugins/plugin.mobile_nav.test.js +0 -66
  358. package/tests/plugins/plugin.resume.test.js +0 -98
  359. package/tests/plugins/plugin.text_selection.test.js +0 -203
  360. package/tests/plugins/plugin.url.test.js +0 -129
  361. package/tests/plugins/plugin.vendor-fullscreen.test.js +0 -65
  362. package/tests/plugins/search/plugin.search.test.js +0 -173
  363. package/tests/plugins/search/plugin.search.view.test.js +0 -106
  364. package/tests/plugins/tts/AbstractTTSEngine.test.js +0 -153
  365. package/tests/plugins/tts/FestivalTTSEngine.test.js +0 -59
  366. package/tests/plugins/tts/PageChunk.test.js +0 -57
  367. package/tests/plugins/tts/PageChunkIterator.test.js +0 -179
  368. package/tests/plugins/tts/WebTTSEngine.test.js +0 -126
  369. package/tests/plugins/tts/utils.test.js +0 -133
  370. package/tests/util/browserSniffing.test.js +0 -56
  371. package/tests/util/docCookies.test.js +0 -15
  372. package/tests/util/strings.test.js +0 -63
  373. package/tests/utils.js +0 -42
  374. package/webpack.config.js +0 -86
@@ -1,9 +1,11 @@
1
+ // @ts-check
1
2
  /** @typedef {import("../../BookReader.js").default} BookReader */
2
3
 
3
4
  import 'jquery-ui/ui/widget.js';
4
5
  import 'jquery-ui/ui/widgets/mouse.js';
5
6
  import 'jquery-ui/ui/widgets/slider.js';
6
7
  import { EVENTS } from '../events.js';
8
+ import { throttle } from '../utils.js';
7
9
 
8
10
  export class Navbar {
9
11
  /**
@@ -21,12 +23,14 @@ export class Navbar {
21
23
 
22
24
  /** @type {Object} controls will be switch over "this.maximumControls" */
23
25
  this.minimumControls = [
24
- 'viewmode'
26
+ 'viewmode',
25
27
  ];
26
28
  /** @type {Object} controls will be switch over "this.minimumControls" */
27
29
  this.maximumControls = [
28
- 'book_left', 'book_right', 'zoom_in', 'zoom_out', 'onepg', 'twopg', 'thumb'
30
+ 'book_left', 'book_right', 'zoom_in', 'zoom_out', 'onepg', 'twopg', 'thumb',
29
31
  ];
32
+
33
+ this.updateNavIndexThrottled = throttle(this.updateNavIndex.bind(this), 250, false);
30
34
  }
31
35
 
32
36
  controlFor(controlName) {
@@ -38,7 +42,7 @@ export class Navbar {
38
42
  return `<li>
39
43
  <button class="BRicon ${option.className}" title="${option.label}">
40
44
  <div class="icon icon-${option.iconClassName}"></div>
41
- <span class="tooltip">${option.label}</span>
45
+ <span class="BRtooltip">${option.label}</span>
42
46
  </button>
43
47
  </li>`;
44
48
  }
@@ -112,11 +116,71 @@ export class Navbar {
112
116
  this.updateViewModeButton(
113
117
  $button,
114
118
  currentViewModeButton.className,
115
- currentViewModeButton.title
119
+ currentViewModeButton.title,
116
120
  );
117
121
  });
118
122
  }
119
123
 
124
+ bindControlClickHandlers() {
125
+ const jIcons = this.$nav.find('.BRicon');
126
+
127
+ // Map of jIcon class -> click handler
128
+ const navigationControls = {
129
+ book_left: () => {
130
+ this.br.trigger(EVENTS.stop);
131
+ this.br.left();
132
+ },
133
+ book_right: () => {
134
+ this.br.trigger(EVENTS.stop);
135
+ this.br.right();
136
+ },
137
+ book_top: this.br.first.bind(this.br),
138
+ book_bottom: this.br.last.bind(this.br),
139
+ book_leftmost: this.br.leftmost.bind(this.br),
140
+ book_rightmost: this.br.rightmost.bind(this.br),
141
+ onepg: () => {
142
+ this.br.switchMode('1up');
143
+ },
144
+ thumb: () => {
145
+ this.br.switchMode('thumb');
146
+ },
147
+ twopg: () => {
148
+ this.br.switchMode('2up');
149
+ },
150
+ zoom_in: () => {
151
+ this.br.trigger(EVENTS.stop);
152
+ this.br.zoom(1);
153
+ this.br.trigger(EVENTS.zoomIn);
154
+ },
155
+ zoom_out: () => {
156
+ this.br.trigger(EVENTS.stop);
157
+ this.br.zoom(-1);
158
+ this.br.trigger(EVENTS.zoomOut);
159
+ },
160
+ full: () => {
161
+ if (this.br.ui == 'embed') {
162
+ const url = this.br.$('.BRembedreturn a').attr('href');
163
+ window.open(url);
164
+ } else {
165
+ this.br.toggleFullscreen();
166
+ }
167
+ },
168
+ };
169
+
170
+ // custom event for auto-loan-renew in ia-book-actions
171
+ // - to know if user is actively reading
172
+ this.$nav.find('nav.BRcontrols li button').on('click', () => {
173
+ this.br.trigger(EVENTS.userAction);
174
+ });
175
+
176
+ for (const control in navigationControls) {
177
+ jIcons.filter(`.${control}`).on('click.bindNavigationHandlers', () => {
178
+ navigationControls[control]();
179
+ return false;
180
+ });
181
+ }
182
+ }
183
+
120
184
  /**
121
185
  * Toggle viewmode button to change page view
122
186
  */
@@ -127,7 +191,7 @@ export class Navbar {
127
191
  .removeClass()
128
192
  .addClass(`icon icon-${iconClass}`)
129
193
  .end()
130
- .find('.tooltip')
194
+ .find('.BRtooltip')
131
195
  .text(tooltipText);
132
196
  }
133
197
 
@@ -135,16 +199,43 @@ export class Navbar {
135
199
  * Switch navbar controls on mobile and desktop
136
200
  */
137
201
  switchNavbarControls() {
138
- // we don't want navbar controls switching with liner-notes
139
- if (this.br.options.bookType !== 'linerNotes') {
140
- if (this.br.refs.$brContainer.prop('clientWidth') < 640) {
202
+ if (this.br.refs.$brContainer.prop('clientWidth') < 640) {
203
+ this.showMinimumNavPageNum();
204
+ // we don't want navbar controls switching with liner-notes
205
+ if (this.br.options.bookType !== 'linerNotes') {
141
206
  this.showMinimumNavbarControls();
142
- } else {
207
+ }
208
+ } else {
209
+ this.showMaximumNavPageNum();
210
+ // we don't want navbar controls switching with liner-notes
211
+ if (this.br.options.bookType !== 'linerNotes') {
143
212
  this.showMaximumNavbarControls();
144
213
  }
145
214
  }
146
215
  }
147
216
 
217
+ /**
218
+ * Switch Book Nav page number display to minimum/mobile
219
+ */
220
+ showMinimumNavPageNum() {
221
+ const minElement = document.querySelector('.BRcurrentpage.BRmin');
222
+ const maxElement = document.querySelector('.BRcurrentpage.BRmax');
223
+
224
+ if (minElement) minElement.classList.remove('hide');
225
+ if (maxElement) maxElement.classList.add('hide');
226
+ }
227
+
228
+ /**
229
+ * Switch Book Nav page number display to maximum/desktop
230
+ */
231
+ showMaximumNavPageNum() {
232
+ const minElement = document.querySelector('.BRcurrentpage.BRmin');
233
+ const maxElement = document.querySelector('.BRcurrentpage.BRmax');
234
+
235
+ if (minElement) minElement.classList.add('hide');
236
+ if (maxElement) maxElement.classList.remove('hide');
237
+ }
238
+
148
239
  /**
149
240
  * Switch Book Navbar controls to minimised
150
241
  * NOTE: only `this.minimumControls` and `this.maximumControls` switch on resize
@@ -200,7 +291,10 @@ export class Navbar {
200
291
  <div class="BRpager"></div>
201
292
  <div class="BRnavline"></div>
202
293
  </div>
203
- <p><span class='BRcurrentpage'></span></p>
294
+ <p>
295
+ <span class="BRcurrentpage BRmax"></span>
296
+ <span class="BRcurrentpage BRmin"></span>
297
+ </p>
204
298
  </li>
205
299
  ${this._renderControls()}
206
300
  </ul>
@@ -213,9 +307,9 @@ export class Navbar {
213
307
  const $slider = this.$root.find('.BRpager').slider({
214
308
  animate: true,
215
309
  min: 0,
216
- max: br.getNumLeafs() - 1,
310
+ max: br.book.getNumLeafs() - 1,
217
311
  value: br.currentIndex(),
218
- range: "min"
312
+ range: "min",
219
313
  });
220
314
 
221
315
  $slider.on('slide', (event, ui) => {
@@ -240,53 +334,25 @@ export class Navbar {
240
334
  return this.$nav;
241
335
  }
242
336
 
243
- /**
244
- * Initialize the navigation bar when embedded
245
- */
246
- initEmbed() {
247
- const { br } = this;
248
- // IA-specific
249
- const thisLink = (window.location + '')
250
- .replace('?ui=embed','')
251
- .replace('/stream/', '/details/')
252
- .replace('#', '/');
253
- const logoHtml = br.showLogo ? `<a class="logo" href="${br.logoURL}" target="_blank"></a>` : '';
254
-
255
- br.refs.$BRfooter = this.$root = $('<div class="BRfooter"></div>');
256
- br.refs.$BRnav = this.$nav = $(
257
- `<div class="BRnav BRnavEmbed">
258
- ${logoHtml}
259
- <span class="BRembedreturn">
260
- <a href="${thisLink}" target="_blank">${br.bookTitle}</a>
261
- </span>
262
- <span class="BRtoolbarbuttons">
263
- <button class="BRicon book_left"></button>
264
- <button class="BRicon book_right"></button>
265
- <button class="BRicon full"></button>
266
- </span>
267
- </div>`);
268
- this.$root.append(this.$nav);
269
- br.refs.$br.append(this.$root);
270
- }
271
-
272
337
  /**
273
338
  * Returns the textual representation of the current page for the navbar
274
339
  * @param {number} index
340
+ * @param {boolean} [useMaxFormat = false]
275
341
  * @return {string}
276
342
  */
277
- getNavPageNumString(index) {
343
+ getNavPageNumString(index, useMaxFormat = false) {
278
344
  const { br } = this;
279
345
  // Accessible index starts at 0 (alas) so we add 1 to make human
280
- const pageNum = br.getPageNum(index);
281
- const pageType = br.getPageProp(index, 'pageType');
282
- const numLeafs = br.getNumLeafs();
346
+ const pageNum = br.book.getPageNum(index);
347
+ const pageType = br.book.getPageProp(index, 'pageType');
348
+ const numLeafs = br.book.getNumLeafs();
283
349
 
284
350
  if (!this.maxPageNum) {
285
351
  // Calculate Max page num (used for pagination display)
286
352
  let maxPageNum = 0;
287
353
  let pageNumVal;
288
354
  for (let i = 0; i < numLeafs; i++) {
289
- pageNumVal = br.getPageNum(i);
355
+ pageNumVal = parseFloat(br.book.getPageNum(i));
290
356
  if (!isNaN(pageNumVal) && pageNumVal > maxPageNum) {
291
357
  maxPageNum = pageNumVal;
292
358
  }
@@ -294,7 +360,8 @@ export class Navbar {
294
360
  this.maxPageNum = maxPageNum;
295
361
  }
296
362
 
297
- return getNavPageNumHtml(index, numLeafs, pageNum, pageType, this.maxPageNum);
363
+ return getNavPageNumHtml(index, numLeafs, pageNum, pageType, this.maxPageNum, useMaxFormat);
364
+
298
365
  }
299
366
 
300
367
  /**
@@ -302,7 +369,8 @@ export class Navbar {
302
369
  * @param {number} index
303
370
  */
304
371
  updateNavPageNum(index) {
305
- this.$root.find('.BRcurrentpage').html(this.getNavPageNumString(index));
372
+ this.$root.find('.BRcurrentpage.BRmax').html(this.getNavPageNumString(index, true));
373
+ this.$root.find('.BRcurrentpage.BRmin').html(this.getNavPageNumString(index));
306
374
  }
307
375
 
308
376
  /**
@@ -322,18 +390,27 @@ export class Navbar {
322
390
  * @param {number} index
323
391
  * @param {number} numLeafs
324
392
  * @param {number|string} pageNum
325
- * @param {*} pageType @deprecated
393
+ * @param {*} pageType - Deprecated
326
394
  * @param {number} maxPageNum
395
+ * @param {boolean} [useMaxFormat = false]
327
396
  * @return {string}
328
397
  */
329
- export function getNavPageNumHtml(index, numLeafs, pageNum, pageType, maxPageNum) {
398
+ export function getNavPageNumHtml(index, numLeafs, pageNum, pageType, maxPageNum, useMaxFormat = false) {
330
399
  const pageIsAsserted = pageNum[0] != 'n';
400
+ const pageIndex = index + 1;
401
+
402
+ if (!pageIsAsserted) {
403
+ pageNum = '—';
404
+ }
405
+
406
+ if (useMaxFormat === true) {
407
+ return `Page ${pageNum} (${pageIndex}/${numLeafs})`;
408
+ }
331
409
 
332
410
  if (!pageIsAsserted) {
333
- const pageIndex = index + 1;
334
- return `(${pageIndex} of ${numLeafs})`; // Page (8 of 10)
411
+ return `(${pageIndex} of ${numLeafs})`;
335
412
  }
336
413
 
337
- const bookLengthLabel = maxPageNum ? ` of ${maxPageNum}` : '';
414
+ const bookLengthLabel = (maxPageNum && parseFloat(pageNum)) ? ` of ${maxPageNum}` : '';
338
415
  return `${pageNum}${bookLengthLabel}`;
339
416
  }
@@ -2,6 +2,8 @@
2
2
  /** @typedef {import('./BookModel.js').PageModel} PageModel */
3
3
  /** @typedef {import('./ImageCache.js').ImageCache} ImageCache */
4
4
 
5
+ import { sleep } from './utils.js';
6
+
5
7
 
6
8
  export class PageContainer {
7
9
  /**
@@ -9,16 +11,17 @@ export class PageContainer {
9
11
  * @param {object} opts
10
12
  * @param {boolean} opts.isProtected Whether we're in a protected book
11
13
  * @param {ImageCache} opts.imageCache
12
- * @param {string} opts.loadingImage
13
14
  */
14
- constructor(page, {isProtected, imageCache, loadingImage}) {
15
+ constructor(page, {isProtected, imageCache}) {
15
16
  this.page = page;
16
17
  this.imageCache = imageCache;
17
- this.loadingImage = loadingImage;
18
18
  this.$container = $('<div />', {
19
19
  'class': `BRpagecontainer ${page ? `pagediv${page.index}` : 'BRemptypage'}`,
20
20
  css: { position: 'absolute' },
21
- }).attr('data-side', page?.pageSide);
21
+ })
22
+ .attr('data-side', page?.pageSide)
23
+ .attr('data-index', page?.index)
24
+ .attr('data-page-num', page?.getPageNum());
22
25
 
23
26
  if (isProtected) {
24
27
  this.$container.append($('<div class="BRscreen" />'));
@@ -43,33 +46,127 @@ export class PageContainer {
43
46
  return;
44
47
  }
45
48
 
46
- const alreadyLoaded = this.imageCache.imageLoaded(this.page.index, reduce);
47
- const nextBestLoadedReduce = !alreadyLoaded && this.imageCache.getBestLoadedReduce(this.page.index, reduce);
49
+ const finalReduce = this.imageCache.getFinalReduce(this.page.index, reduce);
50
+ const newImageURI = this.page.getURI(finalReduce, 0);
48
51
 
49
- // Add the actual, highres image
50
- this.$img?.remove();
51
- this.$img = this.imageCache
52
- .image(this.page.index, reduce)
53
- .prependTo(this.$container);
52
+ // Note: These must be computed _before_ we call .image()
53
+ const alreadyLoaded = this.imageCache.imageLoaded(this.page.index, finalReduce);
54
+ const nextBestLoadedReduce = this.imageCache.getBestLoadedReduce(this.page.index, reduce);
54
55
 
55
- const backgroundLayers = [];
56
- if (!alreadyLoaded) {
57
- this.$container.addClass('BRpageloading');
58
- backgroundLayers.push(`url("${this.loadingImage}") center/20px no-repeat`);
56
+ // Avoid removing/re-adding the image if it's already there
57
+ // This can be called quite a bit, so we need to be fast
58
+ if (this.$img?.data('src') == newImageURI) {
59
+ return this;
59
60
  }
60
- if (nextBestLoadedReduce) {
61
- backgroundLayers.push(`url("${this.page.getURI(nextBestLoadedReduce, 0)}") center/100% no-repeat`);
61
+
62
+ let $oldImg = this.$img;
63
+ this.$img = this.imageCache.image(this.page.index, finalReduce);
64
+ if ($oldImg) {
65
+ this.$img.insertAfter($oldImg);
66
+ } else {
67
+ this.$img.prependTo(this.$container);
62
68
  }
63
69
 
64
70
  if (!alreadyLoaded) {
65
- this.$img
66
- .css('background', backgroundLayers.join(','))
67
- .one('loadend', async (ev) => {
68
- $(ev.target).css({ 'background': '' });
69
- $(ev.target).parent().removeClass('BRpageloading');
70
- });
71
+ this.$container.addClass('BRpageloading');
71
72
  }
72
73
 
74
+ if (!alreadyLoaded && nextBestLoadedReduce) {
75
+ // If we have a slightly lower quality image loaded, use that as the background
76
+ // while the higher res one loads
77
+ const nextBestUri = this.page.getURI(nextBestLoadedReduce, 0);
78
+ if ($oldImg) {
79
+ if ($oldImg.data('src') == nextBestUri) {
80
+ // Do nothing! It's already showing the right thing
81
+ } else {
82
+ // We have a different src, need to update the src
83
+ this.imageCache.image(this.page.index, nextBestLoadedReduce, $oldImg[0]);
84
+ }
85
+ } else {
86
+ // We don't have an old <img>, so we need to create a new one
87
+ $oldImg = this.imageCache.image(this.page.index, nextBestLoadedReduce);
88
+ $oldImg.prependTo(this.$container);
89
+ }
90
+ }
91
+
92
+ this.$img
93
+ .one('load', async (ev) => {
94
+ this.$container.removeClass('BRpageloading');
95
+ // `load` can fire a little early, so wait a spell before removing the old image
96
+ // to avoid flicker
97
+ await sleep(100);
98
+ $oldImg?.remove();
99
+ });
100
+
73
101
  return this;
74
102
  }
75
103
  }
104
+
105
+
106
+ /**
107
+ * @param {PageModel} page
108
+ * @param {string} className
109
+ */
110
+ export function createSVGPageLayer(page, className) {
111
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
112
+ svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
113
+ svg.setAttribute("viewBox", `0 0 ${page.width} ${page.height}`);
114
+ svg.setAttribute('class', `BRPageLayer ${className}`);
115
+ svg.setAttribute('preserveAspectRatio', 'none');
116
+ return svg;
117
+ }
118
+
119
+ /**
120
+ * @param {PageModel} page
121
+ * @param {string} className
122
+ */
123
+ export function createDIVPageLayer(page, className) {
124
+ const div = document.createElement("div");
125
+ div.style.width = `${page.width}px`;
126
+ div.style.height = `${page.height}px`;
127
+ div.setAttribute('class', `BRPageLayer ${className}`);
128
+ return div;
129
+ }
130
+
131
+ /**
132
+ * @param {{ l: number, r: number, b: number, t: number }} box
133
+ */
134
+ export function boxToSVGRect({ l: left, r: right, b: bottom, t: top }) {
135
+ const rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
136
+ rect.setAttribute("x", left.toString());
137
+ rect.setAttribute("y", top.toString());
138
+ rect.setAttribute("width", (right - left).toString());
139
+ rect.setAttribute("height", (bottom - top).toString());
140
+
141
+ // Some style; corner radius 4px. Can't set this in CSS yet
142
+ rect.setAttribute("rx", "4");
143
+ rect.setAttribute("ry", "4");
144
+ return rect;
145
+ }
146
+
147
+ /**
148
+ * @param {string} layerClass
149
+ * @param {Array<{ l: number, r: number, b: number, t: number }>} boxes
150
+ * @param {PageModel} page
151
+ * @param {HTMLElement} containerEl
152
+ * @param {string[]} [rectClasses] CSS classes to add to the rects
153
+ */
154
+ export function renderBoxesInPageContainerLayer(layerClass, boxes, page, containerEl, rectClasses = null) {
155
+ const mountedSvg = containerEl.querySelector(`.${layerClass}`);
156
+ // Create the layer if it's not there
157
+ const svg = mountedSvg || createSVGPageLayer(page, layerClass);
158
+ if (!mountedSvg) {
159
+ // Insert after the image if the image is already loaded.
160
+ const imgEl = containerEl.querySelector('.BRpageimage');
161
+ if (imgEl) $(svg).insertAfter(imgEl);
162
+ else $(svg).prependTo(containerEl);
163
+ }
164
+
165
+ for (const [i, box] of boxes.entries()) {
166
+ const rect = boxToSVGRect(box);
167
+ if (rectClasses) {
168
+ rect.setAttribute('class', rectClasses[i]);
169
+ }
170
+ svg.appendChild(rect);
171
+ }
172
+ }
@@ -7,7 +7,7 @@
7
7
  /** @type {ReduceSet} */
8
8
  export const IntegerReduceSet = {
9
9
  floor: Math.floor,
10
- decr(n) { return n - 1; }
10
+ decr(n) { return n - 1; },
11
11
  };
12
12
 
13
13
  /** @type {ReduceSet} */
@@ -17,7 +17,7 @@ export const Pow2ReduceSet = {
17
17
  },
18
18
  decr(n) {
19
19
  return 2 ** (Math.log2(n) - 1);
20
- }
20
+ },
21
21
  };
22
22
 
23
23
  export const NAMED_REDUCE_SETS = {
@@ -53,12 +53,17 @@ export class Toolbar {
53
53
  $('<a>')
54
54
  .attr({href: br.bookUrl, title: br.bookUrlTitle})
55
55
  .addClass('BRreturn')
56
- .html(br.bookUrlText || br.bookTitle)
56
+ .html(br.bookUrlText || br.bookTitle),
57
57
  );
58
58
  } else if (br.bookTitle) {
59
59
  $titleSectionEl.append(br.bookUrlText || br.bookTitle);
60
60
  }
61
61
 
62
+ // Call _bindNavigationHandlers on the plugins
63
+ for (const plugin of Object.values(br.plugins)) {
64
+ plugin._configureToolbar(br.refs.$BRtoolbar);
65
+ }
66
+
62
67
  // const $hamburger = br.refs.$BRtoolbar.find('BRtoolbarHamburger');
63
68
  return br.refs.$BRtoolbar;
64
69
  }
@@ -75,8 +80,6 @@ export class Toolbar {
75
80
  br.$('.BRnavCntl').addClass('BRup');
76
81
  br.$('.pause').hide();
77
82
 
78
- this.updateToolbarZoom(br.reduce); // Pretty format
79
-
80
83
  // We build in mode 2
81
84
  br.refs.$BRtoolbar.append();
82
85
 
@@ -115,7 +118,7 @@ export class Toolbar {
115
118
  onLoad: () => {
116
119
  br.trigger(EVENTS.stop);
117
120
  br.$('.BRpageviewValue').val(window.location.href);
118
- }
121
+ },
119
122
  });
120
123
  br.$('.info').colorbox({
121
124
  inline: true,
@@ -123,35 +126,10 @@ export class Toolbar {
123
126
  href: br.$('.BRinfo'),
124
127
  onLoad: () => {
125
128
  br.trigger(EVENTS.stop);
126
- }
129
+ },
127
130
  });
128
131
  }
129
132
 
130
- /**
131
- * @deprecated
132
- * @todo .BRzoom doesn't exist anywhere, so this is likely dead code
133
- * Update the displayed zoom factor based on reduction factor
134
- * @param {number} reduce
135
- */
136
- updateToolbarZoom(reduce) {
137
- const { br } = this;
138
- // $$$ TODO preserve zoom/fit for each mode
139
- const autofit = br.mode == br.constMode2up ? br.twoPage.autofit : br.onePage.autofit;
140
- /** @type {string} */
141
- let value;
142
- if (autofit) {
143
- value = autofit.slice(0,1).toUpperCase() + autofit.slice(1);
144
- } else {
145
- value = (100 / reduce)
146
- .toFixed(2)
147
- // Strip trailing zeroes and decimal if all zeroes
148
- .replace(/0+$/,'')
149
- .replace(/\.$/,'')
150
- + '%';
151
- }
152
- br.$('.BRzoom').text(value);
153
- }
154
-
155
133
  /**
156
134
  * @param {JQuery} $shareDiv
157
135
  */
@@ -212,11 +190,11 @@ export class Toolbar {
212
190
  $form.appendTo($shareDiv);
213
191
 
214
192
  $form.find('.fieldset-embed input').on('change', event => {
215
- const form = $(event.target).parents('form:first');
193
+ const form = $(event.target).parents('form').first();
216
194
  const params = {};
217
195
  params.mode = $(form.find('.fieldset-embed input[name=pages]:checked')).val();
218
196
  if (form.find('.fieldset-embed input[name=thispage]').prop('checked')) {
219
- params.page = br.getPageNum(br.currentIndex());
197
+ params.page = br.book.getPageNum(br.currentIndex());
220
198
  }
221
199
 
222
200
  if (br.getEmbedCode) {
@@ -232,20 +210,20 @@ export class Toolbar {
232
210
  // Bind share buttons
233
211
 
234
212
  // Use url without hashes
235
- $form.find('.facebook-share-button').click(() => {
213
+ $form.find('.facebook-share-button').on("click", () => {
236
214
  const params = $.param({ u: this._getSocialShareUrl() });
237
215
  const url = 'https://www.facebook.com/sharer.php?' + params;
238
216
  createPopup(url, 600, 400, 'Share');
239
217
  });
240
- $form.find('.twitter-share-button').click(() => {
218
+ $form.find('.twitter-share-button').on("click", () => {
241
219
  const params = $.param({
242
220
  url: this._getSocialShareUrl(),
243
- text: br.bookTitle
221
+ text: br.bookTitle,
244
222
  });
245
223
  const url = 'https://twitter.com/intent/tweet?' + params;
246
224
  createPopup(url, 600, 400, 'Share');
247
225
  });
248
- $form.find('.email-share-button').click(() => {
226
+ $form.find('.email-share-button').on("click", () => {
249
227
  const body = `${br.bookTitle}\n\n${this._getSocialShareUrl()}`;
250
228
  window.location.href = `mailto:?subject=${encodeURI(br.bookTitle)}&body=${encodeURI(body)}`;
251
229
  });
@@ -331,11 +309,11 @@ export class Toolbar {
331
309
  }
332
310
  }
333
311
 
334
- export function blankInfoDiv() {
312
+ function blankInfoDiv() {
335
313
  return $(`
336
314
  <div class="BRfloat BRinfo">
337
315
  <div class="BRfloatHead">About this book
338
- <button class="floatShut" href="javascript:;" onclick="$.fn.colorbox.close();"><span class="shift">Close</span></button>
316
+ <button class="floatShut" href="javascript:;" onclick="$.fn.colorbox.close();"><span class="br-colorbox-shift">Close</span></button>
339
317
  </div>
340
318
  <div class="BRfloatBody">
341
319
  <div class="BRfloatCover"></div>
@@ -351,12 +329,12 @@ export function blankInfoDiv() {
351
329
  </div>`);
352
330
  }
353
331
 
354
- export function blankShareDiv() {
332
+ function blankShareDiv() {
355
333
  return $(`
356
334
  <div class="BRfloat BRshare">
357
335
  <div class="BRfloatHead">
358
336
  Share
359
- <button class="floatShut" href="javascript:;" onclick="$.fn.colorbox.close();"><span class="shift">Close</span></button>
337
+ <button class="floatShut" href="javascript:;" onclick="$.fn.colorbox.close();"><span class="br-colorbox-shift">Close</span></button>
360
338
  </div>
361
339
  </div>`);
362
340
  }
@@ -3,11 +3,11 @@ export const EVENTS = {
3
3
  /** Indicates that the fragment (a serialization of the reader
4
4
  * state) has changed. */
5
5
  fragmentChange: 'fragmentChange',
6
+ pageChanged: 'pageChanged',
6
7
  PostInit: 'PostInit',
7
8
  stop: 'stop',
8
9
  resize: 'resize',
9
- // nav events:
10
- navToggled: 'navToggled',
10
+ userAction: 'userAction', // event to know if user is actively reading
11
11
  // menu click events
12
12
  fullscreenToggled: 'fullscreenToggled',
13
13
  zoomOut: 'zoomOut',
@@ -16,5 +16,4 @@ export const EVENTS = {
16
16
  '2PageViewSelected': '2PageViewSelected',
17
17
  /* currently 3 represents thumbnail view */
18
18
  '3PageViewSelected': '3PageViewSelected',
19
- mobileNavOpen: 'mobileNavOpen',
20
19
  };