@internetarchive/bookreader 5.0.0-66 → 5.0.0-67

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.
@@ -161,6 +161,44 @@
161
161
  </li>
162
162
  </ul>
163
163
  </li>
164
+ <li>
165
+ Chapters
166
+ <ul>
167
+ <li>
168
+ Normal book with chapters
169
+ <ul>
170
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=adventureofsherl0000unse">
171
+ <i>The Adventures of Sherlock Holmes</i> by Arthur Conan Doyle
172
+ </a></li>
173
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=jalna00dela">
174
+ <i>Jalna</i> by Mazo de la Roche
175
+ </a></li>
176
+ </ul>
177
+ </li>
178
+ <li>
179
+ Book preview
180
+ <ul>
181
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=peoplewareproduc00dema_0">
182
+ <i>Peopleware</i> by Tom DeMarco and Timothy Lister
183
+ </a></li>
184
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=passionforbooksb00rabi">
185
+ <i>A Passion for Books</i>
186
+ </a></li>
187
+ </ul>
188
+ </li>
189
+ <li>
190
+ Book with levelled chapters
191
+ <ul>
192
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=notredamedepar01hugo">
193
+ <i>Notre-Dame de Paris: Tome Premier</i> par Victor Hugo
194
+ </a></li>
195
+ <li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=alanturingenigma0000hodg">
196
+ <i>Alan Turing: The Enigma</i> by Andrew Hodges
197
+ </a></li>
198
+ </ul>
199
+ </li>
200
+ </ul>
201
+ </li>
164
202
  </ul>
165
203
  </details>
166
204
  <div class="demo">
@@ -220,9 +258,9 @@
220
258
 
221
259
  // analytics stub
222
260
  window.archive_analytics = {
223
- send_event_no_sampling: (category, action, label) => console.log('~~~ NO SAMPLE EVENT CALLED: ', { category, action, label }),
224
- send_event: (category, action, label) => console.log('~~~ send_event SAMPLE EVENT CALLED: ', { category, action, label }),
225
- send_ping: (category, action, label) => console.log('~~~ send_ping SAMPLE EVENT CALLED: ', { category, action, label }),
261
+ send_event_no_sampling: (category, action, label) => {}, //console.log('~~~ NO SAMPLE EVENT CALLED: ', { category, action, label }),
262
+ send_event: (category, action, label) => {}, //console.log('~~~ send_event SAMPLE EVENT CALLED: ', { category, action, label }),
263
+ send_ping: (category, action, label) => {}, //console.log('~~~ send_ping SAMPLE EVENT CALLED: ', { category, action, label }),
226
264
  }
227
265
  </script>
228
266
 
@@ -40,7 +40,7 @@
40
40
  template: function(br) {
41
41
  return '<button class="BRicon ' + this.className + ' desktop-only js-tooltip" data-param="foo">' +
42
42
  '<div class="icon icon-onepg"></div>' +
43
- '<span class="tooltip">Overridden control</span>' +
43
+ '<span class="BRtooltip">Overridden control</span>' +
44
44
  '</button>';
45
45
  }
46
46
  },
package/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 5.0.0-67
2
+ - Feature: Re-enable chapters plugin + migrate off mmenu @cdrini
3
+ - Fix: Disable tooltips on touchscreens + fix on IA @cdrini
4
+ - Dev: Remove core-js update block; issue resolved in core-js @cdrini
5
+
1
6
  # 5.0.0-66
2
7
  - Fix: Pinch zooming on iPad/iPhone, Samsung Internet @cdrini
3
8
 
package/index.html CHANGED
@@ -21,7 +21,7 @@
21
21
  <!-- plugin.search.js -->
22
22
  <li><a href="BookReaderDemo/demo-internetarchive.html?ocaid=theworksofplato01platiala">From Internet Archive</a></li>
23
23
  <!-- plugin.search.js -->
24
- <li><a href="BookReaderDemo/demo-internetarchive.html?ocaid=adventuresofoli00dick">From Internet Archive - a book with CHAPTERS</a></li>
24
+ <li><a href="BookReaderDemo/demo-internetarchive.html?ocaid=adventureofsherl0000unse">From Internet Archive - a book with CHAPTERS</a></li>
25
25
  <li><a href="BookReaderDemo/demo-iiif.html">IIIF</a></li>
26
26
  <li><a href="BookReaderDemo/demo-autoplay.html">Autoplay (kiosk mode)</a></li>
27
27
  <li><a href="BookReaderDemo/demo-plugin-menu-toggle.html">Plugin: Full screen menu toggle</a></li>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/bookreader",
3
- "version": "5.0.0-66",
3
+ "version": "5.0.0-67",
4
4
  "description": "The Internet Archive BookReader.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "private": false,
27
27
  "dependencies": {
28
28
  "@internetarchive/ia-activity-indicator": "^0.0.4",
29
- "@internetarchive/ia-item-navigator": "^1.0.3",
29
+ "@internetarchive/ia-item-navigator": "^1.0.4",
30
30
  "@internetarchive/ia-sharing-options": "^1.0.2",
31
31
  "@internetarchive/icon-bookmark": "^1.3.4",
32
32
  "@internetarchive/icon-dl": "^1.3.4",
@@ -35,6 +35,7 @@
35
35
  "@internetarchive/icon-magnify-plus": "^1.3.4",
36
36
  "@internetarchive/icon-search": "^1.3.4",
37
37
  "@internetarchive/icon-share": "^1.3.4",
38
+ "@internetarchive/icon-toc": "^1.3.4",
38
39
  "@internetarchive/icon-visual-adjustment": "^1.3.4",
39
40
  "@internetarchive/modal-manager": "^0.2.12",
40
41
  "@internetarchive/shared-resize-observer": "^0.2.0",
@@ -121,7 +122,7 @@
121
122
  "DOCS:update:test-deps": "If CI succeeds, these should be good to update",
122
123
  "update:test-deps": "npm i @babel/eslint-parser@latest @open-wc/testing-helpers@latest @types/jest@latest codecov@latest eslint@7 eslint-plugin-testcafe@latest jest@latest sinon@latest testcafe@latest",
123
124
  "DOCS:update:build-deps": "These can cause strange changes, so do an npm run build + check file size (git diff --stat), and check the site is as expected",
124
- "update:build-deps": "npm i @babel/core@latest @babel/preset-env@latest @babel/plugin-proposal-class-properties@latest @babel/plugin-proposal-decorators@latest babel-loader@latest core-js@3.27.1 regenerator-runtime@latest sass@latest svgo@latest webpack@latest webpack-cli@latest",
125
+ "update:build-deps": "npm i @babel/core@latest @babel/preset-env@latest @babel/plugin-proposal-class-properties@latest @babel/plugin-proposal-decorators@latest babel-loader@latest core-js@latest regenerator-runtime@latest sass@latest svgo@latest webpack@latest webpack-cli@latest",
125
126
  "codecov": "npx codecov"
126
127
  }
127
128
  }
@@ -239,7 +239,7 @@ export class BookNavigator extends LitElement {
239
239
  });
240
240
  }
241
241
 
242
- this.menuProviders = providers;
242
+ Object.assign(this.menuProviders, providers);
243
243
  this.addMenuShortcut('search');
244
244
  this.addMenuShortcut('volumes');
245
245
  this.updateMenuContents();
@@ -306,9 +306,9 @@ export class BookNavigator extends LitElement {
306
306
  */
307
307
  updateMenuContents() {
308
308
  const {
309
- search, downloads, visualAdjustments, share, bookmarks, volumes
309
+ search, downloads, visualAdjustments, share, bookmarks, volumes, chapters
310
310
  } = this.menuProviders;
311
- const availableMenus = [volumes, search, bookmarks, visualAdjustments, share].filter((menu) => !!menu);
311
+ const availableMenus = [volumes, chapters, search, bookmarks, visualAdjustments, share].filter((menu) => !!menu);
312
312
 
313
313
  if (this.shouldShowDownloadsMenu()) {
314
314
  downloads?.update(this.downloadableTypes);
@@ -410,6 +410,7 @@ export class BookNavigator extends LitElement {
410
410
  bindEventListeners() {
411
411
  window.addEventListener('BookReader:PostInit', (e) => {
412
412
  this.bookreader = e.detail.props;
413
+ this.bookreader.shell = this;
413
414
  this.bookReaderLoaded = true;
414
415
  this.bookReaderCannotLoad = false;
415
416
  this.emitLoadingStatusUpdate(true);
@@ -30,6 +30,18 @@ export class BookModel {
30
30
  this._medianPageSize = null;
31
31
  /** @type {[PageData[], number]} */
32
32
  this._getDataFlattenedCached = null;
33
+
34
+ // Heal missing first page number assertion
35
+ const pages = this._getDataFlattened();
36
+ const firstNumberedPageIndex = pages.findIndex(page => page.pageNum != undefined && !isNaN(parseFloat(page.pageNum)));
37
+ if (firstNumberedPageIndex != -1 && firstNumberedPageIndex > 0) {
38
+ const pageNum = parseFloat(pages[firstNumberedPageIndex].pageNum);
39
+ if (!isNaN(pageNum)) {
40
+ // Note: Since the pages are always sorted in increasing pageNum/index
41
+ // order, this will work for both left-to-right and right-to-left books
42
+ pages[firstNumberedPageIndex - 1].pageNum = pageNum - 1;
43
+ }
44
+ }
33
45
  }
34
46
 
35
47
  /** Get median width/height of page in inches. Memoized for performance. */
@@ -41,7 +41,7 @@ export class Navbar {
41
41
  return `<li>
42
42
  <button class="BRicon ${option.className}" title="${option.label}">
43
43
  <div class="icon icon-${option.iconClassName}"></div>
44
- <span class="tooltip">${option.label}</span>
44
+ <span class="BRtooltip">${option.label}</span>
45
45
  </button>
46
46
  </li>`;
47
47
  }
@@ -130,7 +130,7 @@ export class Navbar {
130
130
  .removeClass()
131
131
  .addClass(`icon icon-${iconClass}`)
132
132
  .end()
133
- .find('.tooltip')
133
+ .find('.BRtooltip')
134
134
  .text(tooltipText);
135
135
  }
136
136
 
@@ -104,8 +104,11 @@
104
104
  border-radius: 2px;
105
105
  background: transparent;
106
106
  outline: none;
107
- &:hover .tooltip {
108
- display: block;
107
+ @media (hover: hover) {
108
+ /* styles to apply on devices that support hover */
109
+ &:hover .BRtooltip {
110
+ display: block;
111
+ }
109
112
  }
110
113
  &.hide {
111
114
  display: none;
@@ -98,6 +98,10 @@
98
98
  // background-image: url(images/marker_chap-on.svg);
99
99
  background-color: blue;
100
100
  }
101
+ .BRchapterPage {
102
+ font-size: 0.85em;
103
+ opacity: .8;
104
+ }
101
105
  }
102
106
  .BRsearch {
103
107
  width: 9px;
@@ -130,8 +134,8 @@
130
134
  }
131
135
  footer {
132
136
  text-align: center;
133
- font-weight: bold;
134
- font-size: 0.9em;
137
+ font-size: 0.85em;
138
+ opacity: .8;
135
139
  }
136
140
  mark {
137
141
  color: $searchResultText;
@@ -166,29 +166,3 @@ html.mm-background .BookReader {
166
166
  @media (min-width: ($brBreakPointMobile + 1)) {
167
167
  .BRtoolbar.responsive { display: block; }
168
168
  }
169
-
170
- li.BRtable-contents-el {
171
- line-height: 150%;
172
- padding: 10px 10px 10px 20px;
173
- overflow: hidden;
174
- color: $controlsText;
175
-
176
- &.chapter-clickable {
177
- font-weight: normal;
178
- }
179
-
180
- &.current-chapter {
181
- background-color: lightblue;
182
- }
183
- //resetting mmenu styling for span inside .table-contents-el
184
- > span {
185
- display: inline;
186
- padding: 0;
187
- white-space: normal;
188
- }
189
-
190
- .BRTOCElementPage {
191
- font-size: 0.85em;
192
- opacity: .8;
193
- }
194
- }
@@ -1,7 +1,7 @@
1
1
  .BRcontrols {
2
2
  width: 100%;
3
3
 
4
- .tooltip {
4
+ .BRtooltip {
5
5
  display: none;
6
6
  position: absolute;
7
7
  width: auto;
@@ -14,9 +14,10 @@
14
14
  color: $controlsText;
15
15
  border-radius: 3px;
16
16
  background: $tooltipBG;
17
+ pointer-events: none;
17
18
  }
18
19
 
19
- .full .tooltip {
20
+ .full .BRtooltip {
20
21
  left: auto;
21
22
  right: 0;
22
23
  transform: translateX(0);