1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +02:00
JS epub parser/reader
Find a file
2013-03-25 14:34:56 -07:00
css added annotator 2013-03-04 12:10:03 -08:00
dist updated readme, remove old server 2013-03-25 14:34:56 -07:00
fpjs fix book path url to handle more options, add music hook 2013-03-25 13:07:19 -07:00
img added annotator 2013-03-04 12:10:03 -08:00
moby-dick added hooks and transculsions 2013-02-07 13:17:01 -08:00
.gitignore updated readme, remove old server 2013-03-25 14:34:56 -07:00
annotator.html fix book path url to handle more options, add music hook 2013-03-25 13:07:19 -07:00
dev.html fix book path url to handle more options, add music hook 2013-03-25 13:07:19 -07:00
favicon.ico Boilerplate 2012-10-27 09:32:48 -07:00
grunt.js added dist version and dev.html for development 2013-03-02 18:34:24 -08:00
humans.txt Boilerplate 2012-10-27 09:32:48 -07:00
index.html fix book path url to handle more options, add music hook 2013-03-25 13:07:19 -07:00
package.json added grunt js and updates css for sliding 2013-02-11 21:16:33 -08:00
README.md updated readme, remove old server 2013-03-25 14:34:56 -07:00
robots.txt Boilerplate 2012-10-27 09:32:48 -07:00

FuturePress

[FuturePress Views]

Why EPUB

[Why EPUB]

ePUB is a widely used and easily convertible format. Many books are currently in this format and it is used as the base for many proprietary formats (such as Mobi and iBooks). We have chosen the ePUB standard because it brings us as close as possible to our “Books on the Web” vision, while enforcing a standard which enables the development of more advanced reader functionality.

An unzipped ePUB3 is a collection of HTML5 files, CSS, images and other media just like any other website. However, it enforces a schema of book components, which allows us to render a book and its parts based on a controlled vocabulary.

More specifically, the ePUB schema standardizes the table of contents, provides a manifest that enables the caching of the entire book and separates the storage of the content from how its displayed.

Running Locally

install (http-server)[https://github.com/nodeapps/http-server]

npm install http-server -g

then you can run the reader locally with the command

http-server

this will start the reader on

(http://localhost:8080/)[http://localhost:8080/]

Dev.html

(http://localhost:8080/dev.html)[http://localhost:8080/dev.html]

This page will pull from the source files and should be used during development.

Index.html

(http://localhost:8080/index.html)[http://localhost:8080/index.html]

This page will use the minified production libraries in the dist/ folder.

Building for Distribution

install (gruntjs)[http://gruntjs.com/getting-started]

npm install -g grunt-cli

npm install

Then when you are ready to build just run

grunt

Getting Started

FP.filePath = "/path/to/js/"; //-- For web workers
FPR.app.init("/path/to/epub/"); //-- Starts the reader, with path to a book

Persistence / Offline Storage

The eBook reader uses persistence to cache the files from an epub for offline viewing, stores information about the book, and remembers what chapter the user was on. Being able to read a book when internet isnt available, and remembering your place in the book is crucial to making our reader website work as an application and fulfill users expectations of how a eBook should function.

Currently, there is not a great cross browser solution for dynamic file storage. Chrome supports the Filesystem API, Firefox/IE support indexedDB, and Safari/Safari Mobile support Web SQL.

The reader detects the storage capabilities of the browser and picks the best available option. When internet is available, the entire book is loaded into storage. When possible, Web Workers is used to handle loading and saving the files in a different thread, so as not to interfere with the reading experience.

The browser tells the reader when there is Internet connectivity, and by listening to those events, it automatically switches to using the stored files. Users can also manually switch to offline mode in the interface.