@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.
- package/BookReader/BookReader.css +8 -0
- package/BookReader/BookReader.js +1 -1
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/ia-bookreader-bundle.js +99 -75
- package/BookReader/ia-bookreader-bundle.js.map +1 -1
- package/BookReader/icons/magnify-minus.svg +1 -1
- package/BookReader/icons/magnify-plus.svg +1 -1
- package/BookReader/plugins/plugin.autoplay.js +1 -1
- package/BookReader/plugins/plugin.autoplay.js.map +1 -1
- package/BookReader/plugins/plugin.chapters.js +1 -1
- package/BookReader/plugins/plugin.chapters.js.map +1 -1
- package/BookReader/plugins/plugin.mobile_nav.js +1 -1
- package/BookReader/plugins/plugin.mobile_nav.js.map +1 -1
- package/BookReader/plugins/plugin.resume.js +1 -1
- package/BookReader/plugins/plugin.resume.js.map +1 -1
- package/BookReader/plugins/plugin.search.js +1 -1
- package/BookReader/plugins/plugin.search.js.map +1 -1
- package/BookReader/plugins/plugin.text_selection.js +1 -1
- package/BookReader/plugins/plugin.text_selection.js.map +1 -1
- package/BookReader/plugins/plugin.tts.js +1 -1
- package/BookReader/plugins/plugin.tts.js.map +1 -1
- package/BookReader/plugins/plugin.url.js +1 -1
- package/BookReader/plugins/plugin.url.js.map +1 -1
- package/CHANGELOG.md +5 -0
- package/README.md +13 -0
- package/package.json +14 -14
- package/renovate.json +1 -1
- package/src/BookReader/Mode1UpLit.js +7 -1
- package/src/BookReader/Mode2Up.js +11 -0
- package/src/BookReader/ModeSmoothZoom.js +2 -0
- package/src/BookReader/PageContainer.js +10 -4
- package/src/BookReader/utils/ScrollClassAdder.js +31 -0
- package/src/assets/icons/magnify-minus.svg +3 -7
- package/src/assets/icons/magnify-plus.svg +3 -7
- package/src/css/_TextSelection.scss +13 -0
- package/tests/jest/BookReader/PageContainer.test.js +5 -4
- package/tests/jest/BookReader/utils/ScrollClassAdder.test.js +49 -0
- package/.husky/_/husky.sh +0 -30
- package/stat/BookNavigator/BookModel.js +0 -14
- package/stat/BookNavigator/BookNavigator.js +0 -524
- package/stat/BookNavigator/assets/bookmark-colors.js +0 -15
- package/stat/BookNavigator/assets/button-base.js +0 -61
- package/stat/BookNavigator/assets/ia-logo.js +0 -17
- package/stat/BookNavigator/assets/icon_checkmark.js +0 -6
- package/stat/BookNavigator/assets/icon_close.js +0 -3
- package/stat/BookNavigator/assets/icon_sort_asc.js +0 -5
- package/stat/BookNavigator/assets/icon_sort_desc.js +0 -5
- package/stat/BookNavigator/assets/icon_sort_neutral.js +0 -5
- package/stat/BookNavigator/assets/icon_volumes.js +0 -11
- package/stat/BookNavigator/bookmarks/bookmark-button.js +0 -64
- package/stat/BookNavigator/bookmarks/bookmark-edit.js +0 -215
- package/stat/BookNavigator/bookmarks/bookmarks-list.js +0 -285
- package/stat/BookNavigator/bookmarks/bookmarks-loginCTA.js +0 -28
- package/stat/BookNavigator/bookmarks/bookmarks-provider.js +0 -56
- package/stat/BookNavigator/bookmarks/ia-bookmarks.js +0 -523
- package/stat/BookNavigator/br-fullscreen-mgr.js +0 -82
- package/stat/BookNavigator/delete-modal-actions.js +0 -49
- package/stat/BookNavigator/downloads/downloads-provider.js +0 -72
- package/stat/BookNavigator/downloads/downloads.js +0 -139
- package/stat/BookNavigator/provider-config.js +0 -0
- package/stat/BookNavigator/search/a-search-result.js +0 -55
- package/stat/BookNavigator/search/search-provider.js +0 -180
- package/stat/BookNavigator/search/search-results.js +0 -360
- package/stat/BookNavigator/sharing.js +0 -31
- package/stat/BookNavigator/visual-adjustments/visual-adjustments-provider.js +0 -94
- package/stat/BookNavigator/visual-adjustments/visual-adjustments.js +0 -280
- package/stat/BookNavigator/volumes/volumes-provider.js +0 -83
- package/stat/BookNavigator/volumes/volumes.js +0 -178
- package/stat/BookReader/BookModel.js +0 -518
- package/stat/BookReader/DebugConsole.js +0 -54
- package/stat/BookReader/DragScrollable.js +0 -233
- package/stat/BookReader/ImageCache.js +0 -116
- package/stat/BookReader/Mode1Up.js +0 -102
- package/stat/BookReader/Mode1UpLit.js +0 -434
- package/stat/BookReader/Mode2Up.js +0 -1372
- package/stat/BookReader/ModeSmoothZoom.js +0 -177
- package/stat/BookReader/ModeThumb.js +0 -344
- package/stat/BookReader/Navbar/Navbar.js +0 -310
- package/stat/BookReader/PageContainer.js +0 -120
- package/stat/BookReader/ReduceSet.js +0 -26
- package/stat/BookReader/Toolbar/Toolbar.js +0 -384
- package/stat/BookReader/events.js +0 -20
- package/stat/BookReader/options.js +0 -324
- package/stat/BookReader/utils/HTMLDimensionsCacher.js +0 -44
- package/stat/BookReader/utils/classes.js +0 -36
- package/stat/BookReader/utils.js +0 -240
- package/stat/BookReader.js +0 -2550
- package/stat/BookReaderComponent/BookReaderComponent.js +0 -117
- package/stat/assets/icons/1up.svg +0 -12
- package/stat/assets/icons/2up.svg +0 -15
- package/stat/assets/icons/advance.svg +0 -26
- package/stat/assets/icons/chevron-right.svg +0 -1
- package/stat/assets/icons/close-circle-dark.svg +0 -1
- package/stat/assets/icons/close-circle.svg +0 -1
- package/stat/assets/icons/fullscreen.svg +0 -17
- package/stat/assets/icons/fullscreen_exit.svg +0 -17
- package/stat/assets/icons/hamburger.svg +0 -15
- package/stat/assets/icons/left-arrow.svg +0 -12
- package/stat/assets/icons/magnify-minus.svg +0 -16
- package/stat/assets/icons/magnify-plus.svg +0 -17
- package/stat/assets/icons/magnify.svg +0 -15
- package/stat/assets/icons/pause.svg +0 -23
- package/stat/assets/icons/play.svg +0 -22
- package/stat/assets/icons/playback-speed.svg +0 -34
- package/stat/assets/icons/read-aloud.svg +0 -22
- package/stat/assets/icons/review.svg +0 -22
- package/stat/assets/icons/thumbnails.svg +0 -17
- package/stat/assets/icons/voice.svg +0 -1
- package/stat/assets/icons/volume-full.svg +0 -22
- package/stat/assets/images/BRicons.png +0 -0
- package/stat/assets/images/BRicons.svg +0 -94
- package/stat/assets/images/BRicons_ia.png +0 -0
- package/stat/assets/images/back_pages.png +0 -0
- package/stat/assets/images/book_bottom_icon.png +0 -0
- package/stat/assets/images/book_down_icon.png +0 -0
- package/stat/assets/images/book_left_icon.png +0 -0
- package/stat/assets/images/book_leftmost_icon.png +0 -0
- package/stat/assets/images/book_right_icon.png +0 -0
- package/stat/assets/images/book_rightmost_icon.png +0 -0
- package/stat/assets/images/book_top_icon.png +0 -0
- package/stat/assets/images/book_up_icon.png +0 -0
- package/stat/assets/images/books_graphic.svg +0 -177
- package/stat/assets/images/booksplit.png +0 -0
- package/stat/assets/images/control_pause_icon.png +0 -0
- package/stat/assets/images/control_play_icon.png +0 -0
- package/stat/assets/images/embed_icon.png +0 -0
- package/stat/assets/images/icon-home-ia.png +0 -0
- package/stat/assets/images/icon_OL-logo-xs.png +0 -0
- package/stat/assets/images/icon_alert-xs.png +0 -0
- package/stat/assets/images/icon_book.svg +0 -12
- package/stat/assets/images/icon_bookmark.svg +0 -12
- package/stat/assets/images/icon_close-pop.png +0 -0
- package/stat/assets/images/icon_download.png +0 -0
- package/stat/assets/images/icon_gear.svg +0 -14
- package/stat/assets/images/icon_hamburger.svg +0 -20
- package/stat/assets/images/icon_home.png +0 -0
- package/stat/assets/images/icon_home.svg +0 -21
- package/stat/assets/images/icon_home_ia.png +0 -0
- package/stat/assets/images/icon_indicator.png +0 -0
- package/stat/assets/images/icon_info.svg +0 -11
- package/stat/assets/images/icon_one_page.svg +0 -8
- package/stat/assets/images/icon_pause.svg +0 -1
- package/stat/assets/images/icon_play.svg +0 -1
- package/stat/assets/images/icon_playback-rate.svg +0 -15
- package/stat/assets/images/icon_return.png +0 -0
- package/stat/assets/images/icon_search_button.svg +0 -8
- package/stat/assets/images/icon_share.svg +0 -9
- package/stat/assets/images/icon_skip-ahead.svg +0 -6
- package/stat/assets/images/icon_skip-back.svg +0 -13
- package/stat/assets/images/icon_speaker.svg +0 -18
- package/stat/assets/images/icon_speaker_open.svg +0 -10
- package/stat/assets/images/icon_thumbnails.svg +0 -12
- package/stat/assets/images/icon_toc.svg +0 -5
- package/stat/assets/images/icon_two_pages.svg +0 -9
- package/stat/assets/images/icon_zoomer.png +0 -0
- package/stat/assets/images/loading.gif +0 -0
- package/stat/assets/images/logo_icon.png +0 -0
- package/stat/assets/images/marker_chap-off.png +0 -0
- package/stat/assets/images/marker_chap-off.svg +0 -11
- package/stat/assets/images/marker_chap-off_ia.png +0 -0
- package/stat/assets/images/marker_chap-on.png +0 -0
- package/stat/assets/images/marker_chap-on.svg +0 -11
- package/stat/assets/images/marker_srch-on.svg +0 -11
- package/stat/assets/images/marker_srchchap-off.png +0 -0
- package/stat/assets/images/marker_srchchap-on.png +0 -0
- package/stat/assets/images/nav_control-dn.png +0 -0
- package/stat/assets/images/nav_control-dn_ia.png +0 -0
- package/stat/assets/images/nav_control-up.png +0 -0
- package/stat/assets/images/nav_control-up_ia.png +0 -0
- package/stat/assets/images/nav_control.png +0 -0
- package/stat/assets/images/one_page_mode_icon.png +0 -0
- package/stat/assets/images/paper-badge.png +0 -0
- package/stat/assets/images/print_icon.png +0 -0
- package/stat/assets/images/progressbar.gif +0 -0
- package/stat/assets/images/right_edges.png +0 -0
- package/stat/assets/images/slider.png +0 -0
- package/stat/assets/images/slider_ia.png +0 -0
- package/stat/assets/images/thumbnail_mode_icon.png +0 -0
- package/stat/assets/images/transparent.png +0 -0
- package/stat/assets/images/two_page_mode_icon.png +0 -0
- package/stat/assets/images/zoom_in_icon.png +0 -0
- package/stat/assets/images/zoom_out_icon.png +0 -0
- package/stat/css/BookReader.scss +0 -89
- package/stat/css/_BRBookmarks.scss +0 -29
- package/stat/css/_BRComponent.scss +0 -13
- package/stat/css/_BRfloat.scss +0 -197
- package/stat/css/_BRicon.scss +0 -48
- package/stat/css/_BRmain.scss +0 -251
- package/stat/css/_BRnav.scss +0 -359
- package/stat/css/_BRpages.scss +0 -139
- package/stat/css/_BRsearch.scss +0 -226
- package/stat/css/_BRtoolbar.scss +0 -84
- package/stat/css/_BRvendor.scss +0 -5
- package/stat/css/_MobileNav.scss +0 -194
- package/stat/css/_TextSelection.scss +0 -32
- package/stat/css/_colorbox.scss +0 -52
- package/stat/css/_controls.scss +0 -253
- package/stat/css/_icons.scss +0 -121
- package/stat/jquery-wrapper.js +0 -4
- package/stat/plugins/plugin.archive_analytics.js +0 -86
- package/stat/plugins/plugin.autoplay.js +0 -129
- package/stat/plugins/plugin.chapters.js +0 -248
- package/stat/plugins/plugin.iframe.js +0 -48
- package/stat/plugins/plugin.mobile_nav.js +0 -288
- package/stat/plugins/plugin.resume.js +0 -68
- package/stat/plugins/plugin.text_selection.js +0 -291
- package/stat/plugins/plugin.url.js +0 -198
- package/stat/plugins/plugin.vendor-fullscreen.js +0 -247
- package/stat/plugins/search/plugin.search.js +0 -439
- package/stat/plugins/search/view.js +0 -439
- package/stat/plugins/tts/AbstractTTSEngine.js +0 -249
- package/stat/plugins/tts/FestivalTTSEngine.js +0 -169
- package/stat/plugins/tts/PageChunk.js +0 -107
- package/stat/plugins/tts/PageChunkIterator.js +0 -163
- package/stat/plugins/tts/WebTTSEngine.js +0 -357
- package/stat/plugins/tts/plugin.tts.js +0 -357
- package/stat/plugins/tts/tooltip_dict.js +0 -15
- package/stat/plugins/tts/utils.js +0 -91
- package/stat/util/browserSniffing.js +0 -30
- package/stat/util/debouncer.js +0 -26
- package/stat/util/docCookies.js +0 -67
- package/stat/util/strings.js +0 -34
@@ -1,280 +0,0 @@
|
|
1
|
-
import { css, html, LitElement } from "lit-element";
|
2
|
-
import { repeat } from "lit-html/directives/repeat.js";
|
3
|
-
import { nothing } from "lit-html";
|
4
|
-
import checkmarkIcon from '../assets/icon_checkmark.js';
|
5
|
-
import "@internetarchive/icon-magnify-minus/icon-magnify-minus";
|
6
|
-
import "@internetarchive/icon-magnify-plus/icon-magnify-plus";
|
7
|
-
|
8
|
-
const namespacedEvent = (eventName) => `visualAdjustment${eventName}`;
|
9
|
-
|
10
|
-
const events = {
|
11
|
-
optionChange: namespacedEvent("OptionChanged"),
|
12
|
-
zoomIn: namespacedEvent("ZoomIn"),
|
13
|
-
zoomOut: namespacedEvent("ZoomOut"),
|
14
|
-
};
|
15
|
-
|
16
|
-
export class IABookVisualAdjustments extends LitElement {
|
17
|
-
static get properties() {
|
18
|
-
return {
|
19
|
-
activeCount: { type: Number },
|
20
|
-
options: { type: Array },
|
21
|
-
renderHeader: { type: Boolean },
|
22
|
-
showZoomControls: { type: Boolean },
|
23
|
-
};
|
24
|
-
}
|
25
|
-
|
26
|
-
constructor() {
|
27
|
-
super();
|
28
|
-
|
29
|
-
this.activeCount = 0;
|
30
|
-
this.options = [];
|
31
|
-
this.renderHeader = false;
|
32
|
-
this.showZoomControls = true;
|
33
|
-
}
|
34
|
-
|
35
|
-
firstUpdated() {
|
36
|
-
this.activeCount = this.activeOptions.length;
|
37
|
-
this.emitOptionChangedEvent();
|
38
|
-
}
|
39
|
-
|
40
|
-
/** Gets list of active options
|
41
|
-
* @return array
|
42
|
-
*/
|
43
|
-
get activeOptions() {
|
44
|
-
return this.options.reduce(
|
45
|
-
(results, option) => (option.active ? [...results, option.id] : results),
|
46
|
-
[]
|
47
|
-
);
|
48
|
-
}
|
49
|
-
|
50
|
-
/**
|
51
|
-
* Returns blob that will be emitted by event
|
52
|
-
*/
|
53
|
-
prepareEventDetails(changedOptionId = "") {
|
54
|
-
return {
|
55
|
-
options: this.options,
|
56
|
-
activeCount: this.activeCount,
|
57
|
-
changedOptionId,
|
58
|
-
};
|
59
|
-
}
|
60
|
-
|
61
|
-
/**
|
62
|
-
* Fires custom event when options change
|
63
|
-
* Provides state details: { options, activeCount, changedOptionId }
|
64
|
-
*
|
65
|
-
* @param { string } changedOptionId
|
66
|
-
*/
|
67
|
-
emitOptionChangedEvent(changedOptionId = "") {
|
68
|
-
const detail = this.prepareEventDetails(changedOptionId);
|
69
|
-
this.dispatchEvent(
|
70
|
-
new CustomEvent(events.optionChange, {
|
71
|
-
bubbles: true,
|
72
|
-
composed: true,
|
73
|
-
detail,
|
74
|
-
})
|
75
|
-
);
|
76
|
-
}
|
77
|
-
|
78
|
-
emitZoomIn() {
|
79
|
-
this.dispatchEvent(new CustomEvent(events.zoomIn));
|
80
|
-
}
|
81
|
-
|
82
|
-
emitZoomOut() {
|
83
|
-
this.dispatchEvent(new CustomEvent(events.zoomOut));
|
84
|
-
}
|
85
|
-
|
86
|
-
/**
|
87
|
-
* Updates adjustment & component state
|
88
|
-
* updates params of available ajdustment options list
|
89
|
-
* updates active adjustment count
|
90
|
-
* triggers custom event
|
91
|
-
* @param { string } optionName
|
92
|
-
*/
|
93
|
-
changeActiveStateFor(optionName) {
|
94
|
-
const updatedOptions = [...this.options];
|
95
|
-
const checkedOption = updatedOptions.find(
|
96
|
-
(option) => option.id === optionName
|
97
|
-
);
|
98
|
-
checkedOption.active = !checkedOption.active;
|
99
|
-
this.options = updatedOptions;
|
100
|
-
this.activeCount = this.activeOptions.length;
|
101
|
-
this.emitOptionChangedEvent(checkedOption.id);
|
102
|
-
}
|
103
|
-
|
104
|
-
setRangeValue(id, value) {
|
105
|
-
const updatedOptions = [...this.options];
|
106
|
-
updatedOptions.find((o) => o.id === id).value = value;
|
107
|
-
this.options = [...updatedOptions];
|
108
|
-
}
|
109
|
-
|
110
|
-
/* render */
|
111
|
-
rangeSlider(option) {
|
112
|
-
return html`
|
113
|
-
<div class=${`range${option.active ? " visible" : ""}`}>
|
114
|
-
<input
|
115
|
-
type="range"
|
116
|
-
name="${option.id}_range"
|
117
|
-
min=${option.min || 0}
|
118
|
-
max=${option.max || 100}
|
119
|
-
step=${option.step || 1}
|
120
|
-
.value=${option.value}
|
121
|
-
@input=${(e) => this.setRangeValue(option.id, e.target.value)}
|
122
|
-
@change=${() => this.emitOptionChangedEvent()}
|
123
|
-
/>
|
124
|
-
<p>${option.value}%</p>
|
125
|
-
</div>
|
126
|
-
`;
|
127
|
-
}
|
128
|
-
|
129
|
-
adjustmentCheckbox(option) {
|
130
|
-
const formID = `adjustment_${option.id}`;
|
131
|
-
return html`<li>
|
132
|
-
<label for="${formID}">
|
133
|
-
<span class="name">${option.name}</span>
|
134
|
-
<input
|
135
|
-
type="checkbox"
|
136
|
-
name="${formID}"
|
137
|
-
id="${formID}"
|
138
|
-
@change=${() => this.changeActiveStateFor(option.id)}
|
139
|
-
?checked=${option.active}
|
140
|
-
/>
|
141
|
-
<span class="icon"></span>
|
142
|
-
</label>
|
143
|
-
${option.value !== undefined ? this.rangeSlider(option) : nothing}
|
144
|
-
</li>`;
|
145
|
-
}
|
146
|
-
|
147
|
-
get headerSection() {
|
148
|
-
const activeAdjustments = this.activeCount
|
149
|
-
? html`<p>(${this.activeCount} active)</p>`
|
150
|
-
: nothing;
|
151
|
-
const header = html`<header>
|
152
|
-
<h3>Visual adjustments</h3>
|
153
|
-
${activeAdjustments}
|
154
|
-
</header>`;
|
155
|
-
return this.renderHeader ? header : nothing;
|
156
|
-
}
|
157
|
-
|
158
|
-
get zoomControls() {
|
159
|
-
return html`
|
160
|
-
<h4>Zoom</h4>
|
161
|
-
<button class="zoom_out" @click=${this.emitZoomOut} title="zoom out">
|
162
|
-
<ia-icon-magnify-minus></ia-icon-magnify-minus>
|
163
|
-
</button>
|
164
|
-
<button class="zoom_in" @click=${this.emitZoomIn} title="zoom in">
|
165
|
-
<ia-icon-magnify-plus></ia-icon-magnify-plus>
|
166
|
-
</button>
|
167
|
-
`;
|
168
|
-
}
|
169
|
-
|
170
|
-
/** @inheritdoc */
|
171
|
-
render() {
|
172
|
-
return html`
|
173
|
-
${this.headerSection}
|
174
|
-
<ul>
|
175
|
-
${repeat(this.options, (option) => option.id, this.adjustmentCheckbox.bind(this))}
|
176
|
-
</ul>
|
177
|
-
${this.showZoomControls ? this.zoomControls : nothing}
|
178
|
-
`;
|
179
|
-
}
|
180
|
-
|
181
|
-
static get styles() {
|
182
|
-
return css`
|
183
|
-
:host {
|
184
|
-
display: block;
|
185
|
-
height: 100%;
|
186
|
-
overflow-y: auto;
|
187
|
-
font-size: 1.4rem;
|
188
|
-
box-sizing: border-box;
|
189
|
-
}
|
190
|
-
|
191
|
-
header {
|
192
|
-
display: flex;
|
193
|
-
align-items: baseline;
|
194
|
-
}
|
195
|
-
|
196
|
-
h3 {
|
197
|
-
padding: 0;
|
198
|
-
margin: 0 1rem 0 0;
|
199
|
-
font-size: 1.6rem;
|
200
|
-
}
|
201
|
-
|
202
|
-
header p {
|
203
|
-
padding: 0;
|
204
|
-
margin: 0;
|
205
|
-
font-size: 1.2rem;
|
206
|
-
font-weight: bold;
|
207
|
-
font-style: italic;
|
208
|
-
}
|
209
|
-
|
210
|
-
ul {
|
211
|
-
padding: 1rem 2rem 0 0;
|
212
|
-
list-style: none;
|
213
|
-
margin-top: 0;
|
214
|
-
}
|
215
|
-
|
216
|
-
[type="checkbox"] {
|
217
|
-
display: none;
|
218
|
-
}
|
219
|
-
|
220
|
-
label {
|
221
|
-
display: flex;
|
222
|
-
justify-content: space-between;
|
223
|
-
align-items: baseline;
|
224
|
-
font-size: 1.4rem;
|
225
|
-
font-weight: bold;
|
226
|
-
line-height: 150%;
|
227
|
-
vertical-align: middle;
|
228
|
-
}
|
229
|
-
|
230
|
-
.icon {
|
231
|
-
display: inline-block;
|
232
|
-
width: 14px;
|
233
|
-
height: 14px;
|
234
|
-
margin-left: .7rem;
|
235
|
-
border: 1px solid var(--primaryTextColor);
|
236
|
-
border-radius: 2px;
|
237
|
-
background: var(--activeButtonBg) 50% 50% no-repeat;
|
238
|
-
}
|
239
|
-
:checked + .icon {
|
240
|
-
background-image: url('${checkmarkIcon}');
|
241
|
-
}
|
242
|
-
|
243
|
-
.range {
|
244
|
-
display: none;
|
245
|
-
padding-top: .5rem;
|
246
|
-
}
|
247
|
-
.range.visible {
|
248
|
-
display: flex;
|
249
|
-
}
|
250
|
-
|
251
|
-
.range p {
|
252
|
-
margin-left: 1rem;
|
253
|
-
}
|
254
|
-
|
255
|
-
h4 {
|
256
|
-
padding: 1rem 0;
|
257
|
-
margin: 0;
|
258
|
-
font-size: 1.4rem;
|
259
|
-
}
|
260
|
-
|
261
|
-
button {
|
262
|
-
-webkit-appearance: none;
|
263
|
-
appearance: none;
|
264
|
-
border: none;
|
265
|
-
border-radius: 0;
|
266
|
-
background: transparent;
|
267
|
-
outline: none;
|
268
|
-
cursor: pointer;
|
269
|
-
--iconFillColor: var(--primaryTextColor);
|
270
|
-
--iconStrokeColor: var(--primaryTextColor);
|
271
|
-
height: 4rem;
|
272
|
-
width: 4rem;
|
273
|
-
}
|
274
|
-
|
275
|
-
button * {
|
276
|
-
display: inline-block;
|
277
|
-
}`;
|
278
|
-
}
|
279
|
-
}
|
280
|
-
customElements.define('ia-book-visual-adjustments', IABookVisualAdjustments);
|
@@ -1,83 +0,0 @@
|
|
1
|
-
import { html } from 'lit-element';
|
2
|
-
|
3
|
-
import sortDescIcon from '../assets/icon_sort_desc.js';
|
4
|
-
import sortAscIcon from '../assets/icon_sort_asc.js';
|
5
|
-
import sortNeutralIcon from '../assets/icon_sort_neutral.js';
|
6
|
-
import volumesIcon from '../assets/icon_volumes.js';
|
7
|
-
|
8
|
-
import './volumes.js';
|
9
|
-
|
10
|
-
export default class VolumesProvider {
|
11
|
-
|
12
|
-
constructor(baseHost, bookreader, optionChange) {
|
13
|
-
this.optionChange = optionChange;
|
14
|
-
this.component = document.createElement("viewable-files");
|
15
|
-
|
16
|
-
const files = bookreader.options.multipleBooksList.by_subprefix;
|
17
|
-
this.viewableFiles = Object.keys(files).map(item => files[item]);
|
18
|
-
this.volumeCount = Object.keys(files).length;
|
19
|
-
|
20
|
-
this.component.subPrefix = bookreader.options.subPrefix || "";
|
21
|
-
this.component.hostUrl = baseHost;
|
22
|
-
this.component.viewableFiles = this.viewableFiles;
|
23
|
-
|
24
|
-
this.id = "volumes";
|
25
|
-
this.label = `Viewable files (${this.volumeCount})`;
|
26
|
-
this.icon = html`${volumesIcon}`;
|
27
|
-
|
28
|
-
this.sortOrderBy = "orig_sort";
|
29
|
-
this.sortVolumes("orig_sort");
|
30
|
-
}
|
31
|
-
|
32
|
-
get sortButton() {
|
33
|
-
const sortIcons = {
|
34
|
-
orig_sort: html`
|
35
|
-
<button class="sort-by neutral-icon" aria-label="Sort volumes in initial order" @click=${() => this.sortVolumes("title_asc")}>${sortNeutralIcon}</button>
|
36
|
-
`,
|
37
|
-
title_asc: html`
|
38
|
-
<button class="sort-by asc-icon" aria-label="Sort volumes in ascending order" @click=${() => this.sortVolumes("title_desc")}>${sortAscIcon}</button>
|
39
|
-
`,
|
40
|
-
title_desc: html`
|
41
|
-
<button class="sort-by desc-icon" aria-label="Sort volumes in descending order" @click=${() => this.sortVolumes("orig_sort")}>${sortDescIcon}</button>
|
42
|
-
`,
|
43
|
-
};
|
44
|
-
|
45
|
-
return sortIcons[this.sortOrderBy];
|
46
|
-
}
|
47
|
-
|
48
|
-
/**
|
49
|
-
* @param {'orig_sort' | 'title_asc' | 'title_desc'} sortByType
|
50
|
-
*/
|
51
|
-
sortVolumes(sortByType) {
|
52
|
-
let sortedFiles = [];
|
53
|
-
|
54
|
-
const files = this.viewableFiles;
|
55
|
-
sortedFiles = files.sort((a, b) => {
|
56
|
-
if (sortByType === 'orig_sort') return a.orig_sort - b.orig_sort;
|
57
|
-
else if (sortByType === 'title_asc') return a.title.localeCompare(b.title);
|
58
|
-
else return b.title.localeCompare(a.title);
|
59
|
-
});
|
60
|
-
|
61
|
-
this.sortOrderBy = sortByType;
|
62
|
-
this.component.viewableFiles = [...sortedFiles];
|
63
|
-
this.actionButton = this.sortButton;
|
64
|
-
this.optionChange(this.bookreader);
|
65
|
-
|
66
|
-
this.multipleFilesClicked(sortByType);
|
67
|
-
}
|
68
|
-
|
69
|
-
/**
|
70
|
-
* @param {'orig_sort' | 'title_asc' | 'title_desc'} orderBy
|
71
|
-
*/
|
72
|
-
multipleFilesClicked(orderBy) {
|
73
|
-
if (!window.archive_analytics) {
|
74
|
-
return;
|
75
|
-
}
|
76
|
-
window.archive_analytics?.send_event_no_sampling(
|
77
|
-
'BookReader',
|
78
|
-
`VolumesSort|${orderBy}`,
|
79
|
-
window.location.path,
|
80
|
-
);
|
81
|
-
}
|
82
|
-
|
83
|
-
}
|
@@ -1,178 +0,0 @@
|
|
1
|
-
import { css, html, LitElement } from 'lit-element';
|
2
|
-
import { nothing } from 'lit-html';
|
3
|
-
import { repeat } from 'lit-html/directives/repeat';
|
4
|
-
|
5
|
-
export class Volumes extends LitElement {
|
6
|
-
static get properties() {
|
7
|
-
return {
|
8
|
-
subPrefix: { type: String },
|
9
|
-
hostUrl: { type: String },
|
10
|
-
viewableFiles: { type: Array },
|
11
|
-
};
|
12
|
-
}
|
13
|
-
|
14
|
-
constructor() {
|
15
|
-
super();
|
16
|
-
this.subPrefix = '';
|
17
|
-
this.hostUrl = '';
|
18
|
-
this.viewableFiles = [];
|
19
|
-
}
|
20
|
-
|
21
|
-
firstUpdated() {
|
22
|
-
const activeFile = this.shadowRoot.querySelector('.content.active');
|
23
|
-
// allow for css animations to run before scrolling to active file
|
24
|
-
setTimeout(() => {
|
25
|
-
// scroll active file into view if needed
|
26
|
-
// note: `scrollIntoViewIfNeeded` handles auto-scroll gracefully for Chrome, Safari
|
27
|
-
// Firefox does not have this capability yet as it does not support `scrollIntoViewIfNeeded`
|
28
|
-
if (activeFile?.scrollIntoViewIfNeeded) {
|
29
|
-
activeFile?.scrollIntoViewIfNeeded(true);
|
30
|
-
return;
|
31
|
-
}
|
32
|
-
|
33
|
-
// Todo: support `scrollIntoView` or `parentContainer.crollTop = x` for FF & "IE 11"
|
34
|
-
// currently, the hard `position: absolutes` misaligns subpanel when `scrollIntoView` is applied :(
|
35
|
-
}, 350);
|
36
|
-
}
|
37
|
-
|
38
|
-
volumeItemWithImageTitle(item) {
|
39
|
-
return html`
|
40
|
-
<li class="content active">
|
41
|
-
<div class="separator"></div>
|
42
|
-
<a class="container" href="${this.hostUrl}${item.url_path}">
|
43
|
-
<div class="image">
|
44
|
-
<img src="${item.image}">
|
45
|
-
</div>
|
46
|
-
<div class="text">
|
47
|
-
<p class="item-title">${item.title}</p>
|
48
|
-
<small>by: ${item.author}</small>
|
49
|
-
</div>
|
50
|
-
</a>
|
51
|
-
</li>
|
52
|
-
`;
|
53
|
-
}
|
54
|
-
|
55
|
-
volumeItem(item) {
|
56
|
-
const activeClass = this.subPrefix === item.file_subprefix ? ' active' : '';
|
57
|
-
return html`
|
58
|
-
<li>
|
59
|
-
<div class="separator"></div>
|
60
|
-
<div class="content${activeClass}">
|
61
|
-
<a href="https://${this.hostUrl}${item.url_path}">
|
62
|
-
<p class="item-title">${item.title}</p>
|
63
|
-
</a>
|
64
|
-
</div>
|
65
|
-
</li>
|
66
|
-
`;
|
67
|
-
}
|
68
|
-
|
69
|
-
get volumesList() {
|
70
|
-
const volumes = repeat(this.viewableFiles, volume => volume?.file_prefix, this.volumeItem.bind(this));
|
71
|
-
return html`
|
72
|
-
<ul>
|
73
|
-
${volumes}
|
74
|
-
<div class="separator"></div>
|
75
|
-
</ul>
|
76
|
-
`;
|
77
|
-
}
|
78
|
-
|
79
|
-
render() {
|
80
|
-
return html`
|
81
|
-
${this.viewableFiles.length ? this.volumesList : nothing}
|
82
|
-
`;
|
83
|
-
}
|
84
|
-
|
85
|
-
static get styles() {
|
86
|
-
return css`
|
87
|
-
:host {
|
88
|
-
display: block;
|
89
|
-
overflow-y: auto;
|
90
|
-
box-sizing: border-box;
|
91
|
-
color: var(--primaryTextColor);
|
92
|
-
margin-top: 14px;
|
93
|
-
margin-bottom: 2rem;
|
94
|
-
--activeBorderWidth: 2px;
|
95
|
-
}
|
96
|
-
|
97
|
-
a {
|
98
|
-
color: #ffffff;
|
99
|
-
text-decoration: none
|
100
|
-
}
|
101
|
-
|
102
|
-
img {
|
103
|
-
width: 35px;
|
104
|
-
height: 45px;
|
105
|
-
}
|
106
|
-
|
107
|
-
ul {
|
108
|
-
padding: 0;
|
109
|
-
list-style: none;
|
110
|
-
margin: var(--activeBorderWidth) 0.5rem 1rem 0;
|
111
|
-
}
|
112
|
-
|
113
|
-
ul > li:first-child .separator {
|
114
|
-
display: none;
|
115
|
-
}
|
116
|
-
|
117
|
-
li {
|
118
|
-
cursor: pointer;
|
119
|
-
outline: none;
|
120
|
-
position: relative;
|
121
|
-
}
|
122
|
-
|
123
|
-
li .content {
|
124
|
-
padding: 2px 0 4px 2px;
|
125
|
-
border: var(--activeBorderWidth) solid transparent;
|
126
|
-
padding: .2rem 0 .4rem .2rem;
|
127
|
-
}
|
128
|
-
|
129
|
-
li .content.active {
|
130
|
-
border: var(--activeBorderWidth) solid #538bc5;
|
131
|
-
}
|
132
|
-
|
133
|
-
small {
|
134
|
-
font-style: italic;
|
135
|
-
white-space: initial;
|
136
|
-
}
|
137
|
-
|
138
|
-
.container {
|
139
|
-
display: flex;
|
140
|
-
align-items: center;
|
141
|
-
justify-content: center
|
142
|
-
}
|
143
|
-
|
144
|
-
.item-title {
|
145
|
-
margin-block-start: 0em;
|
146
|
-
margin-block-end: 0em;
|
147
|
-
font-size: 14px;
|
148
|
-
font-weight: bold;
|
149
|
-
word-wrap: break-word;
|
150
|
-
padding-left: 5px;
|
151
|
-
}
|
152
|
-
|
153
|
-
.separator {
|
154
|
-
background-color: var(--secondaryBGColor);
|
155
|
-
width: 98%;
|
156
|
-
margin: 1px auto;
|
157
|
-
height: 1px;
|
158
|
-
}
|
159
|
-
|
160
|
-
.text {
|
161
|
-
padding-left: 10px;
|
162
|
-
}
|
163
|
-
|
164
|
-
.icon {
|
165
|
-
display: inline-block;
|
166
|
-
width: 14px;
|
167
|
-
height: 14px;
|
168
|
-
margin-left: .7rem;
|
169
|
-
border: 1px solid var(--primaryTextColor);
|
170
|
-
border-radius: 2px;
|
171
|
-
background: var(--activeButtonBg) 50% 50% no-repeat;
|
172
|
-
}
|
173
|
-
|
174
|
-
`;
|
175
|
-
}
|
176
|
-
}
|
177
|
-
|
178
|
-
customElements.define('viewable-files', Volumes);
|