-
Notifications
You must be signed in to change notification settings - Fork 480
Expand file tree
/
Copy pathdemo-internetarchive.html
More file actions
277 lines (261 loc) · 10.3 KB
/
demo-internetarchive.html
File metadata and controls
277 lines (261 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!DOCTYPE html>
<!-- This demo mirrors, as far as possible, the archive.org BookReader configuration and functionality
please keep up to date as BookReader evolves -->
<html lang="en">
<head>
<title>bookreader demo internetArchive</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- WC dependencies -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es2015%2Ces5%2CglobalThis"></script>
<script type="text/javascript" src="https://unpkg.com/lit@2.1.2/polyfill-support.js"></script>
<script type="text/javascript" src="https://unpkg.com/@webcomponents/webcomponentsjs@2.2.10/webcomponents-bundle.js"></script>
<!-- JS dependencies -->
<script src="/BookReader/webcomponents-bundle.js"></script>
<script src="/BookReader/jquery-3.js"></script>
<!-- Bookreader -->
<script src="/BookReader/BookReader.js"></script>
<link rel="stylesheet" href="/BookReader/BookReader.css"/>
<!-- plugins needed for archive.org, in same order as archive.org -->
<script src="/BookReader/plugins/plugin.search.js"></script>
<script src="/BookReader/plugins/plugin.chapters.js"></script>
<script src="/BookReader/plugins/plugin.tts.js"></script>
<script src="/BookReader/plugins/plugin.url.js"></script>
<script src="/BookReader/plugins/plugin.autoplay.js"></script>
<script src="/BookReader/plugins/plugin.resume.js"></script>
<script src="/BookReader/plugins/plugin.archive_analytics.js"></script>
<script src="/BookReader/plugins/plugin.text_selection.js"></script>
<script src="/BookReader/plugins/plugin.experiments.js"></script>
<script type="module" src="/BookReader/ia-bookreader-bundle.js"></script>
<link rel="stylesheet" href="/BookReaderDemo/BookReaderDemo.css"/>
<!-- IA scripts -->
<script src="https://archive.org/bookreader/BookReaderJSIA.js"></script>
</head>
<body>
<section class="theater" style="width: 100%; overflow: hidden; background-color: black;">
<ia-bookreader
baseHost="archive.org"
>
<div id="IABookReaderWrapper" slot="main">
<div id="BookReader" class="BookReader"></div>
</div>
<div>
Internet Archive BookReader Demo<br />
<noscript>
<p>
The BookReader requires JavaScript to be enabled. Please check that
your browser supports JavaScript and that it is enabled in the
browser settings.
</p>
</noscript>
</div>
</ia-bookreader>
</section>
<style>
.demos {
height: 800px;
width: inherit;
padding: 10px;
}
.demo {
border: 1px solid white;
padding: 10px;
}
</style>
<section class="demos">
<details class="demo">
<summary>Test books</summary>
<ul>
<li>
Misc English book
<ul>
<li>
<a href="/BookReaderDemo/demo-internetarchive.html?ocaid=countofmontecris00duma_7">
<i>The Count of Monte-Cristo</i> by Alexandre Dumas
</a>
</li>
<li>
<a href="/BookReaderDemo/demo-internetarchive.html?ocaid=driitaleofdaring00bachuoft">
<i>D’ri and I</i> by Irving Bacheller
</a>
</li>
</ul>
</li>
<li>
Misc non-English book (<a href="https://archive.org/search?query=%21language%3Aeng&sort=-week&and%5B%5D=lending%3A%22is_readable%22&and%5B%5D=mediatype%3A%22texts%22">Search for more</a>)
<ul>
<li>
French: <a href="/BookReaderDemo/demo-internetarchive.html?ocaid=lecomtedemontecr01dumauoft">
<i>Le Comte de Monte-Cristo</i> by Alexandre Dumas
</a>
</li>
</ul>
</li>
<li>
Right-to-left book (<a href="https://archive.org/search?query=page-progression%3Arl&sort=-week&and%5B%5D=lending%3A%22is_readable%22&and%5B%5D=mediatype%3A%22texts%22">Search for more</a>)
<ul>
<li>
<a href="/BookReaderDemo/demo-internetarchive.html?ocaid=gendaitankashu00meijuoft">
<i>Gendai tanka shu</i> by Meiji, Emperor of Japan
</a>
</li>
</ul>
</li>
<li>
Newspaper with columns
<ul>
<li>
<a href="/BookReaderDemo/demo-internetarchive.html?ocaid=Crusader-Vol_28_Nos_1-20_Sept_1986-April_1987">
Crusader-Vol_28_Nos_1-20_Sept_1986-April_1987
</a>
</li>
</ul>
</li>
<li>
Text Selection
<ul>
<li>
OCR with spaces inside each <code><WORD></code> element
<ul>
<li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=theworksofplato01platiala">
<i>The Works of Plato</i> by Plato
</a></li>
</ul>
</li>
<li>
Weird font-sizes/indents
<ul>
<li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=cihm_58393#page/n3">
Microfilm poster thing
</a></li>
</ul>
</li>
<li>
Book with short lines
<ul>
<li>
<a href="/BookReaderDemo/demo-internetarchive.html?ocaid=countofmontecris00duma_7#page/261/mode/2up">
<i>The Count of Monte-Cristo</i>, p.261, second last line
</a>
</li>
</ul>
</li>
<li>
Book with double-spaced lines
<ul>
<li>
<a href="/BookReaderDemo/demo-internetarchive.html?ocaid=calnevpipelineex02unit#page/n93/mode/2up">
calnevpipelineex02unit
</a>
</li>
</ul>
</li>
</ul>
</li>
<li>
Chapters
<ul>
<li>
Normal book with chapters
<ul>
<li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=adventureofsherl0000unse">
<i>The Adventures of Sherlock Holmes</i> by Arthur Conan Doyle
</a></li>
<li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=jalna00dela">
<i>Jalna</i> by Mazo de la Roche
</a></li>
</ul>
</li>
<li>
Book preview
<ul>
<li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=peoplewareproduc00dema_0">
<i>Peopleware</i> by Tom DeMarco and Timothy Lister
</a></li>
<li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=passionforbooksb00rabi">
<i>A Passion for Books</i>
</a></li>
</ul>
</li>
<li>
Book with levelled chapters
<ul>
<li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=notredamedepar01hugo">
<i>Notre-Dame de Paris: Tome Premier</i> par Victor Hugo
</a></li>
<li><a href="/BookReaderDemo/demo-internetarchive.html?ocaid=alanturingenigma0000hodg">
<i>Alan Turing: The Enigma</i> by Andrew Hodges
</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</details>
<div class="demo">
<button id="toggle-loggedin">Toggle Logged in view</button>
<p>Features behind signed in gate: Bookmarks</p>
<p>Logged In Status: <span id="logged-in-status">Logged Out</span></p>
</div>
<div class="demo">
<button id="show-lcp">LCP Download option</button>
</div>
<div class="demo">
<button id="multi-volume">Multiple books</button>
</div>
<div class="demo">
<button id="start-fs">Start at Fullscreen</button>
</div>
<div class="demo">
<h3 id="placeholder">please wait as we are fetching the following: </h3>
<label>
<input type='checkbox' class='group1' name='itemMD' disabled> Item metadata
</label>
<br>
<label>
<input type='checkbox' class='group1' name='bookManifest' disabled> Book manifest
</label>
<br>
</div>
</section>
<div class="demo">
<h3>Placeholder div to allow scrolling</h3>
</div>
<!-- Certain features, like Bookmarks, use modal-manager to draw their interface -->
<modal-manager></modal-manager>
<script >
// Set up demo things
const iaBR = document.querySelector('ia-bookreader');
const toggleLoginBtn = document.querySelector('#toggle-loggedin');
toggleLoginBtn.addEventListener('click', () => {
const currLoggedIn = iaBR.signedIn;
iaBR.signedIn = !currLoggedIn;
document.querySelector('#logged-in-status').innerText = iaBR.signedIn ? 'Logged In' : 'Logged Out';
console.log("Toggled SignedIn state", iaBR.signedIn, { currLoggedIn })
});
const startFSBtn = document.querySelector('#start-fs');
startFSBtn.addEventListener('click', () => {
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.has('view')) {
const url = new URL(window.location);
url.searchParams.delete('view');
window.history.pushState({}, '', url);
}
urlParams.set('view', 'theater');
window.location.search = urlParams.toString();
});
window.addEventListener('BookReader:PostInit', () => {
const placeholder = document.querySelector('#placeholder');
placeholder.innerHTML = 'Dependencies are complete, bookreader has loaded';
});
// analytics stub
window.archive_analytics = {
send_event_no_sampling: (category, action, label) => {}, //console.log('~~~ NO SAMPLE EVENT CALLED: ', { category, action, label }),
send_event: (category, action, label) => {}, //console.log('~~~ send_event SAMPLE EVENT CALLED: ', { category, action, label }),
send_ping: (category, action, label) => {}, //console.log('~~~ send_ping SAMPLE EVENT CALLED: ', { category, action, label }),
}
</script>
<!-- IA fetch demo -->
<script type="module" src="/BookReaderDemo/IADemoBr.js"></script>
</body>
</html>