Skip to content

Commit df9d852

Browse files
committed
Add dev-server bookreader document
1 parent 7c19e8d commit df9d852

File tree

2 files changed

+129
-0
lines changed

2 files changed

+129
-0
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
<title>Internet Archive BookReader</title>
7+
<style>
8+
body {
9+
font-family: sans-serif;
10+
}
11+
</style>
12+
</head>
13+
<body>
14+
<h1>Mock BookReader book</h1>
15+
<p>
16+
This page simulates the essential parts of the <a href="https://github.com/internetarchive/bookreader">Internet Archive BookReader</a>. See <a href="https://archive.org/details/goodytwoshoes00newyiala"><i>Goody Two Shoes</i></a> for a real example.
17+
</p>
18+
19+
<!-- JS dependencies -->
20+
<script src="http://localhost:8000/BookReader/jquery-3.js"></script>
21+
22+
<!-- BookReader and any plugins -->
23+
<link rel="stylesheet" href="http://localhost:8000/BookReader/BookReader.css" />
24+
<script src="http://localhost:8000/BookReader/BookReader.js"></script>
25+
<script src="http://localhost:8000/BookReader/plugins/plugin.text_selection.js"></script>
26+
27+
<!-- BookReader wrapper web component -->
28+
<script type="module"
29+
src="http://localhost:8000/BookReader/ia-bookreader-bundle.js"></script>
30+
31+
<style>
32+
html {
33+
/** This must be set because the nav menu uses rem and sets the fonts really big? */
34+
font-size: 10px;
35+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
36+
}
37+
38+
ia-bookreader, .BookReader {
39+
/** Set the size you want bookreader to be */
40+
height: calc(100vh - 100px);
41+
}
42+
</style>
43+
44+
<ia-bookreader>
45+
<div id="BookReader" class="BookReader" slot="main"></div>
46+
</ia-bookreader>
47+
48+
<script>
49+
document.addEventListener('DOMContentLoaded', function () {
50+
// Expose globally
51+
br = new BookReader({
52+
el: '#BookReader',
53+
bookTitle: 'Goody Two Shoes',
54+
bookUri: 'https://archive.org/details/goodytwoshoes00newyiala',
55+
plugins: {
56+
textSelection: {
57+
enabled: true,
58+
fullDjvuXmlUrl: 'https://cors.archive.org/cors/goodytwoshoes00newyiala/goodytwoshoes00newyiala_djvu.xml',
59+
}
60+
},
61+
62+
data: [
63+
[
64+
{
65+
"width": 2454,
66+
"height": 3192,
67+
"uri": "https://archive.org/download/goodytwoshoes00newyiala/page/n0_s4.jpg",
68+
"leafNum": 1,
69+
}
70+
],
71+
[
72+
{
73+
"width": 2346,
74+
"height": 3140,
75+
"uri": "https://archive.org/download/goodytwoshoes00newyiala/page/n1_s4.jpg",
76+
"leafNum": 2,
77+
},
78+
{
79+
"width": 2346,
80+
"height": 3140,
81+
"uri": "https://archive.org/download/goodytwoshoes00newyiala/page/n2_s4.jpg",
82+
"leafNum": 3,
83+
}
84+
],
85+
[
86+
{
87+
"width": 2346,
88+
"height": 3140,
89+
"uri": "https://archive.org/download/goodytwoshoes00newyiala/page/n3_s4.jpg",
90+
"leafNum": 4,
91+
},
92+
{
93+
"width": 2346,
94+
"height": 3140,
95+
"uri": "https://archive.org/download/goodytwoshoes00newyiala/page/n4_s4.jpg",
96+
"leafNum": 5,
97+
}
98+
],
99+
[
100+
{
101+
"width": 2346,
102+
"height": 3140,
103+
"uri": "https://archive.org/download/goodytwoshoes00newyiala/page/n5_s4.jpg",
104+
"leafNum": 6,
105+
},
106+
{
107+
"width": 2346,
108+
"height": 3140,
109+
"uri": "https://archive.org/download/goodytwoshoes00newyiala/page/n6_s4.jpg",
110+
"leafNum": 7,
111+
}
112+
]
113+
],
114+
});
115+
116+
// Let's go!
117+
br.init();
118+
});
119+
</script>
120+
121+
{{{hypothesisScript}}}
122+
</body>
123+
</html>

dev-server/templates/index.mustache

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
<li><a href="/document/vitalsource-pdf">Mock VitalSource PDF (aka. "fixed") book</a></li>
5555
</ul>
5656

57+
<h3>BookReader test document</h3>
58+
<p>These documents simulate the Internet Archive's <a href="https://github.com/internetarchive/bookreader">BookReader</a>.</p>
59+
<ul>
60+
<li><a href="/document/bookreader">Sample BookReader book</a></li>
61+
</ul>
62+
5763
<h2>Test PDF documents</h2>
5864
<h3>General test documents</h3>
5965
<p>These documents test typical/simple scenarios.</p>

0 commit comments

Comments
 (0)