What iBooks Does Behind the Scenes
Before I got through each of these, here’s how you can find them for yourself. (I’ve got links to GitHub Gists of these files later on as well.)
- Open iBooks, then open a non-DRM book
- Open the Web Inspector
- In the top bar of the Web Inspector, click on Resources
- in the lefthand sidebar, click on the folder titled “Extra Scripts.” These are the scripts that come packaged with the application.
Just what are these files?
See the GitHub Gist here. This file will probably be of the most interest to most EPUB Creators. This file processes the EPUB file and bends it to all the rules of the iBooks application. Ever added a <textarea> to an EPUB file and found you couldn’t enter text in that field in iBooks? That was because your file was manipulated through this file. There’s a lot to go through in here, but this might the file that is causing problems if you try to make more advanced EPUB files for use in iBooks.
See the GitHub Gist here. This file applies the iBooks theme (White, Sepia, and Night) and its styles to your document. This is helpful if you ever want to override particular theme styles.
One thing you won’t be happy about in this file, though, is this comment:
Let’s hope they fix this in iOS 8 iBooks.
See the GitHub Gist here. This one is for the real EPUB spec geeks. This is Apple’s implementation of the Canonocal Fragment Identifier EPUB (EPUBcfi) spec. CFIs allow a reading system to store arbitrary pieces of text. CFIs are used in a lot of ways—for highlights and page positions.
There you have it. If you dig around through these files and find anything interesting be sure to leave a comment.