@internetarchive/bookreader 5.0.0-81 → 5.0.0-82
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.js +1 -1
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/images/unviewable_page.png +0 -0
- package/BookReaderDemo/demo-preview-pages.html +524 -524
- package/CHANGELOG.md +3 -0
- package/package.json +1 -1
- package/src/BookReader/BookModel.js +11 -6
- package/src/BookReader/options.js +9 -0
- package/src/assets/images/unviewable_page.png +0 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -4,11 +4,6 @@ import { clamp } from './utils.js';
|
|
|
4
4
|
/** @typedef {import('./options.js').PageData} PageData */
|
|
5
5
|
/** @typedef {import('../BookReader.js').default} BookReader */
|
|
6
6
|
|
|
7
|
-
// URI to display when a page is not viewable.
|
|
8
|
-
// TODO Render configurable html for the user instead.
|
|
9
|
-
// FIXME Don't reference files on archive.org
|
|
10
|
-
const UNVIEWABLE_PAGE_URI = '/bookreader/static/preview-default.png';
|
|
11
|
-
|
|
12
7
|
/**
|
|
13
8
|
* Contains information about the Book/Document independent of the way it is
|
|
14
9
|
* being rendering. Nothing here should reference e.g. the mode, zoom, etc.
|
|
@@ -160,7 +155,17 @@ export class BookModel {
|
|
|
160
155
|
*/
|
|
161
156
|
// eslint-disable-next-line no-unused-vars
|
|
162
157
|
getPageURI(index, reduce, rotate) {
|
|
163
|
-
|
|
158
|
+
if (!this.getPageProp(index, 'viewable', true)) {
|
|
159
|
+
const uri = this.br.options.unviewablePageURI;
|
|
160
|
+
if (uri.startsWith('.')) {
|
|
161
|
+
// It's a relative path, so make it relative to the images path
|
|
162
|
+
return this.br.options.imagesBaseURL + uri;
|
|
163
|
+
} else {
|
|
164
|
+
return uri;
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
return this.getPageProp(index, 'uri');
|
|
168
|
+
}
|
|
164
169
|
}
|
|
165
170
|
|
|
166
171
|
/**
|
|
@@ -301,6 +301,15 @@ export const DEFAULT_OPTIONS = {
|
|
|
301
301
|
* On init, by default, we want to use srcSet for images
|
|
302
302
|
*/
|
|
303
303
|
useSrcSet: false,
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* @type {string}
|
|
307
|
+
* Path to the image to display when a page is unviewable (i.e. when
|
|
308
|
+
* displaying a preview of a book).
|
|
309
|
+
*
|
|
310
|
+
* Relative to the imagesBaseURL if a relative path is specified.
|
|
311
|
+
*/
|
|
312
|
+
unviewablePageURI: './unviewable_page.png',
|
|
304
313
|
};
|
|
305
314
|
|
|
306
315
|
/**
|
|
Binary file
|