@internetarchive/bookreader 5.0.0-8 → 5.0.0-80

Sign up to get free protection for your applications and to get access to all the features.
Files changed (313) hide show
  1. package/.eslintrc.js +17 -15
  2. package/.github/workflows/node.js.yml +73 -10
  3. package/.github/workflows/npm-publish.yml +6 -20
  4. package/.testcaferc.js +10 -0
  5. package/BookReader/BookReader.css +398 -1133
  6. package/BookReader/BookReader.js +1 -1
  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 -1
  13. package/BookReader/icons/2up.svg +1 -1
  14. package/BookReader/icons/advance.svg +1 -1
  15. package/BookReader/icons/chevron-right.svg +1 -1
  16. package/BookReader/icons/close-circle-dark.svg +1 -1
  17. package/BookReader/icons/close-circle.svg +1 -1
  18. package/BookReader/icons/fullscreen.svg +1 -1
  19. package/BookReader/icons/fullscreen_exit.svg +1 -1
  20. package/BookReader/icons/hamburger.svg +1 -1
  21. package/BookReader/icons/left-arrow.svg +1 -1
  22. package/BookReader/icons/magnify-minus.svg +1 -1
  23. package/BookReader/icons/magnify-plus.svg +1 -1
  24. package/BookReader/icons/magnify.svg +1 -1
  25. package/BookReader/icons/pause.svg +1 -1
  26. package/BookReader/icons/play.svg +1 -1
  27. package/BookReader/icons/playback-speed.svg +1 -1
  28. package/BookReader/icons/read-aloud.svg +1 -1
  29. package/BookReader/icons/review.svg +1 -1
  30. package/BookReader/icons/thumbnails.svg +1 -1
  31. package/BookReader/icons/voice.svg +1 -0
  32. package/BookReader/icons/volume-full.svg +1 -1
  33. package/BookReader/images/BRicons.svg +3 -3
  34. package/BookReader/images/books_graphic.svg +1 -1
  35. package/BookReader/images/icon_book.svg +1 -1
  36. package/BookReader/images/icon_bookmark.svg +1 -1
  37. package/BookReader/images/icon_gear.svg +1 -1
  38. package/BookReader/images/icon_hamburger.svg +1 -1
  39. package/BookReader/images/icon_home.svg +1 -1
  40. package/BookReader/images/icon_info.svg +1 -1
  41. package/BookReader/images/icon_one_page.svg +1 -1
  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 -1
  45. package/BookReader/images/icon_search_button.svg +1 -1
  46. package/BookReader/images/icon_share.svg +1 -1
  47. package/BookReader/images/icon_skip-ahead.svg +1 -1
  48. package/BookReader/images/icon_skip-back.svg +1 -1
  49. package/BookReader/images/icon_speaker.svg +1 -1
  50. package/BookReader/images/icon_speaker_open.svg +1 -1
  51. package/BookReader/images/icon_thumbnails.svg +1 -1
  52. package/BookReader/images/icon_toc.svg +1 -1
  53. package/BookReader/images/icon_two_pages.svg +1 -1
  54. package/BookReader/images/marker_chap-off.svg +1 -1
  55. package/BookReader/images/marker_chap-on.svg +1 -1
  56. package/BookReader/images/marker_srch-on.svg +1 -1
  57. package/BookReader/jquery-3.js +2 -0
  58. package/BookReader/jquery-3.js.LICENSE.txt +24 -0
  59. package/BookReader/plugins/plugin.archive_analytics.js +1 -1
  60. package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
  61. package/BookReader/plugins/plugin.autoplay.js +1 -1
  62. package/BookReader/plugins/plugin.autoplay.js.map +1 -1
  63. package/BookReader/plugins/plugin.chapters.js +25 -1
  64. package/BookReader/plugins/plugin.chapters.js.LICENSE.txt +1 -0
  65. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  66. package/BookReader/plugins/plugin.iframe.js +1 -1
  67. package/BookReader/plugins/plugin.iframe.js.map +1 -1
  68. package/BookReader/plugins/plugin.iiif.js +2 -0
  69. package/BookReader/plugins/plugin.iiif.js.map +1 -0
  70. package/BookReader/plugins/plugin.resume.js +1 -1
  71. package/BookReader/plugins/plugin.resume.js.map +1 -1
  72. package/BookReader/plugins/plugin.search.js +2 -1
  73. package/BookReader/plugins/plugin.search.js.LICENSE.txt +1 -0
  74. package/BookReader/plugins/plugin.search.js.map +1 -1
  75. package/BookReader/plugins/plugin.text_selection.js +2 -1
  76. package/BookReader/plugins/plugin.text_selection.js.LICENSE.txt +1 -0
  77. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  78. package/BookReader/plugins/plugin.tts.js +1 -1
  79. package/BookReader/plugins/plugin.tts.js.LICENSE.txt +2 -0
  80. package/BookReader/plugins/plugin.tts.js.map +1 -1
  81. package/BookReader/plugins/plugin.url.js +1 -1
  82. package/BookReader/plugins/plugin.url.js.map +1 -1
  83. package/BookReader/plugins/plugin.vendor-fullscreen.js +1 -1
  84. package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
  85. package/BookReader/webcomponents-bundle.js +3 -0
  86. package/BookReader/webcomponents-bundle.js.LICENSE.txt +9 -0
  87. package/BookReader/webcomponents-bundle.js.map +1 -0
  88. package/BookReaderDemo/BookReaderDemo.css +18 -19
  89. package/BookReaderDemo/BookReaderJSAdvanced.js +0 -3
  90. package/BookReaderDemo/BookReaderJSAutoplay.js +4 -1
  91. package/BookReaderDemo/BookReaderJSSimple.js +1 -0
  92. package/BookReaderDemo/IADemoBr.js +147 -0
  93. package/BookReaderDemo/demo-advanced.html +2 -2
  94. package/BookReaderDemo/demo-autoplay.html +2 -3
  95. package/BookReaderDemo/demo-embed-iframe-src.html +2 -1
  96. package/BookReaderDemo/demo-fullscreen-mobile.html +3 -5
  97. package/BookReaderDemo/demo-fullscreen.html +2 -4
  98. package/BookReaderDemo/demo-iiif.html +99 -12
  99. package/BookReaderDemo/demo-internetarchive.html +214 -18
  100. package/BookReaderDemo/demo-multiple.html +2 -1
  101. package/BookReaderDemo/demo-preview-pages.html +2 -1
  102. package/BookReaderDemo/demo-simple.html +2 -1
  103. package/BookReaderDemo/demo-vendor-fullscreen.html +2 -4
  104. package/BookReaderDemo/ia-multiple-volumes-manifest.js +170 -0
  105. package/BookReaderDemo/immersion-1up.html +2 -2
  106. package/BookReaderDemo/immersion-mode.html +2 -4
  107. package/BookReaderDemo/toggle_controls.html +3 -2
  108. package/BookReaderDemo/view_mode.html +2 -1
  109. package/BookReaderDemo/viewmode-cycle.html +2 -3
  110. package/CHANGELOG.md +536 -33
  111. package/README.md +14 -1
  112. package/babel.config.js +20 -0
  113. package/codecov.yml +6 -0
  114. package/index.html +4 -1
  115. package/jsconfig.json +19 -0
  116. package/netlify.toml +9 -0
  117. package/package.json +70 -60
  118. package/renovate.json +52 -0
  119. package/scripts/preversion.js +0 -1
  120. package/src/BookNavigator/assets/bookmark-colors.js +1 -1
  121. package/src/BookNavigator/assets/button-base.js +4 -2
  122. package/src/BookNavigator/assets/ia-logo.js +17 -0
  123. package/src/BookNavigator/assets/icon_checkmark.js +1 -1
  124. package/src/BookNavigator/assets/icon_close.js +1 -1
  125. package/src/BookNavigator/book-navigator.js +590 -0
  126. package/src/BookNavigator/bookmarks/bookmark-button.js +3 -2
  127. package/src/BookNavigator/bookmarks/bookmark-edit.js +3 -4
  128. package/src/BookNavigator/bookmarks/bookmarks-list.js +2 -3
  129. package/src/BookNavigator/bookmarks/bookmarks-loginCTA.js +3 -8
  130. package/src/BookNavigator/bookmarks/bookmarks-provider.js +27 -17
  131. package/src/BookNavigator/bookmarks/ia-bookmarks.js +116 -67
  132. package/src/BookNavigator/delete-modal-actions.js +1 -1
  133. package/src/BookNavigator/downloads/downloads-provider.js +36 -21
  134. package/src/BookNavigator/downloads/downloads.js +41 -25
  135. package/src/BookNavigator/search/search-provider.js +49 -27
  136. package/src/BookNavigator/search/search-results.js +23 -9
  137. package/src/BookNavigator/sharing.js +27 -0
  138. package/src/BookNavigator/viewable-files.js +95 -0
  139. package/src/BookNavigator/visual-adjustments/visual-adjustments-provider.js +11 -10
  140. package/src/BookNavigator/visual-adjustments/visual-adjustments.js +3 -3
  141. package/src/BookReader/BookModel.js +64 -34
  142. package/src/BookReader/DragScrollable.js +233 -0
  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 +776 -0
  147. package/src/BookReader/ModeCoordinateSpace.js +29 -0
  148. package/src/BookReader/ModeSmoothZoom.js +312 -0
  149. package/src/BookReader/ModeThumb.js +18 -12
  150. package/src/BookReader/Navbar/Navbar.js +14 -40
  151. package/src/BookReader/PageContainer.js +81 -6
  152. package/src/BookReader/ReduceSet.js +1 -1
  153. package/src/BookReader/Toolbar/Toolbar.js +10 -37
  154. package/src/BookReader/events.js +2 -3
  155. package/src/BookReader/options.js +27 -2
  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.js +118 -13
  160. package/src/BookReader.js +427 -1061
  161. package/src/assets/icons/magnify-minus.svg +3 -7
  162. package/src/assets/icons/magnify-plus.svg +3 -7
  163. package/src/assets/icons/voice.svg +1 -0
  164. package/src/css/BookReader.scss +1 -5
  165. package/src/css/_BRBookmarks.scss +1 -1
  166. package/src/css/_BRComponent.scss +1 -1
  167. package/src/css/_BRmain.scss +16 -3
  168. package/src/css/_BRnav.scss +12 -39
  169. package/src/css/_BRpages.scss +149 -40
  170. package/src/css/_BRsearch.scss +68 -25
  171. package/src/css/_BRtoolbar.scss +5 -5
  172. package/src/css/_TextSelection.scss +87 -27
  173. package/src/css/_colorbox.scss +2 -2
  174. package/src/css/_controls.scss +20 -7
  175. package/src/css/_icons.scss +1 -1
  176. package/src/ia-bookreader/ia-bookreader.js +224 -0
  177. package/src/plugins/plugin.archive_analytics.js +3 -3
  178. package/src/plugins/plugin.autoplay.js +5 -11
  179. package/src/plugins/plugin.chapters.js +237 -191
  180. package/src/plugins/plugin.iiif.js +151 -0
  181. package/src/plugins/plugin.resume.js +3 -3
  182. package/src/plugins/plugin.text_selection.js +464 -134
  183. package/src/plugins/plugin.vendor-fullscreen.js +4 -4
  184. package/src/plugins/search/plugin.search.js +142 -125
  185. package/src/plugins/search/utils.js +43 -0
  186. package/src/plugins/search/view.js +33 -58
  187. package/src/plugins/tts/AbstractTTSEngine.js +71 -40
  188. package/src/plugins/tts/FestivalTTSEngine.js +13 -14
  189. package/src/plugins/tts/PageChunk.js +15 -21
  190. package/src/plugins/tts/PageChunkIterator.js +8 -12
  191. package/src/plugins/tts/WebTTSEngine.js +87 -71
  192. package/src/plugins/tts/plugin.tts.js +96 -127
  193. package/src/plugins/tts/utils.js +15 -25
  194. package/src/plugins/url/UrlPlugin.js +191 -0
  195. package/src/plugins/{plugin.url.js → url/plugin.url.js} +45 -16
  196. package/src/util/browserSniffing.js +22 -0
  197. package/src/util/docCookies.js +21 -2
  198. package/tests/e2e/README.md +37 -0
  199. package/tests/e2e/autoplay.test.js +2 -2
  200. package/tests/e2e/base.test.js +8 -16
  201. package/tests/e2e/helpers/base.js +53 -48
  202. package/tests/e2e/helpers/debug.js +1 -1
  203. package/tests/e2e/helpers/params.js +17 -0
  204. package/tests/e2e/helpers/rightToLeft.js +8 -14
  205. package/tests/e2e/helpers/search.js +73 -0
  206. package/tests/e2e/models/Navigation.js +20 -37
  207. package/tests/e2e/rightToLeft.test.js +4 -5
  208. package/tests/e2e/viewmode.test.js +40 -33
  209. package/tests/jest/BookNavigator/book-navigator.test.js +661 -0
  210. package/tests/jest/BookNavigator/bookmarks/bookmark-button.test.js +43 -0
  211. package/tests/{karma → jest}/BookNavigator/bookmarks/bookmark-edit.test.js +25 -26
  212. package/tests/{karma → jest}/BookNavigator/bookmarks/bookmarks-list.test.js +41 -42
  213. package/tests/jest/BookNavigator/bookmarks/ia-bookmarks.test.js +45 -0
  214. package/tests/jest/BookNavigator/downloads/downloads-provider.test.js +67 -0
  215. package/tests/jest/BookNavigator/downloads/downloads.test.js +53 -0
  216. package/tests/jest/BookNavigator/search/search-provider.test.js +167 -0
  217. package/tests/{karma → jest}/BookNavigator/search/search-results.test.js +109 -60
  218. package/tests/jest/BookNavigator/sharing/sharing-provider.test.js +49 -0
  219. package/tests/jest/BookNavigator/viewable-files/viewable-files-provider.test.js +80 -0
  220. package/tests/jest/BookNavigator/visual-adjustments.test.js +200 -0
  221. package/tests/{BookReader → jest/BookReader}/BookModel.test.js +74 -14
  222. package/tests/jest/BookReader/BookReaderPublicFunctions.test.js +193 -0
  223. package/tests/{BookReader → jest/BookReader}/ImageCache.test.js +4 -4
  224. package/tests/jest/BookReader/Mode1UpLit.test.js +73 -0
  225. package/tests/jest/BookReader/Mode2Up.test.js +98 -0
  226. package/tests/jest/BookReader/Mode2UpLit.test.js +190 -0
  227. package/tests/jest/BookReader/ModeCoordinateSpace.test.js +16 -0
  228. package/tests/jest/BookReader/ModeSmoothZoom.test.js +218 -0
  229. package/tests/jest/BookReader/ModeThumb.test.js +71 -0
  230. package/tests/{BookReader → jest/BookReader}/Navbar/Navbar.test.js +10 -10
  231. package/tests/{BookReader → jest/BookReader}/PageContainer.test.js +88 -6
  232. package/tests/{BookReader → jest/BookReader}/ReduceSet.test.js +1 -1
  233. package/tests/{BookReader → jest/BookReader}/Toolbar/Toolbar.test.js +2 -2
  234. package/tests/jest/BookReader/utils/HTMLDimensionsCacher.test.js +59 -0
  235. package/tests/jest/BookReader/utils/ScrollClassAdder.test.js +49 -0
  236. package/tests/jest/BookReader/utils/SelectionObserver.test.js +57 -0
  237. package/tests/{BookReader → jest/BookReader}/utils/classes.test.js +1 -1
  238. package/tests/jest/BookReader/utils.test.js +229 -0
  239. package/tests/jest/BookReader.keyboard.test.js +190 -0
  240. package/tests/{BookReader.options.test.js → jest/BookReader.options.test.js} +9 -1
  241. package/tests/{BookReader.test.js → jest/BookReader.test.js} +26 -37
  242. package/tests/{plugins → jest/plugins}/plugin.archive_analytics.test.js +2 -2
  243. package/tests/{plugins → jest/plugins}/plugin.autoplay.test.js +4 -4
  244. package/tests/jest/plugins/plugin.chapters.test.js +195 -0
  245. package/tests/{plugins → jest/plugins}/plugin.iframe.test.js +2 -2
  246. package/tests/{plugins → jest/plugins}/plugin.resume.test.js +3 -3
  247. package/tests/jest/plugins/plugin.text_selection.test.js +317 -0
  248. package/tests/{plugins → jest/plugins}/plugin.vendor-fullscreen.test.js +2 -2
  249. package/tests/{plugins → jest/plugins}/search/plugin.search.test.js +25 -47
  250. package/tests/{plugins → jest/plugins}/search/plugin.search.view.test.js +39 -6
  251. package/tests/jest/plugins/search/utils.js +25 -0
  252. package/tests/jest/plugins/search/utils.test.js +29 -0
  253. package/tests/{plugins → jest/plugins}/tts/AbstractTTSEngine.test.js +29 -9
  254. package/tests/{plugins → jest/plugins}/tts/FestivalTTSEngine.test.js +4 -4
  255. package/tests/{plugins → jest/plugins}/tts/PageChunk.test.js +1 -1
  256. package/tests/{plugins → jest/plugins}/tts/PageChunkIterator.test.js +3 -3
  257. package/tests/{plugins → jest/plugins}/tts/WebTTSEngine.test.js +47 -1
  258. package/tests/{plugins → jest/plugins}/tts/utils.test.js +1 -60
  259. package/tests/jest/plugins/url/UrlPlugin.test.js +198 -0
  260. package/tests/{plugins → jest/plugins/url}/plugin.url.test.js +53 -14
  261. package/tests/jest/setup.js +3 -0
  262. package/tests/{util → jest/util}/browserSniffing.test.js +1 -1
  263. package/tests/jest/util/docCookies.test.js +24 -0
  264. package/tests/{util → jest/util}/strings.test.js +1 -1
  265. package/tests/{utils.js → jest/utils.js} +38 -0
  266. package/webpack.config.js +12 -6
  267. package/.babelrc +0 -12
  268. package/.dependabot/config.yml +0 -6
  269. package/.testcaferc.json +0 -5
  270. package/BookReader/bookreader-component-bundle.js +0 -1450
  271. package/BookReader/bookreader-component-bundle.js.LICENSE.txt +0 -38
  272. package/BookReader/bookreader-component-bundle.js.map +0 -1
  273. package/BookReader/jquery-1.10.1.js +0 -2
  274. package/BookReader/jquery-1.10.1.js.LICENSE.txt +0 -24
  275. package/BookReader/plugins/plugin.menu_toggle.js +0 -2
  276. package/BookReader/plugins/plugin.menu_toggle.js.map +0 -1
  277. package/BookReader/plugins/plugin.mobile_nav.js +0 -2
  278. package/BookReader/plugins/plugin.mobile_nav.js.map +0 -1
  279. package/BookReaderDemo/IIIFBookReader.js +0 -207
  280. package/BookReaderDemo/bookreader-template-bundle.js +0 -7178
  281. package/BookReaderDemo/demo-iiif.js +0 -26
  282. package/BookReaderDemo/demo-plugin-menu-toggle.html +0 -34
  283. package/karma.conf.js +0 -23
  284. package/src/BookNavigator/BookModel.js +0 -14
  285. package/src/BookNavigator/BookNavigator.js +0 -446
  286. package/src/BookNavigator/assets/book-loader.js +0 -27
  287. package/src/BookNavigator/br-fullscreen-mgr.js +0 -83
  288. package/src/BookNavigator/search/a-search-result.js +0 -55
  289. package/src/BookReader/DebugConsole.js +0 -54
  290. package/src/BookReaderComponent/BookReaderComponent.js +0 -112
  291. package/src/ItemNavigator/ItemNavigator.js +0 -376
  292. package/src/ItemNavigator/providers/sharing.js +0 -29
  293. package/src/css/_MobileNav.scss +0 -194
  294. package/src/dragscrollable-br.js +0 -261
  295. package/src/lit-wrapper.js +0 -2
  296. package/src/plugins/menu_toggle/plugin.menu_toggle.js +0 -324
  297. package/src/plugins/plugin.mobile_nav.js +0 -287
  298. package/tests/BookReader/BookReaderPublicFunctions.test.js +0 -171
  299. package/tests/BookReader/DebugConsole.test.js +0 -25
  300. package/tests/BookReader/Mode1Up.test.js +0 -164
  301. package/tests/BookReader/Mode2Up.test.js +0 -247
  302. package/tests/BookReader/utils.test.js +0 -109
  303. package/tests/e2e/helpers/desktopSearch.js +0 -72
  304. package/tests/e2e/helpers/mobileSearch.js +0 -85
  305. package/tests/e2e/ia-production/ia-prod-base.js +0 -17
  306. package/tests/karma/BookNavigator/book-navigator.test.js +0 -132
  307. package/tests/karma/BookNavigator/search/search-provider.test.js +0 -23
  308. package/tests/karma/BookNavigator/visual-adjustments.test.js +0 -201
  309. package/tests/plugins/menu_toggle/plugin.menu_toggle.test.js +0 -68
  310. package/tests/plugins/plugin.chapters.test.js +0 -130
  311. package/tests/plugins/plugin.mobile_nav.test.js +0 -66
  312. package/tests/plugins/plugin.text_selection.test.js +0 -203
  313. package/tests/util/docCookies.test.js +0 -15
@@ -7,8 +7,14 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
8
8
  <meta name="apple-mobile-web-app-capable" content="yes">
9
9
 
10
+ <!-- WC dependencies -->
11
+ <script type="text/javascript" src="https://polyfill.io/v3/polyfill.min.js?features=es2015%2Ces5%2CglobalThis"></script>
12
+ <script type="text/javascript" src="https://unpkg.com/lit@2.1.2/polyfill-support.js"></script>
13
+ <script type="text/javascript" src="https://unpkg.com/@webcomponents/webcomponentsjs@2.2.10/webcomponents-bundle.js"></script>
14
+
10
15
  <!-- JS dependencies -->
11
- <script src="../BookReader/jquery-1.10.1.js"></script>
16
+ <script src="../BookReader/webcomponents-bundle.js"></script>
17
+ <script src="../BookReader/jquery-3.js"></script>
12
18
 
13
19
 
14
20
  <!-- Bookreader -->
@@ -25,17 +31,21 @@
25
31
  <script src="../BookReader/plugins/plugin.archive_analytics.js"></script>
26
32
  <script src="../BookReader/plugins/plugin.text_selection.js"></script>
27
33
 
28
- <script type="module" src="../BookReader/bookreader-component-bundle.js"></script>
34
+ <script type="module" src="../BookReader/ia-bookreader-bundle.js"></script>
29
35
 
30
36
  <link rel="stylesheet" href="BookReaderDemo.css"/>
31
- </head>
37
+
38
+ <!-- IA scripts -->
39
+ <script src="https://archive.org/bookreader/BookReaderJSIA.js"></script>
40
+
41
+ </head>
32
42
 
33
43
  <body>
34
- <section style="width: 100%; overflow: hidden; background-color: black;">
44
+ <section class="theater" style="width: 100%; overflow: hidden; background-color: black;">
35
45
  <ia-bookreader
36
- baseHost="https://archive.org"
46
+ baseHost="archive.org"
37
47
  >
38
- <div id="IABookReaderWrapper" slot="bookreader">
48
+ <div id="IABookReaderWrapper" slot="main">
39
49
  <div id="BookReader" class="BookReader"></div>
40
50
  </div>
41
51
  <div>
@@ -50,25 +60,211 @@
50
60
  </div>
51
61
  </ia-bookreader>
52
62
  </section>
53
- <section style="height: 800px; width: 200px;">
54
- <p>placeholder div to allow scrolling</p>
63
+ <style>
64
+ .demos {
65
+ height: 800px;
66
+ width: inherit;
67
+ padding: 10px;
68
+ }
69
+ .demo {
70
+ border: 1px solid white;
71
+ padding: 10px;
72
+ }
73
+ </style>
74
+ <section class="demos">
75
+ <details class="demo">
76
+ <summary>Test books</summary>
77
+ <ul>
78
+ <li>
79
+ Misc English book
80
+ <ul>
81
+ <li>
82
+ <a href="/BookReaderDemo/demo-internetarchive.html?ocaid=countofmontecris00duma_7">
83
+ <i>The Count of Monte-Cristo</i> by Alexandre Dumas
84
+ </a>
85
+ </li>
86
+ <li>
87
+ <a href="/BookReaderDemo/demo-internetarchive.html?ocaid=driitaleofdaring00bachuoft">
88
+ <i>D’ri and I</i> by Irving Bacheller
89
+ </a>
90
+ </li>
91
+ </ul>
92
+ </li>
93
+ <li>
94
+ Misc non-English book (<a href="https://archive.org/search?query=%21language%3Aeng&sort=-week&and%5B%5D=lending%3A%22is_readable%22&and%5B%5D=mediatype%3A%22texts%22">Search for more</a>)
95
+ <ul>
96
+ <li>
97
+ French: <a href="/BookReaderDemo/demo-internetarchive.html?ocaid=lecomtedemontecr01dumauoft">
98
+ <i>Le Comte de Monte-Cristo</i> by Alexandre Dumas
99
+ </a>
100
+ </li>
101
+ </ul>
102
+ </li>
103
+ <li>
104
+ Right-to-left book (<a href="https://archive.org/search?query=page-progression%3Arl&sort=-week&and%5B%5D=lending%3A%22is_readable%22&and%5B%5D=mediatype%3A%22texts%22">Search for more</a>)
105
+ <ul>
106
+ <li>
107
+ <a href="/BookReaderDemo/demo-internetarchive.html?ocaid=gendaitankashu00meijuoft">
108
+ <i>Gendai tanka shu</i> by Meiji, Emperor of Japan
109
+ </a>
110
+ </li>
111
+ </ul>
112
+ </li>
113
+ <li>
114
+ Newspaper with columns
115
+ <ul>
116
+ <li>
117
+ <a href="/BookReaderDemo/demo-internetarchive.html?ocaid=Crusader-Vol_28_Nos_1-20_Sept_1986-April_1987">
118
+ Crusader-Vol_28_Nos_1-20_Sept_1986-April_1987
119
+ </a>
120
+ </li>
121
+ </ul>
122
+ </li>
123
+ <li>
124
+ Text Selection
125
+ <ul>
126
+ <li>
127
+ OCR with spaces inside each <code>&lt;WORD&gt;</code> element
128
+ <ul>
129
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=theworksofplato01platiala">
130
+ <i>The Works of Plato</i> by Plato
131
+ </a></li>
132
+ </ul>
133
+ </li>
134
+ <li>
135
+ Weird font-sizes/indents
136
+ <ul>
137
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=cihm_58393#page/n3">
138
+ Microfilm poster thing
139
+ </a></li>
140
+ </ul>
141
+ </li>
142
+ <li>
143
+ Book with short lines
144
+ <ul>
145
+ <li>
146
+ <a href="/BookReaderDemo/demo-internetarchive.html?ocaid=countofmontecris00duma_7#page/261/mode/2up">
147
+ <i>The Count of Monte-Cristo</i>, p.261, second last line
148
+ </a>
149
+ </li>
150
+ </ul>
151
+ </li>
152
+ <li>
153
+ Book with double-spaced lines
154
+ <ul>
155
+ <li>
156
+ <a href="/BookReaderDemo/demo-internetarchive.html?ocaid=calnevpipelineex02unit#page/n93/mode/2up">
157
+ calnevpipelineex02unit
158
+ </a>
159
+ </li>
160
+ </ul>
161
+ </li>
162
+ </ul>
163
+ </li>
164
+ <li>
165
+ Chapters
166
+ <ul>
167
+ <li>
168
+ Normal book with chapters
169
+ <ul>
170
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=adventureofsherl0000unse">
171
+ <i>The Adventures of Sherlock Holmes</i> by Arthur Conan Doyle
172
+ </a></li>
173
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=jalna00dela">
174
+ <i>Jalna</i> by Mazo de la Roche
175
+ </a></li>
176
+ </ul>
177
+ </li>
178
+ <li>
179
+ Book preview
180
+ <ul>
181
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=peoplewareproduc00dema_0">
182
+ <i>Peopleware</i> by Tom DeMarco and Timothy Lister
183
+ </a></li>
184
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=passionforbooksb00rabi">
185
+ <i>A Passion for Books</i>
186
+ </a></li>
187
+ </ul>
188
+ </li>
189
+ <li>
190
+ Book with levelled chapters
191
+ <ul>
192
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=notredamedepar01hugo">
193
+ <i>Notre-Dame de Paris: Tome Premier</i> par Victor Hugo
194
+ </a></li>
195
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=alanturingenigma0000hodg">
196
+ <i>Alan Turing: The Enigma</i> by Andrew Hodges
197
+ </a></li>
198
+ </ul>
199
+ </li>
200
+ </ul>
201
+ </li>
202
+ </ul>
203
+ </details>
204
+ <div class="demo">
205
+ <button id="toggle-loggedin">Toggle Logged in view</button>
206
+ <p>Features behind signed in gate: Bookmarks</p>
207
+ <p>Logged In Status: <span id="logged-in-status">Logged Out</span></p>
208
+ </div>
209
+ <div class="demo">
210
+ <button id="show-lcp">LCP Download option</button>
211
+ </div>
212
+ <div class="demo">
213
+ <button id="multi-volume">Multiple books</button>
214
+ </div>
215
+ <div class="demo">
216
+ <button id="start-fs">Start at Fullscreen</button>
217
+ </div>
218
+ <div class="demo">
219
+ <h3 id="placeholder">please wait as we are fetching the following: </h3>
220
+ <input type='checkbox' class='group1' name='itemMD' disabled>Item metadata</input><br>
221
+ <input type='checkbox' class='group1' name='bookManifest' disabled> Book manifest</input><br>
222
+ </div>
55
223
  </section>
224
+ <div class="demo">
225
+ <h3>Placeholder div to allow scrolling</h3>
226
+ </div>
56
227
 
228
+ <!-- Certain features, like Bookmarks, use modal-manager to draw their interface -->
229
+ <modal-manager></modal-manager>
230
+ <script >
231
+ // Set up demo things
232
+ const iaBR = document.querySelector('ia-bookreader');
233
+ const toggleLoginBtn = document.querySelector('#toggle-loggedin');
234
+ toggleLoginBtn.addEventListener('click', () => {
235
+ const currLoggedIn = iaBR.signedIn;
236
+ iaBR.signedIn = !currLoggedIn;
57
237
 
58
- <script id="pageUrl" type="text/javascript"></script>
59
-
60
- <script>
61
- var ocaid = location.href.match(/ocaid=([^&#]+)/i)[1];
238
+ document.querySelector('#logged-in-status').innerText = iaBR.signedIn ? 'Logged In' : 'Logged Out';
239
+ console.log("Toggled SignedIn state", iaBR.signedIn, { currLoggedIn })
240
+ });
62
241
 
63
- // Override options coming from IA
64
- BookReader.optionOverrides.imagesBaseURL = '/BookReader/images/';
242
+ const startFSBtn = document.querySelector('#start-fs');
243
+ startFSBtn.addEventListener('click', () => {
244
+ const urlParams = new URLSearchParams(window.location.search);
245
+ if (urlParams.has('view')) {
246
+ const url = new URL(window.location);
247
+ url.searchParams.delete('view');
248
+ window.history.pushState({}, '', url);
249
+ }
250
+ urlParams.set('view', 'theater');
251
+ window.location.search = urlParams.toString();
252
+ });
65
253
 
66
- // Temp; Circumvent bug in BookReaderJSIA code
67
- window.Sentry = null;
254
+ window.addEventListener('BookReader:PostInit', () => {
255
+ const placeholder = document.querySelector('#placeholder');
256
+ placeholder.innerHTML = 'Dependencies are complete, bookreader has loaded';
257
+ });
68
258
 
69
- var script_url = 'https://archive.org/bookreader/BookReaderJSLocate.php?subPrefix=&id=' + ocaid;
70
- document.getElementById('pageUrl').src = script_url;
259
+ // analytics stub
260
+ window.archive_analytics = {
261
+ send_event_no_sampling: (category, action, label) => {}, //console.log('~~~ NO SAMPLE EVENT CALLED: ', { category, action, label }),
262
+ send_event: (category, action, label) => {}, //console.log('~~~ send_event SAMPLE EVENT CALLED: ', { category, action, label }),
263
+ send_ping: (category, action, label) => {}, //console.log('~~~ send_ping SAMPLE EVENT CALLED: ', { category, action, label }),
264
+ }
71
265
  </script>
72
266
 
267
+ <!-- IA fetch demo -->
268
+ <script type="module" src="IADemoBr.js"></script>
73
269
  </body>
74
270
  </html>
@@ -7,7 +7,8 @@
7
7
  <meta name="apple-mobile-web-app-capable" content="yes">
8
8
 
9
9
  <!-- JS dependencies -->
10
- <script src="../BookReader/jquery-1.10.1.js"></script>
10
+ <script src="../BookReader/webcomponents-bundle.js"></script>
11
+ <script src="../BookReader/jquery-3.js"></script>
11
12
 
12
13
 
13
14
  <!-- BookReader and plugins -->
@@ -8,7 +8,8 @@
8
8
  <meta name="apple-mobile-web-app-capable" content="yes">
9
9
 
10
10
  <!-- JS dependencies -->
11
- <script src="../BookReader/jquery-1.10.1.js"></script>
11
+ <script src="../BookReader/webcomponents-bundle.js"></script>
12
+ <script src="../BookReader/jquery-3.js"></script>
12
13
 
13
14
 
14
15
  <!-- BookReader and plugins -->
@@ -7,7 +7,8 @@
7
7
  <meta name="apple-mobile-web-app-capable" content="yes">
8
8
 
9
9
  <!-- JS dependencies -->
10
- <script src="../BookReader/jquery-1.10.1.js"></script>
10
+ <script src="../BookReader/webcomponents-bundle.js"></script>
11
+ <script src="../BookReader/jquery-3.js"></script>
11
12
 
12
13
 
13
14
  <!-- BookReader and plugins -->
@@ -7,16 +7,14 @@
7
7
  <meta name="apple-mobile-web-app-capable" content="yes">
8
8
 
9
9
  <!-- JS dependencies -->
10
- <script src="../BookReader/jquery-1.10.1.js"></script>
10
+ <script src="../BookReader/webcomponents-bundle.js"></script>
11
+ <script src="../BookReader/jquery-3.js"></script>
11
12
 
12
13
 
13
14
  <!-- BookReader and plugins -->
14
15
  <link rel="stylesheet" href="../BookReader/BookReader.css"/>
15
16
  <script src="../BookReader/BookReader.js"></script>
16
17
 
17
- <!-- Mobile nav plugin -->
18
- <script src="../BookReader/plugins/plugin.mobile_nav.js"></script>
19
-
20
18
  <!-- URL-changing plugin -->
21
19
  <script src="../BookReader/plugins/plugin.url.js"></script>
22
20
 
@@ -0,0 +1,170 @@
1
+ /* eslint-disable no-useless-escape */
2
+ const extraVolOptions = {
3
+ "isBeta": false,
4
+ "el": "#BookReader",
5
+ "enableBookTitleLink": false,
6
+ "bookUrlText": null,
7
+ "startFullscreen": false,
8
+ "initialSearchTerm": null,
9
+ "onePage": {
10
+ "autofit": "auto"
11
+ },
12
+ "showToolbar": false,
13
+ "autoResize": false,
14
+ "enableFSLogoShortcut": true,
15
+ "enableBookmarks": true,
16
+ "enableMultipleBooks": true,
17
+ "purchase_url": "",
18
+ "multipleBooksList": {
19
+ "by_subprefix": {
20
+ "book1/GPORFP": {
21
+ "url_path": "/details/SubBookTest",
22
+ "file_subprefix": "book1/GPORFP",
23
+ "title": "book1/GPORFP.pdf",
24
+ "file_source": "/book1/GPORFP_jp2.zip",
25
+ "orig_sort": 0
26
+ },
27
+ "subdir/book2/brewster_kahle_internet_archive": {
28
+ "url_path": "/details/SubBookTest/subdir/book2/brewster_kahle_internet_archive",
29
+ "file_subprefix": "subdir/book2/brewster_kahle_internet_archive",
30
+ "title": "subdir/book2/brewster_kahle_internet_archive.pdf",
31
+ "file_source": "/subdir/book2/brewster_kahle_internet_archive_jp2.zip",
32
+ "orig_sort": 1
33
+ },
34
+ "subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume": {
35
+ "url_path": "/details/SubBookTest/subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume",
36
+ "file_subprefix": "subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume",
37
+ "title": "subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume.pdf",
38
+ "file_source": "/subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume_jp2.zip",
39
+ "orig_sort": 2
40
+ }
41
+ },
42
+ "main_dir": "/2/items/SubBookTest"
43
+ }
44
+ };
45
+ const custvolumesManifest = {
46
+ "data": {
47
+ "streamOnly": false,
48
+ "isRestricted": false,
49
+ "id": "SubBookTest",
50
+ "subPrefix": "book1/GPORFP",
51
+ "olHost": "https://openlibrary.org",
52
+ "bookUrl": "/details/SubBookTest",
53
+ "downloadUrls": [
54
+ [
55
+ "PDF",
56
+ "//archive.org/download/SubBookTest/book1/GPORFP.pdf"
57
+ ],
58
+ [
59
+ "ePub",
60
+ "//archive.org/download/SubBookTest/book1/GPORFP.epub"
61
+ ],
62
+ [
63
+ "Plain Text",
64
+ "//archive.org/download/SubBookTest/book1/GPORFP_djvu.txt"
65
+ ],
66
+ [
67
+ "DAISY",
68
+ "//archive.org/download/SubBookTest/book1/GPORFP_daisy.zip"
69
+ ],
70
+ [
71
+ "Kindle",
72
+ "//archive.org/download/SubBookTest/book1/GPORFP.mobi"
73
+ ]
74
+ ]
75
+ },
76
+ "brOptions": {
77
+ "bookId": "SubBookTest",
78
+ "bookPath": "/2/items/SubBookTest/book1/GPORFP",
79
+ "imageFormat": "jp2",
80
+ "server": "ia800304.us.archive.org",
81
+ "subPrefix": "book1/GPORFP",
82
+ "zip": "/2/items/SubBookTest/book1/GPORFP_jp2.zip",
83
+ "bookTitle": "Test with sub-dirs",
84
+ "ppi": "600",
85
+ "defaultStartLeaf": 0,
86
+ "pageProgression": "lr",
87
+ "vars": {
88
+ "bookId": "SubBookTest",
89
+ "bookPath": "/2/items/SubBookTest/book1/GPORFP",
90
+ "server": "ia800304.us.archive.org",
91
+ "subPrefix": "book1/GPORFP"
92
+ },
93
+ "plugins": {
94
+ "textSelection": {
95
+ "enabled": true,
96
+ "singlePageDjvuXmlUrl": "https://{{server}}/BookReader/BookReaderGetTextWrapper.php?path={{bookPath|urlencode}}_djvu.xml&mode=djvu_xml&page={{pageIndex}}"
97
+ }
98
+ },
99
+ "data": [
100
+ [
101
+ {
102
+ "width": 5213,
103
+ "height": 6566,
104
+ "uri": "https://ia800304.us.archive.org/BookReader/BookReaderImages.php?zip=/2/items/SubBookTest/book1/GPORFP_jp2.zip&file=GPORFP_jp2/GPORFP_0000.jp2&id=SubBookTest",
105
+ "leafNum": 0,
106
+ "uri_2": {
107
+ "link": "https://archive.org/download/SubBookTest/book1/GPORFP_jp2.zip/GPORFP_jp2%2FGPORFP_0000.jp2",
108
+ "base_params": "ext=jpg"
109
+ },
110
+ "pageType": "Title",
111
+ "pageSide": "R"
112
+ }
113
+ ]
114
+ ]
115
+ },
116
+ "lendingInfo": {
117
+ "lendingStatus": null,
118
+ "userid": 0,
119
+ "isAdmin": false,
120
+ "isArchiveOrgLending": false,
121
+ "isOpenLibraryLending": false,
122
+ "isLendingRequired": false,
123
+ "isBrowserBorrowable": false,
124
+ "isPrintDisabledOnly": false,
125
+ "isAvailable": false,
126
+ "isAvailableForBrowsing": false,
127
+ "userHasBorrowed": false,
128
+ "userHasBrowsed": false,
129
+ "userOnWaitingList": false,
130
+ "userHoldIsReady": false,
131
+ "userIsPrintDisabled": false,
132
+ "shouldProtectImages": false,
133
+ "daysLeftOnLoan": 0,
134
+ "secondsLeftOnLoan": 0,
135
+ "loansUrl": "",
136
+ "bookUrl": "",
137
+ "loanCount": 0,
138
+ "totalWaitlistCount": 0,
139
+ "userWaitlistPosition": -1,
140
+ "maxLoans": 10,
141
+ "loanRecord": [
142
+
143
+ ]
144
+ },
145
+ "metadata": {
146
+ "identifier": "SubBookTest",
147
+ "title": "Test with sub-dirs",
148
+ "mediatype": "texts",
149
+ "collection": [
150
+ "opensource",
151
+ "community"
152
+ ],
153
+ "publicdate": "2009-07-08 23:10:10",
154
+ "addeddate": "2009-07-08 23:09:09",
155
+ "uploader": "mang@archive.org",
156
+ "updatedate": "2009-07-08 23:10:24",
157
+ "updater": "mang@archive",
158
+ "language": "English",
159
+ "identifier-access": "http://www.archive.org/details/SubBookTest",
160
+ "identifier-ark": "ark:/13960/t08w3w21h",
161
+ "ppi": "600",
162
+ "ocr": "ABBYY FineReader 8.0",
163
+ "repub_state": "4",
164
+ "noindex": "true",
165
+ "curation": "[curator]validator@archive.org[/curator][date]20140402011645[/date][comment]checked for malware[/comment]",
166
+ "backup_location": "ia903603_14"
167
+ }
168
+ };
169
+
170
+ export { custvolumesManifest, extraVolOptions };
@@ -5,7 +5,8 @@
5
5
  <meta name="apple-mobile-web-app-capable" content="yes">
6
6
 
7
7
  <!-- JS dependencies -->
8
- <script src="../BookReader/jquery-1.10.1.js"></script>
8
+ <script src="../BookReader/webcomponents-bundle.js"></script>
9
+ <script src="../BookReader/jquery-3.js"></script>
9
10
 
10
11
 
11
12
  <!-- Bookreader -->
@@ -13,7 +14,6 @@
13
14
  <link rel="stylesheet" href="../BookReader/BookReader.css"/>
14
15
 
15
16
  <!-- plugins needed for archive.org, in same order as archive.org -->
16
- <script src="../BookReader/plugins/plugin.mobile_nav.js"></script>
17
17
  <script src="../BookReader/plugins/plugin.search.js"></script>
18
18
  <script src="../BookReader/plugins/plugin.chapters.js"></script>
19
19
  <script src="../BookReader/plugins/plugin.tts.js"></script>
@@ -7,16 +7,14 @@
7
7
  <meta name="apple-mobile-web-app-capable" content="yes">
8
8
 
9
9
  <!-- JS dependencies -->
10
- <script src="../BookReader/jquery-1.10.1.js"></script>
10
+ <script src="../BookReader/webcomponents-bundle.js"></script>
11
+ <script src="../BookReader/jquery-3.js"></script>
11
12
 
12
13
 
13
14
  <!-- BookReader and plugins -->
14
15
  <link rel="stylesheet" href="../BookReader/BookReader.css"/>
15
16
  <script src="../BookReader/BookReader.js"></script>
16
17
 
17
- <!-- Mobile nav plugin -->
18
- <script src="../BookReader/plugins/plugin.mobile_nav.js"></script>
19
-
20
18
  <!-- URL-changing plugin -->
21
19
  <script src="../BookReader/plugins/plugin.url.js"></script>
22
20
 
@@ -7,7 +7,8 @@
7
7
  <meta name="apple-mobile-web-app-capable" content="yes">
8
8
 
9
9
  <!-- JS dependencies -->
10
- <script src="../BookReader/jquery-1.10.1.js"></script>
10
+ <script src="../BookReader/webcomponents-bundle.js"></script>
11
+ <script src="../BookReader/jquery-3.js"></script>
11
12
 
12
13
 
13
14
  <!-- BookReader and plugins -->
@@ -39,7 +40,7 @@
39
40
  template: function(br) {
40
41
  return '<button class="BRicon ' + this.className + ' desktop-only js-tooltip" data-param="foo">' +
41
42
  '<div class="icon icon-onepg"></div>' +
42
- '<span class="tooltip">Overridden control</span>' +
43
+ '<span class="BRtooltip">Overridden control</span>' +
43
44
  '</button>';
44
45
  }
45
46
  },
@@ -7,7 +7,8 @@
7
7
  <meta name="apple-mobile-web-app-capable" content="yes">
8
8
 
9
9
  <!-- JS dependencies -->
10
- <script src="../BookReader/jquery-1.10.1.js"></script>
10
+ <script src="../BookReader/webcomponents-bundle.js"></script>
11
+ <script src="../BookReader/jquery-3.js"></script>
11
12
 
12
13
 
13
14
  <!-- BookReader and plugins -->
@@ -7,9 +7,8 @@
7
7
  <meta name="apple-mobile-web-app-capable" content="yes">
8
8
 
9
9
  <!-- JS dependencies -->
10
- <script src="../BookReader/jquery-1.10.1.js"></script>
11
-
12
- <script src="../BookReader/jquery.bt.min.js"></script>
10
+ <script src="../BookReader/webcomponents-bundle.js"></script>
11
+ <script src="../BookReader/jquery-3.js"></script>
13
12
 
14
13
  <!-- BookReader and plugins -->
15
14
  <link rel="stylesheet" href="../BookReader/BookReader.css"/>