UNPKG

epubjs

Version:

Render ePub documents in the browser, across many devices

41 lines (25 loc) 758 B
EPUBJS.Reader = function(){ // Load the opf this.book = ePub("content.opf"); }; EPUBJS.Reader.prototype.open = function(current){ // Load the opf this.rendition = this.book.renderTo("viewer"); this.displayed = this.rendition.display(current, {viewsLimit: 3}); this.displayed.then(function(renderer){ // -- do stuff }); // Navigation loaded this.book.loaded.navigation.then(function(toc){ // console.log(toc); }); }; if(window.parent === window.self & !window.Reader) { var landing = window.location.href.substring(window.location.href.lastIndexOf('/') + 1); var reader = new EPUBJS.Reader(); window.Reader = reader; $(document).ready(function(){ $('body').empty(); reader.open(landing); }); };