The demo pulls images from archive.org and requires an Internet connection.
+++ /dev/null
-//Copyright(c)2008 Internet Archive. Software license AGPL version 3.
-
-gb = new GnuBook();
-
-gb.getPageWidth = function(index) {
- return 800;
-}
-
-gb.getPageHeight = function(index) {
- return 1200;
-}
-
-gb.getPageURI = function(index) {
- var leafStr = '000';
- var imgStr = (index+1).toString();
- var re = new RegExp("0{"+imgStr.length+"}$");
- var url = 'StandAloneImages/page'+leafStr.replace(re, imgStr) + '.jpg';
- return url;
-}
-
-gb.getPageSide = function(index) {
- if (0 == (index & 0x1)) {
- return 'R';
- } else {
- return 'L';
- }
-}
-
-gb.getPageNum = function(index) {
- return index+1;
-}
-
-gb.numLeafs = 15;
-
-gb.bookTitle= 'Open Library Bookreader Presentation';
-gb.bookUrl = 'http://openlibrary.org';
-gb.init();
--- /dev/null
+//
+// This file shows the minimum you need to provide to GnuBook to display a book
+//
+// Copyright(c)2008-2009 Internet Archive. Software license AGPL version 3.
+
+// Create the GnuBook object
+gb = new GnuBook();
+
+// Return the width of a given page. Here we assume all images are 800 pixels wide
+gb.getPageWidth = function(index) {
+ return 800;
+}
+
+// Return the height of a given page. Here we assume all images are 1200 pixels high
+gb.getPageHeight = function(index) {
+ return 1200;
+}
+
+// We load the images from archive.org -- you can modify this function to retrieve images
+// using a different URL structure
+gb.getPageURI = function(index) {
+ var leafStr = '000';
+ var imgStr = (index+1).toString();
+ var re = new RegExp("0{"+imgStr.length+"}$");
+ var url = 'http://www.archive.org/download/GnuBook/img/page'+leafStr.replace(re, imgStr) + '.jpg';
+ return url;
+}
+
+// Return which side, left or right, that a given page should be displayed on
+gb.getPageSide = function(index) {
+ if (0 == (index & 0x1)) {
+ return 'R';
+ } else {
+ return 'L';
+ }
+}
+
+// For a given "accessible page index" return the page number in the book.
+//
+// For example, index 5 might correspond to "Page 1" if there is front matter such
+// as a title page and table of contents.
+gb.getPageNum = function(index) {
+ return index+1;
+}
+
+// Total number of leafs
+gb.numLeafs = 15;
+
+// Book title and the URL used for the book title link
+gb.bookTitle= 'Open Library Bookreader Presentation';
+gb.bookUrl = 'http://openlibrary.org';
+
+// Let's go!
+gb.init();
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+
+<html>
+<head>
+ <title>bookreader demo</title>
+ <link rel="stylesheet" type="text/css" href="../GnuBook/GnuBook.css">
+ <script type="text/javascript" src="http://www.archive.org/download/GnuBook/lib/jquery-1.2.6.min.js"></script>
+ <script type="text/javascript" src="http://www.archive.org/download/GnuBook/lib/jquery.easing.1.3.js"></script>
+ <script type="text/javascript" src="../GnuBook/GnuBook.js"></script>
+</head>
+<body style="background-color: rgb(249, 248, 208);">
+
+<div id="GnuBook" style="left:10px; right:10px; top:10px; bottom:2em;">x</div>
+<script type="text/javascript" src="GnuBookJSSimple.js"></script>
+
+<div id="GBfooter">
+ <div class="GBlogotype">
+ <a href="http://openlibrary.org/" class="GBwhite">Open Library</a>
+ <a href="http://openlibrary.org/beta" class="GBwhite" style="font-size: 0.8em; text-decoration: underline;">beta</a>
+ </div>
+ <div class="GBnavlinks">
+ <a class="GBwhite" href="http://openlibrary.org/dev/docs/bookreader">About the Bookreader</a> |
+ <a class="GBwhite" href="https://bugs.launchpad.net/gnubook/+filebug-advanced">Report Errors</a> |
+ <a class="GBwhite" href="http://openlibrary.org/about">About Us</a> |
+ <a class="GBwhite" href="http://openlibrary.org/index/index.html">Index</a> |
+ <a class="GBwhite" href="http://www.archive.org/">IA</a> |
+ <a class="GBwhite" href="http://www.opencontentalliance.org/">OCA</a> |
+ <a class="GBwhite" href="http://wikimediafoundation.org/">WMF</a> |
+ <a class="GBwhite" href="http://openlibrary.org/about/contact">Contact Us</a>
+ </div>
+</div>
+
+</body>
+</html>