@internetarchive/bookreader 5.0.0-9-multiple-files → 5.0.0-90

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 (333) hide show
  1. package/.eslintrc.js +21 -19
  2. package/.github/workflows/node.js.yml +81 -7
  3. package/.github/workflows/npm-publish.yml +6 -20
  4. package/.testcaferc.js +10 -0
  5. package/BookReader/BookReader.css +505 -1442
  6. package/BookReader/BookReader.js +2 -21564
  7. package/BookReader/BookReader.js.LICENSE.txt +20 -20
  8. package/BookReader/BookReader.js.map +1 -1
  9. package/BookReader/ia-bookreader-bundle.js +1782 -0
  10. package/BookReader/ia-bookreader-bundle.js.LICENSE.txt +7 -0
  11. package/BookReader/ia-bookreader-bundle.js.map +1 -0
  12. package/BookReader/icons/1up.svg +1 -12
  13. package/BookReader/icons/2up.svg +1 -15
  14. package/BookReader/icons/advance.svg +3 -26
  15. package/BookReader/icons/chevron-right.svg +1 -1
  16. package/BookReader/icons/close-circle-dark.svg +1 -0
  17. package/BookReader/icons/close-circle.svg +1 -1
  18. package/BookReader/icons/fullscreen.svg +1 -17
  19. package/BookReader/icons/fullscreen_exit.svg +1 -17
  20. package/BookReader/icons/hamburger.svg +1 -15
  21. package/BookReader/icons/left-arrow.svg +1 -12
  22. package/BookReader/icons/magnify-minus.svg +1 -16
  23. package/BookReader/icons/magnify-plus.svg +1 -17
  24. package/BookReader/icons/magnify.svg +1 -15
  25. package/BookReader/icons/pause.svg +1 -23
  26. package/BookReader/icons/play.svg +1 -22
  27. package/BookReader/icons/playback-speed.svg +1 -34
  28. package/BookReader/icons/read-aloud.svg +1 -22
  29. package/BookReader/icons/review.svg +3 -22
  30. package/BookReader/icons/thumbnails.svg +1 -17
  31. package/BookReader/icons/voice.svg +1 -0
  32. package/BookReader/icons/volume-full.svg +1 -22
  33. package/BookReader/images/BRicons.svg +5 -94
  34. package/BookReader/images/books_graphic.svg +1 -177
  35. package/BookReader/images/icon_book.svg +1 -12
  36. package/BookReader/images/icon_bookmark.svg +1 -12
  37. package/BookReader/images/icon_gear.svg +1 -14
  38. package/BookReader/images/icon_hamburger.svg +1 -20
  39. package/BookReader/images/icon_home.svg +1 -21
  40. package/BookReader/images/icon_info.svg +1 -11
  41. package/BookReader/images/icon_one_page.svg +1 -8
  42. package/BookReader/images/icon_pause.svg +1 -1
  43. package/BookReader/images/icon_play.svg +1 -1
  44. package/BookReader/images/icon_playback-rate.svg +1 -15
  45. package/BookReader/images/icon_search_button.svg +1 -8
  46. package/BookReader/images/icon_share.svg +1 -9
  47. package/BookReader/images/icon_skip-ahead.svg +1 -6
  48. package/BookReader/images/icon_skip-back.svg +2 -13
  49. package/BookReader/images/icon_speaker.svg +1 -18
  50. package/BookReader/images/icon_speaker_open.svg +1 -10
  51. package/BookReader/images/icon_thumbnails.svg +1 -12
  52. package/BookReader/images/icon_toc.svg +1 -5
  53. package/BookReader/images/icon_two_pages.svg +1 -9
  54. package/BookReader/images/marker_chap-off.svg +1 -11
  55. package/BookReader/images/marker_chap-on.svg +1 -11
  56. package/BookReader/images/marker_srch-on.svg +1 -11
  57. package/BookReader/images/unviewable_page.png +0 -0
  58. package/BookReader/jquery-3.js +2 -0
  59. package/BookReader/jquery-3.js.LICENSE.txt +24 -0
  60. package/BookReader/plugins/plugin.archive_analytics.js +1 -172
  61. package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
  62. package/BookReader/plugins/plugin.autoplay.js +1 -165
  63. package/BookReader/plugins/plugin.autoplay.js.map +1 -1
  64. package/BookReader/plugins/plugin.chapters.js +22 -301
  65. package/BookReader/plugins/plugin.chapters.js.LICENSE.txt +1 -0
  66. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  67. package/BookReader/plugins/plugin.iframe.js +1 -74
  68. package/BookReader/plugins/plugin.iframe.js.map +1 -1
  69. package/BookReader/plugins/plugin.iiif.js +2 -0
  70. package/BookReader/plugins/plugin.iiif.js.map +1 -0
  71. package/BookReader/plugins/plugin.resume.js +1 -368
  72. package/BookReader/plugins/plugin.resume.js.map +1 -1
  73. package/BookReader/plugins/plugin.search.js +2 -1420
  74. package/BookReader/plugins/plugin.search.js.LICENSE.txt +1 -0
  75. package/BookReader/plugins/plugin.search.js.map +1 -1
  76. package/BookReader/plugins/plugin.text_selection.js +2 -1080
  77. package/BookReader/plugins/plugin.text_selection.js.LICENSE.txt +1 -0
  78. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  79. package/BookReader/plugins/plugin.tts.js +2 -9193
  80. package/BookReader/plugins/plugin.tts.js.LICENSE.txt +2 -0
  81. package/BookReader/plugins/plugin.tts.js.map +1 -1
  82. package/BookReader/plugins/plugin.url.js +1 -269
  83. package/BookReader/plugins/plugin.url.js.map +1 -1
  84. package/BookReader/plugins/plugin.vendor-fullscreen.js +1 -379
  85. package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
  86. package/BookReader/webcomponents-bundle.js +3 -0
  87. package/BookReader/webcomponents-bundle.js.LICENSE.txt +9 -0
  88. package/BookReader/webcomponents-bundle.js.map +1 -0
  89. package/BookReaderDemo/BookReaderDemo.css +18 -19
  90. package/BookReaderDemo/BookReaderJSAdvanced.js +0 -3
  91. package/BookReaderDemo/BookReaderJSSimple.js +1 -0
  92. package/BookReaderDemo/IADemoBr.js +144 -0
  93. package/BookReaderDemo/demo-advanced.html +2 -2
  94. package/BookReaderDemo/demo-embed-iframe-src.html +2 -1
  95. package/BookReaderDemo/demo-fullscreen-mobile.html +3 -5
  96. package/BookReaderDemo/demo-fullscreen.html +2 -4
  97. package/BookReaderDemo/demo-iiif.html +99 -12
  98. package/BookReaderDemo/demo-internetarchive.html +214 -18
  99. package/BookReaderDemo/demo-multiple.html +2 -1
  100. package/BookReaderDemo/demo-preview-pages.html +526 -525
  101. package/BookReaderDemo/demo-simple.html +2 -1
  102. package/BookReaderDemo/demo-vendor-fullscreen.html +2 -4
  103. package/BookReaderDemo/ia-multiple-volumes-manifest.js +170 -0
  104. package/BookReaderDemo/immersion-1up.html +2 -2
  105. package/BookReaderDemo/immersion-mode.html +2 -4
  106. package/BookReaderDemo/toggle_controls.html +3 -2
  107. package/BookReaderDemo/view_mode.html +2 -1
  108. package/BookReaderDemo/viewmode-cycle.html +2 -3
  109. package/CHANGELOG.md +595 -33
  110. package/README.md +14 -1
  111. package/babel.config.js +20 -0
  112. package/codecov.yml +6 -0
  113. package/index.html +5 -2
  114. package/jsconfig.json +19 -0
  115. package/netlify.toml +9 -0
  116. package/package.json +70 -62
  117. package/renovate.json +52 -0
  118. package/scripts/preversion.js +0 -1
  119. package/src/BookNavigator/assets/bookmark-colors.js +1 -1
  120. package/src/BookNavigator/assets/button-base.js +10 -2
  121. package/src/BookNavigator/assets/ia-logo.js +17 -0
  122. package/src/BookNavigator/assets/icon_checkmark.js +1 -1
  123. package/src/BookNavigator/assets/icon_close.js +1 -1
  124. package/src/BookNavigator/book-navigator.js +590 -0
  125. package/src/BookNavigator/bookmarks/bookmark-button.js +3 -2
  126. package/src/BookNavigator/bookmarks/bookmark-edit.js +3 -4
  127. package/src/BookNavigator/bookmarks/bookmarks-list.js +2 -3
  128. package/src/BookNavigator/bookmarks/bookmarks-loginCTA.js +4 -9
  129. package/src/BookNavigator/bookmarks/bookmarks-provider.js +27 -17
  130. package/src/BookNavigator/bookmarks/ia-bookmarks.js +116 -67
  131. package/src/BookNavigator/delete-modal-actions.js +1 -1
  132. package/src/BookNavigator/downloads/downloads-provider.js +36 -21
  133. package/src/BookNavigator/downloads/downloads.js +29 -25
  134. package/src/BookNavigator/search/search-provider.js +80 -28
  135. package/src/BookNavigator/search/search-results.js +29 -26
  136. package/src/BookNavigator/sharing.js +27 -0
  137. package/src/BookNavigator/viewable-files.js +95 -0
  138. package/src/BookNavigator/visual-adjustments/visual-adjustments-provider.js +13 -12
  139. package/src/BookNavigator/visual-adjustments/visual-adjustments.js +7 -7
  140. package/src/BookReader/BookModel.js +76 -41
  141. package/src/BookReader/DragScrollable.js +233 -0
  142. package/src/BookReader/ImageCache.js +48 -15
  143. package/src/BookReader/Mode1Up.js +56 -351
  144. package/src/BookReader/Mode1UpLit.js +388 -0
  145. package/src/BookReader/Mode2Up.js +73 -1318
  146. package/src/BookReader/Mode2UpLit.js +777 -0
  147. package/src/BookReader/ModeCoordinateSpace.js +29 -0
  148. package/src/BookReader/ModeSmoothZoom.js +312 -0
  149. package/src/BookReader/ModeThumb.js +19 -13
  150. package/src/BookReader/Navbar/Navbar.js +70 -54
  151. package/src/BookReader/PageContainer.js +116 -22
  152. package/src/BookReader/ReduceSet.js +3 -3
  153. package/src/BookReader/Toolbar/Toolbar.js +14 -41
  154. package/src/BookReader/events.js +2 -3
  155. package/src/BookReader/options.js +73 -15
  156. package/src/BookReader/utils/HTMLDimensionsCacher.js +44 -0
  157. package/src/BookReader/utils/ScrollClassAdder.js +31 -0
  158. package/src/BookReader/utils/SelectionObserver.js +45 -0
  159. package/src/BookReader/utils/classes.js +1 -1
  160. package/src/BookReader/utils.js +128 -13
  161. package/src/BookReader.js +562 -1078
  162. package/src/BookReaderPlugin.js +44 -0
  163. package/src/assets/icons/close-circle-dark.svg +1 -0
  164. package/src/assets/icons/magnify-minus.svg +3 -7
  165. package/src/assets/icons/magnify-plus.svg +3 -7
  166. package/src/assets/icons/voice.svg +1 -0
  167. package/src/assets/images/unviewable_page.png +0 -0
  168. package/src/css/BookReader.scss +1 -17
  169. package/src/css/_BRBookmarks.scss +1 -1
  170. package/src/css/_BRComponent.scss +1 -1
  171. package/src/css/_BRicon.scss +8 -2
  172. package/src/css/_BRmain.scss +33 -27
  173. package/src/css/_BRnav.scss +12 -42
  174. package/src/css/_BRpages.scss +170 -42
  175. package/src/css/_BRsearch.scss +68 -230
  176. package/src/css/_BRtoolbar.scss +5 -5
  177. package/src/css/_TextSelection.scss +87 -27
  178. package/src/css/_colorbox.scss +2 -2
  179. package/src/css/_controls.scss +24 -7
  180. package/src/css/_icons.scss +7 -1
  181. package/src/ia-bookreader/ia-bookreader.js +224 -0
  182. package/src/plugins/plugin.archive_analytics.js +84 -78
  183. package/src/plugins/plugin.autoplay.js +99 -104
  184. package/src/plugins/plugin.chapters.js +237 -191
  185. package/src/plugins/plugin.iframe.js +1 -1
  186. package/src/plugins/plugin.iiif.js +141 -0
  187. package/src/plugins/plugin.resume.js +53 -50
  188. package/src/plugins/plugin.text_selection.js +503 -175
  189. package/src/plugins/plugin.vendor-fullscreen.js +7 -7
  190. package/src/plugins/search/plugin.search.js +183 -121
  191. package/src/plugins/search/utils.js +43 -0
  192. package/src/plugins/search/view.js +67 -202
  193. package/src/plugins/tts/AbstractTTSEngine.js +75 -45
  194. package/src/plugins/tts/FestivalTTSEngine.js +21 -31
  195. package/src/plugins/tts/PageChunk.js +16 -23
  196. package/src/plugins/tts/PageChunkIterator.js +11 -17
  197. package/src/plugins/tts/WebTTSEngine.js +88 -72
  198. package/src/plugins/tts/plugin.tts.js +310 -350
  199. package/src/plugins/tts/utils.js +16 -26
  200. package/src/plugins/url/UrlPlugin.js +191 -0
  201. package/src/plugins/{plugin.url.js → url/plugin.url.js} +47 -18
  202. package/src/util/browserSniffing.js +22 -0
  203. package/src/util/docCookies.js +21 -2
  204. package/src/util/strings.js +1 -0
  205. package/tests/e2e/README.md +37 -0
  206. package/tests/e2e/autoplay.test.js +9 -6
  207. package/tests/e2e/base.test.js +8 -16
  208. package/tests/e2e/helpers/base.js +55 -50
  209. package/tests/e2e/helpers/debug.js +1 -1
  210. package/tests/e2e/helpers/mockSearch.js +19 -22
  211. package/tests/e2e/helpers/params.js +17 -0
  212. package/tests/e2e/helpers/rightToLeft.js +8 -14
  213. package/tests/e2e/helpers/search.js +73 -0
  214. package/tests/e2e/models/Navigation.js +20 -37
  215. package/tests/e2e/rightToLeft.test.js +4 -5
  216. package/tests/e2e/viewmode.test.js +40 -33
  217. package/tests/jest/BookNavigator/book-navigator.test.js +661 -0
  218. package/tests/jest/BookNavigator/bookmarks/bookmark-button.test.js +43 -0
  219. package/tests/{karma → jest}/BookNavigator/bookmarks/bookmark-edit.test.js +25 -26
  220. package/tests/{karma → jest}/BookNavigator/bookmarks/bookmarks-list.test.js +41 -42
  221. package/tests/jest/BookNavigator/bookmarks/ia-bookmarks.test.js +45 -0
  222. package/tests/jest/BookNavigator/downloads/downloads-provider.test.js +67 -0
  223. package/tests/jest/BookNavigator/downloads/downloads.test.js +53 -0
  224. package/tests/jest/BookNavigator/search/search-provider.test.js +167 -0
  225. package/tests/{karma/BookNavigator → jest/BookNavigator/search}/search-results.test.js +109 -60
  226. package/tests/jest/BookNavigator/sharing/sharing-provider.test.js +49 -0
  227. package/tests/jest/BookNavigator/viewable-files/viewable-files-provider.test.js +80 -0
  228. package/tests/jest/BookNavigator/visual-adjustments.test.js +200 -0
  229. package/tests/{BookReader → jest/BookReader}/BookModel.test.js +74 -14
  230. package/tests/jest/BookReader/BookReaderPublicFunctions.test.js +193 -0
  231. package/tests/{BookReader → jest/BookReader}/ImageCache.test.js +4 -4
  232. package/tests/jest/BookReader/Mode1UpLit.test.js +73 -0
  233. package/tests/jest/BookReader/Mode2Up.test.js +98 -0
  234. package/tests/jest/BookReader/Mode2UpLit.test.js +190 -0
  235. package/tests/jest/BookReader/ModeCoordinateSpace.test.js +16 -0
  236. package/tests/jest/BookReader/ModeSmoothZoom.test.js +218 -0
  237. package/tests/jest/BookReader/ModeThumb.test.js +71 -0
  238. package/tests/{BookReader → jest/BookReader}/Navbar/Navbar.test.js +42 -29
  239. package/tests/jest/BookReader/PageContainer.test.js +238 -0
  240. package/tests/{BookReader → jest/BookReader}/ReduceSet.test.js +1 -1
  241. package/tests/{BookReader → jest/BookReader}/Toolbar/Toolbar.test.js +3 -3
  242. package/tests/jest/BookReader/utils/HTMLDimensionsCacher.test.js +59 -0
  243. package/tests/jest/BookReader/utils/ScrollClassAdder.test.js +49 -0
  244. package/tests/jest/BookReader/utils/SelectionObserver.test.js +57 -0
  245. package/tests/{BookReader → jest/BookReader}/utils/classes.test.js +1 -1
  246. package/tests/jest/BookReader/utils.test.js +250 -0
  247. package/tests/jest/BookReader.keyboard.test.js +190 -0
  248. package/tests/{BookReader.options.test.js → jest/BookReader.options.test.js} +10 -2
  249. package/tests/{BookReader.test.js → jest/BookReader.test.js} +43 -53
  250. package/tests/jest/plugins/plugin.archive_analytics.test.js +20 -0
  251. package/tests/jest/plugins/plugin.autoplay.test.js +35 -0
  252. package/tests/jest/plugins/plugin.chapters.test.js +195 -0
  253. package/tests/{plugins → jest/plugins}/plugin.iframe.test.js +4 -4
  254. package/tests/{plugins → jest/plugins}/plugin.resume.test.js +22 -35
  255. package/tests/jest/plugins/plugin.text_selection.test.js +316 -0
  256. package/tests/{plugins → jest/plugins}/plugin.vendor-fullscreen.test.js +2 -2
  257. package/tests/{plugins → jest/plugins}/search/plugin.search.test.js +26 -47
  258. package/tests/{plugins → jest/plugins}/search/plugin.search.view.test.js +42 -9
  259. package/tests/jest/plugins/search/utils.js +25 -0
  260. package/tests/jest/plugins/search/utils.test.js +29 -0
  261. package/tests/{plugins → jest/plugins}/tts/AbstractTTSEngine.test.js +30 -10
  262. package/tests/{plugins → jest/plugins}/tts/FestivalTTSEngine.test.js +4 -4
  263. package/tests/{plugins → jest/plugins}/tts/PageChunk.test.js +1 -1
  264. package/tests/{plugins → jest/plugins}/tts/PageChunkIterator.test.js +3 -3
  265. package/tests/{plugins → jest/plugins}/tts/WebTTSEngine.test.js +47 -1
  266. package/tests/{plugins → jest/plugins}/tts/utils.test.js +1 -60
  267. package/tests/jest/plugins/url/UrlPlugin.test.js +198 -0
  268. package/tests/{plugins → jest/plugins/url}/plugin.url.test.js +57 -18
  269. package/tests/jest/setup.js +3 -0
  270. package/tests/{util → jest/util}/browserSniffing.test.js +1 -1
  271. package/tests/jest/util/docCookies.test.js +24 -0
  272. package/tests/{util → jest/util}/strings.test.js +1 -1
  273. package/tests/{utils.js → jest/utils.js} +38 -0
  274. package/webpack.config.js +16 -10
  275. package/.babelrc +0 -12
  276. package/.dependabot/config.yml +0 -6
  277. package/.testcaferc.json +0 -5
  278. package/BookReader/bookreader-component-bundle.js +0 -14330
  279. package/BookReader/bookreader-component-bundle.js.LICENSE.txt +0 -38
  280. package/BookReader/bookreader-component-bundle.js.map +0 -1
  281. package/BookReader/icons/sort-ascending.svg +0 -1
  282. package/BookReader/icons/sort-descending.svg +0 -1
  283. package/BookReader/jquery-1.10.1.js +0 -108
  284. package/BookReader/jquery-1.10.1.js.LICENSE.txt +0 -24
  285. package/BookReader/plugins/plugin.menu_toggle.js +0 -369
  286. package/BookReader/plugins/plugin.menu_toggle.js.map +0 -1
  287. package/BookReader/plugins/plugin.mobile_nav.js +0 -335
  288. package/BookReader/plugins/plugin.mobile_nav.js.map +0 -1
  289. package/BookReaderDemo/BookReaderJSAutoplay.js +0 -56
  290. package/BookReaderDemo/IIIFBookReader.js +0 -207
  291. package/BookReaderDemo/bookreader-template-bundle.js +0 -7178
  292. package/BookReaderDemo/demo-autoplay.html +0 -38
  293. package/BookReaderDemo/demo-iiif.js +0 -26
  294. package/BookReaderDemo/demo-plugin-menu-toggle.html +0 -34
  295. package/karma.conf.js +0 -23
  296. package/src/BookNavigator/BookModel.js +0 -14
  297. package/src/BookNavigator/BookNavigator.js +0 -452
  298. package/src/BookNavigator/assets/book-loader.js +0 -27
  299. package/src/BookNavigator/assets/icon_sort_ascending.js +0 -5
  300. package/src/BookNavigator/assets/icon_sort_descending.js +0 -5
  301. package/src/BookNavigator/br-fullscreen-mgr.js +0 -83
  302. package/src/BookNavigator/search/a-search-result.js +0 -55
  303. package/src/BookNavigator/volumes/volumes-provider.js +0 -108
  304. package/src/BookNavigator/volumes/volumes.js +0 -162
  305. package/src/BookReader/DebugConsole.js +0 -54
  306. package/src/BookReaderComponent/BookReaderComponent.js +0 -112
  307. package/src/ItemNavigator/ItemNavigator.js +0 -372
  308. package/src/ItemNavigator/providers/sharing.js +0 -29
  309. package/src/assets/icons/sort-ascending.svg +0 -1
  310. package/src/assets/icons/sort-descending.svg +0 -1
  311. package/src/css/_MobileNav.scss +0 -194
  312. package/src/dragscrollable-br.js +0 -261
  313. package/src/plugins/menu_toggle/plugin.menu_toggle.js +0 -324
  314. package/src/plugins/plugin.mobile_nav.js +0 -287
  315. package/tests/BookReader/BookReaderPublicFunctions.test.js +0 -171
  316. package/tests/BookReader/DebugConsole.test.js +0 -25
  317. package/tests/BookReader/Mode1Up.test.js +0 -164
  318. package/tests/BookReader/Mode2Up.test.js +0 -247
  319. package/tests/BookReader/PageContainer.test.js +0 -115
  320. package/tests/BookReader/utils.test.js +0 -109
  321. package/tests/e2e/helpers/desktopSearch.js +0 -72
  322. package/tests/e2e/helpers/mobileSearch.js +0 -85
  323. package/tests/e2e/ia-production/ia-prod-base.js +0 -17
  324. package/tests/karma/BookNavigator/book-navigator.test.js +0 -132
  325. package/tests/karma/BookNavigator/visual-adjustments.test.js +0 -201
  326. package/tests/karma/BookNavigator/volumes.test.js +0 -133
  327. package/tests/plugins/menu_toggle/plugin.menu_toggle.test.js +0 -68
  328. package/tests/plugins/plugin.archive_analytics.test.js +0 -23
  329. package/tests/plugins/plugin.autoplay.test.js +0 -52
  330. package/tests/plugins/plugin.chapters.test.js +0 -130
  331. package/tests/plugins/plugin.mobile_nav.test.js +0 -66
  332. package/tests/plugins/plugin.text_selection.test.js +0 -203
  333. package/tests/util/docCookies.test.js +0 -15
@@ -1,83 +0,0 @@
1
- import Debouncer from '../util/debouncer';
2
-
3
- /**
4
- * Manages fullscreen size
5
- * so that bookreader chrome is always visible
6
- * This is a shim to hold us until we update loan bar
7
- * https://drive.google.com/drive/folders/1Ym9FDMZPiM4EbNh3NU-_2h8kizIYaLWt
8
- */
9
- export default class BRFullscreenMgr {
10
- constructor(brSelector = '#BookReader') {
11
- this.debounceTime = 250;
12
- this.savedScrollY = 0;
13
- this.savedScrollX = 0;
14
- this.brSelector = brSelector;
15
-
16
- this.setup = this.setup.bind(this);
17
- this.teardown = this.teardown.bind(this);
18
- this.resizeBookReaderContainer = this.resizeBookReaderContainer.bind(this);
19
-
20
- this.handleResizeEvent = this.handleResizeEvent.bind(this);
21
-
22
- this.handleBookReaderHeight = new Debouncer(
23
- this.resizeBookReaderContainer, this.debounceTime, this,
24
- );
25
- }
26
-
27
- get brDom() {
28
- return document.querySelector(this.brSelector);
29
- }
30
-
31
- /**
32
- * Sets bookreader height
33
- * & adds resize, orientationchange listeners
34
- * & passes captured scroll positions
35
- *
36
- * @param {object} brInstance
37
- */
38
- setup(brInstance) {
39
- this.bookreader = brInstance;
40
-
41
- this.resizeBookReaderContainer();
42
- window.addEventListener('resize', this.handleResizeEvent);
43
- }
44
-
45
- /**
46
- * Resets BookReader height
47
- * & removes event handlers, resets captured scroll positions
48
- */
49
- teardown() {
50
- this.brDom.setAttribute('style', '');
51
- window.removeEventListener('resize', this.handleResizeEvent);
52
- window.scrollTo(this.savedScrollX, this.savedScrollY);
53
- this.savedScrollX = 0;
54
- this.savedScrollY = 0;
55
- }
56
-
57
- /**
58
- * Event listener for resize & orientationchange
59
- */
60
- handleResizeEvent() {
61
- this.handleBookReaderHeight.execute();
62
- }
63
-
64
- /**
65
- * Calculates & sets BookReader's needed height to
66
- * take the loan bar into account
67
- * + appends fullscreen classes to DOM
68
- */
69
- resizeBookReaderContainer() {
70
- const { scrollX, scrollY } = window;
71
- this.savedScrollX = scrollX;
72
- this.savedScrollY = scrollY;
73
- this.bookreader.updateBrClasses();
74
-
75
- const loanbar = document.querySelector('.BookReaderMessage');
76
- const loanbarHeight = loanbar?.offsetHeight ?? 0;
77
- const windowHeight = window.innerHeight;
78
- const newHeight = `${(windowHeight - loanbarHeight)}px`;
79
- this.brDom.style.height = newHeight;
80
- this.brDom.style.top = loanbarHeight;
81
- window.scrollTo(0, 0);
82
- }
83
- }
@@ -1,55 +0,0 @@
1
- import { nothing } from 'lit-html';
2
- import { html, LitElement } from 'lit-element';
3
- import { unsafeHTML } from 'lit-html/directives/unsafe-html';
4
-
5
- export class BookSearchResult extends LitElement {
6
- static get properties() {
7
- return {
8
- match: { type: Object },
9
- };
10
- }
11
-
12
- constructor() {
13
- super();
14
-
15
- this.matchRegex = new RegExp('{{{(.+?)}}}', 'g');
16
- }
17
-
18
- createRenderRoot() {
19
- return this;
20
- }
21
-
22
- highlightedHit(hit) {
23
- return html`
24
- <p>${unsafeHTML(hit.replace(this.matchRegex, '<mark>$1</mark>'))}</p>
25
- `;
26
- }
27
-
28
- resultSelected() {
29
- this.dispatchEvent(new CustomEvent('resultSelected', {
30
- bubbles: true,
31
- composed: true,
32
- detail: {
33
- match: this.match,
34
- },
35
- }));
36
- }
37
-
38
- render() {
39
- const { match } = this;
40
- const { par = [] } = match;
41
- const [resultDetails = {}] = par;
42
- const pageNumber = Number.isInteger(resultDetails.page)
43
- ? html`<p class="page-num">Page -${resultDetails.page}-</p>` : nothing;
44
- const coverImage = html`<img src="${match.cover}" />`;
45
- return html`
46
- <li @click=${this.resultSelected}>
47
- ${match.cover ? coverImage : nothing}
48
- <h4>${match.title || nothing}</h4>
49
- ${pageNumber}
50
- ${this.highlightedHit(match.text)}
51
- </li>
52
- `;
53
- }
54
- }
55
- customElements.define('book-search-result', BookSearchResult);
@@ -1,108 +0,0 @@
1
- import { html } from 'lit-element';
2
- import sortAscendingIcon from '../assets/icon_sort_ascending.js';
3
- import sortDescendingIcon from '../assets/icon_sort_descending.js';
4
-
5
- import './volumes.js';
6
-
7
- const stub = {
8
- "success": true,
9
- "value": {
10
- "identifier": "SubBookTest",
11
- "mediatype": "texts",
12
- "files": {
13
- "by_subprefix": {
14
- "/details/SubBookTest": {
15
- "url_path": "/details/SubBookTest",
16
- "file_prefix": "book1/GPORFP",
17
- "title": "book1/GPORFP.pdf",
18
- "file_source": "/book1/GPORFP_jp2.zip"
19
- },
20
- "/details/SubBookTest/subdir/book2/brewster_kahle_internet_archive": {
21
- "url_path": "/details/SubBookTest/subdir/book2/brewster_kahle_internet_archive",
22
- "file_prefix": "subdir/book2/brewster_kahle_internet_archive",
23
- "title": "subdir/book2/brewster_kahle_internet_archive.pdf",
24
- "file_source": "/subdir/book2/brewster_kahle_internet_archive_jp2.zip"
25
- },
26
- "/details/SubBookTest/subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume": {
27
- "url_path": "/details/SubBookTest/subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume",
28
- "file_prefix": "subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume",
29
- "title": "subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume.pdf",
30
- "file_source": "/subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume_jp2.zip"
31
- }
32
- },
33
- "main_dir": "/2/items/SubBookTest"
34
- }
35
- }
36
- };
37
-
38
-
39
- export default class VolumesProvider {
40
-
41
- constructor(optionChange, baseHost, bookreader) {
42
- this.optionChange = optionChange
43
- this.component = document.createElement('viewable-files');
44
-
45
- const files = bookreader.options.multipleBooksList?.by_subprefix
46
- this.viewableFiles = Object.keys(files).map(item => files[item]);
47
- this.volumeCount = Object.keys(files).length;
48
- this.isFirstLoad = true
49
- this.isSortAscending = false;
50
-
51
- console.log('hostUrl: ', baseHost)
52
- this.component.subPrefix = bookreader.options === undefined ? 'theworksofplato01platiala' : bookreader.options.subPrefix;
53
- this.component.hostUrl = baseHost;
54
- this.component.viewableFiles = this.viewableFiles;
55
-
56
- this.id = 'volumes';
57
- this.label = `Viewable Files (${this.volumeCount})`
58
- this.icon = html`<ia-icon icon="volumes" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>`;
59
- this.actionButton = this.headerIcon
60
- this.sortVolumes()
61
- }
62
-
63
- get sortAscendingIcon() {
64
- const iconStyle = 'background: transparent; border: none; position: absolute; right: 25px';
65
- return html`<button style=${iconStyle} class="sort-asc icon" aria-label="Sort volumes in ascending order" @click=${() => this.sortVolumes()}>${sortAscendingIcon}</button>`;
66
- }
67
-
68
- get sortDescendingIcon() {
69
- const iconStyle = 'background: transparent; border: none; position: absolute; right: 25px';
70
- return html`<button style=${iconStyle} class="sort-desc icon" aria-label="Sort volumes in descending order" @click=${() => this.sortVolumes()}>${sortDescendingIcon}</button>`;
71
- }
72
-
73
- get headerIcon() {
74
- return this.isSortAscending ? this.sortAscendingIcon : this.sortDescendingIcon;
75
- }
76
-
77
- sortVolumes() {
78
- this.isSortAscending = !this.isSortAscending;
79
- const sortedFiles = this.viewableFiles.sort((a, b) => {
80
- if (this.isSortAscending) return a.title.localeCompare(b.title);
81
- else return b.title.localeCompare(a.title);
82
- })
83
-
84
- this.component.viewableFiles = [...sortedFiles]
85
- if (!this.isFirstLoad) {
86
- this.actionButton = this.headerIcon
87
- this.optionChange(this.bookreader)
88
- } else {
89
- this.isFirstLoad = false
90
- }
91
- }
92
-
93
- bindEvents() {
94
- this.component.addEventListener('click', this.multiplefilesClicked.bind(this));
95
- }
96
-
97
- multiplefilesClicked({ detail }) {
98
- // maybe some analytics?
99
- if (window.archive_analytics) {
100
- window.archive_analytics?.send_event_no_sampling(
101
- 'BookReader',
102
- `VolumesSort`,
103
- window.location.path,
104
- );
105
- }
106
- }
107
-
108
- }
@@ -1,162 +0,0 @@
1
- import { css, html, LitElement } from 'lit-element';
2
- import { nothing } from 'lit-html'
3
- import { repeat } from 'lit-html/directives/repeat';
4
-
5
- export class Volumes extends LitElement {
6
- static get properties() {
7
- return {
8
- subPrefix: { type: String },
9
- hostUrl: { type: String },
10
- viewableFiles: { type: Array }
11
- };
12
- }
13
-
14
- constructor() {
15
- super();
16
- this.subPrefix = '';
17
- this.hostUrl = '';
18
- this.viewableFiles = [];
19
- }
20
-
21
- volumeItemWithImageTitle(item) {
22
- return html`
23
- <li class="content active">
24
- <div class="separator"></div>
25
- <a class="container" href="${this.hostUrl}${item.url_path}">
26
- <div class="image">
27
- <img src="${item.image}">
28
- </div>
29
- <div class="text">
30
- <p class="item-title">${item.title}</p>
31
- <small>by: ${item.author}</small>
32
- </div>
33
- </a>
34
- </li>
35
- `
36
- }
37
-
38
- volumeItem(item) {
39
- const activeClass = this.subPrefix === item.file_subprefix ? 'active' : ''
40
- console.log('hostUrl: ', this.hostUrl)
41
- return html`
42
- <li>
43
- <div class="separator"></div>
44
- <div class="content ${activeClass}">
45
- <a href="${this.hostUrl}${item.url_path}">
46
- <p class="item-title">${item.title}</p>
47
- </a>
48
- </div>
49
- </li>
50
- `
51
- }
52
-
53
- get volumesList() {
54
- const volumes = repeat(this.viewableFiles, volume => volume?.file_prefix, this.volumeItem.bind(this));
55
- return html`
56
- <ul>
57
- ${volumes}
58
- <div class="separator"></div>
59
- </ul>
60
- `
61
- }
62
-
63
- render() {
64
- return html`
65
- <div>${this.viewableFiles.length ? this.volumesList : nothing}</div>
66
- `
67
- }
68
-
69
- static get styles() {
70
- return css`
71
- :host {
72
- display: block;
73
- overflow-y: auto;
74
- box-sizing: border-box;
75
- color: var(--primaryTextColor);
76
- margin-top: 14px;
77
- margin-bottom: 2rem;
78
- --activeBorderWidth: 2px;
79
- }
80
-
81
- a {
82
- color: #ffffff;
83
- text-decoration: none
84
- }
85
-
86
- img {
87
- width: 35px;
88
- height: 45px;
89
- }
90
-
91
- ul {
92
- padding: 0;
93
- list-style: none;
94
- margin: var(--activeBorderWidth) 0.5rem 1rem 0;
95
- }
96
-
97
- ul > li:first-child .separator {
98
- display: none;
99
- }
100
-
101
- li {
102
- cursor: pointer;
103
- outline: none;
104
- position: relative;
105
- }
106
-
107
- li .content {
108
- padding: 2px 0 4px 2px;
109
- border: var(--activeBorderWidth) solid transparent;
110
- padding: .2rem 0 .4rem .2rem;
111
- }
112
-
113
- li .content.active {
114
- border: var(--activeBorderWidth) solid #538bc5;
115
- }
116
-
117
- small {
118
- font-style: italic;
119
- white-space: initial;
120
- }
121
-
122
- .container {
123
- display: flex;
124
- align-items: center;
125
- justify-content: center
126
- }
127
-
128
- .item-title {
129
- margin-block-start: 0em;
130
- margin-block-end: 0em;
131
- font-size: 14px;
132
- font-weight: bold;
133
- word-wrap: break-word;
134
- padding-left: 5px;
135
- }
136
-
137
- .separator {
138
- background-color: var(--secondaryBGColor);
139
- width: 98%;
140
- margin: 1px auto;
141
- height: 1px;
142
- }
143
-
144
- .text {
145
- padding-left: 10px;
146
- }
147
-
148
- .icon {
149
- display: inline-block;
150
- width: 14px;
151
- height: 14px;
152
- margin-left: .7rem;
153
- border: 1px solid var(--primaryTextColor);
154
- border-radius: 2px;
155
- background: var(--activeButtonBg) 50% 50% no-repeat;
156
- }
157
-
158
- `;
159
- }
160
- }
161
-
162
- customElements.define('viewable-files', Volumes);
@@ -1,54 +0,0 @@
1
- /**
2
- * Displays a console on the document for debugging devices where remote
3
- * debugging is not feasible, and forwards all console.log's to be displayed
4
- * on screen.
5
- */
6
- export class DebugConsole {
7
- constructor() {
8
- /** How many times we've seen the same line in a row */
9
- this.currentRun = 0;
10
- }
11
-
12
- init() {
13
- this.$log = $(`<div id="_debugLog" style="width: 100%; height: 300px; overflow: auto" />`);
14
- $(document.body).prepend(this.$log);
15
-
16
- this.$form = $(`
17
- <form>
18
- <input style="width:100%; font-family: monospace;" id="_debugLogInput">
19
- </form>`);
20
- this.$log.append(this.$form);
21
-
22
- this.$form.submit(ev => {
23
- ev.preventDefault();
24
- const result = eval(this.$form.find('input').val());
25
- this.logToScreen([result]);
26
- });
27
-
28
- const _realLog = console.log.bind(console);
29
- console.log = (...args) => {
30
- _realLog(...args);
31
- this.logToScreen(args);
32
- }
33
-
34
- window.onerror = (...args) => this.logToScreen(args);
35
- }
36
-
37
- /**
38
- * Log the provided array onto the on screen console
39
- * @param {Array} args
40
- */
41
- logToScreen(args) {
42
- const html = args.map(JSON.stringify).join(',');
43
- const $lastEntry = this.$log.children('.log-entry:last-child')
44
- if ($lastEntry.find('.entry-code').html() == html) {
45
- $lastEntry.find('.count').text(`(${++this.currentRun})`);
46
- } else {
47
- this.currentRun = 1;
48
- this.$log.append($(`
49
- <div class="log-entry">
50
- <code class="count"></code> <code class="entry-code">${html}</code>
51
- </div>`));
52
- }
53
- }
54
- }
@@ -1,112 +0,0 @@
1
- /**
2
- * BookReaderTemplate to load BookNavigator components
3
- */
4
-
5
- import { LitElement, html, css } from 'lit-element';
6
-
7
- import '../ItemNavigator/ItemNavigator.js'
8
- import '../BookNavigator/BookNavigator.js'
9
-
10
- export class BookReader extends LitElement {
11
- static get properties() {
12
- return {
13
- base64Json: { type: String },
14
- baseHost: { type: String },
15
- };
16
- }
17
-
18
- constructor() {
19
- super();
20
- this.base64Json = '';
21
- this.baseHost = 'https://archive.org';
22
- }
23
-
24
- firstUpdated() {
25
- this.fetchData();
26
- }
27
-
28
- /**
29
- * Fetch metadata response from public metadata API
30
- * convert response to base64 data
31
- * set base64 data to props
32
- */
33
- async fetchData() {
34
- const ocaid = new URLSearchParams(location.search).get('ocaid');
35
- const response = await fetch(`${this.baseHost}/metadata/${ocaid}`);
36
- const bookMetadata = await response.json();
37
- const jsonBtoa = btoa(JSON.stringify(bookMetadata));
38
- this.setBaseJSON(jsonBtoa);
39
- }
40
-
41
- /**
42
- * Set base64 data to prop
43
- * @param {string} value - base64 string format
44
- */
45
- setBaseJSON(value) {
46
- this.base64Json = value;
47
- }
48
-
49
- render() {
50
- return html`
51
- <div class="ia-bookreader">
52
- <item-navigator
53
- itemType="bookreader"
54
- basehost=${this.baseHost}
55
- item=${this.base64Json}>
56
- <div slot="bookreader">
57
- <slot name="bookreader"></slot>
58
- </div>
59
- </item-navigator>
60
- </div>
61
- `;
62
- }
63
-
64
- static get styles() {
65
- return css`
66
- :host {
67
- display: block;
68
- --primaryBGColor: var(--black, #000);
69
- --secondaryBGColor: #222;
70
- --tertiaryBGColor: #333;
71
- --primaryTextColor: var(--white, #fff);
72
- --primaryCTAFill: #194880;
73
- --primaryCTABorder: #c5d1df;
74
- --secondaryCTAFill: #333;
75
- --secondaryCTABorder: #999;
76
- --primaryErrorCTAFill: #e51c26;
77
- --primaryErrorCTABorder: #f8c6c8;
78
- }
79
-
80
- .ia-bookreader {
81
- background-color: var(--primaryBGColor);
82
- position: relative;
83
- height: auto;
84
- }
85
-
86
- item-navigator {
87
- display: block;
88
- width: 100%;
89
- color: var(--primaryTextColor);
90
- --menuButtonLabelDisplay: block;
91
- --menuWidth: 320px;
92
- --menuSliderBg: var(--secondaryBGColor);
93
- --activeButtonBg: var(--tertiaryBGColor);
94
- --subpanelRightBorderColor: var(--secondaryCTABorder);
95
- --animationTiming: 100ms;
96
- --iconFillColor: var(--primaryTextColor);
97
- --iconStrokeColor: var(--primaryTextColor);
98
- --menuSliderHeaderIconHeight: 2rem;
99
- --menuSliderHeaderIconWidth: 2rem;
100
- --iconWidth: 2.4rem;
101
- --iconHeight: 2.4rem;
102
- --shareLinkColor: var(--primaryTextColor);
103
- --shareIconBorder: var(--primaryTextColor);
104
- --shareIconBg: var(--secondaryBGColor);
105
- --activityIndicatorLoadingDotColor: var(--primaryTextColor);
106
- --activityIndicatorLoadingRingColor: var(--primaryTextColor);
107
- }
108
- `;
109
- }
110
- }
111
-
112
- window.customElements.define("ia-bookreader", BookReader);