UNPKG

epubjs

Version:

Render ePub documents in the browser, across many devices

103 lines (76 loc) 3.6 kB
<!DOCTYPE html> <html class="no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>ePubJS Annotator Example</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width"> <meta name="apple-mobile-web-app-capable" content="yes"> <link rel="stylesheet" href="basic.css"> <!-- EPUBJS Renderer --> <script src="../build/epub.min.js"></script> <!-- jQuery --> <script src="../libs/jquery/jquery-1.9.0.js"></script> <!-- Annotator --> <!-- <script src="../libs/annotator/annotator-full.js"></script> --> <script src="../libs/annotator/lib/util.js"></script> <script src="../libs/annotator/lib/console.js"></script> <script src="../libs/annotator/lib/class.js"></script> <script src="../libs/annotator/lib/range.js"></script> <script src="../libs/annotator/lib/annotator.js"></script> <script src="../libs/annotator/lib/widget.js"></script> <script src="../libs/annotator/lib/editor.js"></script> <script src="../libs/annotator/lib/viewer.js"></script> <script src="../libs/annotator/lib/notification.js"></script> <script src="../libs/annotator/lib/xpath.js"></script> <script src="../libs/annotator/lib/plugin/store.js"></script> <script src="../libs/annotator/lib/plugin/permissions.js"></script> <script src="../libs/annotator/lib/plugin/annotateitpermissions.js"></script> <script src="../libs/annotator/lib/plugin/auth.js"></script> <script src="../libs/annotator/lib/plugin/tags.js"></script> <script src="../libs/annotator/lib/plugin/unsupported.js"></script> <script src="../libs/annotator/lib/plugin/filter.js"></script> <script src="../hooks/extensions/annotate.js"></script> <link rel="stylesheet" href="../libs/annotator/css/annotator.css"> <script> "use strict"; var Book = ePub("../reader_src/moby-dick/", { restore: true }); </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 id="loader"><img src="../reader/img/loader.gif"></div> <select id="toc"></select> </div> <script> Book.getMetadata().then(function(meta){ document.title = meta.bookTitle+" – "+meta.creator; }); Book.getToc().then(function(toc){ var $select = document.getElementById("toc"), docfrag = document.createDocumentFragment(); toc.forEach(function(chapter) { var option = document.createElement("option"); option.textContent = chapter.label; option.ref = chapter.href; docfrag.appendChild(option); }); $select.appendChild(docfrag); $select.onchange = function(){ var index = $select.selectedIndex, url = $select.options[index].ref; Book.goto(url); return false; } }); Book.ready.all.then(function(){ document.getElementById("loader").style.display = "none"; }); Book.renderTo("area"); </script> </body> </html>