@internetarchive/bookreader 5.0.0-82 → 5.0.0-84

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. package/.eslintrc.js +9 -9
  2. package/.github/workflows/node.js.yml +9 -7
  3. package/BookReader/BookReader.css +2 -2
  4. package/BookReader/BookReader.js +1 -1
  5. package/BookReader/BookReader.js.map +1 -1
  6. package/BookReader/ia-bookreader-bundle.js +33 -33
  7. package/BookReader/ia-bookreader-bundle.js.map +1 -1
  8. package/BookReader/plugins/plugin.archive_analytics.js.map +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.iframe.js.map +1 -1
  13. package/BookReader/plugins/plugin.iiif.js +1 -1
  14. package/BookReader/plugins/plugin.iiif.js.map +1 -1
  15. package/BookReader/plugins/plugin.search.js +1 -1
  16. package/BookReader/plugins/plugin.search.js.map +1 -1
  17. package/BookReader/plugins/plugin.text_selection.js +1 -1
  18. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  19. package/BookReader/plugins/plugin.tts.js +1 -1
  20. package/BookReader/plugins/plugin.tts.js.map +1 -1
  21. package/BookReader/plugins/plugin.url.js +1 -1
  22. package/BookReader/plugins/plugin.url.js.map +1 -1
  23. package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
  24. package/BookReaderDemo/IADemoBr.js +10 -3
  25. package/BookReaderDemo/demo-iiif.html +1 -1
  26. package/BookReaderDemo/demo-internetarchive.html +1 -1
  27. package/CHANGELOG.md +15 -0
  28. package/babel.config.js +5 -5
  29. package/package.json +16 -18
  30. package/renovate.json +1 -1
  31. package/src/BookNavigator/book-navigator.js +8 -8
  32. package/src/BookNavigator/bookmarks/bookmarks-loginCTA.js +1 -1
  33. package/src/BookNavigator/bookmarks/bookmarks-provider.js +1 -1
  34. package/src/BookNavigator/bookmarks/ia-bookmarks.js +1 -1
  35. package/src/BookNavigator/downloads/downloads.js +4 -16
  36. package/src/BookNavigator/search/search-provider.js +2 -2
  37. package/src/BookNavigator/search/search-results.js +1 -1
  38. package/src/BookNavigator/sharing.js +1 -1
  39. package/src/BookNavigator/viewable-files.js +1 -1
  40. package/src/BookNavigator/visual-adjustments/visual-adjustments.js +3 -3
  41. package/src/BookReader/BookModel.js +1 -1
  42. package/src/BookReader/DragScrollable.js +2 -2
  43. package/src/BookReader/ModeSmoothZoom.js +5 -5
  44. package/src/BookReader/ModeThumb.js +2 -2
  45. package/src/BookReader/Navbar/Navbar.js +4 -4
  46. package/src/BookReader/ReduceSet.js +2 -2
  47. package/src/BookReader/Toolbar/Toolbar.js +4 -4
  48. package/src/BookReader/options.js +10 -10
  49. package/src/BookReader/utils/classes.js +1 -1
  50. package/src/BookReader.js +12 -12
  51. package/src/css/_BRicon.scss +8 -2
  52. package/src/ia-bookreader/ia-bookreader.js +1 -1
  53. package/src/plugins/plugin.archive_analytics.js +1 -1
  54. package/src/plugins/plugin.autoplay.js +2 -2
  55. package/src/plugins/plugin.chapters.js +3 -3
  56. package/src/plugins/plugin.iframe.js +1 -1
  57. package/src/plugins/plugin.iiif.js +9 -5
  58. package/src/plugins/plugin.text_selection.js +2 -2
  59. package/src/plugins/plugin.vendor-fullscreen.js +3 -3
  60. package/src/plugins/search/plugin.search.js +16 -11
  61. package/src/plugins/search/view.js +4 -1
  62. package/src/plugins/tts/AbstractTTSEngine.js +1 -1
  63. package/src/plugins/tts/FestivalTTSEngine.js +3 -3
  64. package/src/plugins/tts/PageChunk.js +2 -2
  65. package/src/plugins/tts/WebTTSEngine.js +1 -1
  66. package/src/plugins/tts/plugin.tts.js +1 -1
  67. package/src/plugins/tts/utils.js +1 -1
  68. package/src/plugins/url/plugin.url.js +1 -1
  69. package/tests/e2e/helpers/mockSearch.js +13 -13
  70. package/tests/jest/BookNavigator/book-navigator.test.js +27 -27
  71. package/tests/jest/BookNavigator/downloads/downloads-provider.test.js +5 -5
  72. package/tests/jest/BookNavigator/downloads/downloads.test.js +3 -3
  73. package/tests/jest/BookNavigator/search/search-provider.test.js +15 -15
  74. package/tests/jest/BookNavigator/search/search-results.test.js +1 -1
  75. package/tests/jest/BookNavigator/sharing/sharing-provider.test.js +5 -5
  76. package/tests/jest/BookNavigator/viewable-files/viewable-files-provider.test.js +8 -8
  77. package/tests/jest/BookReader/BookReaderPublicFunctions.test.js +3 -3
  78. package/tests/jest/BookReader/Mode1UpLit.test.js +2 -2
  79. package/tests/jest/BookReader/Mode2UpLit.test.js +3 -3
  80. package/tests/jest/BookReader/ModeSmoothZoom.test.js +4 -4
  81. package/tests/jest/BookReader/Navbar/Navbar.test.js +16 -16
  82. package/tests/jest/BookReader/Toolbar/Toolbar.test.js +1 -1
  83. package/tests/jest/BookReader.keyboard.test.js +1 -1
  84. package/tests/jest/BookReader.options.test.js +1 -1
  85. package/tests/jest/BookReader.test.js +4 -4
  86. package/tests/jest/plugins/plugin.chapters.test.js +3 -3
  87. package/tests/jest/plugins/plugin.iframe.test.js +2 -2
  88. package/tests/jest/plugins/plugin.text_selection.test.js +1 -1
  89. package/tests/jest/plugins/search/plugin.search.view.test.js +6 -6
  90. package/tests/jest/plugins/search/utils.js +3 -3
  91. package/tests/jest/plugins/tts/AbstractTTSEngine.test.js +1 -1
  92. package/tests/jest/plugins/tts/WebTTSEngine.test.js +2 -2
  93. package/tests/jest/plugins/url/UrlPlugin.test.js +2 -2
  94. package/tests/jest/plugins/url/plugin.url.test.js +6 -6
  95. package/webpack.config.js +6 -6
package/src/BookReader.js CHANGED
@@ -275,7 +275,7 @@ BookReader.prototype.getActivePageContainerElementsForIndex = function(pageIndex
275
275
  return [
276
276
  this._modes.mode2Up.mode2UpLit.pageContainerCache[pageIndex]?.$container?.[0],
277
277
  this._modes.mode1Up.mode1UpLit.pageContainerCache[pageIndex]?.$container?.[0],
278
- ...(this.mode == this.constModeThumb ? this.$(`.pagediv${pageIndex}`).toArray() : [])
278
+ ...(this.mode == this.constModeThumb ? this.$(`.pagediv${pageIndex}`).toArray() : []),
279
279
  ].filter(x => x);
280
280
  };
281
281
 
@@ -816,7 +816,7 @@ BookReader.prototype.bindGestures = function(jElement) {
816
816
  */
817
817
  BookReader.prototype.drawLeafsThrottled = utils.throttle(
818
818
  BookReader.prototype.drawLeafs,
819
- 250 // 250 ms gives quick feedback, but doesn't eat cpu
819
+ 250, // 250 ms gives quick feedback, but doesn't eat cpu
820
820
  );
821
821
 
822
822
  /**
@@ -845,12 +845,12 @@ BookReader.prototype.resizeBRcontainer = function(animate) {
845
845
  if (animate) {
846
846
  this.refs.$brContainer.animate({
847
847
  top: this.getToolBarHeight(),
848
- bottom: this.getFooterHeight()
848
+ bottom: this.getFooterHeight(),
849
849
  }, this.constResizeAnimationDuration, 'linear');
850
850
  } else {
851
851
  this.refs.$brContainer.css({
852
852
  top: this.getToolBarHeight(),
853
- bottom: this.getFooterHeight()
853
+ bottom: this.getFooterHeight(),
854
854
  });
855
855
  }
856
856
  };
@@ -1012,8 +1012,8 @@ BookReader.prototype.switchMode = function(
1012
1012
  {
1013
1013
  suppressFragmentChange = false,
1014
1014
  init = false,
1015
- pageFound = false
1016
- } = {}
1015
+ pageFound = false,
1016
+ } = {},
1017
1017
  ) {
1018
1018
  // Skip checks before init() complete
1019
1019
  if (this.init.initComplete) {
@@ -1209,7 +1209,7 @@ BookReader.prototype.currentIndex = function() {
1209
1209
  */
1210
1210
  BookReader.prototype.updateFirstIndex = function(
1211
1211
  index,
1212
- { suppressFragmentChange = false } = {}
1212
+ { suppressFragmentChange = false } = {},
1213
1213
  ) {
1214
1214
  // If there's no change, do nothing
1215
1215
  if (this.firstIndex === index) return;
@@ -1424,7 +1424,7 @@ BookReader.prototype.bindNavigationHandlers = function() {
1424
1424
  if ($brNavCntlBtmEl.hasClass('BRdn')) {
1425
1425
  if (self.refs.$BRtoolbar)
1426
1426
  promises.push(self.refs.$BRtoolbar.animate(
1427
- {top: self.getToolBarHeight() * -1}
1427
+ {top: self.getToolBarHeight() * -1},
1428
1428
  ).promise());
1429
1429
  promises.push(self.$('.BRfooter').animate({bottom: self.getFooterHeight() * -1}).promise());
1430
1430
  $brNavCntlBtmEl.addClass('BRup').removeClass('BRdn');
@@ -1454,7 +1454,7 @@ BookReader.prototype.bindNavigationHandlers = function() {
1454
1454
  self.resizeBRcontainer();
1455
1455
  }
1456
1456
  });
1457
- }
1457
+ },
1458
1458
  );
1459
1459
  $brNavCntlBtmEl
1460
1460
  .on("mouseover", function() {
@@ -1506,7 +1506,7 @@ BookReader.prototype.updateFromParams = function(params) {
1506
1506
  if (mode) {
1507
1507
  this.switchMode(
1508
1508
  mode,
1509
- { init: init, suppressFragmentChange: !fragmentChange }
1509
+ { init: init, suppressFragmentChange: !fragmentChange },
1510
1510
  );
1511
1511
  }
1512
1512
 
@@ -1608,7 +1608,7 @@ BookReader.prototype.showProgressPopup = function(msg, onCloseCallback) {
1608
1608
 
1609
1609
  const bar = document.createElement("div");
1610
1610
  $(bar).css({
1611
- height: '20px'
1611
+ height: '20px',
1612
1612
  }).prop('className', 'BRprogressbar');
1613
1613
  $(this.popup).append(bar);
1614
1614
 
@@ -1869,7 +1869,7 @@ BookReader.prototype.fragmentFromParams = function(params, urlMode = 'hash') {
1869
1869
  BookReader.prototype.queryStringFromParams = function(
1870
1870
  params,
1871
1871
  currQueryString,
1872
- urlMode = 'hash'
1872
+ urlMode = 'hash',
1873
1873
  ) {
1874
1874
  const newParams = new URLSearchParams(currQueryString);
1875
1875
 
@@ -38,8 +38,14 @@ i.BRicon { display: inline-block; }
38
38
  .BRicon.info { @include sprite-offet(1); }
39
39
  .BRicon.share { @include sprite-offet(3); }
40
40
  // We can only transition these because they are adjacent
41
- .BRicon.read { @include sprite-offet(5); transition-property: background-color, border, background-position; }
42
- .BRicon.unread { @include sprite-offet(7); transition-property: background-color, border, background-position; }
41
+ .BRicon.read {
42
+ transition-property: background-color, border, background-position;
43
+ @include sprite-offet(5);
44
+ }
45
+ .BRicon.unread {
46
+ transition-property: background-color, border, background-position;
47
+ @include sprite-offet(7);
48
+ }
43
49
  .BRicon.fit { @include sprite-offet(9); }
44
50
  .BRicon.download { @include sprite-offet(38); }
45
51
  .BRicon.return { @include sprite-offet(26); }
@@ -62,7 +62,7 @@ export class IaBookReader extends LitElement {
62
62
  let modalManager = document.querySelector('modal-manager');
63
63
  if (!modalManager) {
64
64
  modalManager = document.createElement(
65
- 'modal-manager'
65
+ 'modal-manager',
66
66
  );
67
67
  document.body.appendChild(modalManager);
68
68
  }
@@ -33,7 +33,7 @@ BookReader.prototype.archiveAnalyticsSendFragmentChange = function() {
33
33
  const values = {
34
34
  bookreader: "user_changed_view",
35
35
  itemid: this.bookId,
36
- cache_bust: Math.random()
36
+ cache_bust: Math.random(),
37
37
  };
38
38
  // EEK! offsite embedding and /details/ page books look the same in analytics, otherwise!
39
39
  values.offsite = 1;
@@ -4,7 +4,7 @@
4
4
  * Plugin which adds an autoplay feature. Useful for kiosk situations.
5
5
  */
6
6
  jQuery.extend(BookReader.defaultOptions, {
7
- enableAutoPlayPlugin: true
7
+ enableAutoPlayPlugin: true,
8
8
  });
9
9
 
10
10
  /**
@@ -66,7 +66,7 @@ BookReader.prototype.autoToggle = function(overrides) {
66
66
 
67
67
  const options = $.extend({
68
68
  flipSpeed: this.flipSpeed,
69
- flipDelay: this.flipDelay
69
+ flipDelay: this.flipDelay,
70
70
  }, overrides);
71
71
 
72
72
  this.flipSpeed = typeof options.flipSpeed === "number" ? options.flipSpeed : this.flipSpeed;
@@ -118,8 +118,8 @@ BookReader.prototype._chaptersRenderMarker = function(tocEntry, entryIndex) {
118
118
  .text(chapterStr)
119
119
  .append(
120
120
  $('<div class="BRchapterPage" />')
121
- .text(this.book.getPageName(tocEntry.pageIndex))
122
- )
121
+ .text(this.book.getPageName(tocEntry.pageIndex)),
122
+ ),
123
123
  )
124
124
  .addClass('BRchapter')
125
125
  .css({ left: percentThrough })
@@ -179,7 +179,7 @@ BookReader.prototype.getOpenLibraryRecord = async function (olHost, ocaid) {
179
179
  * @param {PageIndex} curIndex
180
180
  */
181
181
  BookReader.prototype._chaptersUpdateCurrent = function(
182
- curIndex = (this.mode == 2 ? Math.max(...this.displayedIndices) : this.firstIndex)
182
+ curIndex = (this.mode == 2 ? Math.max(...this.displayedIndices) : this.firstIndex),
183
183
  ) {
184
184
  const tocEntriesIndexed = this._tocEntries.filter((el) => el.pageIndex != undefined).reverse();
185
185
  const currChapter = tocEntriesIndexed[
@@ -33,7 +33,7 @@ export function _attachEventListeners(br, parent = window.parent) {
33
33
 
34
34
  parent.postMessage(
35
35
  { type: MESSAGE_TYPE_FRAGMENT_CHANGE, fragment },
36
- '*'
36
+ '*',
37
37
  );
38
38
  });
39
39
 
@@ -35,7 +35,7 @@ class IIIFPlugin {
35
35
  bookTitle: resolveInternationalString(manifest.label),
36
36
  pageProgression: manifest.viewingDirection == "right-to-left" ? "rl" : "lr",
37
37
  // numLeafs: manifest.items.length,
38
- metadata: manifest.metadata.map((metadata) => {
38
+ metadata: (manifest.metadata || []).map((metadata) => {
39
39
  return {
40
40
  label: resolveInternationalString(metadata.label),
41
41
  value: resolveInternationalString(metadata.value),
@@ -51,7 +51,7 @@ class IIIFPlugin {
51
51
  const body = bodyArr instanceof Array ? bodyArr[0] : bodyArr;
52
52
  const uri = body.service[0].id;
53
53
  return `${uri}/full/pct:${percent}/0/default.jpg`;
54
- }
54
+ },
55
55
  };
56
56
 
57
57
  if (manifest.viewingDirection == "top-to-bottom" || manifest.viewingDirection == "bottom-to-top") {
@@ -76,7 +76,9 @@ class IIIFPlugin {
76
76
  spread = [];
77
77
  }
78
78
  });
79
-
79
+ if (spread.length > 0) {
80
+ book.data.push(spread);
81
+ }
80
82
  return book;
81
83
  }
82
84
 
@@ -98,7 +100,7 @@ class IIIFPlugin {
98
100
  const percent = Math.floor(100 * 1 / reduce);
99
101
  const uri = manifest.sequences[0].canvases[pageIndex].images[0].resource.service['@id'];
100
102
  return `${uri}/full/pct:${percent}/0/default.jpg`;
101
- }
103
+ },
102
104
  };
103
105
 
104
106
  let spread = [];
@@ -116,7 +118,9 @@ class IIIFPlugin {
116
118
  spread = [];
117
119
  }
118
120
  });
119
-
121
+ if (spread.length > 0) {
122
+ book.data.push(spread);
123
+ }
120
124
  return book;
121
125
  }
122
126
  }
@@ -89,7 +89,7 @@ export class TextSelectionPlugin {
89
89
  url: applyVariables(this.options.fullDjvuXmlUrl, this.optionVariables),
90
90
  dataType: this.options.jsonp ? "jsonp" : "html",
91
91
  cache: true,
92
- error: (e) => undefined
92
+ error: (e) => undefined,
93
93
  }).then((res) => {
94
94
  try {
95
95
  const xmlMap = $.parseXML(res);
@@ -475,7 +475,7 @@ function determineRealRects(parentEl, selector) {
475
475
  origRect.width,
476
476
  origRect.height,
477
477
  )];
478
- })
478
+ }),
479
479
  );
480
480
  document.body.removeChild(parentEl);
481
481
  Object.assign(parentEl.style, initals);
@@ -8,7 +8,7 @@ if (!isMobile()) {
8
8
 
9
9
  jQuery.extend(BookReader.defaultOptions, {
10
10
  /** @type {boolean} */
11
- enableVendorFullscreenPlugin: true
11
+ enableVendorFullscreenPlugin: true,
12
12
  });
13
13
 
14
14
  /** @override */
@@ -225,13 +225,13 @@ export function fullscreenAllowed() {
225
225
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event
226
226
  */
227
227
  export function bindFullscreenChangeListener(
228
- data, fullscreenchangeListener
228
+ data, fullscreenchangeListener,
229
229
  ) {
230
230
  const event = 'fullscreenchange ';
231
231
  const vendor_prefixes = [
232
232
  'webkit',
233
233
  'moz',
234
- 'ms'
234
+ 'ms',
235
235
  ];
236
236
  const all_events = (event + vendor_prefixes.join(event) + event).trim();
237
237
  $(document).on(all_events, data, fullscreenchangeListener);
@@ -66,7 +66,17 @@ BookReader.prototype.setup = (function (super_) {
66
66
  /** @type { {[pageIndex: number]: SearchInsideMatchBox[]} } */
67
67
  this._searchBoxesByIndex = {};
68
68
 
69
- this.searchView = undefined;
69
+ if (this.enableSearch) {
70
+ this.searchView = new SearchView({
71
+ br: this,
72
+ searchCancelledCallback: () => {
73
+ this._cancelSearch();
74
+ this.trigger('SearchCanceled', { term: this.searchTerm, instance: this });
75
+ },
76
+ });
77
+ } else {
78
+ this.searchView = null;
79
+ }
70
80
  };
71
81
  })(BookReader.prototype.setup);
72
82
 
@@ -74,15 +84,10 @@ BookReader.prototype.setup = (function (super_) {
74
84
  BookReader.prototype.init = (function (super_) {
75
85
  return function () {
76
86
  super_.call(this);
77
- // give SearchView the most complete bookreader state
78
- this.searchView = new SearchView({
79
- br: this,
80
- searchCancelledCallback: () => {
81
- this._cancelSearch();
82
- this.trigger('SearchCanceled', { term: this.searchTerm, instance: this });
83
- }
84
- });
85
- if (this.options.enableSearch && this.options.initialSearchTerm) {
87
+ if (!this.enableSearch) return;
88
+
89
+ this.searchView.init();
90
+ if (this.options.initialSearchTerm) {
86
91
  /**
87
92
  * this.search() take two parameter
88
93
  * 1. this.options.initialSearchTerm - search term
@@ -93,7 +98,7 @@ BookReader.prototype.init = (function (super_) {
93
98
  */
94
99
  this.search(
95
100
  this.options.initialSearchTerm,
96
- { goToFirstResult: this.options.goToFirstResult, suppressFragmentChange: false }
101
+ { goToFirstResult: this.options.goToFirstResult, suppressFragmentChange: false },
97
102
  );
98
103
  }
99
104
  };
@@ -11,10 +11,13 @@ class SearchView {
11
11
  this.br = br;
12
12
  this.matches = [];
13
13
  this.cacheDOMElements();
14
- this.bindEvents();
15
14
  this.cancelSearch = searchCancelledCallback;
16
15
  }
17
16
 
17
+ init() {
18
+ this.bindEvents();
19
+ }
20
+
18
21
  cacheDOMElements() {
19
22
  this.dom = {};
20
23
  // Search input within the top toolbar. Will be removed once the mobile menu is replaced.
@@ -134,7 +134,7 @@ export default class AbstractTTSEngine {
134
134
  await Promise.all([
135
135
  this.activeSound.stop(),
136
136
  this._chunkIterator.decrement()
137
- .then(() => this._chunkIterator.decrement())
137
+ .then(() => this._chunkIterator.decrement()),
138
138
  ]);
139
139
  this.step();
140
140
  }
@@ -29,7 +29,7 @@ export default class FestivalTTSEngine extends AbstractTTSEngine {
29
29
  /** @override */
30
30
  getVoices() {
31
31
  return [
32
- { default: true, lang: "en-US", localService: false, name: "Festival - English (US)", voiceURI: null }
32
+ { default: true, lang: "en-US", localService: false, name: "Festival - English (US)", voiceURI: null },
33
33
  ];
34
34
  }
35
35
 
@@ -45,7 +45,7 @@ export default class FestivalTTSEngine extends AbstractTTSEngine {
45
45
  url: '/bookreader/BookReader/soundmanager/swf',
46
46
  useHTML5Audio: true,
47
47
  //flash 8 version of swf is buggy when calling play() on a sound that is still loading
48
- flashVersion: 9
48
+ flashVersion: 9,
49
49
  });
50
50
  }
51
51
 
@@ -125,7 +125,7 @@ class FestivalTTSSound {
125
125
  onresume: async () => {
126
126
  await sleep(25);
127
127
  if (this.rate != 1) this.sound.setPlaybackRate(this.rate);
128
- }
128
+ },
129
129
  });
130
130
  return this.sound.load();
131
131
  }
@@ -29,8 +29,8 @@ export default class PageChunk {
29
29
  cache: true,
30
30
  data: {
31
31
  path: `${bookPath}_djvu.xml`,
32
- page: leafIndex
33
- }
32
+ page: leafIndex,
33
+ },
34
34
  });
35
35
  return PageChunk._fromTextWrapperResponse(leafIndex, chunks);
36
36
  }
@@ -45,7 +45,7 @@ export default class WebTTSEngine extends AbstractTTSEngine {
45
45
  // album: 'The Ultimate Collection (Remastered)',
46
46
  artwork: [
47
47
  { src: br.options.thumbnail, type: 'image/jpg' },
48
- ]
48
+ ],
49
49
  });
50
50
 
51
51
  navigator.mediaSession.setActionHandler('play', () => {
@@ -306,7 +306,7 @@ BookReader.prototype.ttsHighlightChunk = function(chunk) {
306
306
 
307
307
  // group by index; currently only possible to have chunks on one page :/
308
308
  this._ttsBoxesByIndex = {
309
- [pageIndex]: chunk.lineRects.map(([l, b, r, t]) => ({l, r, b, t}))
309
+ [pageIndex]: chunk.lineRects.map(([l, b, r, t]) => ({l, r, b, t})),
310
310
  };
311
311
 
312
312
  // update any already created pages
@@ -30,7 +30,7 @@ const COLUMN_TO_LANG_INDEX = {
30
30
  'Endonym': 1,
31
31
  'ISO 639-1': 2,
32
32
  'ISO 639-2/T': 3,
33
- 'ISO 639-2/B': 4
33
+ 'ISO 639-2/B': 4,
34
34
  };
35
35
 
36
36
  /**
@@ -61,7 +61,7 @@ BookReader.prototype.init = (function(super_) {
61
61
  });
62
62
 
63
63
  this.bind(BookReader.eventNames.fragmentChange,
64
- this.urlUpdateFragment.bind(this)
64
+ this.urlUpdateFragment.bind(this),
65
65
  );
66
66
  }
67
67
  super_.call(this);
@@ -30,7 +30,7 @@ const MOCKED_RESPONSE_NOT_FOUND = {
30
30
  "page_count": 1,
31
31
  "body_length": 666,
32
32
  "leaf0_missing": true,
33
- "matches": []
33
+ "matches": [],
34
34
  };
35
35
 
36
36
  const MOCKED_RESPONSE_FOUND = {
@@ -51,8 +51,8 @@ const MOCKED_RESPONSE_FOUND = {
51
51
  "b": 811,
52
52
  "t": 753,
53
53
  "page": PAGE_FIRST_RESULT_ADJUSTED,
54
- "l": 894
55
- }
54
+ "l": 894,
55
+ },
56
56
  ],
57
57
  "b": 1935,
58
58
  "t": 686,
@@ -60,9 +60,9 @@ const MOCKED_RESPONSE_FOUND = {
60
60
  "r": 1704,
61
61
  "l": 148,
62
62
  "page_height": 2940,
63
- "page": PAGE_FIRST_RESULT_ADJUSTED
64
- }
65
- ]
63
+ "page": PAGE_FIRST_RESULT_ADJUSTED,
64
+ },
65
+ ],
66
66
  },
67
67
  {
68
68
  "text": "That when the Dodger, and his accomplished friend Master Bates, joined in the hue-and-cry which was raised at Oliver's heels, in consequence of their executing an illegal conveyance of Mr. Brownlow's personal property, as has been already described, they were actuated by a very laudable and becoming regard for themselves ; and forasmuch as the freedom of the subject and the liberty of the individual are among the first and proudest boasts of a true-hearted Englishman, so, I need hardly beg the reader to observe, that this action should tend to exalt them in the opinion of all jniblic and patriotic men, in almost as great a degree as this strong proof of their anxiety for their own preservation and safety goes to corroborate and confirm the little code of laws which certain profound and sound-judging philosophers have laid down as the mainsprings of all Nature's deeds and actions : the said philosophers very wisely reducing the good lady's proceedings to matters of maxim and {{{" + TEST_TEXT_FOUND + "}}} : and, by a very neat and pretty compliment to her exalted wisdom and understanding, putting entirely out of sight any considerations of heart, or generous impulse and feeling. For, these are matters totally beneath a female who is acknowledged by universal admission to be far above the numerous little foibles and weaknesses of her sex.",
@@ -74,8 +74,8 @@ const MOCKED_RESPONSE_FOUND = {
74
74
  "b": 2567,
75
75
  "t": 2507,
76
76
  "page": 162,
77
- "l": 441
78
- }
77
+ "l": 441,
78
+ },
79
79
  ],
80
80
  "b": 2631,
81
81
  "t": 1439,
@@ -83,11 +83,11 @@ const MOCKED_RESPONSE_FOUND = {
83
83
  "r": 1620,
84
84
  "l": 56,
85
85
  "page_height": 2940,
86
- "page": 162
87
- }
88
- ]
89
- }
90
- ]
86
+ "page": 162,
87
+ },
88
+ ],
89
+ },
90
+ ],
91
91
  };
92
92
 
93
93
  export const SEARCH_MATCHES_LENGTH = MOCKED_RESPONSE_FOUND.matches.length;
@@ -22,7 +22,7 @@ const container = (sharedObserver = null) => {
22
22
  identifier: 'foo',
23
23
  creator: 'bar',
24
24
  title: 'baz',
25
- }
25
+ },
26
26
  };
27
27
  const modalMgr = new ModalManager();
28
28
  return html`
@@ -49,7 +49,7 @@ window.ResizeObserver = class ResizeObserver {
49
49
  beforeEach(() => {
50
50
  window.archive_analytics = {
51
51
  send_event_no_sampling: sinon.fake(),
52
- send_event: sinon.fake()
52
+ send_event: sinon.fake(),
53
53
  };
54
54
  });
55
55
 
@@ -78,7 +78,7 @@ describe('<book-navigator>', () => {
78
78
  jumpToIndex: sinon.fake(),
79
79
  options: { enableMultipleBooks: false }, // for multipleBooks
80
80
  el: '#BookReader',
81
- refs: {}
81
+ refs: {},
82
82
  };
83
83
 
84
84
  const sharedObserver = new SharedResizeObserver();
@@ -93,7 +93,7 @@ describe('<book-navigator>', () => {
93
93
  expect(brStub.resize.callCount).toEqual(0);
94
94
 
95
95
  window.dispatchEvent(new CustomEvent('BookReader:PostInit', {
96
- detail: { props: brStub }
96
+ detail: { props: brStub },
97
97
  }));
98
98
  await elementUpdated(el);
99
99
 
@@ -142,8 +142,8 @@ describe('<book-navigator>', () => {
142
142
  jumpToIndex: sinon.fake(),
143
143
  options: {},
144
144
  refs: {
145
- $brContainer
146
- }
145
+ $brContainer,
146
+ },
147
147
  };
148
148
  el.bookreader = brStub;
149
149
  await el.elementUpdated;
@@ -173,8 +173,8 @@ describe('<book-navigator>', () => {
173
173
  jumpToIndex: sinon.fake(),
174
174
  options: { enableSearch: true },
175
175
  refs: {
176
- $brContainer
177
- }
176
+ $brContainer,
177
+ },
178
178
  };
179
179
  el.bookreader = brStub;
180
180
  await el.elementUpdated;
@@ -199,13 +199,13 @@ describe('<book-navigator>', () => {
199
199
  enableMultipleBooks: true,
200
200
  multipleBooksList: {
201
201
  by_subprefix: {
202
- fooSubprefix: 'beep'
203
- }
204
- }
202
+ fooSubprefix: 'beep',
203
+ },
204
+ },
205
205
  },
206
206
  refs: {
207
- $brContainer
208
- }
207
+ $brContainer,
208
+ },
209
209
  };
210
210
  el.bookreader = brStub;
211
211
  await el.elementUpdated;
@@ -242,8 +242,8 @@ describe('<book-navigator>', () => {
242
242
  jumpToIndex: sinon.fake(),
243
243
  options: {},
244
244
  refs: {
245
- $brContainer
246
- }
245
+ $brContainer,
246
+ },
247
247
  };
248
248
  el.bookreader = brStub;
249
249
  await el.elementUpdated;
@@ -325,7 +325,7 @@ describe('<book-navigator>', () => {
325
325
  'volumes',
326
326
  'chapters',
327
327
  'search',
328
- 'bookmarks'
328
+ 'bookmarks',
329
329
  ]);
330
330
  });
331
331
  });
@@ -368,8 +368,8 @@ describe('<book-navigator>', () => {
368
368
  resize: sinon.fake(),
369
369
  options: {},
370
370
  refs: {
371
- $brContainer: document.createElement('div')
372
- }
371
+ $brContainer: document.createElement('div'),
372
+ },
373
373
  };
374
374
  el.bookreader = brStub;
375
375
  await elementUpdated(el);
@@ -379,9 +379,9 @@ describe('<book-navigator>', () => {
379
379
  const mockResizeEvent = {
380
380
  contentRect: {
381
381
  height: 500,
382
- width: 900
382
+ width: 900,
383
383
  },
384
- target: el.mainBRContainer
384
+ target: el.mainBRContainer,
385
385
  };
386
386
  el.handleResize(mockResizeEvent);
387
387
 
@@ -398,8 +398,8 @@ describe('<book-navigator>', () => {
398
398
  resize: sinon.fake(),
399
399
  options: {},
400
400
  refs: {
401
- $brContainer: document.createElement('div')
402
- }
401
+ $brContainer: document.createElement('div'),
402
+ },
403
403
  };
404
404
 
405
405
  el.bookreader = brStub;
@@ -410,9 +410,9 @@ describe('<book-navigator>', () => {
410
410
  const mockResizeEvent = {
411
411
  contentRect: {
412
412
  height: 500,
413
- width: 900
413
+ width: 900,
414
414
  },
415
- target: el.mainBRContainer
415
+ target: el.mainBRContainer,
416
416
  };
417
417
  el.handleResize(mockResizeEvent);
418
418
 
@@ -540,7 +540,7 @@ describe('<book-navigator>', () => {
540
540
  await elementUpdated(el);
541
541
 
542
542
  window.dispatchEvent(new CustomEvent('BookReader:fullscreenToggled', {
543
- detail: { props: brStub }
543
+ detail: { props: brStub },
544
544
  }));
545
545
  await elementUpdated(el);
546
546
 
@@ -581,7 +581,7 @@ describe('<book-navigator>', () => {
581
581
 
582
582
  // analytics fires
583
583
  expect(window.archive_analytics.send_event_no_sampling.called).toEqual(
584
- false
584
+ false,
585
585
  );
586
586
  expect(window.archive_analytics.send_event.called).toEqual(true);
587
587
  // we prevent default
@@ -633,7 +633,7 @@ describe('<book-navigator>', () => {
633
633
  await el.elementUpdated;
634
634
 
635
635
  expect(window.archive_analytics.send_event_no_sampling.called).toEqual(
636
- false
636
+ false,
637
637
  );
638
638
  expect(window.archive_analytics.send_event.called).toEqual(false);
639
639