Skip to content

Commit 46bdf4c

Browse files
committed
Use getFromUrl helper in more places
1 parent f44cca0 commit 46bdf4c

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

BookReaderDemo/IADemoBr.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ import { extraVolOptions, custvolumesManifest } from './ia-multiple-volumes-mani
55
* This is how Internet Archive loads bookreader
66
*/
77
const urlParams = new URLSearchParams(window.location.search);
8+
function getFromUrl(name, def) {
9+
if (urlParams.has(name)) {
10+
return urlParams.get(name);
11+
} else {
12+
return def;
13+
}
14+
}
815

916
const ocaid = urlParams.get('ocaid');
1017
const openFullImmersionTheater = urlParams.get('view') === 'theater';
@@ -41,18 +48,10 @@ const initializeBookReader = (brManifest) => {
4148

4249
const customAutoflipParams = {
4350
autoflip: !!autoflip,
44-
flipSpeed: urlParams.flipSpeed || 2000,
45-
flipDelay: urlParams.flipDelay || 5000
51+
flipSpeed: parseFloat(getFromUrl('flipSpeed', '2000')),
52+
flipDelay: parseFloat(getFromUrl('flipDelay', '5000')),
4653
};
4754

48-
function getFromUrl(name, def) {
49-
if (urlParams.has(name)) {
50-
return urlParams.get(name);
51-
} else {
52-
return def;
53-
}
54-
}
55-
5655
const options = {
5756
el: '#BookReader',
5857
/* Url plugin - IA uses History mode for URL */

0 commit comments

Comments
 (0)