@internetarchive/bookreader 5.0.0-6-14 → 5.0.0-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (271) hide show
  1. package/.eslintrc.js +17 -15
  2. package/.github/workflows/node.js.yml +72 -10
  3. package/.github/workflows/npm-publish.yml +6 -20
  4. package/.testcaferc.js +10 -0
  5. package/BookReader/BookReader.css +241 -140
  6. package/BookReader/BookReader.js +1 -1
  7. package/BookReader/BookReader.js.LICENSE.txt +24 -20
  8. package/BookReader/BookReader.js.map +1 -1
  9. package/BookReader/ia-bookreader-bundle.js +1519 -0
  10. package/BookReader/ia-bookreader-bundle.js.LICENSE.txt +17 -0
  11. package/BookReader/ia-bookreader-bundle.js.map +1 -0
  12. package/BookReader/icons/close-circle-dark.svg +1 -0
  13. package/BookReader/icons/magnify-minus.svg +1 -1
  14. package/BookReader/icons/magnify-plus.svg +1 -1
  15. package/BookReader/icons/pause.svg +1 -1
  16. package/BookReader/icons/playback-speed.svg +1 -1
  17. package/BookReader/icons/read-aloud.svg +1 -1
  18. package/BookReader/icons/voice.svg +1 -0
  19. package/BookReader/images/BRicons.svg +2 -2
  20. package/BookReader/images/books_graphic.svg +1 -1
  21. package/BookReader/images/icon_book.svg +1 -1
  22. package/BookReader/images/icon_gear.svg +1 -1
  23. package/BookReader/images/icon_info.svg +1 -1
  24. package/BookReader/images/icon_playback-rate.svg +1 -1
  25. package/BookReader/images/icon_search_button.svg +1 -1
  26. package/BookReader/images/icon_share.svg +1 -1
  27. package/BookReader/images/icon_speaker.svg +1 -1
  28. package/BookReader/images/icon_speaker_open.svg +1 -1
  29. package/BookReader/images/marker_chap-off.svg +1 -1
  30. package/BookReader/images/marker_chap-on.svg +1 -1
  31. package/BookReader/images/marker_srch-on.svg +1 -1
  32. package/BookReader/jquery-3.js +2 -0
  33. package/BookReader/jquery-3.js.LICENSE.txt +24 -0
  34. package/BookReader/plugins/plugin.archive_analytics.js +1 -1
  35. package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
  36. package/BookReader/plugins/plugin.autoplay.js +1 -1
  37. package/BookReader/plugins/plugin.autoplay.js.map +1 -1
  38. package/BookReader/plugins/plugin.chapters.js +1 -1
  39. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  40. package/BookReader/plugins/plugin.iframe.js +1 -1
  41. package/BookReader/plugins/plugin.iframe.js.map +1 -1
  42. package/BookReader/plugins/plugin.mobile_nav.js +1 -1
  43. package/BookReader/plugins/plugin.mobile_nav.js.map +1 -1
  44. package/BookReader/plugins/plugin.resume.js +1 -1
  45. package/BookReader/plugins/plugin.resume.js.map +1 -1
  46. package/BookReader/plugins/plugin.search.js +1 -1
  47. package/BookReader/plugins/plugin.search.js.map +1 -1
  48. package/BookReader/plugins/plugin.text_selection.js +1 -1
  49. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  50. package/BookReader/plugins/plugin.tts.js +1 -1
  51. package/BookReader/plugins/plugin.tts.js.map +1 -1
  52. package/BookReader/plugins/plugin.url.js +1 -1
  53. package/BookReader/plugins/plugin.url.js.map +1 -1
  54. package/BookReader/plugins/plugin.vendor-fullscreen.js +1 -1
  55. package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
  56. package/BookReader/webcomponents-bundle.js +3 -0
  57. package/BookReader/webcomponents-bundle.js.LICENSE.txt +9 -0
  58. package/BookReader/webcomponents-bundle.js.map +1 -0
  59. package/BookReaderDemo/BookReaderDemo.css +14 -1
  60. package/BookReaderDemo/BookReaderJSAutoplay.js +4 -1
  61. package/BookReaderDemo/BookReaderJSSimple.js +1 -0
  62. package/BookReaderDemo/IADemoBr.js +147 -0
  63. package/BookReaderDemo/demo-advanced.html +2 -2
  64. package/BookReaderDemo/demo-autoplay.html +2 -1
  65. package/BookReaderDemo/demo-embed-iframe-src.html +2 -1
  66. package/BookReaderDemo/demo-fullscreen-mobile.html +2 -1
  67. package/BookReaderDemo/demo-fullscreen.html +2 -1
  68. package/BookReaderDemo/demo-iiif.html +2 -1
  69. package/BookReaderDemo/demo-internetarchive.html +84 -17
  70. package/BookReaderDemo/demo-multiple.html +2 -1
  71. package/BookReaderDemo/demo-preview-pages.html +2 -1
  72. package/BookReaderDemo/demo-simple.html +2 -1
  73. package/BookReaderDemo/demo-vendor-fullscreen.html +2 -1
  74. package/BookReaderDemo/ia-multiple-volumes-manifest.js +170 -0
  75. package/BookReaderDemo/immersion-1up.html +2 -1
  76. package/BookReaderDemo/immersion-mode.html +2 -1
  77. package/BookReaderDemo/toggle_controls.html +2 -1
  78. package/BookReaderDemo/view_mode.html +2 -1
  79. package/BookReaderDemo/viewmode-cycle.html +2 -3
  80. package/CHANGELOG.md +244 -0
  81. package/README.md +14 -1
  82. package/babel.config.js +19 -0
  83. package/codecov.yml +6 -0
  84. package/index.html +3 -0
  85. package/jsconfig.json +19 -0
  86. package/netlify.toml +5 -0
  87. package/package.json +70 -59
  88. package/renovate.json +52 -0
  89. package/scripts/preversion.js +4 -1
  90. package/src/BookNavigator/assets/bookmark-colors.js +1 -1
  91. package/src/BookNavigator/assets/button-base.js +9 -2
  92. package/src/BookNavigator/assets/ia-logo.js +17 -0
  93. package/src/BookNavigator/assets/icon_checkmark.js +1 -1
  94. package/src/BookNavigator/assets/icon_close.js +1 -1
  95. package/src/BookNavigator/assets/icon_sort_asc.js +5 -0
  96. package/src/BookNavigator/assets/icon_sort_desc.js +5 -0
  97. package/src/BookNavigator/assets/icon_sort_neutral.js +5 -0
  98. package/src/BookNavigator/assets/icon_volumes.js +11 -0
  99. package/src/BookNavigator/book-navigator.js +585 -0
  100. package/src/BookNavigator/bookmarks/bookmark-button.js +3 -2
  101. package/src/BookNavigator/bookmarks/bookmark-edit.js +3 -4
  102. package/src/BookNavigator/bookmarks/bookmarks-list.js +2 -3
  103. package/src/BookNavigator/bookmarks/bookmarks-loginCTA.js +3 -8
  104. package/src/BookNavigator/bookmarks/bookmarks-provider.js +27 -17
  105. package/src/BookNavigator/bookmarks/ia-bookmarks.js +116 -67
  106. package/src/BookNavigator/delete-modal-actions.js +1 -1
  107. package/src/BookNavigator/downloads/downloads-provider.js +36 -21
  108. package/src/BookNavigator/downloads/downloads.js +41 -25
  109. package/src/BookNavigator/search/search-provider.js +80 -28
  110. package/src/BookNavigator/search/search-results.js +34 -25
  111. package/src/BookNavigator/sharing.js +27 -0
  112. package/src/BookNavigator/visual-adjustments/visual-adjustments-provider.js +11 -10
  113. package/src/BookNavigator/visual-adjustments/visual-adjustments.js +3 -3
  114. package/src/BookNavigator/volumes/volumes-provider.js +111 -0
  115. package/src/BookNavigator/volumes/volumes.js +188 -0
  116. package/src/BookReader/BookModel.js +59 -30
  117. package/src/BookReader/DebugConsole.js +3 -3
  118. package/src/BookReader/DragScrollable.js +233 -0
  119. package/src/BookReader/Mode1Up.js +56 -351
  120. package/src/BookReader/Mode1UpLit.js +391 -0
  121. package/src/BookReader/Mode2Up.js +73 -1318
  122. package/src/BookReader/Mode2UpLit.js +781 -0
  123. package/src/BookReader/ModeCoordinateSpace.js +29 -0
  124. package/src/BookReader/ModeSmoothZoom.js +211 -0
  125. package/src/BookReader/ModeThumb.js +17 -11
  126. package/src/BookReader/Navbar/Navbar.js +10 -36
  127. package/src/BookReader/PageContainer.js +69 -6
  128. package/src/BookReader/ReduceSet.js +1 -1
  129. package/src/BookReader/Toolbar/Toolbar.js +10 -37
  130. package/src/BookReader/events.js +2 -0
  131. package/src/BookReader/options.js +24 -2
  132. package/src/BookReader/utils/HTMLDimensionsCacher.js +44 -0
  133. package/src/BookReader/utils/ScrollClassAdder.js +31 -0
  134. package/src/BookReader/utils.js +108 -13
  135. package/src/BookReader.js +481 -828
  136. package/src/assets/icons/close-circle-dark.svg +1 -0
  137. package/src/assets/icons/magnify-minus.svg +3 -7
  138. package/src/assets/icons/magnify-plus.svg +3 -7
  139. package/src/assets/icons/voice.svg +1 -0
  140. package/src/css/_BRBookmarks.scss +1 -1
  141. package/src/css/_BRComponent.scss +1 -1
  142. package/src/css/_BRmain.scss +33 -0
  143. package/src/css/_BRnav.scss +4 -26
  144. package/src/css/_BRpages.scss +147 -40
  145. package/src/css/_BRsearch.scss +25 -11
  146. package/src/css/_TextSelection.scss +16 -17
  147. package/src/css/_colorbox.scss +2 -2
  148. package/src/css/_controls.scss +17 -5
  149. package/src/css/_icons.scss +7 -1
  150. package/src/ia-bookreader/ia-bookreader.js +224 -0
  151. package/src/plugins/plugin.archive_analytics.js +3 -3
  152. package/src/plugins/plugin.autoplay.js +4 -9
  153. package/src/plugins/plugin.chapters.js +28 -35
  154. package/src/plugins/plugin.mobile_nav.js +11 -10
  155. package/src/plugins/plugin.resume.js +3 -3
  156. package/src/plugins/plugin.text_selection.js +32 -41
  157. package/src/plugins/plugin.vendor-fullscreen.js +4 -4
  158. package/src/plugins/search/plugin.search.js +179 -103
  159. package/src/plugins/search/view.js +59 -44
  160. package/src/plugins/tts/AbstractTTSEngine.js +46 -37
  161. package/src/plugins/tts/FestivalTTSEngine.js +13 -14
  162. package/src/plugins/tts/PageChunk.js +15 -21
  163. package/src/plugins/tts/PageChunkIterator.js +8 -12
  164. package/src/plugins/tts/WebTTSEngine.js +87 -71
  165. package/src/plugins/tts/plugin.tts.js +94 -125
  166. package/src/plugins/tts/utils.js +0 -25
  167. package/src/plugins/url/UrlPlugin.js +193 -0
  168. package/src/plugins/{plugin.url.js → url/plugin.url.js} +45 -16
  169. package/src/util/docCookies.js +21 -2
  170. package/tests/e2e/README.md +37 -0
  171. package/tests/e2e/autoplay.test.js +2 -2
  172. package/tests/e2e/base.test.js +7 -7
  173. package/tests/e2e/helpers/base.js +28 -23
  174. package/tests/e2e/helpers/debug.js +1 -1
  175. package/tests/e2e/helpers/desktopSearch.js +14 -13
  176. package/tests/e2e/helpers/mobileSearch.js +3 -3
  177. package/tests/e2e/helpers/params.js +17 -0
  178. package/tests/e2e/helpers/rightToLeft.js +4 -10
  179. package/tests/e2e/models/Navigation.js +13 -4
  180. package/tests/e2e/rightToLeft.test.js +4 -5
  181. package/tests/e2e/viewmode.test.js +40 -33
  182. package/tests/jest/BookNavigator/book-navigator.test.js +658 -0
  183. package/tests/jest/BookNavigator/bookmarks/bookmark-button.test.js +43 -0
  184. package/tests/{karma → jest}/BookNavigator/bookmarks/bookmark-edit.test.js +25 -26
  185. package/tests/{karma → jest}/BookNavigator/bookmarks/bookmarks-list.test.js +41 -42
  186. package/tests/jest/BookNavigator/bookmarks/ia-bookmarks.test.js +45 -0
  187. package/tests/jest/BookNavigator/downloads/downloads-provider.test.js +67 -0
  188. package/tests/jest/BookNavigator/downloads/downloads.test.js +53 -0
  189. package/tests/jest/BookNavigator/search/search-provider.test.js +167 -0
  190. package/tests/{karma/BookNavigator → jest/BookNavigator/search}/search-results.test.js +104 -60
  191. package/tests/jest/BookNavigator/sharing/sharing-provider.test.js +49 -0
  192. package/tests/jest/BookNavigator/visual-adjustments.test.js +200 -0
  193. package/tests/jest/BookNavigator/volumes/volumes-provider.test.js +184 -0
  194. package/tests/jest/BookNavigator/volumes/volumes.test.js +97 -0
  195. package/tests/{BookReader → jest/BookReader}/BookModel.test.js +59 -14
  196. package/tests/jest/BookReader/BookReaderPublicFunctions.test.js +193 -0
  197. package/tests/{BookReader → jest/BookReader}/DebugConsole.test.js +1 -1
  198. package/tests/{BookReader → jest/BookReader}/ImageCache.test.js +4 -4
  199. package/tests/jest/BookReader/Mode1UpLit.test.js +73 -0
  200. package/tests/jest/BookReader/Mode2Up.test.js +98 -0
  201. package/tests/jest/BookReader/Mode2UpLit.test.js +190 -0
  202. package/tests/jest/BookReader/ModeCoordinateSpace.test.js +16 -0
  203. package/tests/jest/BookReader/ModeSmoothZoom.test.js +175 -0
  204. package/tests/jest/BookReader/ModeThumb.test.js +71 -0
  205. package/tests/{BookReader → jest/BookReader}/Navbar/Navbar.test.js +10 -10
  206. package/tests/{BookReader → jest/BookReader}/PageContainer.test.js +88 -6
  207. package/tests/{BookReader → jest/BookReader}/ReduceSet.test.js +1 -1
  208. package/tests/{BookReader → jest/BookReader}/Toolbar/Toolbar.test.js +2 -2
  209. package/tests/jest/BookReader/utils/HTMLDimensionsCacher.test.js +59 -0
  210. package/tests/jest/BookReader/utils/ScrollClassAdder.test.js +49 -0
  211. package/tests/{BookReader → jest/BookReader}/utils/classes.test.js +1 -1
  212. package/tests/jest/BookReader/utils.test.js +217 -0
  213. package/tests/jest/BookReader.keyboard.test.js +190 -0
  214. package/tests/{BookReader.options.test.js → jest/BookReader.options.test.js} +9 -1
  215. package/tests/{BookReader.test.js → jest/BookReader.test.js} +26 -37
  216. package/tests/{plugins → jest/plugins}/plugin.archive_analytics.test.js +2 -2
  217. package/tests/{plugins → jest/plugins}/plugin.autoplay.test.js +4 -4
  218. package/tests/{plugins → jest/plugins}/plugin.chapters.test.js +10 -11
  219. package/tests/{plugins → jest/plugins}/plugin.iframe.test.js +2 -2
  220. package/tests/{plugins → jest/plugins}/plugin.mobile_nav.test.js +5 -5
  221. package/tests/{plugins → jest/plugins}/plugin.resume.test.js +3 -3
  222. package/tests/{plugins → jest/plugins}/plugin.text_selection.test.js +39 -47
  223. package/tests/{plugins → jest/plugins}/plugin.vendor-fullscreen.test.js +2 -2
  224. package/tests/{plugins → jest/plugins}/search/plugin.search.test.js +57 -47
  225. package/tests/{plugins → jest/plugins}/search/plugin.search.view.test.js +35 -6
  226. package/tests/{plugins → jest/plugins}/tts/AbstractTTSEngine.test.js +9 -9
  227. package/tests/{plugins → jest/plugins}/tts/FestivalTTSEngine.test.js +4 -4
  228. package/tests/{plugins → jest/plugins}/tts/PageChunk.test.js +1 -1
  229. package/tests/{plugins → jest/plugins}/tts/PageChunkIterator.test.js +3 -3
  230. package/tests/{plugins → jest/plugins}/tts/WebTTSEngine.test.js +47 -1
  231. package/tests/{plugins → jest/plugins}/tts/utils.test.js +1 -60
  232. package/tests/jest/plugins/url/UrlPlugin.test.js +190 -0
  233. package/tests/{plugins → jest/plugins/url}/plugin.url.test.js +53 -14
  234. package/tests/jest/setup.js +3 -0
  235. package/tests/{util → jest/util}/browserSniffing.test.js +1 -1
  236. package/tests/jest/util/docCookies.test.js +24 -0
  237. package/tests/{util → jest/util}/strings.test.js +1 -1
  238. package/tests/{utils.js → jest/utils.js} +38 -0
  239. package/webpack.config.js +11 -5
  240. package/.babelrc +0 -12
  241. package/.dependabot/config.yml +0 -6
  242. package/.testcaferc.json +0 -5
  243. package/BookReader/bookreader-component-bundle.js +0 -1450
  244. package/BookReader/bookreader-component-bundle.js.LICENSE.txt +0 -38
  245. package/BookReader/bookreader-component-bundle.js.map +0 -1
  246. package/BookReader/jquery-1.10.1.js +0 -2
  247. package/BookReader/jquery-1.10.1.js.LICENSE.txt +0 -24
  248. package/BookReader/plugins/plugin.menu_toggle.js +0 -2
  249. package/BookReader/plugins/plugin.menu_toggle.js.map +0 -1
  250. package/BookReaderDemo/bookreader-template-bundle.js +0 -7178
  251. package/BookReaderDemo/demo-plugin-menu-toggle.html +0 -34
  252. package/karma.conf.js +0 -23
  253. package/src/BookNavigator/BookModel.js +0 -14
  254. package/src/BookNavigator/BookNavigator.js +0 -438
  255. package/src/BookNavigator/assets/book-loader.js +0 -27
  256. package/src/BookNavigator/br-fullscreen-mgr.js +0 -83
  257. package/src/BookNavigator/search/a-search-result.js +0 -55
  258. package/src/BookReaderComponent/BookReaderComponent.js +0 -112
  259. package/src/ItemNavigator/ItemNavigator.js +0 -372
  260. package/src/ItemNavigator/providers/sharing.js +0 -29
  261. package/src/dragscrollable-br.js +0 -261
  262. package/src/plugins/menu_toggle/plugin.menu_toggle.js +0 -324
  263. package/tests/BookReader/BookReaderPublicFunctions.test.js +0 -171
  264. package/tests/BookReader/Mode1Up.test.js +0 -164
  265. package/tests/BookReader/Mode2Up.test.js +0 -247
  266. package/tests/BookReader/utils.test.js +0 -109
  267. package/tests/e2e/ia-production/ia-prod-base.js +0 -17
  268. package/tests/karma/BookNavigator/book-navigator.test.js +0 -132
  269. package/tests/karma/BookNavigator/visual-adjustments.test.js +0 -201
  270. package/tests/plugins/menu_toggle/plugin.menu_toggle.test.js +0 -68
  271. package/tests/util/docCookies.test.js +0 -15
@@ -0,0 +1,224 @@
1
+ /**
2
+ * BookReaderTemplate to load BookNavigator components
3
+ */
4
+
5
+ import { LitElement, html, css } from 'lit';
6
+
7
+ import '@internetarchive/ia-item-navigator';
8
+ import '../BookNavigator/book-navigator.js';
9
+ // eslint-disable-next-line no-unused-vars
10
+ import { ModalManager } from '@internetarchive/modal-manager';
11
+ import '@internetarchive/modal-manager';
12
+ import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
13
+
14
+ export class IaBookReader extends LitElement {
15
+ static get properties() {
16
+ return {
17
+ item: { type: Object },
18
+ baseHost: { type: String },
19
+ signedIn: { type: Boolean },
20
+ fullscreen: { type: Boolean, reflect: true, attribute: true },
21
+ sharedObserver: { type: Object, attribute: false },
22
+ modal: { type: Object, attribute: false },
23
+ loaded: { type: Boolean },
24
+ menuShortcuts: { type: Array },
25
+ menuContents: { type: Array },
26
+ };
27
+ }
28
+
29
+ constructor() {
30
+ super();
31
+ this.item = undefined;
32
+ this.bookreader = undefined;
33
+ this.baseHost = 'https://archive.org';
34
+ this.fullscreen = false;
35
+ this.signedIn = false;
36
+ /** @type {ModalManager} */
37
+ this.modal = undefined;
38
+ /** @type {SharedResizeObserver} */
39
+ this.sharedObserver = undefined;
40
+ this.loaded = false;
41
+ this.menuShortcuts = [];
42
+ this.menuContents = [];
43
+ this.openMenuName = '';
44
+ }
45
+
46
+ updated() {
47
+ if (!this.modal) {
48
+ this.setModalManager();
49
+ }
50
+
51
+ if (!this.sharedObserver) {
52
+ this.sharedObserver = new SharedResizeObserver();
53
+ }
54
+ }
55
+
56
+ get itemNav() {
57
+ return this.shadowRoot.querySelector('ia-item-navigator');
58
+ }
59
+
60
+ /** Creates modal DOM & attaches to `<body>` */
61
+ setModalManager() {
62
+ let modalManager = document.querySelector('modal-manager');
63
+ if (!modalManager) {
64
+ modalManager = document.createElement(
65
+ 'modal-manager'
66
+ );
67
+ document.body.appendChild(modalManager);
68
+ }
69
+
70
+ this.modal = modalManager;
71
+ }
72
+
73
+ manageFullscreen(e) {
74
+ const { detail } = e;
75
+ const fullscreen = !!detail.isFullScreen;
76
+ this.fullscreen = fullscreen;
77
+ this.dispatchEvent(new CustomEvent('fullscreenStateUpdated', { detail: { fullscreen }}));
78
+
79
+ }
80
+
81
+ loadingStateUpdated(e) {
82
+ const { loaded } = e.detail;
83
+ this.loaded = loaded || null;
84
+ this.dispatchEvent(new CustomEvent('loadingStateUpdated', { detail: { loaded }}));
85
+ }
86
+
87
+ setMenuShortcuts(e) {
88
+ this.menuShortcuts = [...e.detail];
89
+ }
90
+
91
+ setMenuContents(e) {
92
+ const updatedContents = [...e.detail];
93
+ this.menuContents = updatedContents;
94
+ }
95
+
96
+ manageSideMenuEvents(e) {
97
+ const { menuId, action } = e.detail;
98
+ if (!menuId) {
99
+ return;
100
+ }
101
+
102
+ this.openMenuName = menuId;
103
+
104
+ if (action === 'open') {
105
+ this.itemNav?.openShortcut(menuId);
106
+ } else if (action === 'toggle') {
107
+ this.itemNav?.toggleMenu();
108
+ }
109
+ }
110
+
111
+ render() {
112
+ return html`
113
+ <div class="main-component">
114
+ <ia-item-navigator
115
+ ?viewportInFullscreen=${this.fullscreen}
116
+ .basehost=${this.baseHost}
117
+ .item=${this.item}
118
+ .modal=${this.modal}
119
+ .loaded=${this.loaded}
120
+ .sharedObserver=${this.sharedObserver}
121
+ ?signedIn=${this.signedIn}
122
+ .menuShortcuts=${this.menuShortcuts}
123
+ .menuContents=${this.menuContents}
124
+ .openMenu=${this.openMenuName}
125
+ >
126
+ <div slot="header">
127
+ <slot name="header"></slot>
128
+ </div>
129
+ <div slot="main">
130
+ <book-navigator
131
+ .modal=${this.modal}
132
+ .baseHost=${this.baseHost}
133
+ .itemMD=${this.item}
134
+ ?signedIn=${this.signedIn}
135
+ ?sideMenuOpen=${this.menuOpened}
136
+ .sharedObserver=${this.sharedObserver}
137
+ @ViewportInFullScreen=${this.manageFullscreen}
138
+ @loadingStateUpdated=${this.loadingStateUpdated}
139
+ @updateSideMenu=${this.manageSideMenuEvents}
140
+ @menuUpdated=${this.setMenuContents}
141
+ @menuShortcutsUpdated=${this.setMenuShortcuts}
142
+ >
143
+ <div slot="main">
144
+ <slot name="main"></slot>
145
+ </div>
146
+ </book-navigator>
147
+ </div>
148
+ </ia-item-navigator>
149
+ </div>
150
+ `;
151
+ }
152
+
153
+ static get styles() {
154
+ return css`
155
+ :host {
156
+ display: block;
157
+ --primaryBGColor: var(--black, #000);
158
+ --secondaryBGColor: #222;
159
+ --tertiaryBGColor: #333;
160
+ --primaryTextColor: var(--white, #fff);
161
+ --primaryCTAFill: #194880;
162
+ --primaryCTABorder: #c5d1df;
163
+ --secondaryCTAFill: #333;
164
+ --secondaryCTABorder: #999;
165
+ --primaryErrorCTAFill: #e51c26;
166
+ --primaryErrorCTABorder: #f8c6c8;
167
+ background-color: var(--primaryBGColor);
168
+ position: relative;
169
+ }
170
+
171
+ :host([fullscreen]),
172
+ ia-item-navigator[viewportinfullscreen] {
173
+ position: fixed;
174
+ inset: 0;
175
+ height: 100%;
176
+ min-height: unset;
177
+ }
178
+
179
+ .main-component {
180
+ height: 100%;
181
+ width: 100%;
182
+ min-height: inherit;
183
+ }
184
+
185
+ div[slot="header"],
186
+ div[slot="main"] {
187
+ display: flex;
188
+ width: 100%;
189
+ }
190
+
191
+ slot {
192
+ display: block;
193
+ flex: 1;
194
+ }
195
+
196
+ ia-item-navigator {
197
+ min-height: var(--br-height, inherit);
198
+ height: var(--br-height, inherit);
199
+ display: block;
200
+ width: 100%;
201
+ color: var(--primaryTextColor);
202
+ --menuButtonLabelDisplay: block;
203
+ --menuWidth: 320px;
204
+ --menuSliderBg: var(--secondaryBGColor);
205
+ --activeButtonBg: var(--tertiaryBGColor);
206
+ --subpanelRightBorderColor: var(--secondaryCTABorder);
207
+ --animationTiming: 100ms;
208
+ --iconFillColor: var(--primaryTextColor);
209
+ --iconStrokeColor: var(--primaryTextColor);
210
+ --menuSliderHeaderIconHeight: 2rem;
211
+ --menuSliderHeaderIconWidth: 2rem;
212
+ --iconWidth: 2.4rem;
213
+ --iconHeight: 2.4rem;
214
+ --shareLinkColor: var(--primaryTextColor);
215
+ --shareIconBorder: var(--primaryTextColor);
216
+ --shareIconBg: var(--secondaryBGColor);
217
+ --activityIndicatorLoadingDotColor: var(--primaryTextColor);
218
+ --activityIndicatorLoadingRingColor: var(--primaryTextColor);
219
+ }
220
+ `;
221
+ }
222
+ }
223
+
224
+ window.customElements.define("ia-bookreader", IaBookReader);
@@ -1,4 +1,4 @@
1
- /* global BookReader, archive_analytics */
1
+ /* global BookReader */
2
2
  /**
3
3
  * Plugin for Archive.org analytics
4
4
  */
@@ -50,13 +50,13 @@ BookReader.prototype.archiveAnalyticsSendFragmentChange = function() {
50
50
  // avoids embed cross site exceptions -- but on (+) side, means it is and keeps marked offite!
51
51
 
52
52
  // Send bookreader ping
53
- archive_analytics.send_ping(values, null, "augment_for_ao_site");
53
+ window.archive_analytics.send_ping(values, null, "augment_for_ao_site");
54
54
 
55
55
  // Also send tracking event ping
56
56
  const additionalEventParams = this.options.lendingInfo && this.options.lendingInfo.loanId
57
57
  ? { loanId: this.options.lendingInfo.loanId }
58
58
  : {};
59
- archive_analytics.send_event('BookReader', 'UserChangedView', window.location.pathname, additionalEventParams);
59
+ window.archive_analytics.send_event('BookReader', 'UserChangedView', window.location.pathname, additionalEventParams);
60
60
 
61
61
  this.archiveAnalyticsSendFragmentChange.prevFragment = newFragment;
62
62
  }
@@ -80,11 +80,6 @@ BookReader.prototype.autoToggle = function(overrides) {
80
80
  this.switchMode(this.constMode2up);
81
81
  }
82
82
 
83
- // Change to autofit if book is too large
84
- if (this.reduce < this.twoPageGetAutofitReduce()) {
85
- this.zoom('auto');
86
- }
87
-
88
83
  if (null == this.autoTimer) {
89
84
  // $$$ Draw events currently cause layout problems when they occur during animation.
90
85
  // There is a specific problem when changing from 1-up immediately to autoplay in RTL so
@@ -94,7 +89,7 @@ BookReader.prototype.autoToggle = function(overrides) {
94
89
  // don't flip immediately -- wait until timer fires
95
90
  } else {
96
91
  // flip immediately
97
- this.flipFwdToIndex();
92
+ this.next({ triggerStop: false });
98
93
  }
99
94
 
100
95
  this.$('.play').hide();
@@ -102,10 +97,10 @@ BookReader.prototype.autoToggle = function(overrides) {
102
97
  this.autoTimer = setInterval(() => {
103
98
  if (this.animating) return;
104
99
 
105
- if (Math.max(this.twoPage.currentIndexL, this.twoPage.currentIndexR) >= this.lastDisplayableIndex()) {
106
- this.flipBackToIndex(1); // $$$ really what we want?
100
+ if (Math.max(this.twoPage.currentIndexL, this.twoPage.currentIndexR) >= this.book.getNumLeafs() - 1) {
101
+ this.prev({ triggerStop: false }); // $$$ really what we want?
107
102
  } else {
108
- this.flipFwdToIndex();
103
+ this.next({ triggerStop: false });
109
104
  }
110
105
  }, this.flipDelay);
111
106
  } else {
@@ -36,14 +36,12 @@ BookReader.prototype.init = (function(super_) {
36
36
  this.updateTOCState(this.firstIndex, this._tocEntries);
37
37
  }
38
38
  }
39
- )
40
- $(".BRmobileMenu__tableContents").click(
41
- () => {
42
- this.updateTOCState(this.firstIndex, this._tocEntries);
43
- }
44
39
  );
40
+ $(".BRmobileMenu__tableContents").on("click", () => {
41
+ this.updateTOCState(this.firstIndex, this._tocEntries);
42
+ });
45
43
  }
46
- }
44
+ };
47
45
  })(BookReader.prototype.init);
48
46
 
49
47
  /**
@@ -55,12 +53,12 @@ BookReader.prototype.init = (function(super_) {
55
53
  */
56
54
  BookReader.prototype.addChapter = function(chapterTitle, pageNumber, pageIndex) {
57
55
  const uiStringPage = 'Page'; // i18n
58
- const percentThrough = BookReader.util.cssPercentage(pageIndex, this.getNumLeafs() - 1);
56
+ const percentThrough = BookReader.util.cssPercentage(pageIndex, this.book.getNumLeafs() - 1);
59
57
  const jumpToChapter = (event) => {
60
58
  this.jumpToIndex($(event.delegateTarget).data('pageIndex'));
61
59
  $('.current-chapter').removeClass('current-chapter');
62
60
  $(event.delegateTarget).addClass('current-chapter');
63
- }
61
+ };
64
62
  const title = `${chapterTitle} | `;
65
63
  const pageStr = `${uiStringPage} ${pageNumber}`;
66
64
 
@@ -79,7 +77,7 @@ BookReader.prototype.addChapter = function(chapterTitle, pageNumber, pageIndex)
79
77
  .css({ left: percentThrough })
80
78
  .appendTo(this.$('.BRnavline'))
81
79
  .data({ pageIndex })
82
- .hover(event => {
80
+ .on("mouseenter", event => {
83
81
  // remove hover effect from other markers then turn on just for this
84
82
  const marker = event.currentTarget;
85
83
  const tooltip = marker.querySelector('div');
@@ -91,9 +89,8 @@ BookReader.prototype.addChapter = function(chapterTitle, pageNumber, pageIndex)
91
89
  }
92
90
  this.$('.BRsearch,.BRchapter').removeClass('front');
93
91
  $(event.target).addClass('front');
94
- },
95
- event => $(event.target).removeClass('front')
96
- )
92
+ })
93
+ .on("mouseleave", event => $(event.target).removeClass('front'))
97
94
  .on('click', jumpToChapter);
98
95
 
99
96
  //adding clickable properties to mobile chapters
@@ -126,7 +123,7 @@ BookReader.prototype.updateTOC = function(tocEntries) {
126
123
  this._tocEntries = tocEntries;
127
124
  $('.table-contents-list').children().each((i, el) => {
128
125
  tocEntries[i].mobileHTML = el;
129
- })
126
+ });
130
127
  };
131
128
 
132
129
  /**
@@ -154,7 +151,7 @@ BookReader.prototype.updateTOC = function(tocEntries) {
154
151
  * @param {TocEntry} tocEntryObject
155
152
  */
156
153
  BookReader.prototype.addChapterFromEntry = function(tocEntryObject) {
157
- tocEntryObject.pageIndex = this.getPageIndex(tocEntryObject['pagenum']);
154
+ tocEntryObject.pageIndex = this.book.getPageIndex(tocEntryObject['pagenum']);
158
155
  //creates a string with non-void tocEntryObject.label and tocEntryObject.title
159
156
  const chapterStr = [tocEntryObject.label, tocEntryObject.title]
160
157
  .filter(x => x)
@@ -162,9 +159,9 @@ BookReader.prototype.addChapterFromEntry = function(tocEntryObject) {
162
159
  this.addChapter(chapterStr, tocEntryObject['pagenum'], tocEntryObject.pageIndex);
163
160
  this.$('.BRchapter, .BRsearch').each((i, el) => {
164
161
  const $el = $(el);
165
- $el.hover(
166
- () => $el.addClass('front'),
167
- () => $el.removeClass('front'));
162
+ $el
163
+ .on("mouseenter", () => $el.addClass('front'))
164
+ .on("mouseleave", () => $el.removeClass('front'));
168
165
  });
169
166
  };
170
167
 
@@ -177,7 +174,7 @@ BookReader.prototype.addChapterFromEntry = function(tocEntryObject) {
177
174
  * This makes a call to OL API and calls the given callback function with the
178
175
  * response from the API.
179
176
  */
180
- BookReader.prototype.getOpenLibraryRecord = function () {
177
+ BookReader.prototype.getOpenLibraryRecord = async function () {
181
178
  // Try looking up by ocaid first, then by source_record
182
179
  const baseURL = `${this.olHost}/query.json?type=/type/edition&*=`;
183
180
  const fetchUrlByBookId = `${baseURL}&ocaid=${this.bookId}`;
@@ -193,21 +190,17 @@ BookReader.prototype.getOpenLibraryRecord = function () {
193
190
  }
194
191
  };
195
192
 
196
- $.ajax({ url: fetchUrlByBookId, dataType: 'jsonp' })
197
- .then(data => {
198
- if (data && data.length > 0) {
199
- return data;
200
- } else {
201
- // try sourceid
202
- return $.ajax({ url: `${baseURL}&source_records=ia:${this.bookId}`, dataType: 'jsonp' });
203
- }
204
- })
205
- .then(data => {
206
- if (data && data.length > 0) {
207
- setUpChapterMarkers(data[0]);
208
- }
209
- });
210
- }
193
+ let data = await $.ajax({ url: fetchUrlByBookId, dataType: 'jsonp' });
194
+
195
+ if (!data || !data.length) {
196
+ // try sourceid
197
+ data = await $.ajax({ url: `${baseURL}&source_records=ia:${this.bookId}`, dataType: 'jsonp' });
198
+ }
199
+
200
+ if (data && data.length > 0) {
201
+ setUpChapterMarkers(data[0]);
202
+ }
203
+ };
211
204
 
212
205
  // Extend buildMobileDrawerElement with table of contents list
213
206
  BookReader.prototype.buildMobileDrawerElement = (function (super_) {
@@ -240,7 +233,7 @@ BookReader.prototype.buildMobileDrawerElement = (function (super_) {
240
233
  */
241
234
  BookReader.prototype.updateTOCState = function(currIndex, tocEntries) {
242
235
  //this function won't have any effects if called before OpenLibrary request is finished
243
- if (!tocEntries) {return}
236
+ if (!tocEntries) {return;}
244
237
  $('.current-chapter').removeClass('current-chapter');
245
238
  const tocEntriesIndexed = tocEntries.filter((el) => el.pageIndex != undefined).reverse();
246
239
  const currChapter = tocEntriesIndexed[tocEntriesIndexed.findIndex(
@@ -248,4 +241,4 @@ BookReader.prototype.updateTOCState = function(currIndex, tocEntries) {
248
241
  if (currChapter != undefined) {
249
242
  $(currChapter.mobileHTML).addClass('current-chapter');
250
243
  }
251
- }
244
+ };
@@ -25,7 +25,7 @@ const FILTERLIST = [
25
25
  filter: "contrast(120%)",
26
26
  label: "High contrast"
27
27
  },
28
- ]
28
+ ];
29
29
 
30
30
  jQuery.extend(BookReader.defaultOptions, {
31
31
  enableMobileNav: true,
@@ -86,15 +86,16 @@ BookReader.prototype.initToolbar = (function (super_) {
86
86
  });
87
87
 
88
88
  //apply filters when checkboxs clicked
89
- $drawerEl.find('.BRcheckbox-filters').click(() => applyFilters($drawerEl, this));
89
+ $drawerEl.find('.BRcheckbox-filters')
90
+ .on("click", () => applyFilters($drawerEl, this));
90
91
 
91
92
  // Bind mobile switch buttons
92
- $drawerEl.find('.DrawerLayoutButton.one_page_mode').click(
93
- () => this.switchMode(this.constMode1up));
94
- $drawerEl.find('.DrawerLayoutButton.two_page_mode').click(
95
- () => this.switchMode(this.constMode2up));
96
- $drawerEl.find('.DrawerLayoutButton.thumbnail_mode').click(
97
- () => this.switchMode(this.constModeThumb));
93
+ $drawerEl.find('.DrawerLayoutButton.one_page_mode')
94
+ .on("click", () => this.switchMode(this.constMode1up));
95
+ $drawerEl.find('.DrawerLayoutButton.two_page_mode')
96
+ .on("click", () => this.switchMode(this.constMode2up));
97
+ $drawerEl.find('.DrawerLayoutButton.thumbnail_mode')
98
+ .on("click", () => this.switchMode(this.constModeThumb));
98
99
 
99
100
  if (this.mobileNavFullscreenOnly) {
100
101
  $(document.body).addClass('BRbodyMobileNavEnabledFullscreen');
@@ -178,7 +179,7 @@ BookReader.prototype.buildMobileDrawerElement = function() {
178
179
 
179
180
  `;
180
181
  experimentalHtml = experimentalHtml.concat(checkboxHtml);
181
- })
182
+ });
182
183
  experimentalHtml = experimentalHtml.concat("</div>");
183
184
  }
184
185
 
@@ -284,4 +285,4 @@ const applyFilters = (drawerEl, br) => {
284
285
  filter: ${filterStr};
285
286
  -webkit-filter: ${filterStr};}`;
286
287
  document.body.appendChild(filtersSheet);
287
- }
288
+ };
@@ -37,7 +37,7 @@ BookReader.prototype.getResumeValue = function() {
37
37
  const val = BookReader.docCookies.getItem('br-resume');
38
38
  if (val !== null) return parseInt(val);
39
39
  else return null;
40
- }
40
+ };
41
41
 
42
42
  /**
43
43
  * Return cookie path using pathname up to /page/... or /mode/...
@@ -49,7 +49,7 @@ BookReader.prototype.getResumeValue = function() {
49
49
  */
50
50
  BookReader.prototype.getCookiePath = function(urlPathPart) {
51
51
  return urlPathPart.match('.+?(?=/page/|/mode/|$)')[0];
52
- }
52
+ };
53
53
 
54
54
  /**
55
55
  * Sets page resume value, for remembering reader's page
@@ -65,4 +65,4 @@ BookReader.prototype.updateResumeValue = function(index, cookieName) {
65
65
  const path = this.options.resumeCookiePath
66
66
  || this.getCookiePath(window.location.pathname);
67
67
  BookReader.docCookies.setItem(cookieName || 'br-resume', index, ttl, path, null, false);
68
- }
68
+ };
@@ -1,7 +1,9 @@
1
1
  //@ts-check
2
+ import { createSVGPageLayer } from '../BookReader/PageContainer.js';
2
3
  import { isFirefox, isSafari } from '../util/browserSniffing.js';
3
4
  import { applyVariables } from '../util/strings.js';
4
5
  /** @typedef {import('../util/strings.js').StringWithVars} StringWithVars */
6
+ /** @typedef {import('../BookReader/PageContainer.js').PageContainer} PageContainer */
5
7
 
6
8
  const BookReader = /** @type {typeof import('../BookReader').default} */(window.BookReader);
7
9
 
@@ -11,6 +13,8 @@ export const DEFAULT_OPTIONS = {
11
13
  fullDjvuXmlUrl: null,
12
14
  /** @type {StringWithVars} The URL to fetch a single page of the DJVU xml. Supports options.vars. Also has {{pageIndex}} */
13
15
  singlePageDjvuXmlUrl: null,
16
+ /** Whether to fetch the XML as a jsonp */
17
+ jsonp: false,
14
18
  };
15
19
  /** @typedef {typeof DEFAULT_OPTIONS} TextSelectionPluginOptions */
16
20
 
@@ -46,7 +50,7 @@ export class TextSelectionPlugin {
46
50
  // Tspans are necessary on Chrome because they prevent newline character after every word when copying
47
51
  this.svgParagraphElement = "text";
48
52
  this.svgWordElement = "tspan";
49
- this.insertNewlines = avoidTspans
53
+ this.insertNewlines = avoidTspans;
50
54
  // Safari has a bug where `pointer-events` doesn't work on `<tspans>`. So
51
55
  // there we will set `pointer-events: all` on the paragraph element. We don't
52
56
  // do this everywhere, because it's a worse experience. Thanks Safari :/
@@ -72,7 +76,8 @@ export class TextSelectionPlugin {
72
76
  this.djvuPagesPromise = $.ajax({
73
77
  type: "GET",
74
78
  url: applyVariables(this.options.fullDjvuXmlUrl, this.optionVariables),
75
- dataType: "html",
79
+ dataType: this.options.jsonp ? "jsonp" : "html",
80
+ cache: true,
76
81
  error: (e) => undefined
77
82
  }).then((res) => {
78
83
  try {
@@ -94,21 +99,21 @@ export class TextSelectionPlugin {
94
99
  if (cachedEntry) {
95
100
  return cachedEntry.response;
96
101
  }
97
- return $.ajax({
102
+ const res = await $.ajax({
98
103
  type: "GET",
99
104
  url: applyVariables(this.options.singlePageDjvuXmlUrl, this.optionVariables, { pageIndex: index }),
100
- dataType: "html",
105
+ dataType: this.options.jsonp ? "jsonp" : "html",
106
+ cache: true,
101
107
  error: (e) => undefined,
102
- }).then((res) => {
103
- try {
104
- const xmlDoc = $.parseXML(res);
105
- const result = xmlDoc && $(xmlDoc).find("OBJECT")[0];
106
- this.pageTextCache.add({ index, response: result });
107
- return result;
108
- } catch (e) {
109
- return undefined;
110
- }
111
108
  });
109
+ try {
110
+ const xmlDoc = $.parseXML(res);
111
+ const result = xmlDoc && $(xmlDoc).find("OBJECT")[0];
112
+ this.pageTextCache.add({ index, response: result });
113
+ return result;
114
+ } catch (e) {
115
+ return undefined;
116
+ }
112
117
  } else {
113
118
  const XMLpagesArr = await this.djvuPagesPromise;
114
119
  if (XMLpagesArr) return XMLpagesArr[index];
@@ -144,8 +149,8 @@ export class TextSelectionPlugin {
144
149
  this.textSelectingMode(svg);
145
150
  }
146
151
  else svg.classList.remove("selectingSVG");
147
- })
148
- })
152
+ });
153
+ });
149
154
  }
150
155
 
151
156
  /**
@@ -158,13 +163,13 @@ export class TextSelectionPlugin {
158
163
  if (window.getSelection().toString() != "") window.getSelection().removeAllRanges();
159
164
  }
160
165
  event.stopPropagation();
161
- })
166
+ });
162
167
  $(svg).on('mouseup.textSelectPluginHandler', (event) => {
163
168
  event.stopPropagation();
164
169
  if (window.getSelection().toString() == "") {
165
170
  $(svg).off(".textSelectPluginHandler");
166
171
  this.defaultMode(svg); }
167
- })
172
+ });
168
173
  }
169
174
 
170
175
  /**
@@ -175,21 +180,20 @@ export class TextSelectionPlugin {
175
180
  /** @type {JQuery<SVGElement>} */
176
181
  const $svg = $container.find('svg.textSelectionSVG');
177
182
  if (!$svg.length) return;
178
- $svg.each((i, s) => this.defaultMode(s))
183
+ $svg.each((i, s) => this.defaultMode(s));
179
184
  this.interceptCopy($container);
180
185
  }
181
186
 
182
187
  /**
183
- * @param {number} pageIndex
184
- * @param {JQuery} $container
188
+ * @param {PageContainer} pageContainer
185
189
  */
186
- async createTextLayer(pageIndex, $container) {
190
+ async createTextLayer(pageContainer) {
191
+ const pageIndex = pageContainer.page.index;
192
+ const $container = pageContainer.$container;
187
193
  const $svgLayers = $container.find('.textSelectionSVG');
188
194
  if ($svgLayers.length) return;
189
195
  const XMLpage = await this.getPageText(pageIndex);
190
196
  if (!XMLpage) return;
191
- const XMLwidth = $(XMLpage).attr("width");
192
- const XMLheight = $(XMLpage).attr("height");
193
197
 
194
198
  const totalWords = $(XMLpage).find("WORD").length;
195
199
  if (totalWords > this.maxWordRendered) {
@@ -197,19 +201,8 @@ export class TextSelectionPlugin {
197
201
  return;
198
202
  }
199
203
 
200
- const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
201
- svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
202
- svg.setAttribute("viewBox", `0 0 ${XMLwidth} ${XMLheight}`);
204
+ const svg = createSVGPageLayer(pageContainer.page, 'textSelectionSVG');
203
205
  $container.append(svg);
204
- svg.setAttribute('class', 'textSelectionSVG');
205
- svg.setAttribute('preserveAspectRatio', 'none');
206
- $(svg).css({
207
- "width": "100%",
208
- "position": "absolute",
209
- "height": "100%",
210
- "top": "0",
211
- "left": "0",
212
- });
213
206
 
214
207
  $(XMLpage).find("PARAGRAPH").each((i, paragraph) => {
215
208
  // Adding text element for each paragraph in the page
@@ -266,7 +259,7 @@ export class TextSelectionPlugin {
266
259
  const paragWordHeight = wordHeightArr[Math.floor(wordHeightArr.length * 0.85)];
267
260
  paragSvg.setAttribute("font-size", paragWordHeight.toString());
268
261
  svg.appendChild(paragSvg);
269
- })
262
+ });
270
263
  this.stopPageFlip($container);
271
264
  }
272
265
  }
@@ -290,11 +283,9 @@ export class BookreaderWithTextSelection extends BookReader {
290
283
  _createPageContainer(index) {
291
284
  const pageContainer = super._createPageContainer(index);
292
285
  // Disable if thumb mode; it's too janky
293
- // index can be -1 for "pre-cover" region
294
- // Added checking of lastPageIndex to avoid loop around index value
295
- const lastPageIndex = this.getNumLeafs() - 1;
296
- if (this.mode !== this.constModeThumb && (index >= 0 && index <= lastPageIndex)) {
297
- this.textSelectionPlugin?.createTextLayer(index, pageContainer.$container);
286
+ // .page can be null for "pre-cover" region
287
+ if (this.mode !== this.constModeThumb && pageContainer.page) {
288
+ this.textSelectionPlugin?.createTextLayer(pageContainer);
298
289
  }
299
290
  return pageContainer;
300
291
  }
@@ -56,7 +56,7 @@ if (!isMobile()) {
56
56
  $(document.body).append(cboxOverlay).append(cbox);
57
57
  }
58
58
  });
59
- }
59
+ };
60
60
  })(BookReader.prototype.init);
61
61
 
62
62
  /**
@@ -92,7 +92,7 @@ if (!isMobile()) {
92
92
  $(document).off('keyup' + EVENT_NAMESPACE);
93
93
 
94
94
  this.isFullscreenActive = false;
95
- this.updateBrClasses()
95
+ this.updateBrClasses();
96
96
 
97
97
  this.resize();
98
98
  this.refs.$brContainer.animate({ opacity: 1 }, 400, 'linear');
@@ -233,8 +233,8 @@ export function bindFullscreenChangeListener(
233
233
  'moz',
234
234
  'ms'
235
235
  ];
236
- const all_events = $.trim(event + vendor_prefixes.join(event) + event);
237
- $(document).bind(all_events, data, fullscreenchangeListener);
236
+ const all_events = (event + vendor_prefixes.join(event) + event).trim();
237
+ $(document).on(all_events, data, fullscreenchangeListener);
238
238
  }
239
239
 
240
240
  /**