From 716ff57d189cb6ec2c5e10e0e7eb05aa53fd5b83 Mon Sep 17 00:00:00 2001 From: Fred Chasen Date: Mon, 25 Mar 2013 15:05:38 -0700 Subject: [PATCH] expanded readme --- README.md | 35 ++++++++++++++++++++++++++++++++++- fpjs/hooks/transculsions.js | 2 +- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c782ab8..18e627c 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,11 @@ FuturePress ![FuturePress Views](http://fchasen.com/futurepress/fp.png) +FuturePress is a javascript library for rendering ePUB's in the browser, across many devices. + +FPJS provides common ebook functions (such as persistence and pagination) without the need to develop a dedicated application or plugin. + +Unlike an application, our HTML / Javascript reader can be hosted anywhere and can be easily customized using javascript, such as changing the interface or adding annotation functionality. Why EPUB ------------------------- @@ -82,4 +87,32 @@ Currently, there is not a great cross browser solution for dynamic file storage. 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. \ No newline at end of file +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. + +Hooks +------------------------- + +Similar to a plugins, FPJS implements events that can be "hooked" into. + +Examples of this functionality is loading videos from youtube links before displaying a chapters contents. + +Hooks require a event to latch onto and a callback for when they are finished. + +Example hook: + +```javascript +FP.Hooks.register("beforeChapterDisplay").example = function(callback, chapter){ + + var elements = chapter.doc.querySelectorAll('[video]'), + items = Array.prototype.slice.call(elements); + + items.forEach(function(item){ + //-- do something with the video item + } + + if(callback) callback(); + + +} +``` + diff --git a/fpjs/hooks/transculsions.js b/fpjs/hooks/transculsions.js index e483cb7..040b2fa 100644 --- a/fpjs/hooks/transculsions.js +++ b/fpjs/hooks/transculsions.js @@ -1,7 +1,7 @@ FP.Hooks.register("beforeChapterDisplay").transculsions = function(callback, chapter){ var trans = chapter.doc.querySelectorAll('[transclusion]'), - items = Array.prototype.slice.call(trans);; + items = Array.prototype.slice.call(trans); items.forEach(function(item){ var src = item.getAttribute("ref"),