@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.
- package/.eslintrc.js +9 -9
- package/.github/workflows/node.js.yml +9 -7
- package/BookReader/BookReader.css +2 -2
- package/BookReader/BookReader.js +1 -1
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/ia-bookreader-bundle.js +33 -33
- package/BookReader/ia-bookreader-bundle.js.map +1 -1
- package/BookReader/plugins/plugin.archive_analytics.js.map +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.iframe.js.map +1 -1
- package/BookReader/plugins/plugin.iiif.js +1 -1
- package/BookReader/plugins/plugin.iiif.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/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
- package/BookReaderDemo/IADemoBr.js +10 -3
- package/BookReaderDemo/demo-iiif.html +1 -1
- package/BookReaderDemo/demo-internetarchive.html +1 -1
- package/CHANGELOG.md +15 -0
- package/babel.config.js +5 -5
- package/package.json +16 -18
- package/renovate.json +1 -1
- package/src/BookNavigator/book-navigator.js +8 -8
- package/src/BookNavigator/bookmarks/bookmarks-loginCTA.js +1 -1
- package/src/BookNavigator/bookmarks/bookmarks-provider.js +1 -1
- package/src/BookNavigator/bookmarks/ia-bookmarks.js +1 -1
- package/src/BookNavigator/downloads/downloads.js +4 -16
- package/src/BookNavigator/search/search-provider.js +2 -2
- package/src/BookNavigator/search/search-results.js +1 -1
- package/src/BookNavigator/sharing.js +1 -1
- package/src/BookNavigator/viewable-files.js +1 -1
- package/src/BookNavigator/visual-adjustments/visual-adjustments.js +3 -3
- package/src/BookReader/BookModel.js +1 -1
- package/src/BookReader/DragScrollable.js +2 -2
- package/src/BookReader/ModeSmoothZoom.js +5 -5
- package/src/BookReader/ModeThumb.js +2 -2
- package/src/BookReader/Navbar/Navbar.js +4 -4
- package/src/BookReader/ReduceSet.js +2 -2
- package/src/BookReader/Toolbar/Toolbar.js +4 -4
- package/src/BookReader/options.js +10 -10
- package/src/BookReader/utils/classes.js +1 -1
- package/src/BookReader.js +12 -12
- package/src/css/_BRicon.scss +8 -2
- package/src/ia-bookreader/ia-bookreader.js +1 -1
- package/src/plugins/plugin.archive_analytics.js +1 -1
- package/src/plugins/plugin.autoplay.js +2 -2
- package/src/plugins/plugin.chapters.js +3 -3
- package/src/plugins/plugin.iframe.js +1 -1
- package/src/plugins/plugin.iiif.js +9 -5
- package/src/plugins/plugin.text_selection.js +2 -2
- package/src/plugins/plugin.vendor-fullscreen.js +3 -3
- package/src/plugins/search/plugin.search.js +16 -11
- package/src/plugins/search/view.js +4 -1
- package/src/plugins/tts/AbstractTTSEngine.js +1 -1
- package/src/plugins/tts/FestivalTTSEngine.js +3 -3
- package/src/plugins/tts/PageChunk.js +2 -2
- package/src/plugins/tts/WebTTSEngine.js +1 -1
- package/src/plugins/tts/plugin.tts.js +1 -1
- package/src/plugins/tts/utils.js +1 -1
- package/src/plugins/url/plugin.url.js +1 -1
- package/tests/e2e/helpers/mockSearch.js +13 -13
- package/tests/jest/BookNavigator/book-navigator.test.js +27 -27
- package/tests/jest/BookNavigator/downloads/downloads-provider.test.js +5 -5
- package/tests/jest/BookNavigator/downloads/downloads.test.js +3 -3
- package/tests/jest/BookNavigator/search/search-provider.test.js +15 -15
- package/tests/jest/BookNavigator/search/search-results.test.js +1 -1
- package/tests/jest/BookNavigator/sharing/sharing-provider.test.js +5 -5
- package/tests/jest/BookNavigator/viewable-files/viewable-files-provider.test.js +8 -8
- package/tests/jest/BookReader/BookReaderPublicFunctions.test.js +3 -3
- package/tests/jest/BookReader/Mode1UpLit.test.js +2 -2
- package/tests/jest/BookReader/Mode2UpLit.test.js +3 -3
- package/tests/jest/BookReader/ModeSmoothZoom.test.js +4 -4
- package/tests/jest/BookReader/Navbar/Navbar.test.js +16 -16
- package/tests/jest/BookReader/Toolbar/Toolbar.test.js +1 -1
- package/tests/jest/BookReader.keyboard.test.js +1 -1
- package/tests/jest/BookReader.options.test.js +1 -1
- package/tests/jest/BookReader.test.js +4 -4
- package/tests/jest/plugins/plugin.chapters.test.js +3 -3
- package/tests/jest/plugins/plugin.iframe.test.js +2 -2
- package/tests/jest/plugins/plugin.text_selection.test.js +1 -1
- package/tests/jest/plugins/search/plugin.search.view.test.js +6 -6
- package/tests/jest/plugins/search/utils.js +3 -3
- package/tests/jest/plugins/tts/AbstractTTSEngine.test.js +1 -1
- package/tests/jest/plugins/tts/WebTTSEngine.test.js +2 -2
- package/tests/jest/plugins/url/UrlPlugin.test.js +2 -2
- package/tests/jest/plugins/url/plugin.url.test.js +6 -6
- package/webpack.config.js +6 -6
@@ -7,20 +7,20 @@ const downloadableTypes = [
|
|
7
7
|
["ePub", "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.epub"],
|
8
8
|
["Plain Text", "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala_djvu.txt"],
|
9
9
|
["DAISY", "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala_daisy.zip"],
|
10
|
-
["Kindle", "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.mobi"]
|
10
|
+
["Kindle", "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.mobi"],
|
11
11
|
];
|
12
12
|
|
13
13
|
const downloads = [
|
14
14
|
{
|
15
15
|
type: "PDF",
|
16
16
|
url: "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.pdf",
|
17
|
-
note: "PDF files contain high quality images of pages."
|
17
|
+
note: "PDF files contain high quality images of pages.",
|
18
18
|
},
|
19
19
|
{
|
20
20
|
type: "ePub",
|
21
21
|
url: "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.epub",
|
22
|
-
note: "ePub files are smaller in size, but may contain errors."
|
23
|
-
}
|
22
|
+
note: "ePub files are smaller in size, but may contain errors.",
|
23
|
+
},
|
24
24
|
];
|
25
25
|
|
26
26
|
afterEach(() => {
|
@@ -52,7 +52,7 @@ describe('Downloads Provider', () => {
|
|
52
52
|
|
53
53
|
test('render view if book is protected', () => {
|
54
54
|
const provider = new DownloadsProvider({
|
55
|
-
bookreader: { options: { isProtected: true } }
|
55
|
+
bookreader: { options: { isProtected: true } },
|
56
56
|
});
|
57
57
|
|
58
58
|
expect(provider.isBookProtected).toEqual(true);
|
@@ -11,13 +11,13 @@ const downloads = [
|
|
11
11
|
{
|
12
12
|
type: "PDF",
|
13
13
|
url: "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.pdf",
|
14
|
-
note: "PDF files contain high quality images of pages."
|
14
|
+
note: "PDF files contain high quality images of pages.",
|
15
15
|
},
|
16
16
|
{
|
17
17
|
type: "ePub",
|
18
18
|
url: "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.epub",
|
19
|
-
note: "ePub files are smaller in size, but may contain errors."
|
20
|
-
}
|
19
|
+
note: "ePub files are smaller in size, but may contain errors.",
|
20
|
+
},
|
21
21
|
];
|
22
22
|
|
23
23
|
|
@@ -11,7 +11,7 @@ describe('Search Provider', () => {
|
|
11
11
|
describe('constructor', () => {
|
12
12
|
const provider = new searchProvider({
|
13
13
|
onProviderChange: sinon.fake(),
|
14
|
-
bookreader: {}
|
14
|
+
bookreader: {},
|
15
15
|
});
|
16
16
|
|
17
17
|
expect(provider.bookreader).toBeDefined();
|
@@ -27,7 +27,7 @@ describe('Search Provider', () => {
|
|
27
27
|
test('Event: catches `BookReader:SearchStarted`', async() => {
|
28
28
|
const provider = new searchProvider({
|
29
29
|
onProviderChange: sinon.fake(),
|
30
|
-
bookreader: {}
|
30
|
+
bookreader: {},
|
31
31
|
});
|
32
32
|
sinon.spy(provider, 'updateMenu');
|
33
33
|
window.dispatchEvent(new CustomEvent('BookReader:SearchStarted', { detail: { props: { term: 'foo' }}}));
|
@@ -36,7 +36,7 @@ describe('Search Provider', () => {
|
|
36
36
|
test('Event: catches `BookReader:SearchCallback`', async() => {
|
37
37
|
const provider = new searchProvider({
|
38
38
|
onProviderChange: sinon.fake(),
|
39
|
-
bookreader: {}
|
39
|
+
bookreader: {},
|
40
40
|
});
|
41
41
|
sinon.spy(provider, 'updateMenu');
|
42
42
|
const brStub = {};
|
@@ -47,7 +47,7 @@ describe('Search Provider', () => {
|
|
47
47
|
test('Event: catches `BookReader:SearchCallbackEmpty`', async() => {
|
48
48
|
const provider = new searchProvider({
|
49
49
|
onProviderChange: sinon.fake(),
|
50
|
-
bookreader: {}
|
50
|
+
bookreader: {},
|
51
51
|
});
|
52
52
|
sinon.spy(provider, 'onSearchRequestError');
|
53
53
|
sinon.spy(provider, 'updateMenu');
|
@@ -60,7 +60,7 @@ describe('Search Provider', () => {
|
|
60
60
|
test('Event: catches `BookReader:SearchCallbackNotIndexed`', async() => {
|
61
61
|
const provider = new searchProvider({
|
62
62
|
onProviderChange: sinon.fake(),
|
63
|
-
bookreader: {}
|
63
|
+
bookreader: {},
|
64
64
|
});
|
65
65
|
const brStub = {};
|
66
66
|
sinon.spy(provider, 'onSearchRequestError');
|
@@ -73,7 +73,7 @@ describe('Search Provider', () => {
|
|
73
73
|
test('Event: catches `BookReader:SearchCallbackError`', async() => {
|
74
74
|
const provider = new searchProvider({
|
75
75
|
onProviderChange: sinon.fake(),
|
76
|
-
bookreader: {}
|
76
|
+
bookreader: {},
|
77
77
|
});
|
78
78
|
sinon.spy(provider, 'onSearchRequestError');
|
79
79
|
sinon.spy(provider, 'updateMenu');
|
@@ -88,8 +88,8 @@ describe('Search Provider', () => {
|
|
88
88
|
onProviderChange: sinon.fake(),
|
89
89
|
bookreader: {
|
90
90
|
leafNumToIndex: sinon.fake(),
|
91
|
-
_searchPluginGoToResult: sinon.fake()
|
92
|
-
}
|
91
|
+
_searchPluginGoToResult: sinon.fake(),
|
92
|
+
},
|
93
93
|
});
|
94
94
|
|
95
95
|
const searchResultStub = {
|
@@ -97,7 +97,7 @@ describe('Search Provider', () => {
|
|
97
97
|
};
|
98
98
|
fixtureSync(provider.component).dispatchEvent(
|
99
99
|
new CustomEvent('resultSelected',
|
100
|
-
{ detail: searchResultStub })
|
100
|
+
{ detail: searchResultStub }),
|
101
101
|
);
|
102
102
|
|
103
103
|
expect(provider.bookreader._searchPluginGoToResult.callCount).toEqual(1);
|
@@ -105,15 +105,15 @@ describe('Search Provider', () => {
|
|
105
105
|
test('update url when search is cancelled or input cleared', async() => {
|
106
106
|
const urlPluginMock = {
|
107
107
|
pullFromAddressBar: sinon.fake(),
|
108
|
-
removeUrlParam: sinon.fake()
|
108
|
+
removeUrlParam: sinon.fake(),
|
109
109
|
};
|
110
110
|
const provider = new searchProvider({
|
111
111
|
onProviderChange: sinon.fake(),
|
112
112
|
bookreader: {
|
113
113
|
leafNumToIndex: sinon.fake(),
|
114
114
|
_searchPluginGoToResult: sinon.fake(),
|
115
|
-
urlPlugin: urlPluginMock
|
116
|
-
}
|
115
|
+
urlPlugin: urlPluginMock,
|
116
|
+
},
|
117
117
|
});
|
118
118
|
|
119
119
|
provider.onSearchCanceled();
|
@@ -139,7 +139,7 @@ describe('Search Provider', () => {
|
|
139
139
|
fieldToSet = field;
|
140
140
|
valueOfFieldToSet = val;
|
141
141
|
setUrlParamCalled = true;
|
142
|
-
}
|
142
|
+
},
|
143
143
|
};
|
144
144
|
const provider = new searchProvider({
|
145
145
|
onProviderChange: sinon.fake(),
|
@@ -147,8 +147,8 @@ describe('Search Provider', () => {
|
|
147
147
|
leafNumToIndex: sinon.fake(),
|
148
148
|
_searchPluginGoToResult: sinon.fake(),
|
149
149
|
urlPlugin: urlPluginMock,
|
150
|
-
search: sinon.fake()
|
151
|
-
}
|
150
|
+
search: sinon.fake(),
|
151
|
+
},
|
152
152
|
});
|
153
153
|
|
154
154
|
const searchInitiatedEvent = new CustomEvent('bookSearchInitiated', { detail: { query: 'foobar' } });
|
@@ -11,7 +11,7 @@ const item = {
|
|
11
11
|
identifier: 'stubby-id',
|
12
12
|
creator: 'mr. big',
|
13
13
|
title: 'Stubby title',
|
14
|
-
}
|
14
|
+
},
|
15
15
|
};
|
16
16
|
|
17
17
|
const baseHost = 'foo.org';
|
@@ -23,8 +23,8 @@ describe('Sharing Provider', () => {
|
|
23
23
|
item,
|
24
24
|
baseHost,
|
25
25
|
bookreader: {
|
26
|
-
options: { subPrefix }
|
27
|
-
}
|
26
|
+
options: { subPrefix },
|
27
|
+
},
|
28
28
|
});
|
29
29
|
|
30
30
|
expect(provider.id).toEqual('share');
|
@@ -39,8 +39,8 @@ describe('Sharing Provider', () => {
|
|
39
39
|
item,
|
40
40
|
baseHost,
|
41
41
|
bookreader: {
|
42
|
-
options: { subPrefix }
|
43
|
-
}
|
42
|
+
options: { subPrefix },
|
43
|
+
},
|
44
44
|
});
|
45
45
|
|
46
46
|
expect(fixtureSync(provider.component).fileSubPrefix).toEqual(subPrefix);
|
@@ -13,25 +13,25 @@ const brOptions = {
|
|
13
13
|
"file_subprefix": "book1/GPORFP",
|
14
14
|
"orig_sort": 1,
|
15
15
|
"title": "book1/GPORFP.pdf",
|
16
|
-
"file_source": "/book1/GPORFP_jp2.zip"
|
16
|
+
"file_source": "/book1/GPORFP_jp2.zip",
|
17
17
|
},
|
18
18
|
"/details/SubBookTest/subdir/book2/brewster_kahle_internet_archive": {
|
19
19
|
"url_path": "/details/SubBookTest/subdir/book2/brewster_kahle_internet_archive",
|
20
20
|
"file_subprefix": "subdir/book2/brewster_kahle_internet_archive",
|
21
21
|
"orig_sort": 2,
|
22
22
|
"title": "subdir/book2/brewster_kahle_internet_archive.pdf",
|
23
|
-
"file_source": "/subdir/book2/brewster_kahle_internet_archive_jp2.zip"
|
23
|
+
"file_source": "/subdir/book2/brewster_kahle_internet_archive_jp2.zip",
|
24
24
|
},
|
25
25
|
"/details/SubBookTest/subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume": {
|
26
26
|
"url_path": "/details/SubBookTest/subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume",
|
27
27
|
"file_subprefix": "subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume",
|
28
28
|
"orig_sort": 3,
|
29
29
|
"title": "subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume.pdf",
|
30
|
-
"file_source": "/subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume_jp2.zip"
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
34
|
-
}
|
30
|
+
"file_source": "/subdir/subsubdir/book3/Rfp008011ResponseInternetArchive-without-resume_jp2.zip",
|
31
|
+
},
|
32
|
+
},
|
33
|
+
},
|
34
|
+
},
|
35
35
|
};
|
36
36
|
|
37
37
|
afterEach(() => {
|
@@ -47,7 +47,7 @@ describe('Volumes Provider', () => {
|
|
47
47
|
const provider = new ViewableFilesProvider({
|
48
48
|
baseHost,
|
49
49
|
bookreader: brOptions,
|
50
|
-
onProviderChange
|
50
|
+
onProviderChange,
|
51
51
|
});
|
52
52
|
|
53
53
|
const files = brOptions.options.multipleBooksList.by_subprefix;
|
@@ -31,14 +31,14 @@ describe('BookReader.prototype.toggleFullscreen', () => {
|
|
31
31
|
br.jumpToIndex = sinon.fake();
|
32
32
|
br.refs.$brContainer = {
|
33
33
|
css: sinon.fake(),
|
34
|
-
animate: (options, speed, style, callback) => callback()
|
34
|
+
animate: (options, speed, style, callback) => callback(),
|
35
35
|
};
|
36
36
|
br.refs.$br = {
|
37
37
|
updateBrClasses: sinon.fake(),
|
38
38
|
removeClass: sinon.fake(),
|
39
39
|
addClass: sinon.fake(),
|
40
40
|
css: sinon.fake(),
|
41
|
-
animate: (options, speed, style, callback) => callback()
|
41
|
+
animate: (options, speed, style, callback) => callback(),
|
42
42
|
};
|
43
43
|
|
44
44
|
await br.toggleFullscreen();
|
@@ -124,7 +124,7 @@ describe('BookReader.prototype.exitFullScreen', () => {
|
|
124
124
|
};
|
125
125
|
br.refs.$brContainer = {
|
126
126
|
css: sinon.fake(),
|
127
|
-
animate: (options, speed, style, callback) => callback()
|
127
|
+
animate: (options, speed, style, callback) => callback(),
|
128
128
|
};
|
129
129
|
await br.exitFullScreen();
|
130
130
|
expect(br.switchMode.callCount).toEqual(1);
|
@@ -116,7 +116,7 @@ describe("computePositions", () => {
|
|
116
116
|
leafEdgesRightEnd: 0.252,
|
117
117
|
leafEdgesRightFullWidth: 0.006,
|
118
118
|
spreadWidth: 0.492,
|
119
|
-
bookWidth: 0.498
|
119
|
+
bookWidth: 0.498,
|
120
120
|
};
|
121
121
|
const SPREAD_EXPECTED = {
|
122
122
|
leafEdgesLeftStart: -0.246,
|
@@ -139,7 +139,7 @@ describe("computePositions", () => {
|
|
139
139
|
leafEdgesRightEnd: 0.252,
|
140
140
|
leafEdgesRightFullWidth: 0.004,
|
141
141
|
spreadWidth: 0.492,
|
142
|
-
bookWidth: 0.498
|
142
|
+
bookWidth: 0.498,
|
143
143
|
};
|
144
144
|
const RIGHT_COVER_EXPECTED = {
|
145
145
|
leafEdgesLeftStart: -0.242,
|
@@ -162,7 +162,7 @@ describe("computePositions", () => {
|
|
162
162
|
leafEdgesRightEnd: 0.01,
|
163
163
|
leafEdgesRightFullWidth: 0,
|
164
164
|
spreadWidth: 0.246,
|
165
|
-
bookWidth: 0.252
|
165
|
+
bookWidth: 0.252,
|
166
166
|
};
|
167
167
|
|
168
168
|
test("left cover page", () => {
|
@@ -19,7 +19,7 @@ function dummy_mode(overrides = {}) {
|
|
19
19
|
boundingClientRect: { left: 0, top: 0 },
|
20
20
|
},
|
21
21
|
scaleCenter: {x: 0.5, y: 0.5},
|
22
|
-
...overrides
|
22
|
+
...overrides,
|
23
23
|
};
|
24
24
|
}
|
25
25
|
|
@@ -75,9 +75,9 @@ describe('ModeSmoothZoom', () => {
|
|
75
75
|
clientHeight: 100,
|
76
76
|
boundingClientRect: {
|
77
77
|
left: 5,
|
78
|
-
top: 50
|
79
|
-
}
|
80
|
-
}
|
78
|
+
top: 50,
|
79
|
+
},
|
80
|
+
},
|
81
81
|
});
|
82
82
|
const msz = new ModeSmoothZoom(mode);
|
83
83
|
expect(msz.scaleCenter).toEqual({ x: 0.5, y: 0.5 });
|
@@ -40,7 +40,7 @@ beforeEach(() => {
|
|
40
40
|
uri: '//archive.org/download/BookReader/img/page004.jpg' },
|
41
41
|
{ width: 800, height: 1200,
|
42
42
|
uri: '//archive.org/download/BookReader/img/page005.jpg' },
|
43
|
-
]
|
43
|
+
],
|
44
44
|
],
|
45
45
|
});
|
46
46
|
br.init();
|
@@ -89,8 +89,8 @@ describe('Navbar controls overrides', () => {
|
|
89
89
|
visible: true,
|
90
90
|
className: 'viewmode',
|
91
91
|
excludedModes: [1],
|
92
|
-
}
|
93
|
-
}
|
92
|
+
},
|
93
|
+
},
|
94
94
|
};
|
95
95
|
createBRWithOverrides(overrides);
|
96
96
|
|
@@ -107,9 +107,9 @@ describe('Navbar controls overrides', () => {
|
|
107
107
|
const overrides = {
|
108
108
|
controls: {
|
109
109
|
onePage: {
|
110
|
-
visible: false
|
111
|
-
}
|
112
|
-
}
|
110
|
+
visible: false,
|
111
|
+
},
|
112
|
+
},
|
113
113
|
};
|
114
114
|
createBRWithOverrides(overrides);
|
115
115
|
|
@@ -122,9 +122,9 @@ describe('Navbar controls overrides', () => {
|
|
122
122
|
const overrides = {
|
123
123
|
controls: {
|
124
124
|
onePage: {
|
125
|
-
className: 'foo'
|
126
|
-
}
|
127
|
-
}
|
125
|
+
className: 'foo',
|
126
|
+
},
|
127
|
+
},
|
128
128
|
};
|
129
129
|
createBRWithOverrides(overrides);
|
130
130
|
|
@@ -139,9 +139,9 @@ describe('Navbar controls overrides', () => {
|
|
139
139
|
onePage: {
|
140
140
|
template: () => (
|
141
141
|
'<button id="foo"></button>'
|
142
|
-
)
|
143
|
-
}
|
144
|
-
}
|
142
|
+
),
|
143
|
+
},
|
144
|
+
},
|
145
145
|
};
|
146
146
|
createBRWithOverrides(overrides);
|
147
147
|
|
@@ -154,12 +154,12 @@ describe('Navbar controls overrides', () => {
|
|
154
154
|
const overrides = {
|
155
155
|
controls: {
|
156
156
|
viewmode: {
|
157
|
-
visible: true
|
157
|
+
visible: true,
|
158
158
|
},
|
159
159
|
onePage: {
|
160
|
-
visible: false
|
161
|
-
}
|
162
|
-
}
|
160
|
+
visible: false,
|
161
|
+
},
|
162
|
+
},
|
163
163
|
};
|
164
164
|
createBRWithOverrides(overrides);
|
165
165
|
|
@@ -137,7 +137,7 @@ test('adds q= term to urlMode=history query string', () => {
|
|
137
137
|
expect(br.queryStringFromParams(
|
138
138
|
{ search: 'test value' },
|
139
139
|
'name=value',
|
140
|
-
'history'
|
140
|
+
'history',
|
141
141
|
)).toBe('?name=value&q=test+value');
|
142
142
|
});
|
143
143
|
|
@@ -145,7 +145,7 @@ test('replaces q= term in urlMode=history query string', () => {
|
|
145
145
|
expect(br.queryStringFromParams(
|
146
146
|
{ search: 'test+value' },
|
147
147
|
'q=foo&a=1&b=2&c=3',
|
148
|
-
'history'
|
148
|
+
'history',
|
149
149
|
)).toBe('?q=test%2Bvalue&a=1&b=2&c=3');
|
150
150
|
});
|
151
151
|
|
@@ -153,7 +153,7 @@ test('does not add q= term to urlMode=hash query string', () => {
|
|
153
153
|
expect(br.queryStringFromParams(
|
154
154
|
{ search: 'test value' },
|
155
155
|
'name=value',
|
156
|
-
'hash'
|
156
|
+
'hash',
|
157
157
|
)).toBe('?name=value');
|
158
158
|
});
|
159
159
|
|
@@ -228,7 +228,7 @@ describe('nextReduce', () => {
|
|
228
228
|
// auto doesn't get read by nextReduce (bug)
|
229
229
|
// It looks like width/height are set for 1up, and auto is set for 2up,
|
230
230
|
// and neither is set for thumb
|
231
|
-
{ reduce: 6.2, autofit: "auto" }
|
231
|
+
{ reduce: 6.2, autofit: "auto" },
|
232
232
|
];
|
233
233
|
|
234
234
|
const currentReduces = [
|
@@ -71,7 +71,7 @@ afterEach(() => {
|
|
71
71
|
describe("BRChaptersPlugin", () => {
|
72
72
|
beforeEach(() => {
|
73
73
|
sinon.stub(BookModel.prototype, "getPageIndex").callsFake((str) =>
|
74
|
-
parseFloat(str)
|
74
|
+
parseFloat(str),
|
75
75
|
);
|
76
76
|
});
|
77
77
|
|
@@ -159,7 +159,7 @@ describe("BRChaptersPlugin", () => {
|
|
159
159
|
menuProviders: {},
|
160
160
|
addMenuShortcut: sinon.stub(),
|
161
161
|
updateMenuContents: sinon.stub(),
|
162
|
-
}
|
162
|
+
},
|
163
163
|
};
|
164
164
|
BookReader.prototype._chaptersRender.call(fakeBR);
|
165
165
|
expect(fakeBR.shell.menuProviders['chapters']).toBeTruthy();
|
@@ -178,7 +178,7 @@ describe("BRChaptersPlugin", () => {
|
|
178
178
|
_tocEntries: SAMPLE_TOC,
|
179
179
|
_chaptersPanel: {
|
180
180
|
currentChapter: null,
|
181
|
-
}
|
181
|
+
},
|
182
182
|
};
|
183
183
|
BookReader.prototype._chaptersUpdateCurrent.call(fakeBR);
|
184
184
|
expect(fakeBR._chaptersPanel.currentChapter).toEqual(SAMPLE_TOC[1]);
|
@@ -35,8 +35,8 @@ test('updates params when window receives a message', () => {
|
|
35
35
|
window.dispatchEvent(new MessageEvent('message', {
|
36
36
|
data: {
|
37
37
|
type: 'bookReaderFragmentChange',
|
38
|
-
fragment: ''
|
39
|
-
}
|
38
|
+
fragment: '',
|
39
|
+
},
|
40
40
|
}));
|
41
41
|
expect(br.updateFromParams.callCount).toBe(1);
|
42
42
|
});
|
@@ -23,9 +23,9 @@ const results = {
|
|
23
23
|
r: 1598,
|
24
24
|
l: 50,
|
25
25
|
page_height: 2940,
|
26
|
-
page: 37
|
27
|
-
}]
|
28
|
-
}]
|
26
|
+
page: 37,
|
27
|
+
}],
|
28
|
+
}],
|
29
29
|
};
|
30
30
|
|
31
31
|
marshallSearchResults(results, () => '', '{{{', '}}}');
|
@@ -46,9 +46,9 @@ const resultWithScript = {
|
|
46
46
|
r: 1598,
|
47
47
|
l: 50,
|
48
48
|
page_height: 2940,
|
49
|
-
page: 37
|
50
|
-
}]
|
51
|
-
}]
|
49
|
+
page: 37,
|
50
|
+
}],
|
51
|
+
}],
|
52
52
|
};
|
53
53
|
|
54
54
|
marshallSearchResults(resultWithScript, () => '', '{{{', '}}}');
|
@@ -106,7 +106,7 @@ for (const dummyVoice of [dummyVoiceHyphens, dummyVoiceUnderscores]) {
|
|
106
106
|
{ default: false, lang: "ru-RU", name: "Google русский", localService: false, voiceURI: "Google русский" },
|
107
107
|
{ default: false, lang: "zh-CN", name: "Google 普通话(中国大陆)", localService: false, voiceURI: "Google 普通话(中国大陆)" },
|
108
108
|
{ default: false, lang: "zh-HK", name: "Google 粤語(香港)", localService: false, voiceURI: "Google 粤語(香港)" },
|
109
|
-
{ default: false, lang: "zh-TW", name: "Google 國語(臺灣)", localService: false, voiceURI: "Google 國語(臺灣)" }
|
109
|
+
{ default: false, lang: "zh-TW", name: "Google 國語(臺灣)", localService: false, voiceURI: "Google 國語(臺灣)" },
|
110
110
|
];
|
111
111
|
|
112
112
|
expect(getBestBookVoice(voices, 'en', ['en-CA', 'en'])).toBe(voices[0]);
|
@@ -39,7 +39,7 @@ describe('WebTTSEngine', () => {
|
|
39
39
|
localService: true,
|
40
40
|
name: "Daria",
|
41
41
|
voiceURI: "com.apple.voice.compact.bg-BG.Daria",
|
42
|
-
}
|
42
|
+
},
|
43
43
|
];
|
44
44
|
const voices = WebTTSEngine.prototype.getVoices();
|
45
45
|
expect(voices.length).toBe(3);
|
@@ -61,7 +61,7 @@ describe('WebTTSEngine', () => {
|
|
61
61
|
localService: true,
|
62
62
|
name: "Daria",
|
63
63
|
voiceURI: "com.apple.voice.compact.bg-BG.Daria",
|
64
|
-
}
|
64
|
+
},
|
65
65
|
];
|
66
66
|
const voices = WebTTSEngine.prototype.getVoices();
|
67
67
|
expect(voices.length).toBe(2);
|
@@ -66,10 +66,10 @@ describe('UrlPlugin tests', () => {
|
|
66
66
|
const url1 = '/mode/2up?ref=ol&ui=embed&wrapper=false&view=theater';
|
67
67
|
|
68
68
|
expect(urlPlugin.urlStringToUrlState(url)).toEqual(
|
69
|
-
{page: 'n7', mode: '2up', q: 'hello', view: 'theather', foo: 'bar', sort: 'title_asc'}
|
69
|
+
{page: 'n7', mode: '2up', q: 'hello', view: 'theather', foo: 'bar', sort: 'title_asc'},
|
70
70
|
);
|
71
71
|
expect(urlPlugin.urlStringToUrlState(url1)).toEqual(
|
72
|
-
{mode: '2up', ref: 'ol', ui: 'embed', wrapper: 'false', view: 'theater'}
|
72
|
+
{mode: '2up', ref: 'ol', ui: 'embed', wrapper: 'false', view: 'theater'},
|
73
73
|
);
|
74
74
|
});
|
75
75
|
|
@@ -55,7 +55,7 @@ describe('Plugin: URL controller', () => {
|
|
55
55
|
BookReader.prototype.paramsFromCurrent = jest.fn(() => ({
|
56
56
|
index: 88,
|
57
57
|
mode: 1,
|
58
|
-
search: ''
|
58
|
+
search: '',
|
59
59
|
}));
|
60
60
|
br.options.urlMode = 'history';
|
61
61
|
br.init();
|
@@ -71,7 +71,7 @@ describe('Plugin: URL controller', () => {
|
|
71
71
|
BookReader.prototype.paramsFromCurrent = jest.fn(() => ({
|
72
72
|
index: 2,
|
73
73
|
mode: 2,
|
74
|
-
search: ''
|
74
|
+
search: '',
|
75
75
|
}));
|
76
76
|
br.options.urlMode = 'history';
|
77
77
|
br.init();
|
@@ -87,7 +87,7 @@ describe('Plugin: URL controller', () => {
|
|
87
87
|
BookReader.prototype.paramsFromCurrent = jest.fn(() => ({
|
88
88
|
index: 1,
|
89
89
|
mode: 2,
|
90
|
-
search: 'foo'
|
90
|
+
search: 'foo',
|
91
91
|
}));
|
92
92
|
BookReader.prototype.search = jest.fn();
|
93
93
|
br.options.urlMode = 'history';
|
@@ -104,7 +104,7 @@ describe('Plugin: URL controller', () => {
|
|
104
104
|
BookReader.prototype.paramsFromCurrent = jest.fn(() => ({
|
105
105
|
index: 1,
|
106
106
|
mode: 2,
|
107
|
-
view: 'theater'
|
107
|
+
view: 'theater',
|
108
108
|
}));
|
109
109
|
BookReader.prototype.search = jest.fn();
|
110
110
|
br.options.urlMode = 'history';
|
@@ -123,7 +123,7 @@ describe('Plugin: URL controller', () => {
|
|
123
123
|
BookReader.prototype.paramsFromCurrent = jest.fn(() => ({
|
124
124
|
index: 1,
|
125
125
|
mode: 2,
|
126
|
-
view: 'theater'
|
126
|
+
view: 'theater',
|
127
127
|
}));
|
128
128
|
BookReader.prototype.search = jest.fn();
|
129
129
|
br.options.urlMode = 'history';
|
@@ -142,7 +142,7 @@ describe('Plugin: URL controller', () => {
|
|
142
142
|
BookReader.prototype.paramsFromCurrent = jest.fn(() => ({
|
143
143
|
index: 1,
|
144
144
|
mode: 2,
|
145
|
-
search: 'foo'
|
145
|
+
search: 'foo',
|
146
146
|
}));
|
147
147
|
BookReader.prototype.search = jest.fn();
|
148
148
|
br.options.initialSearchTerm = 'foo';
|