dauwhe / acme-labs

Books in Browsers

Home Page:https://dauwhe.github.io/acme-labs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Acme Labs https://dauwhe.github.io/acme-labs/

###a toy digital reading system

Can the web platform provide a great reading experience for publications? Can web application manifests and service workers more easily implement the functionality of dedicated reading apps? Acme Labs is an experimental implementation of a browser-friendly ebook format BFF, and aims to explore some of the ideas of (portable) web publications.

Goals

  1. Provide a reading experience much like common dedicated e-readers like iBooks and Readium. This includes user control over font size, a night mode, easy access to navigation, pagination, etc.

  2. The publications themselves should not need any scripts to function.

  3. The publications should work offline.

  4. It should be possible to save publications to a local filesystem.

Publications

Each publication is in a folder. The folder contains a manifest.json file. The manifest is a web application manifest, but with two additional members:

  1. The spine member. This describes the order of content documents in the publication, as in EPUB.
"spine": [{
    "href": "html/c001.html",
    "type": "text/html"
  }, {
    "href": "html/c002.html",
    "type": "text/html"
  }],
  1. The resources member. This lists all the other required components of the publication—images, fonts, css, scripts, and so on.
"resources": [{
    "href": "images/moby-dick-book-cover.jpg",
    "type": "image/jpeg"
  },{
    "href": "css/mobydick.css",
    "type": "text/css"
  },{
    "href": "index.html",
    "type": "text/html",
    "properties": "nav"
  }]

Each publication should contain an html file which could serve as a starting point for readers. This file at least should contain a link to the manifest. See BFF for details.

Reading System

The reading system is the main.html page. Book content is displayed in an iframe. Navigation between files is based on reading the manifest.

The service worker caches files listed in the manifest when the "save" button is clicked. The "zip" button downloads a zip of the publication. The highly experimental "package" button downloads a package based on the W3C TAG Packaging on the Web draft, as extended by Dmitry Titov.

Warning

Warning: the code is really rough, as I don't know what I'm doing.

Usage

Use python -m SimpleHTTPServer to host the repo at http://localhost:8000/

Contributing

Currently, the repository is a mix of ES5 and ES6/ES2015. We are using eslint and the AirBnB JavaScript code styles to keep things tidy. kroner.js is the one ES6/ES2015 file we have atm, so to lint it do the following:

$ npm i -g eslint eslint-config-airbnb # once to install things
$ eslint kroner.js # prior to committing changes

Acknowledgments

Jake Archibald wrote the original service worker (kroner.js) and page.js files. The manifest format was hashed out with Hadrien Gardeur. All of this is really the work of the entire DPUB/EPUB community.

About

Books in Browsers

https://dauwhe.github.io/acme-labs/

License:MIT License


Languages

Language:HTML 96.3%Language:JavaScript 3.3%Language:CSS 0.3%