@internetarchive/bookreader 5.0.0-44 → 5.0.0-44-a1

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.
@@ -15,10 +15,18 @@ const searchTerm = urlParams.get('q');
15
15
  const iaBookReader = document.querySelector('ia-bookreader');
16
16
 
17
17
  const downloadListWithLCP = [
18
+ [
19
+ "PDF",
20
+ "regular pdf link"
21
+ ],
18
22
  [
19
23
  "lcpPDF",
20
24
  "link to lcp pdf"
21
25
  ],
26
+ [
27
+ "ePub",
28
+ "link to epub"
29
+ ],
22
30
  [
23
31
  "lcpEPUB",
24
32
  "link to lcp epub"
package/CHANGELOG.md CHANGED
@@ -1,8 +1,3 @@
1
- # 5.0.0-44
2
- Fix: dynamic `q=<term>` url parameter @iisa
3
- Fix: lcp download links @iisa
4
- Dev: dependency updates @renovate
5
-
6
1
  # 5.0.0-43
7
2
  Fix: search results panel display asserted page numbers @cdrini
8
3
  Dev: dependency updates @renovate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/bookreader",
3
- "version": "5.0.0-44",
3
+ "version": "5.0.0-44-a1",
4
4
  "description": "The Internet Archive BookReader.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,14 +51,14 @@
51
51
  "@webcomponents/webcomponentsjs": "^2.6.0",
52
52
  "babel-loader": "8.2.5",
53
53
  "codecov": "^3.8.3",
54
- "concurrently": "7.2.2",
54
+ "concurrently": "7.1.0",
55
55
  "core-js": "3.22.3",
56
56
  "cpx2": "4.2.0",
57
57
  "eslint": "^7.32.0",
58
58
  "eslint-plugin-no-jquery": "^2.7.0",
59
59
  "eslint-plugin-testcafe": "^0.2.1",
60
60
  "hammerjs": "^2.0.8",
61
- "http-server": "14.1.1",
61
+ "http-server": "14.1.0",
62
62
  "iso-language-codes": "1.1.0",
63
63
  "jest": "^28.1.0",
64
64
  "jest-environment-jsdom": "^28.1.0",
@@ -69,13 +69,13 @@
69
69
  "jquery.browser": "0.1.0",
70
70
  "jquery.mmenu": "5.6.5",
71
71
  "live-server": "1.2.2",
72
- "node-fetch": "3.2.10",
72
+ "node-fetch": "3.2.4",
73
73
  "regenerator-runtime": "0.13.9",
74
- "sass": "1.52.1",
74
+ "sass": "1.51.0",
75
75
  "sinon": "^14.0.0",
76
76
  "soundmanager2": "2.97.20170602",
77
77
  "svgo": "2.8.0",
78
- "testcafe": "^1.19.0",
78
+ "testcafe": "^1.18.6",
79
79
  "testcafe-browser-provider-browserstack": "^1.13.2-alpha.1",
80
80
  "webpack": "5.51.1",
81
81
  "webpack-cli": "4.9.2"
@@ -73,9 +73,9 @@ export class IABookDownloads extends LitElement {
73
73
  return html`
74
74
  <p>For LCP downloads, make sure you have SimplyE or Aldiko Next installed on mobile or Thorium on desktop.</p>
75
75
  <ul>
76
- <li><a href="https://librarysimplified.org/simplye/" rel="noopener noreferrer nofollow" target="_blank">Install SimplyE</a></li>
77
- <li><a href="https://www.demarque.com/en-aldiko" rel="noopener noreferrer nofollow" target="_blank">Install Aldiko</a></li>
78
- <li><a href="https://www.edrlab.org/software/thorium-reader/" rel="noopener noreferrer nofollow" target="_blank">Install Thorium</a></li>
76
+ <li><a href="https://librarysimplified.org/simplye/" rel="noopener noreferrer" target="_blank">Install SimplyE</a></li>
77
+ <li><a href="https://www.demarque.com/en-aldiko" rel="noopener noreferrer" target="_blank">Install Aldiko</a></li>
78
+ <li><a href="https://www.edrlab.org/software/thorium-reader/" rel="noopener noreferrer" target="_blank">Install Thorium</a></li>
79
79
  </ul>
80
80
  `;
81
81
  }
@@ -85,10 +85,8 @@ export class IABookDownloads extends LitElement {
85
85
  ${this.header}
86
86
  ${this.loanExpiryMessage}
87
87
  <ul>${this.renderDownloadOptions()}</ul>
88
- ${this.hasLCPOption
89
- ? this.installSimplyEAldikoThoriumMsg
90
- : (this.isBookProtected ? this.accessProtectedBook : nothing)
91
- }
88
+ ${this.hasLCPOption ? this.installSimplyEAldikoThoriumMsg : nothing}
89
+ ${this.isBookProtected && !this.hasLCPOption ? this.accessProtectedBook : nothing}
92
90
  `;
93
91
  }
94
92
 
@@ -75,10 +75,6 @@ export default class SearchProvider {
75
75
  searchCanceled: true
76
76
  };
77
77
  this.updateMenu(updateMenuFor);
78
-
79
- if (this.bookreader.urlPlugin) {
80
- this.updateSearchInUrl();
81
- }
82
78
  }
83
79
 
84
80
  onSearchStarted(e) {
@@ -150,21 +146,6 @@ export default class SearchProvider {
150
146
  };
151
147
  this.updateMenu({ openMenu: false });
152
148
  this.bookreader?.searchView?.clearSearchFieldAndResults(false);
153
- if (this.bookreader.urlPlugin) {
154
- this.updateSearchInUrl();
155
- }
156
- }
157
-
158
- /** update URL `q=<term>` query param in URL */
159
- updateSearchInUrl() {
160
- if (this.bookreader.urlPlugin) {
161
- this.bookreader.urlPlugin.pullFromAddressBar();
162
- if (searchState.query) {
163
- this.bookreader.urlPlugin.setUrlParam('q', searchState.query);
164
- } else {
165
- this.bookreader.urlPlugin.removeUrlParam('q');
166
- }
167
- }
168
149
  }
169
150
 
170
151
  /**
@@ -60,9 +60,6 @@ export class IABookSearchResults extends LitElement {
60
60
 
61
61
  setQuery(e) {
62
62
  this.query = e.currentTarget.value;
63
- if (!this.query) {
64
- this.cancelSearch();
65
- }
66
63
  }
67
64
 
68
65
  performSearch(e) {
@@ -151,7 +148,6 @@ export class IABookSearchResults extends LitElement {
151
148
  name="query"
152
149
  alt="Search inside this book."
153
150
  @keyup=${this.setQuery}
154
- @search=${this.setQuery}
155
151
  .value=${this.query}
156
152
  />
157
153
  </fieldset>
@@ -102,66 +102,5 @@ describe('Search Provider', () => {
102
102
 
103
103
  expect(provider.bookreader._searchPluginGoToResult.callCount).toEqual(1);
104
104
  });
105
- test('update url when search is cancelled or input cleared', async() => {
106
- const urlPluginMock = {
107
- pullFromAddressBar: sinon.fake(),
108
- removeUrlParam: sinon.fake()
109
- };
110
- const provider = new searchProvider({
111
- onProviderChange: sinon.fake(),
112
- bookreader: {
113
- leafNumToIndex: sinon.fake(),
114
- _searchPluginGoToResult: sinon.fake(),
115
- urlPlugin: urlPluginMock
116
- }
117
- });
118
-
119
- provider.onSearchCanceled();
120
- await provider.updateComplete;
121
-
122
- expect(urlPluginMock.pullFromAddressBar.callCount).toEqual(1);
123
- expect(urlPluginMock.removeUrlParam.callCount).toEqual(1);
124
-
125
- provider.onSearchCanceled();
126
- await provider.updateComplete;
127
-
128
- expect(urlPluginMock.pullFromAddressBar.callCount).toEqual(2);
129
- expect(urlPluginMock.removeUrlParam.callCount).toEqual(2);
130
- });
131
- it('updateSearchInUrl', async () => {
132
- let fieldToSet;
133
- let valueOfFieldToSet;
134
- let setUrlParamCalled = false;
135
- const urlPluginMock = {
136
- pullFromAddressBar: sinon.fake(),
137
- removeUrlParam: sinon.fake(),
138
- setUrlParam: (field, val) => {
139
- fieldToSet = field;
140
- valueOfFieldToSet = val;
141
- setUrlParamCalled = true;
142
- }
143
- };
144
- const provider = new searchProvider({
145
- onProviderChange: sinon.fake(),
146
- bookreader: {
147
- leafNumToIndex: sinon.fake(),
148
- _searchPluginGoToResult: sinon.fake(),
149
- urlPlugin: urlPluginMock,
150
- search: sinon.fake()
151
- }
152
- });
153
-
154
- const searchInitiatedEvent = new CustomEvent('bookSearchInitiated', { detail: { query: 'foobar' } });
155
- // set initial seachState with a query
156
- provider.onBookSearchInitiated(searchInitiatedEvent);
157
- await provider.updateComplete;
158
- // checking this fn:
159
- provider.updateSearchInUrl();
160
- await provider.updateComplete;
161
-
162
- expect(fieldToSet).toEqual('q');
163
- expect(valueOfFieldToSet).toEqual('foobar');
164
- expect(setUrlParamCalled).toBe(true);
165
- });
166
105
  });
167
106
  });
@@ -236,17 +236,4 @@ describe('<ia-book-search-results>', () => {
236
236
 
237
237
  expect(response).toBeDefined();
238
238
  });
239
- it('cancels search when input is cleared', async () => {
240
- const el = await fixture(container(results));
241
-
242
- el.cancelSearch = sinon.fake();
243
- await el.updateComplete;
244
-
245
- const searchInput = el.shadowRoot.querySelector('[name="query"]');
246
-
247
- searchInput.value = '';
248
- searchInput.dispatchEvent(new Event('search'));
249
-
250
- expect(el.cancelSearch.callCount).toEqual(1);
251
- });
252
239
  });