@internetarchive/bookreader 5.0.0-88-alpha.10 → 5.0.0-88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BookReader/BookReader.css +3 -3
- package/BookReader/BookReader.js +1 -1
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/ia-bookreader-bundle.js +87 -108
- package/BookReader/ia-bookreader-bundle.js.map +1 -1
- package/BookReader/plugins/plugin.archive_analytics.js +1 -1
- package/BookReader/plugins/plugin.archive_analytics.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 +4 -0
- package/babel.config.js +12 -30
- package/jsconfig.json +1 -3
- package/package.json +14 -16
- package/src/BookNavigator/search/search-results.js +1 -1
- package/src/BookReader/Mode1UpLit.js +56 -86
- package/src/BookReader/Mode2UpLit.js +2 -3
- package/src/BookReader/Navbar/Navbar.js +53 -11
- package/src/BookReader/options.js +3 -0
- package/src/BookReader.js +49 -1
- package/src/BookReaderPlugin.js +28 -0
- package/src/css/_BRnav.scss +0 -3
- package/src/css/_controls.scss +4 -0
- package/src/plugins/plugin.archive_analytics.js +84 -78
- package/src/plugins/plugin.chapters.js +17 -22
- package/src/plugins/plugin.text_selection.js +1 -1
- package/src/plugins/tts/plugin.tts.js +2 -2
- package/tests/jest/BookReader/Navbar/Navbar.test.js +16 -3
- package/tests/jest/plugins/plugin.archive_analytics.test.js +8 -11
- package/dist/esm/BookNavigator/assets/bookmark-colors.js +0 -4
- package/dist/esm/BookNavigator/assets/button-base.js +0 -4
- package/dist/esm/BookNavigator/assets/ia-logo.js +0 -4
- package/dist/esm/BookNavigator/assets/icon_checkmark.js +0 -8
- package/dist/esm/BookNavigator/assets/icon_close.js +0 -4
- package/dist/esm/BookNavigator/book-navigator.js +0 -612
- package/dist/esm/BookNavigator/bookmarks/bookmark-button.js +0 -35
- package/dist/esm/BookNavigator/bookmarks/bookmark-edit.js +0 -78
- package/dist/esm/BookNavigator/bookmarks/bookmarks-list.js +0 -160
- package/dist/esm/BookNavigator/bookmarks/bookmarks-loginCTA.js +0 -24
- package/dist/esm/BookNavigator/bookmarks/bookmarks-provider.js +0 -55
- package/dist/esm/BookNavigator/bookmarks/ia-bookmarks.js +0 -521
- package/dist/esm/BookNavigator/delete-modal-actions.js +0 -29
- package/dist/esm/BookNavigator/downloads/downloads-provider.js +0 -84
- package/dist/esm/BookNavigator/downloads/downloads.js +0 -69
- package/dist/esm/BookNavigator/search/search-provider.js +0 -238
- package/dist/esm/BookNavigator/search/search-results.js +0 -161
- package/dist/esm/BookNavigator/sharing.js +0 -26
- package/dist/esm/BookNavigator/viewable-files.js +0 -94
- package/dist/esm/BookNavigator/visual-adjustments/visual-adjustments-provider.js +0 -83
- package/dist/esm/BookNavigator/visual-adjustments/visual-adjustments.js +0 -131
- package/dist/esm/BookReader/BookModel.js +0 -575
- package/dist/esm/BookReader/DragScrollable.js +0 -224
- package/dist/esm/BookReader/ImageCache.js +0 -122
- package/dist/esm/BookReader/Mode1Up.js +0 -114
- package/dist/esm/BookReader/Mode1UpLit.js +0 -579
- package/dist/esm/BookReader/Mode2Up.js +0 -106
- package/dist/esm/BookReader/Mode2UpLit.js +0 -1020
- package/dist/esm/BookReader/ModeCoordinateSpace.js +0 -28
- package/dist/esm/BookReader/ModeSmoothZoom.js +0 -318
- package/dist/esm/BookReader/ModeThumb.js +0 -366
- package/dist/esm/BookReader/Navbar/Navbar.js +0 -253
- package/dist/esm/BookReader/PageContainer.js +0 -165
- package/dist/esm/BookReader/ReduceSet.js +0 -27
- package/dist/esm/BookReader/Toolbar/Toolbar.js +0 -242
- package/dist/esm/BookReader/events.js +0 -20
- package/dist/esm/BookReader/options.js +0 -331
- package/dist/esm/BookReader/utils/HTMLDimensionsCacher.js +0 -48
- package/dist/esm/BookReader/utils/ScrollClassAdder.js +0 -31
- package/dist/esm/BookReader/utils/SelectionObserver.js +0 -42
- package/dist/esm/BookReader/utils/classes.js +0 -37
- package/dist/esm/BookReader/utils.js +0 -315
- package/dist/esm/BookReader.js +0 -1827
- package/dist/esm/assets/icons/1up.svg +0 -12
- package/dist/esm/assets/icons/2up.svg +0 -15
- package/dist/esm/assets/icons/advance.svg +0 -26
- package/dist/esm/assets/icons/chevron-right.svg +0 -1
- package/dist/esm/assets/icons/close-circle-dark.svg +0 -1
- package/dist/esm/assets/icons/close-circle.svg +0 -1
- package/dist/esm/assets/icons/fullscreen.svg +0 -17
- package/dist/esm/assets/icons/fullscreen_exit.svg +0 -17
- package/dist/esm/assets/icons/hamburger.svg +0 -15
- package/dist/esm/assets/icons/left-arrow.svg +0 -12
- package/dist/esm/assets/icons/magnify-minus.svg +0 -12
- package/dist/esm/assets/icons/magnify-plus.svg +0 -13
- package/dist/esm/assets/icons/magnify.svg +0 -15
- package/dist/esm/assets/icons/pause.svg +0 -23
- package/dist/esm/assets/icons/play.svg +0 -22
- package/dist/esm/assets/icons/playback-speed.svg +0 -34
- package/dist/esm/assets/icons/read-aloud.svg +0 -22
- package/dist/esm/assets/icons/review.svg +0 -22
- package/dist/esm/assets/icons/thumbnails.svg +0 -17
- package/dist/esm/assets/icons/voice.svg +0 -1
- package/dist/esm/assets/icons/volume-full.svg +0 -22
- package/dist/esm/assets/images/BRicons.png +0 -0
- package/dist/esm/assets/images/BRicons.svg +0 -94
- package/dist/esm/assets/images/BRicons_ia.png +0 -0
- package/dist/esm/assets/images/back_pages.png +0 -0
- package/dist/esm/assets/images/book_bottom_icon.png +0 -0
- package/dist/esm/assets/images/book_down_icon.png +0 -0
- package/dist/esm/assets/images/book_left_icon.png +0 -0
- package/dist/esm/assets/images/book_leftmost_icon.png +0 -0
- package/dist/esm/assets/images/book_right_icon.png +0 -0
- package/dist/esm/assets/images/book_rightmost_icon.png +0 -0
- package/dist/esm/assets/images/book_top_icon.png +0 -0
- package/dist/esm/assets/images/book_up_icon.png +0 -0
- package/dist/esm/assets/images/books_graphic.svg +0 -177
- package/dist/esm/assets/images/booksplit.png +0 -0
- package/dist/esm/assets/images/control_pause_icon.png +0 -0
- package/dist/esm/assets/images/control_play_icon.png +0 -0
- package/dist/esm/assets/images/embed_icon.png +0 -0
- package/dist/esm/assets/images/icon-home-ia.png +0 -0
- package/dist/esm/assets/images/icon_OL-logo-xs.png +0 -0
- package/dist/esm/assets/images/icon_alert-xs.png +0 -0
- package/dist/esm/assets/images/icon_book.svg +0 -12
- package/dist/esm/assets/images/icon_bookmark.svg +0 -12
- package/dist/esm/assets/images/icon_close-pop.png +0 -0
- package/dist/esm/assets/images/icon_download.png +0 -0
- package/dist/esm/assets/images/icon_gear.svg +0 -14
- package/dist/esm/assets/images/icon_hamburger.svg +0 -20
- package/dist/esm/assets/images/icon_home.png +0 -0
- package/dist/esm/assets/images/icon_home.svg +0 -21
- package/dist/esm/assets/images/icon_home_ia.png +0 -0
- package/dist/esm/assets/images/icon_indicator.png +0 -0
- package/dist/esm/assets/images/icon_info.svg +0 -11
- package/dist/esm/assets/images/icon_one_page.svg +0 -8
- package/dist/esm/assets/images/icon_pause.svg +0 -1
- package/dist/esm/assets/images/icon_play.svg +0 -1
- package/dist/esm/assets/images/icon_playback-rate.svg +0 -15
- package/dist/esm/assets/images/icon_return.png +0 -0
- package/dist/esm/assets/images/icon_search_button.svg +0 -8
- package/dist/esm/assets/images/icon_share.svg +0 -9
- package/dist/esm/assets/images/icon_skip-ahead.svg +0 -6
- package/dist/esm/assets/images/icon_skip-back.svg +0 -13
- package/dist/esm/assets/images/icon_speaker.svg +0 -18
- package/dist/esm/assets/images/icon_speaker_open.svg +0 -10
- package/dist/esm/assets/images/icon_thumbnails.svg +0 -12
- package/dist/esm/assets/images/icon_toc.svg +0 -5
- package/dist/esm/assets/images/icon_two_pages.svg +0 -9
- package/dist/esm/assets/images/icon_zoomer.png +0 -0
- package/dist/esm/assets/images/loading.gif +0 -0
- package/dist/esm/assets/images/logo_icon.png +0 -0
- package/dist/esm/assets/images/marker_chap-off.png +0 -0
- package/dist/esm/assets/images/marker_chap-off.svg +0 -11
- package/dist/esm/assets/images/marker_chap-off_ia.png +0 -0
- package/dist/esm/assets/images/marker_chap-on.png +0 -0
- package/dist/esm/assets/images/marker_chap-on.svg +0 -11
- package/dist/esm/assets/images/marker_srch-on.svg +0 -11
- package/dist/esm/assets/images/marker_srchchap-off.png +0 -0
- package/dist/esm/assets/images/marker_srchchap-on.png +0 -0
- package/dist/esm/assets/images/nav_control-dn.png +0 -0
- package/dist/esm/assets/images/nav_control-dn_ia.png +0 -0
- package/dist/esm/assets/images/nav_control-up.png +0 -0
- package/dist/esm/assets/images/nav_control-up_ia.png +0 -0
- package/dist/esm/assets/images/nav_control.png +0 -0
- package/dist/esm/assets/images/one_page_mode_icon.png +0 -0
- package/dist/esm/assets/images/paper-badge.png +0 -0
- package/dist/esm/assets/images/print_icon.png +0 -0
- package/dist/esm/assets/images/progressbar.gif +0 -0
- package/dist/esm/assets/images/right_edges.png +0 -0
- package/dist/esm/assets/images/slider.png +0 -0
- package/dist/esm/assets/images/slider_ia.png +0 -0
- package/dist/esm/assets/images/thumbnail_mode_icon.png +0 -0
- package/dist/esm/assets/images/transparent.png +0 -0
- package/dist/esm/assets/images/two_page_mode_icon.png +0 -0
- package/dist/esm/assets/images/unviewable_page.png +0 -0
- package/dist/esm/assets/images/zoom_in_icon.png +0 -0
- package/dist/esm/assets/images/zoom_out_icon.png +0 -0
- package/dist/esm/css/BookReader.scss +0 -85
- package/dist/esm/css/_BRBookmarks.scss +0 -29
- package/dist/esm/css/_BRComponent.scss +0 -13
- package/dist/esm/css/_BRfloat.scss +0 -197
- package/dist/esm/css/_BRicon.scss +0 -54
- package/dist/esm/css/_BRmain.scss +0 -262
- package/dist/esm/css/_BRnav.scss +0 -354
- package/dist/esm/css/_BRpages.scss +0 -213
- package/dist/esm/css/_BRsearch.scss +0 -268
- package/dist/esm/css/_BRtoolbar.scss +0 -84
- package/dist/esm/css/_BRvendor.scss +0 -5
- package/dist/esm/css/_TextSelection.scss +0 -108
- package/dist/esm/css/_colorbox.scss +0 -52
- package/dist/esm/css/_controls.scss +0 -257
- package/dist/esm/css/_icons.scss +0 -121
- package/dist/esm/ia-bookreader/ia-bookreader.js +0 -141
- package/dist/esm/jquery-wrapper.js +0 -3
- package/dist/esm/plugins/plugin.archive_analytics.js +0 -72
- package/dist/esm/plugins/plugin.autoplay.js +0 -119
- package/dist/esm/plugins/plugin.chapters.js +0 -288
- package/dist/esm/plugins/plugin.iframe.js +0 -44
- package/dist/esm/plugins/plugin.iiif.js +0 -146
- package/dist/esm/plugins/plugin.resume.js +0 -66
- package/dist/esm/plugins/plugin.text_selection.js +0 -621
- package/dist/esm/plugins/plugin.vendor-fullscreen.js +0 -227
- package/dist/esm/plugins/search/plugin.search.js +0 -499
- package/dist/esm/plugins/search/utils.js +0 -42
- package/dist/esm/plugins/search/view.js +0 -360
- package/dist/esm/plugins/tts/AbstractTTSEngine.js +0 -282
- package/dist/esm/plugins/tts/FestivalTTSEngine.js +0 -192
- package/dist/esm/plugins/tts/PageChunk.js +0 -105
- package/dist/esm/plugins/tts/PageChunkIterator.js +0 -155
- package/dist/esm/plugins/tts/WebTTSEngine.js +0 -364
- package/dist/esm/plugins/tts/plugin.tts.js +0 -315
- package/dist/esm/plugins/tts/tooltip_dict.js +0 -14
- package/dist/esm/plugins/tts/utils.js +0 -79
- package/dist/esm/plugins/url/UrlPlugin.js +0 -197
- package/dist/esm/plugins/url/plugin.url.js +0 -212
- package/dist/esm/util/browserSniffing.js +0 -56
- package/dist/esm/util/debouncer.js +0 -25
- package/dist/esm/util/docCookies.js +0 -75
- package/dist/esm/util/strings.js +0 -34
- package/index.js +0 -2
@@ -1,86 +1,92 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
*/
|
5
|
-
|
6
|
-
enableArchiveAnalytics: true,
|
7
|
-
/** Provide a means of debugging, cause otherwise it's impossible to test locally */
|
8
|
-
debugArchiveAnaltyics: false,
|
9
|
-
});
|
10
|
-
|
11
|
-
BookReader.prototype.init = (function(super_) {
|
12
|
-
return function() {
|
13
|
-
super_.call(this);
|
14
|
-
|
15
|
-
if (this.options.enableArchiveAnalytics) {
|
16
|
-
this.bind(BookReader.eventNames.fragmentChange, () => this.archiveAnalyticsSendFragmentChange());
|
17
|
-
}
|
18
|
-
};
|
19
|
-
})(BookReader.prototype.init);
|
1
|
+
// @ts-check
|
2
|
+
import { BookReaderPlugin } from "../BookReaderPlugin.js";
|
3
|
+
|
4
|
+
const BookReader = /** @type {typeof import('../BookReader').default} */(window.BookReader);
|
5
|
+
|
20
6
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
7
|
+
export class ArchiveAnalyticsPlugin extends BookReaderPlugin {
|
8
|
+
options = {
|
9
|
+
enabled: true,
|
10
|
+
/** Provide a means of debugging, cause otherwise it's impossible to test locally */
|
11
|
+
debug: false,
|
25
12
|
}
|
26
13
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
itemid: this.bookId,
|
36
|
-
cache_bust: Math.random(),
|
37
|
-
};
|
38
|
-
// EEK! offsite embedding and /details/ page books look the same in analytics, otherwise!
|
39
|
-
values.offsite = 1;
|
40
|
-
values.details = 0;
|
41
|
-
try {
|
42
|
-
values.offsite = window.top.location.hostname.match(/\.archive.org$/)
|
43
|
-
? 0
|
44
|
-
: 1;
|
45
|
-
values.details =
|
46
|
-
!values.offsite && window.top.location.pathname.match(/^\/details\//)
|
47
|
-
? 1
|
48
|
-
: 0;
|
49
|
-
} catch (e) {}
|
50
|
-
// avoids embed cross site exceptions -- but on (+) side, means it is and keeps marked offite!
|
51
|
-
|
52
|
-
// Send bookreader ping
|
53
|
-
window.archive_analytics.send_ping(values, null, "augment_for_ao_site");
|
54
|
-
|
55
|
-
// Also send tracking event ping
|
56
|
-
const additionalEventParams = this.options.lendingInfo && this.options.lendingInfo.loanId
|
57
|
-
? { loanId: this.options.lendingInfo.loanId }
|
58
|
-
: {};
|
59
|
-
window.archive_analytics.send_event('BookReader', 'UserChangedView', window.location.pathname, additionalEventParams);
|
60
|
-
|
61
|
-
this.archiveAnalyticsSendFragmentChange.prevFragment = newFragment;
|
14
|
+
/** @type {string} */
|
15
|
+
_prevFragment = null;
|
16
|
+
|
17
|
+
/** @override */
|
18
|
+
init() {
|
19
|
+
if (this.options.enabled) {
|
20
|
+
this.br.bind(BookReader.eventNames.fragmentChange, () => this.sendFragmentChange());
|
21
|
+
}
|
62
22
|
}
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
23
|
+
|
24
|
+
/** @private */
|
25
|
+
sendFragmentChange() {
|
26
|
+
if (!window.archive_analytics) {
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
|
30
|
+
const prevFragment = this._prevFragment;
|
31
|
+
|
32
|
+
const params = this.br.paramsFromCurrent();
|
33
|
+
const newFragment = this.br.fragmentFromParams(params);
|
34
|
+
|
35
|
+
if (prevFragment != newFragment) {
|
36
|
+
const values = {
|
37
|
+
bookreader: "user_changed_view",
|
38
|
+
itemid: this.br.bookId,
|
39
|
+
cache_bust: Math.random(),
|
40
|
+
};
|
41
|
+
// EEK! offsite embedding and /details/ page books look the same in analytics, otherwise!
|
42
|
+
values.offsite = 1;
|
43
|
+
values.details = 0;
|
44
|
+
try {
|
45
|
+
values.offsite = window.top.location.hostname.match(/\.archive.org$/)
|
46
|
+
? 0
|
47
|
+
: 1;
|
48
|
+
values.details =
|
49
|
+
!values.offsite && window.top.location.pathname.match(/^\/details\//)
|
50
|
+
? 1
|
51
|
+
: 0;
|
52
|
+
} catch (e) { }
|
53
|
+
// avoids embed cross site exceptions -- but on (+) side, means it is and keeps marked offite!
|
54
|
+
|
55
|
+
// Send bookreader ping
|
56
|
+
window.archive_analytics.send_ping(values, null, "augment_for_ao_site");
|
57
|
+
|
58
|
+
// Also send tracking event ping
|
59
|
+
const additionalEventParams = this.br.options.lendingInfo?.loanId
|
60
|
+
? { loanId: this.br.options.lendingInfo.loanId }
|
61
|
+
: {};
|
62
|
+
window.archive_analytics.send_event('BookReader', 'UserChangedView', window.location.pathname, additionalEventParams);
|
63
|
+
|
64
|
+
this._prevFragment = newFragment;
|
65
|
+
}
|
77
66
|
}
|
78
67
|
|
79
|
-
|
68
|
+
/**
|
69
|
+
* Sends a tracking "Event". See https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#events
|
70
|
+
* @param {string} category
|
71
|
+
* @param {string} action
|
72
|
+
* @param {number} [value] (must be an int)
|
73
|
+
* @param {Object} [additionalEventParams]
|
74
|
+
*/
|
75
|
+
sendEvent(category, action, value, additionalEventParams) {
|
76
|
+
if (!this.options.enabled) return;
|
80
77
|
|
81
|
-
|
82
|
-
|
83
|
-
|
78
|
+
if (this.options.debug) {
|
79
|
+
console.log("archiveAnalyticsSendEvent", arguments, window.archive_analytics);
|
80
|
+
}
|
81
|
+
|
82
|
+
if (!window.archive_analytics) return;
|
83
|
+
|
84
|
+
additionalEventParams = additionalEventParams || {};
|
85
|
+
if (typeof (value) == 'number') {
|
86
|
+
additionalEventParams.ev = value;
|
87
|
+
}
|
88
|
+
window.archive_analytics.send_event(category, action, null, additionalEventParams);
|
84
89
|
}
|
85
|
-
|
86
|
-
|
90
|
+
}
|
91
|
+
|
92
|
+
BookReader?.registerPlugin('archiveAnalytics', ArchiveAnalyticsPlugin);
|
@@ -191,6 +191,7 @@ BookReader.prototype._chaptersUpdateCurrent = function(
|
|
191
191
|
}
|
192
192
|
};
|
193
193
|
|
194
|
+
@customElement('br-chapters-panel')
|
194
195
|
export class BRChaptersPanel extends LitElement {
|
195
196
|
/** @type {TocEntry[]} */
|
196
197
|
@property({ type: Array })
|
@@ -213,9 +214,9 @@ export class BRChaptersPanel extends LitElement {
|
|
213
214
|
|
214
215
|
render() {
|
215
216
|
return html`
|
216
|
-
|
217
|
-
|
218
|
-
|
217
|
+
<ol>
|
218
|
+
${this.contents.map(tocEntry => this.renderTOCEntry(tocEntry))}
|
219
|
+
</ol>
|
219
220
|
`;
|
220
221
|
}
|
221
222
|
|
@@ -224,29 +225,26 @@ export class BRChaptersPanel extends LitElement {
|
|
224
225
|
*/
|
225
226
|
renderTOCEntry(tocEntry) {
|
226
227
|
const chapterTitle = [tocEntry.label, tocEntry.title]
|
227
|
-
.filter(
|
228
|
+
.filter(x => x)
|
228
229
|
.join(' ');
|
229
230
|
const clickable = tocEntry.pageIndex != undefined;
|
230
231
|
// note the click-tracking won't work...
|
231
|
-
return html`
|
232
|
+
return html`
|
233
|
+
<li
|
232
234
|
class="
|
233
235
|
BRtable-contents-el
|
234
236
|
${clickable ? 'clickable' : ''}
|
235
237
|
${tocEntry == this.currentChapter ? 'current' : ''}
|
236
238
|
"
|
237
|
-
style="${styleMap({
|
238
|
-
data-event-click-tracking="${ifDefined(
|
239
|
-
clickable ? 'BRTOCPanel|GoToChapter' : undefined,
|
240
|
-
)}"
|
239
|
+
style="${styleMap({marginLeft: (tocEntry.level - 1) * 10 + 'px'})}"
|
240
|
+
data-event-click-tracking="${ifDefined(clickable ? "BRTOCPanel|GoToChapter" : undefined)}"
|
241
241
|
@click="${() => this.jumpToPage(tocEntry.pageIndex)}"
|
242
242
|
>
|
243
243
|
${chapterTitle}
|
244
|
-
${tocEntry.pagenum
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
`
|
249
|
-
: nothing}
|
244
|
+
${tocEntry.pagenum ? html`
|
245
|
+
<br />
|
246
|
+
<span class="BRTOCElementPage">Page ${tocEntry.pagenum}</span>
|
247
|
+
` : nothing}
|
250
248
|
</li>`;
|
251
249
|
}
|
252
250
|
|
@@ -283,20 +281,17 @@ export class BRChaptersPanel extends LitElement {
|
|
283
281
|
}
|
284
282
|
|
285
283
|
li.clickable:not(.current):hover {
|
286
|
-
background-color: rgba(255,
|
284
|
+
background-color: rgba(255,255,255, 0.05);
|
287
285
|
}
|
288
286
|
|
289
287
|
li.current {
|
290
|
-
background-color: rgba(255,
|
288
|
+
background-color: rgba(255,255,255,0.9);
|
291
289
|
color: #333;
|
292
290
|
}
|
293
291
|
|
294
292
|
.BRTOCElementPage {
|
295
293
|
font-size: 0.85em;
|
296
|
-
opacity:
|
297
|
-
}
|
298
|
-
`;
|
294
|
+
opacity: .8;
|
295
|
+
}`;
|
299
296
|
}
|
300
297
|
}
|
301
|
-
|
302
|
-
customElements.define('br-chapters-panel', BRChaptersPanel);
|
@@ -423,7 +423,7 @@ export class BookreaderWithTextSelection extends BookReader {
|
|
423
423
|
new SelectionObserver('.BRtextLayer', (selectEvent) => {
|
424
424
|
// Track how often selection is used
|
425
425
|
if (selectEvent == 'started') {
|
426
|
-
this.
|
426
|
+
this._plugins.archiveAnalytics?.sendEvent('BookReader', 'SelectStart');
|
427
427
|
|
428
428
|
// Set a class on the page to avoid hiding it when zooming/etc
|
429
429
|
this.refs.$br.find('.BRpagecontainer--hasSelection').removeClass('BRpagecontainer--hasSelection');
|
@@ -352,10 +352,10 @@ BookReader.prototype.ttsRemoveHilites = function () {
|
|
352
352
|
* @param {number} [value]
|
353
353
|
*/
|
354
354
|
BookReader.prototype.ttsSendAnalyticsEvent = function(action, value) {
|
355
|
-
if (this.
|
355
|
+
if (this._plugins.archiveAnalytics) {
|
356
356
|
const extraValues = {};
|
357
357
|
const mediaLanguage = this.ttsEngine.opts.bookLanguage;
|
358
358
|
if (mediaLanguage) extraValues.mediaLanguage = mediaLanguage;
|
359
|
-
this.
|
359
|
+
this._plugins.archiveAnalytics.sendEvent('BRReadAloud', action, value, extraValues);
|
360
360
|
}
|
361
361
|
};
|
@@ -4,17 +4,30 @@ import BookReader from '@/src/BookReader.js';
|
|
4
4
|
|
5
5
|
describe('getNavPageNumHtml', () => {
|
6
6
|
const f = getNavPageNumHtml;
|
7
|
-
|
7
|
+
|
8
|
+
test('handle n-prefixed page numbers-min format', () => {
|
8
9
|
expect(f(3, 40, 'n3', '', 40)).toBe('(4 of 40)');
|
9
10
|
});
|
10
11
|
|
11
|
-
test('handle regular page numbers', () => {
|
12
|
+
test('handle regular page numbers-min format', () => {
|
12
13
|
expect(f(3, 40, '14', '', 40)).toBe('14 of 40');
|
13
14
|
});
|
14
15
|
|
15
|
-
test('handle no max page', () => {
|
16
|
+
test('handle no max page-min format', () => {
|
16
17
|
expect(f(3, 40, '14', '', null)).toBe('14');
|
17
18
|
});
|
19
|
+
|
20
|
+
test('handle n-prefixed page numbers-max format', () => {
|
21
|
+
expect(f(3, 40, 'n3', '', 40, true)).toBe('Page — (4/40)');
|
22
|
+
});
|
23
|
+
|
24
|
+
test('handle regular page numbers-max format', () => {
|
25
|
+
expect(f(3, 40, '14', '', 40, true)).toBe('Page 14 (4/40)');
|
26
|
+
});
|
27
|
+
|
28
|
+
test('handle no max page-max format', () => {
|
29
|
+
expect(f(3, 40, '14', '', null, true)).toBe('Page 14 (4/40)');
|
30
|
+
});
|
18
31
|
});
|
19
32
|
|
20
33
|
/** @type {BookReader} */
|
@@ -1,23 +1,20 @@
|
|
1
1
|
import sinon from 'sinon';
|
2
|
-
import
|
3
|
-
import '@/src/plugins/plugin.archive_analytics.js';
|
4
|
-
|
5
|
-
describe('archiveAnalyticsSendEvent', () => {
|
6
|
-
const sendEvent = BookReader.prototype.archiveAnalyticsSendEvent;
|
2
|
+
import {ArchiveAnalyticsPlugin} from '@/src/plugins/plugin.archive_analytics.js';
|
7
3
|
|
4
|
+
describe('sendEvent', () => {
|
8
5
|
test('logs if debug set to true', () => {
|
9
6
|
const stub = sinon.stub(console, 'log');
|
10
|
-
const
|
11
|
-
|
7
|
+
const p = new ArchiveAnalyticsPlugin({});
|
8
|
+
p.setup({ debug: true });
|
9
|
+
p.sendEvent();
|
12
10
|
expect(stub.callCount).toBe(1);
|
13
11
|
stub.restore();
|
14
12
|
});
|
15
13
|
|
16
14
|
test('Does not error if window.archive_analytics is undefined', () => {
|
17
|
-
const
|
18
|
-
const
|
19
|
-
|
15
|
+
const p = new ArchiveAnalyticsPlugin({});
|
16
|
+
const spy = sinon.spy(p.sendEvent);
|
17
|
+
p.sendEvent();
|
20
18
|
expect(spy.threw()).toBe(false);
|
21
19
|
});
|
22
20
|
});
|
23
|
-
|
@@ -1,4 +0,0 @@
|
|
1
|
-
var _templateObject;
|
2
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
3
|
-
import { css } from 'lit';
|
4
|
-
export default css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .blue {\n --iconFillColor: var(--blueBookmarkColor, #0023f5);\n }\n\n .red {\n --iconFillColor: var(--redBookmarkColor, #eb3223);\n }\n\n .green {\n --iconFillColor: var(--greenBookmarkColor, #75ef4c);\n }\n"])));
|
@@ -1,4 +0,0 @@
|
|
1
|
-
var _templateObject;
|
2
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
3
|
-
import { css } from 'lit';
|
4
|
-
export default css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ia-button {\n min-height: 3rem;\n border: none;\n outline: none;\n cursor: pointer;\n color: var(--primaryTextColor);\n line-height: normal;\n border-radius: .4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n font-family: inherit;\n display: inline-block;\n padding: .6rem 1.2rem;\n border: 1px solid transparent;\n\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n user-select: none;\n }\n\n .ia-button.link,\n .ia-button.external {\n min-height: unset;\n text-decoration: none;\n }\n\n .ia-button:disabled,\n .ia-button.disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .ia-button.transparent {\n background-color: transparent;\n }\n \n .ia-button.slim {\n padding: 0;\n }\n\n .ia-button.primary {\n background-color: var(--primaryCTAFill);\n border-color: var(--primaryCTABorder);\n }\n\n .ia-button.cancel {\n background-color: var(--primaryErrorCTAFill);\n border-color: var(--primaryErrorCTABorder);\n }\n\n .ia-button.external {\n background: var(--secondaryCTAFill);\n border-color: var(--secondaryCTABorder);\n }\n"])));
|
@@ -1,4 +0,0 @@
|
|
1
|
-
var _templateObject;
|
2
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
3
|
-
import { svg } from 'lit';
|
4
|
-
export default svg(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n <svg class=\"ia-logo\" width=\"27\" height=\"30\" viewBox=\"0 0 27 30\" xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"logoTitleID logoDescID\">\n <title id=\"logoTitleID\">Internet Archive logo</title>\n <desc id=\"logoDescID\">A line drawing of the Internet Archive headquarters building fa\xE7ade.</desc>\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <mask id=\"mask-2\" fill=\"white\">\n <path d=\"M26.6666667,28.6046512 L26.6666667,30 L0,30 L0.000283687943,28.6046512 L26.6666667,28.6046512 Z M25.6140351,26.5116279 L25.6140351,28.255814 L1.05263158,28.255814 L1.05263158,26.5116279 L25.6140351,26.5116279 Z M3.62469203,7.6744186 L3.91746909,7.82153285 L4.0639977,10.1739544 L4.21052632,13.9963932 L4.21052632,17.6725617 L4.0639977,22.255044 L4.03962296,25.3421929 L3.62469203,25.4651163 L2.16024641,25.4651163 L1.72094074,25.3421929 L1.55031755,22.255044 L1.40350877,17.6970339 L1.40350877,14.0211467 L1.55031755,10.1739544 L1.68423854,7.80887484 L1.98962322,7.6744186 L3.62469203,7.6744186 Z M24.6774869,7.6744186 L24.9706026,7.82153285 L25.1168803,10.1739544 L25.2631579,13.9963932 L25.2631579,17.6725617 L25.1168803,22.255044 L25.0927809,25.3421929 L24.6774869,25.4651163 L23.2130291,25.4651163 L22.7736357,25.3421929 L22.602418,22.255044 L22.4561404,17.6970339 L22.4561404,14.0211467 L22.602418,10.1739544 L22.7369262,7.80887484 L23.0420916,7.6744186 L24.6774869,7.6744186 Z M9.94042303,7.6744186 L10.2332293,7.82153285 L10.3797725,10.1739544 L10.5263158,13.9963932 L10.5263158,17.6725617 L10.3797725,22.255044 L10.3556756,25.3421929 L9.94042303,25.4651163 L8.47583122,25.4651163 L8.0362015,25.3421929 L7.86556129,22.255044 L7.71929825,17.6970339 L7.71929825,14.0211467 L7.86556129,10.1739544 L8.00005604,7.80887484 L8.30491081,7.6744186 L9.94042303,7.6744186 Z M18.0105985,7.6744186 L18.3034047,7.82153285 L18.449948,10.1739544 L18.5964912,13.9963932 L18.5964912,17.6725617 L18.449948,22.255044 L18.425851,25.3421929 L18.0105985,25.4651163 L16.5460067,25.4651163 L16.1066571,25.3421929 L15.9357367,22.255044 L15.7894737,17.6970339 L15.7894737,14.0211467 L15.9357367,10.1739544 L16.0702315,7.80887484 L16.3753664,7.6744186 L18.0105985,7.6744186 Z M25.6140351,4.53488372 L25.6140351,6.97674419 L1.05263158,6.97674419 L1.05263158,4.53488372 L25.6140351,4.53488372 Z M13.0806755,0 L25.9649123,2.93331338 L25.4484139,3.8372093 L0.771925248,3.8372093 L0,3.1041615 L13.0806755,0 Z\" id=\"path-1\"></path>\n </mask>\n <use fill=\"#FFFFFF\" xlink:href=\"#path-1\"></use>\n <g mask=\"url(#mask-2)\" fill=\"#FFFFFF\">\n <path d=\"M0,0 L26.6666667,0 L26.6666667,30 L0,30 L0,0 Z\" id=\"swatch\"></path>\n </g>\n </g>\n </svg>\n"])));
|
@@ -1,8 +0,0 @@
|
|
1
|
-
var _templateObject;
|
2
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
3
|
-
import { css } from 'lit';
|
4
|
-
|
5
|
-
// Original SVG object for reference
|
6
|
-
// <svg height="10" viewBox="0 0 13 10" width="13" xmlns="http://www.w3.org/2000/svg"><path d="m4.33333333 10-4.33333333-4.16666667 1.73333333-1.66666666 2.6 2.5 6.93333337-6.66666667 1.7333333 1.66666667z" fill="#fff" fill-rule="evenodd"/></svg>
|
7
|
-
|
8
|
-
export default css(_templateObject || (_templateObject = _taggedTemplateLiteral(["data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwIiB2aWV3Qm94PSIwIDAgMTMgMTAiIHdpZHRoPSIxMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNC4zMzMzMzMzMyAxMC00LjMzMzMzMzMzLTQuMTY2NjY2NjcgMS43MzMzMzMzMy0xLjY2NjY2NjY2IDIuNiAyLjUgNi45MzMzMzMzNy02LjY2NjY2NjY3IDEuNzMzMzMzMyAxLjY2NjY2NjY3eiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+"])));
|
@@ -1,4 +0,0 @@
|
|
1
|
-
var _templateObject;
|
2
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
3
|
-
import { css } from 'lit';
|
4
|
-
export default css(_templateObject || (_templateObject = _taggedTemplateLiteral(["data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNDAgNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgYXJpYS1sYWJlbGxlZGJ5PSJjbG9zZVRpdGxlSUQgY2xvc2VEZXNjSUQiPjxwYXRoIGQ9Ik0yOS4xOTIgMTAuODA4YTEuNSAxLjUgMCAwMTAgMi4xMkwyMi4xMjIgMjBsNy4wNyA3LjA3MmExLjUgMS41IDAgMDEtMi4xMiAyLjEyMWwtNy4wNzMtNy4wNy03LjA3IDcuMDdhMS41IDEuNSAwIDAxLTIuMTIxLTIuMTJsNy4wNy03LjA3My03LjA3LTcuMDdhMS41IDEuNSAwIDAxMi4xMi0yLjEyMUwyMCAxNy44NzhsNy4wNzItNy4wN2ExLjUgMS41IDAgMDEyLjEyMSAweiIgY2xhc3M9ImZpbGwtY29sb3IiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg=="])));
|