<!DOCTYPE html>
<html lang="en">
  <head>
    <title>
      LIBER - "{{.Book.Metadata.Title}}"
    </title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <link rel="shortcut icon" href="/static/favicon.ico">
    <link rel="stylesheet" href="/static/css/reader.css">
  </head>

  <body>
    <div id="main">
      <div id="prev" class="arrow">‹</div>
      <div id="area"></div>
      <div id="next" class="arrow">›</div>
    </div>

    <script src="/static/js/jquery-2.1.1.min.js"></script>
    <script src="/static/js/epub.min.js"></script>
    <script src="/static/js/zip.min.js"></script>

    <script>
EPUBJS.filePath = "/static/js/";

$(function() {
  var Book = ePub("/dl/{{.Book.Id}}/{{.FileIndex}}",
                  {restore: true, contained: true});
  $("#prev").click(function() { Book.prevPage(); });
  $("#next").click(function() { Book.nextPage(); });
  $(window).keydown(function(event) {
    //console.log('keydown(): ' + event.which);
    if (event.which == 33 || event.which == 37 || event.which == 38) {
      Book.prevPage();
    } else if (event.which == 32 || event.which == 34 || event.which == 39 || event.which == 40) {
      Book.nextPage();
    }
  });

  Book.renderTo("area");
});
    </script>
  </body>
</html>