@internetarchive/bookreader 5.0.0-38 → 5.0.0-39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. package/BookReader/BookReader.css +8 -0
  2. package/BookReader/BookReader.js +1 -1
  3. package/BookReader/BookReader.js.map +1 -1
  4. package/BookReader/ia-bookreader-bundle.js +99 -75
  5. package/BookReader/ia-bookreader-bundle.js.map +1 -1
  6. package/BookReader/icons/magnify-minus.svg +1 -1
  7. package/BookReader/icons/magnify-plus.svg +1 -1
  8. package/BookReader/plugins/plugin.autoplay.js +1 -1
  9. package/BookReader/plugins/plugin.autoplay.js.map +1 -1
  10. package/BookReader/plugins/plugin.chapters.js +1 -1
  11. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  12. package/BookReader/plugins/plugin.mobile_nav.js +1 -1
  13. package/BookReader/plugins/plugin.mobile_nav.js.map +1 -1
  14. package/BookReader/plugins/plugin.resume.js +1 -1
  15. package/BookReader/plugins/plugin.resume.js.map +1 -1
  16. package/BookReader/plugins/plugin.search.js +1 -1
  17. package/BookReader/plugins/plugin.search.js.map +1 -1
  18. package/BookReader/plugins/plugin.text_selection.js +1 -1
  19. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  20. package/BookReader/plugins/plugin.tts.js +1 -1
  21. package/BookReader/plugins/plugin.tts.js.map +1 -1
  22. package/BookReader/plugins/plugin.url.js +1 -1
  23. package/BookReader/plugins/plugin.url.js.map +1 -1
  24. package/CHANGELOG.md +5 -0
  25. package/README.md +13 -0
  26. package/package.json +14 -14
  27. package/renovate.json +1 -1
  28. package/src/BookReader/Mode1UpLit.js +7 -1
  29. package/src/BookReader/Mode2Up.js +11 -0
  30. package/src/BookReader/ModeSmoothZoom.js +2 -0
  31. package/src/BookReader/PageContainer.js +10 -4
  32. package/src/BookReader/utils/ScrollClassAdder.js +31 -0
  33. package/src/assets/icons/magnify-minus.svg +3 -7
  34. package/src/assets/icons/magnify-plus.svg +3 -7
  35. package/src/css/_TextSelection.scss +13 -0
  36. package/tests/jest/BookReader/PageContainer.test.js +5 -4
  37. package/tests/jest/BookReader/utils/ScrollClassAdder.test.js +49 -0
  38. package/.husky/_/husky.sh +0 -30
  39. package/stat/BookNavigator/BookModel.js +0 -14
  40. package/stat/BookNavigator/BookNavigator.js +0 -524
  41. package/stat/BookNavigator/assets/bookmark-colors.js +0 -15
  42. package/stat/BookNavigator/assets/button-base.js +0 -61
  43. package/stat/BookNavigator/assets/ia-logo.js +0 -17
  44. package/stat/BookNavigator/assets/icon_checkmark.js +0 -6
  45. package/stat/BookNavigator/assets/icon_close.js +0 -3
  46. package/stat/BookNavigator/assets/icon_sort_asc.js +0 -5
  47. package/stat/BookNavigator/assets/icon_sort_desc.js +0 -5
  48. package/stat/BookNavigator/assets/icon_sort_neutral.js +0 -5
  49. package/stat/BookNavigator/assets/icon_volumes.js +0 -11
  50. package/stat/BookNavigator/bookmarks/bookmark-button.js +0 -64
  51. package/stat/BookNavigator/bookmarks/bookmark-edit.js +0 -215
  52. package/stat/BookNavigator/bookmarks/bookmarks-list.js +0 -285
  53. package/stat/BookNavigator/bookmarks/bookmarks-loginCTA.js +0 -28
  54. package/stat/BookNavigator/bookmarks/bookmarks-provider.js +0 -56
  55. package/stat/BookNavigator/bookmarks/ia-bookmarks.js +0 -523
  56. package/stat/BookNavigator/br-fullscreen-mgr.js +0 -82
  57. package/stat/BookNavigator/delete-modal-actions.js +0 -49
  58. package/stat/BookNavigator/downloads/downloads-provider.js +0 -72
  59. package/stat/BookNavigator/downloads/downloads.js +0 -139
  60. package/stat/BookNavigator/provider-config.js +0 -0
  61. package/stat/BookNavigator/search/a-search-result.js +0 -55
  62. package/stat/BookNavigator/search/search-provider.js +0 -180
  63. package/stat/BookNavigator/search/search-results.js +0 -360
  64. package/stat/BookNavigator/sharing.js +0 -31
  65. package/stat/BookNavigator/visual-adjustments/visual-adjustments-provider.js +0 -94
  66. package/stat/BookNavigator/visual-adjustments/visual-adjustments.js +0 -280
  67. package/stat/BookNavigator/volumes/volumes-provider.js +0 -83
  68. package/stat/BookNavigator/volumes/volumes.js +0 -178
  69. package/stat/BookReader/BookModel.js +0 -518
  70. package/stat/BookReader/DebugConsole.js +0 -54
  71. package/stat/BookReader/DragScrollable.js +0 -233
  72. package/stat/BookReader/ImageCache.js +0 -116
  73. package/stat/BookReader/Mode1Up.js +0 -102
  74. package/stat/BookReader/Mode1UpLit.js +0 -434
  75. package/stat/BookReader/Mode2Up.js +0 -1372
  76. package/stat/BookReader/ModeSmoothZoom.js +0 -177
  77. package/stat/BookReader/ModeThumb.js +0 -344
  78. package/stat/BookReader/Navbar/Navbar.js +0 -310
  79. package/stat/BookReader/PageContainer.js +0 -120
  80. package/stat/BookReader/ReduceSet.js +0 -26
  81. package/stat/BookReader/Toolbar/Toolbar.js +0 -384
  82. package/stat/BookReader/events.js +0 -20
  83. package/stat/BookReader/options.js +0 -324
  84. package/stat/BookReader/utils/HTMLDimensionsCacher.js +0 -44
  85. package/stat/BookReader/utils/classes.js +0 -36
  86. package/stat/BookReader/utils.js +0 -240
  87. package/stat/BookReader.js +0 -2550
  88. package/stat/BookReaderComponent/BookReaderComponent.js +0 -117
  89. package/stat/assets/icons/1up.svg +0 -12
  90. package/stat/assets/icons/2up.svg +0 -15
  91. package/stat/assets/icons/advance.svg +0 -26
  92. package/stat/assets/icons/chevron-right.svg +0 -1
  93. package/stat/assets/icons/close-circle-dark.svg +0 -1
  94. package/stat/assets/icons/close-circle.svg +0 -1
  95. package/stat/assets/icons/fullscreen.svg +0 -17
  96. package/stat/assets/icons/fullscreen_exit.svg +0 -17
  97. package/stat/assets/icons/hamburger.svg +0 -15
  98. package/stat/assets/icons/left-arrow.svg +0 -12
  99. package/stat/assets/icons/magnify-minus.svg +0 -16
  100. package/stat/assets/icons/magnify-plus.svg +0 -17
  101. package/stat/assets/icons/magnify.svg +0 -15
  102. package/stat/assets/icons/pause.svg +0 -23
  103. package/stat/assets/icons/play.svg +0 -22
  104. package/stat/assets/icons/playback-speed.svg +0 -34
  105. package/stat/assets/icons/read-aloud.svg +0 -22
  106. package/stat/assets/icons/review.svg +0 -22
  107. package/stat/assets/icons/thumbnails.svg +0 -17
  108. package/stat/assets/icons/voice.svg +0 -1
  109. package/stat/assets/icons/volume-full.svg +0 -22
  110. package/stat/assets/images/BRicons.png +0 -0
  111. package/stat/assets/images/BRicons.svg +0 -94
  112. package/stat/assets/images/BRicons_ia.png +0 -0
  113. package/stat/assets/images/back_pages.png +0 -0
  114. package/stat/assets/images/book_bottom_icon.png +0 -0
  115. package/stat/assets/images/book_down_icon.png +0 -0
  116. package/stat/assets/images/book_left_icon.png +0 -0
  117. package/stat/assets/images/book_leftmost_icon.png +0 -0
  118. package/stat/assets/images/book_right_icon.png +0 -0
  119. package/stat/assets/images/book_rightmost_icon.png +0 -0
  120. package/stat/assets/images/book_top_icon.png +0 -0
  121. package/stat/assets/images/book_up_icon.png +0 -0
  122. package/stat/assets/images/books_graphic.svg +0 -177
  123. package/stat/assets/images/booksplit.png +0 -0
  124. package/stat/assets/images/control_pause_icon.png +0 -0
  125. package/stat/assets/images/control_play_icon.png +0 -0
  126. package/stat/assets/images/embed_icon.png +0 -0
  127. package/stat/assets/images/icon-home-ia.png +0 -0
  128. package/stat/assets/images/icon_OL-logo-xs.png +0 -0
  129. package/stat/assets/images/icon_alert-xs.png +0 -0
  130. package/stat/assets/images/icon_book.svg +0 -12
  131. package/stat/assets/images/icon_bookmark.svg +0 -12
  132. package/stat/assets/images/icon_close-pop.png +0 -0
  133. package/stat/assets/images/icon_download.png +0 -0
  134. package/stat/assets/images/icon_gear.svg +0 -14
  135. package/stat/assets/images/icon_hamburger.svg +0 -20
  136. package/stat/assets/images/icon_home.png +0 -0
  137. package/stat/assets/images/icon_home.svg +0 -21
  138. package/stat/assets/images/icon_home_ia.png +0 -0
  139. package/stat/assets/images/icon_indicator.png +0 -0
  140. package/stat/assets/images/icon_info.svg +0 -11
  141. package/stat/assets/images/icon_one_page.svg +0 -8
  142. package/stat/assets/images/icon_pause.svg +0 -1
  143. package/stat/assets/images/icon_play.svg +0 -1
  144. package/stat/assets/images/icon_playback-rate.svg +0 -15
  145. package/stat/assets/images/icon_return.png +0 -0
  146. package/stat/assets/images/icon_search_button.svg +0 -8
  147. package/stat/assets/images/icon_share.svg +0 -9
  148. package/stat/assets/images/icon_skip-ahead.svg +0 -6
  149. package/stat/assets/images/icon_skip-back.svg +0 -13
  150. package/stat/assets/images/icon_speaker.svg +0 -18
  151. package/stat/assets/images/icon_speaker_open.svg +0 -10
  152. package/stat/assets/images/icon_thumbnails.svg +0 -12
  153. package/stat/assets/images/icon_toc.svg +0 -5
  154. package/stat/assets/images/icon_two_pages.svg +0 -9
  155. package/stat/assets/images/icon_zoomer.png +0 -0
  156. package/stat/assets/images/loading.gif +0 -0
  157. package/stat/assets/images/logo_icon.png +0 -0
  158. package/stat/assets/images/marker_chap-off.png +0 -0
  159. package/stat/assets/images/marker_chap-off.svg +0 -11
  160. package/stat/assets/images/marker_chap-off_ia.png +0 -0
  161. package/stat/assets/images/marker_chap-on.png +0 -0
  162. package/stat/assets/images/marker_chap-on.svg +0 -11
  163. package/stat/assets/images/marker_srch-on.svg +0 -11
  164. package/stat/assets/images/marker_srchchap-off.png +0 -0
  165. package/stat/assets/images/marker_srchchap-on.png +0 -0
  166. package/stat/assets/images/nav_control-dn.png +0 -0
  167. package/stat/assets/images/nav_control-dn_ia.png +0 -0
  168. package/stat/assets/images/nav_control-up.png +0 -0
  169. package/stat/assets/images/nav_control-up_ia.png +0 -0
  170. package/stat/assets/images/nav_control.png +0 -0
  171. package/stat/assets/images/one_page_mode_icon.png +0 -0
  172. package/stat/assets/images/paper-badge.png +0 -0
  173. package/stat/assets/images/print_icon.png +0 -0
  174. package/stat/assets/images/progressbar.gif +0 -0
  175. package/stat/assets/images/right_edges.png +0 -0
  176. package/stat/assets/images/slider.png +0 -0
  177. package/stat/assets/images/slider_ia.png +0 -0
  178. package/stat/assets/images/thumbnail_mode_icon.png +0 -0
  179. package/stat/assets/images/transparent.png +0 -0
  180. package/stat/assets/images/two_page_mode_icon.png +0 -0
  181. package/stat/assets/images/zoom_in_icon.png +0 -0
  182. package/stat/assets/images/zoom_out_icon.png +0 -0
  183. package/stat/css/BookReader.scss +0 -89
  184. package/stat/css/_BRBookmarks.scss +0 -29
  185. package/stat/css/_BRComponent.scss +0 -13
  186. package/stat/css/_BRfloat.scss +0 -197
  187. package/stat/css/_BRicon.scss +0 -48
  188. package/stat/css/_BRmain.scss +0 -251
  189. package/stat/css/_BRnav.scss +0 -359
  190. package/stat/css/_BRpages.scss +0 -139
  191. package/stat/css/_BRsearch.scss +0 -226
  192. package/stat/css/_BRtoolbar.scss +0 -84
  193. package/stat/css/_BRvendor.scss +0 -5
  194. package/stat/css/_MobileNav.scss +0 -194
  195. package/stat/css/_TextSelection.scss +0 -32
  196. package/stat/css/_colorbox.scss +0 -52
  197. package/stat/css/_controls.scss +0 -253
  198. package/stat/css/_icons.scss +0 -121
  199. package/stat/jquery-wrapper.js +0 -4
  200. package/stat/plugins/plugin.archive_analytics.js +0 -86
  201. package/stat/plugins/plugin.autoplay.js +0 -129
  202. package/stat/plugins/plugin.chapters.js +0 -248
  203. package/stat/plugins/plugin.iframe.js +0 -48
  204. package/stat/plugins/plugin.mobile_nav.js +0 -288
  205. package/stat/plugins/plugin.resume.js +0 -68
  206. package/stat/plugins/plugin.text_selection.js +0 -291
  207. package/stat/plugins/plugin.url.js +0 -198
  208. package/stat/plugins/plugin.vendor-fullscreen.js +0 -247
  209. package/stat/plugins/search/plugin.search.js +0 -439
  210. package/stat/plugins/search/view.js +0 -439
  211. package/stat/plugins/tts/AbstractTTSEngine.js +0 -249
  212. package/stat/plugins/tts/FestivalTTSEngine.js +0 -169
  213. package/stat/plugins/tts/PageChunk.js +0 -107
  214. package/stat/plugins/tts/PageChunkIterator.js +0 -163
  215. package/stat/plugins/tts/WebTTSEngine.js +0 -357
  216. package/stat/plugins/tts/plugin.tts.js +0 -357
  217. package/stat/plugins/tts/tooltip_dict.js +0 -15
  218. package/stat/plugins/tts/utils.js +0 -91
  219. package/stat/util/browserSniffing.js +0 -30
  220. package/stat/util/debouncer.js +0 -26
  221. package/stat/util/docCookies.js +0 -67
  222. package/stat/util/strings.js +0 -34
@@ -1,360 +0,0 @@
1
- /* eslint-disable class-methods-use-this */
2
- import { nothing } from 'lit-html';
3
- import { css, html, LitElement } from 'lit-element';
4
- import '@internetarchive/ia-activity-indicator/ia-activity-indicator';
5
- import './a-search-result.js';
6
- import checkmarkIcon from '../assets/icon_checkmark.js';
7
- import closeIcon from '../assets/icon_close.js';
8
- import buttonCSS from '../assets/button-base.js';
9
-
10
-
11
- export class IABookSearchResults extends LitElement {
12
- static get properties() {
13
- return {
14
- results: { type: Array },
15
- query: { type: String },
16
- queryInProgress: { type: Boolean },
17
- renderHeader: { type: Boolean },
18
- renderSearchAllFiles: { type: Boolean },
19
- displayResultImages: { type: Boolean },
20
- errorMessage: { type: String },
21
- };
22
- }
23
-
24
- constructor() {
25
- super();
26
-
27
- this.results = [];
28
- this.query = '';
29
- this.queryInProgress = false;
30
- this.renderHeader = false;
31
- this.renderSearchAllFields = false;
32
- this.displayResultImages = false;
33
- this.errorMessage = '';
34
-
35
- this.bindBookReaderListeners();
36
- }
37
-
38
- /** @inheritdoc */
39
- updated() {
40
- this.focusOnInputIfNecessary();
41
- }
42
-
43
- bindBookReaderListeners() {
44
- document.addEventListener('BookReader:SearchCallback', this.setResults.bind(this));
45
- }
46
-
47
- /**
48
- * Provide immediate input focus if there aren't any results displayed
49
- */
50
- focusOnInputIfNecessary() {
51
- if (this.results.length) {
52
- return;
53
- }
54
- const searchInput = this.shadowRoot.querySelector('input[type=\'search\']');
55
- searchInput.focus();
56
- }
57
-
58
- setResults({ detail }) {
59
- this.results = detail.results;
60
- }
61
-
62
- setQuery(e) {
63
- this.query = e.currentTarget.value;
64
- }
65
-
66
- performSearch(e) {
67
- e.preventDefault();
68
- const input = e.currentTarget.querySelector('input[type="search"]');
69
- if (!input || !input.value) {
70
- return;
71
- }
72
- this.dispatchEvent(new CustomEvent('bookSearchInitiated', {
73
- bubbles: true,
74
- composed: true,
75
- detail: {
76
- query: this.query,
77
- },
78
- }));
79
- }
80
-
81
- selectResult() {
82
- this.dispatchEvent(new CustomEvent('closeMenu', {
83
- bubbles: true,
84
- composed: true,
85
- }));
86
- }
87
-
88
- cancelSearch() {
89
- this.queryInProgress = false;
90
- this.dispatchSearchCanceled();
91
- }
92
-
93
- dispatchSearchCanceled() {
94
- this.dispatchEvent(new Event('bookSearchCanceled'));
95
- }
96
-
97
- get resultsCount() {
98
- const count = this.results.length;
99
- return count ? html`<p>(${count} result${count > 1 ? 's' : ''})</p>` : nothing;
100
- }
101
-
102
- get headerSection() {
103
- const header = html`<header>
104
- <h3>Search inside</h3>
105
- ${this.resultsCount}
106
- </header>`;
107
- return this.renderHeader ? header : nothing;
108
- }
109
-
110
- get searchMultipleControls() {
111
- const controls = html`
112
- <input name="all_files" id="all_files" type="checkbox" />
113
- <label class="checkbox" for="all_files">Search all files</label>
114
- `;
115
- return this.renderSearchAllFiles ? controls : nothing;
116
- }
117
-
118
- get loadingIndicator() {
119
- return html`
120
- <div class="loading">
121
- <ia-activity-indicator mode="processing"></ia-activity-indicator>
122
- <p>Searching</p>
123
- <button class="ia-button external cancel-search" @click=${this.cancelSearch}>Cancel</button>
124
- </div>
125
- `;
126
- }
127
-
128
- get resultsSet() {
129
- const resultsClass = this.displayResultImages ? 'show-image' : '';
130
- return html`
131
- <ul class="results ${resultsClass}">
132
- ${this.results.map(match => html`
133
- <book-search-result
134
- .match=${match}
135
- @resultSelected=${this.selectResult}
136
- ></book-search-result>
137
- `)}
138
- </ul>
139
- `;
140
- }
141
-
142
- get searchForm() {
143
- return html`
144
- <form action="" method="get" @submit=${this.performSearch}>
145
- <fieldset>
146
- ${this.searchMultipleControls}
147
- <input
148
- type="search"
149
- name="query"
150
- alt="Search inside this book."
151
- @keyup=${this.setQuery}
152
- .value=${this.query}
153
- />
154
- </fieldset>
155
- </form>
156
- `;
157
- }
158
-
159
- get setErrorMessage() {
160
- return html`
161
- <p class="error-message">${this.errorMessage}</p>
162
- `;
163
- }
164
-
165
- get searchCTA() {
166
- return html`<p class="search-cta"><em>Please enter text to search for</em></p>`;
167
- }
168
-
169
- render() {
170
- const showSearchCTA = (!this.queryInProgress && !this.errorMessage)
171
- && (!this.queryInProgress && !this.results.length);
172
- return html`
173
- ${this.headerSection}
174
- ${this.searchForm}
175
- <div class="results-container">
176
- ${this.queryInProgress ? this.loadingIndicator : nothing}
177
- ${this.errorMessage ? this.setErrorMessage : nothing}
178
- ${this.results.length ? this.resultsSet : nothing}
179
- ${showSearchCTA ? this.searchCTA : nothing}
180
- </div>
181
- `;
182
- }
183
-
184
- static get styles() {
185
- const searchResultText = css`var(--searchResultText, #adaedc)`;
186
- const searchResultBg = css`var(--searchResultBg, #272958)`;
187
- const searchResultBorder = css`var(--searchResultBorder, #adaedc)`;
188
- const activeButtonBg = css`(--tertiaryBGColor, #333)`;
189
-
190
- const mainCSS = css`
191
- :host {
192
- display: block;
193
- height: 100%;
194
- padding: 1.5rem 1rem 2rem 0;
195
- overflow-y: auto;
196
- font-size: 1.4rem;
197
- box-sizing: border-box;
198
- }
199
-
200
- mark {
201
- padding: 0 .2rem;
202
- color: ${searchResultText};
203
- background: ${searchResultBg};
204
- border: 1px solid ${searchResultBorder};
205
- border-radius: 2px;
206
- }
207
-
208
- h3 {
209
- padding: 0;
210
- margin: 0 1rem 0 0;
211
- font-size: 2rem;
212
- }
213
-
214
- header {
215
- display: flex;
216
- align-items: center;
217
- padding: 0 2rem 0 0;
218
- }
219
- header p {
220
- padding: 0;
221
- margin: 0;
222
- font-size: 1.2rem;
223
- font-weight: bold;
224
- font-style: italic;
225
- }
226
-
227
- fieldset {
228
- padding: 0 0 1rem 0;
229
- border: none;
230
- }
231
-
232
- [type="checkbox"] {
233
- display: none;
234
- }
235
-
236
- label {
237
- display: block;
238
- text-align: center;
239
- }
240
-
241
- label.checkbox {
242
- padding-bottom: .5rem;
243
- font-size: 1.6rem;
244
- line-height: 150%;
245
- vertical-align: middle;
246
- }
247
-
248
- label.checkbox:after {
249
- display: inline-block;
250
- width: 14px;
251
- height: 14px;
252
- margin-left: .7rem;
253
- content: "";
254
- border-radius: 2px;
255
- }
256
- :checked + label.checkbox:after {
257
- background-image: url('${checkmarkIcon}');
258
- }
259
-
260
- label.checkbox[for="all_files"]:after {
261
- background: ${activeButtonBg} 50% 50% no-repeat;
262
- border: 1px solid var(--primaryTextColor);
263
- }
264
-
265
- [type="search"] {
266
- color: var(--primaryTextColor);
267
- border: 1px solid var(--primaryTextColor);
268
- -webkit-appearance: textfield;
269
- width: 100%;
270
- height: 3rem;
271
- padding: 0 1.5rem;
272
- box-sizing: border-box;
273
- font: normal 1.6rem "Helvetica qNeue", Helvetica, Arial, sans-serif;
274
- border-radius: 1.5rem;
275
- background: transparent;
276
- }
277
- [type="search"]:focus {
278
- outline: none;
279
- }
280
- [type="search"]::-webkit-search-cancel-button {
281
- width: 18px;
282
- height: 18px;
283
- -webkit-appearance: none;
284
- appearance: none;
285
- -webkit-mask: url('${closeIcon}') 0 0 no-repeat;
286
- mask: url('${closeIcon}') 0 0 no-repeat;
287
- -webkit-mask-size: 100%;
288
- mask-size: 100%;
289
- background: #fff;
290
- }
291
-
292
- p.page-num {
293
- font-weight: bold;
294
- padding-bottom: 0;
295
- }
296
-
297
- p.search-cta {
298
- text-align: center;
299
- }
300
-
301
- .results-container {
302
- padding-bottom: 2rem;
303
- }
304
-
305
- ul {
306
- padding: 0 0 2rem 0;
307
- margin: 0;
308
- list-style: none;
309
- }
310
-
311
- ul.show-image li {
312
- display: grid;
313
- }
314
-
315
- li {
316
- cursor: pointer;
317
- grid-template-columns: 30px 1fr;
318
- grid-gap: 0 .5rem;
319
- }
320
-
321
- li img {
322
- display: block;
323
- width: 100%;
324
- }
325
-
326
- li h4 {
327
- grid-column: 2 / 3;
328
- padding: 0 0 2rem 0;
329
- margin: 0;
330
- font-weight: normal;
331
- }
332
-
333
- li p {
334
- grid-column: 2 / 3;
335
- padding: 0 0 1.5rem 0;
336
- margin: 0;
337
- font-size: 1.2rem;
338
- }
339
-
340
- .loading {
341
- text-align: center;
342
- }
343
-
344
- .loading p {
345
- padding: 0 0 1rem 0;
346
- margin: 0;
347
- font-size: 1.2rem;
348
- }
349
-
350
- ia-activity-indicator {
351
- display: block;
352
- width: 40px;
353
- height: 40px;
354
- margin: 0 auto;
355
- }
356
- `;
357
- return [buttonCSS, mainCSS];
358
- }
359
- }
360
- customElements.define('ia-book-search-results', IABookSearchResults);
@@ -1,31 +0,0 @@
1
- import { html } from 'lit-element';
2
- import '@internetarchive/icon-share/icon-share';
3
- import '@internetarchive/ia-sharing-options';
4
-
5
- export default class {
6
- constructor(metadata = {}, baseHost, baseItemType, subPrefix = '') {
7
- const { identifier, creator, title } = metadata;
8
- const encodedSubPrefix = encodeURIComponent(subPrefix);
9
- const urlIdentifier = subPrefix && (subPrefix !== identifier) ? `${identifier}/${encodedSubPrefix}` : identifier;
10
- this.idPath = urlIdentifier;
11
- this.itemType = baseItemType;
12
- const label = `Share this ${this.reconcileItemType}`;
13
- this.icon = html`<ia-icon-share style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon-share>`;
14
- this.label = label;
15
- this.id = 'share';
16
- this.component = html`<ia-sharing-options
17
- identifier="${urlIdentifier}"
18
- type="book"
19
- creator="${creator}"
20
- description="${title}"
21
- baseHost="${baseHost}"
22
- ></ia-sharing-options>`;
23
- }
24
-
25
- get reconcileItemType() {
26
- if (this.itemType === 'bookreader') {
27
- return 'book';
28
- }
29
- return 'item';
30
- }
31
- }
@@ -1,94 +0,0 @@
1
- import { html } from 'lit-element';
2
- import '@internetarchive/icon-visual-adjustment/icon-visual-adjustment';
3
- import './visual-adjustments';
4
-
5
- const visualAdjustmentOptions = [{
6
- id: 'brightness',
7
- name: 'Adjust brightness',
8
- active: false,
9
- min: 0,
10
- max: 150,
11
- step: 1,
12
- value: 100,
13
- }, {
14
- id: 'contrast',
15
- name: 'Adjust contrast',
16
- active: false,
17
- min: 0,
18
- max: 150,
19
- step: 1,
20
- value: 100,
21
- }, {
22
- id: 'invert',
23
- name: 'Inverted colors (dark mode)',
24
- active: false,
25
- }, {
26
- id: 'grayscale',
27
- name: 'Grayscale',
28
- active: false,
29
- }];
30
-
31
- export default class {
32
- constructor(options) {
33
- const { onOptionChange = () => {}, bookContainerSelector, bookreader } = options;
34
- this.onOptionChange = onOptionChange;
35
- this.bookContainerSelector = bookContainerSelector;
36
- this.bookreader = bookreader;
37
-
38
- this.onAdjustmentChange = this.onAdjustmentChange.bind(this);
39
- this.optionUpdateComplete = this.optionUpdateComplete.bind(this);
40
- this.updateOptionsCount = this.updateOptionsCount.bind(this);
41
- this.onZoomIn = this.onZoomIn.bind(this);
42
- this.onZoomOut = this.onZoomOut.bind(this);
43
-
44
- this.activeCount = 0;
45
- this.icon = html`<ia-icon-visual-adjustment style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon-visual-adjustment>`;
46
- this.label = 'Visual Adjustments';
47
- this.menuDetails = this.updateOptionsCount();
48
- this.id = 'adjustment';
49
- this.component = html`
50
- <ia-book-visual-adjustments
51
- .options=${visualAdjustmentOptions}
52
- @visualAdjustmentOptionChanged=${this.onAdjustmentChange}
53
- @visualAdjustmentZoomIn=${this.onZoomIn}
54
- @visualAdjustmentZoomOut=${this.onZoomOut}
55
- ></ia-book-visual-adjustments>
56
- `;
57
- }
58
-
59
- onZoomIn() {
60
- this.bookreader.zoom(1);
61
- }
62
-
63
- onZoomOut() {
64
- this.bookreader.zoom(-1);
65
- }
66
-
67
- onAdjustmentChange(event) {
68
- const { detail } = event;
69
- const adjustments = {
70
- brightness: (value) => `brightness(${value}%)`,
71
- contrast: (value) => `contrast(${value}%)`,
72
- grayscale: () => 'grayscale(100%)',
73
- invert: () => 'invert(100%)',
74
- };
75
- const filters = detail.options.reduce((values, option) => {
76
- const newValue = `${option.active ? adjustments[option.id](option.value) : ''}`;
77
- return newValue ? [...values, newValue] : values;
78
- }, []).join(' ');
79
-
80
- document.querySelector(this.bookContainerSelector).style.setProperty('filter', filters);
81
-
82
- this.optionUpdateComplete(event);
83
- }
84
-
85
- optionUpdateComplete(event) {
86
- this.activeCount = event.detail.activeCount;
87
- this.updateOptionsCount(event);
88
- this.onOptionChange(event);
89
- }
90
-
91
- updateOptionsCount() {
92
- this.menuDetails = `(${this.activeCount} active)`;
93
- }
94
- }