openmedialibrary/static/html/epub.html

104 lines
2.5 KiB
HTML
Raw Normal View History

2014-05-04 17:26:43 +00:00
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>epub.js</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- EPUBJS Renderer -->
<script src="/static/epub.js/epub.min.js"></script>
<style type="text/css">
body {
overflow: hidden;
background: #fff;
}
#main {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
#area {
position: absolute;
right: 44px;
left: 44px;
top: 32px;
bottom: 32px;
}
#area iframe {
border: none;
}
#prev {
top: 0;
left: 0;
width: 36px;
bottom: 0;
}
#next {
right: 0;
top: 0;
width: 36px;
bottom: 0;
}
.arrow {
position: absolute;
}
.arrow:hover {
background: #eee;
}
.arrow:active {
background: #fff;
}
</style>
<script>
"use strict";
function bookUrl() {
return document.location.pathname.replace(/\/reader\//, '/epub/');
}
var Book = ePub({store: false});
Book.open(bookUrl());
Book.getMetadata().then(function(meta) {
document.title = meta.bookTitle + " " + meta.creator;
document.addEventListener("keydown", function(event) {
if (event.keyCode == 39 || event.keyCode == 40) {
Book.nextPage();
} else if (event.keyCode == 37 || event.keyCode == 38) {
Book.prevPage();
}
}, false);
});
</script>
</head>
<body>
<div id="main">
<div id="prev" onclick="Book.prevPage();" class="arrow"></div>
<div id="area"></div>
<div id="next" onclick="Book.nextPage();"class="arrow"></div>
</div>
<script>
Book.renderTo("area");
</script>
</body>
</html>