this.lastDisplayableIndex2up = null;
// We link to index.php to avoid redirect which breaks back button
+ // Should be overriden (before init) by custom implmentations.
this.logoURL = 'http://www.archive.org/index.php';
- // Base URL for images
+ // Base URL for UI images - should be overriden (before init) by
+ // custom implementations.
+ // $$$ This is the same directory as the images referenced by relative
+ // path in the CSS. Would be better to automagically find that path.
this.imagesBaseURL = '/bookreader/images/';
// Mode constants
// Hide mode buttons and autoplay if 2up is not available
// $$$ if we end up with more than two modes we should show the applicable buttons
if ( !this.canSwitchToMode(this.constMode2up) ) {
- jToolbar.find('.one_page_mode, .two_page_mode, .play, .pause').hide();
+ jToolbar.find('.two_page_mode, .play, .pause').hide();
+ }
+ if ( !this.canSwitchToMode(this.constModeThumb) ) {
+ jToolbar.find('.thumbnail_mode').hide();
+ }
+
+ // Hide one page button if it is the only mode available
+ if ( ! (this.canSwitchToMode(this.constMode2up) || this.canSwitchToMode(this.constModeThumb)) ) {
+ jToolbar.find('.one_page_mode').hide();
}
// Switch to requested mode -- binds other click handlers
//________
// Returns true if we can switch to the requested mode
BookReader.prototype.canSwitchToMode = function(mode) {
- if (mode == this.constMode2up) {
+ if (mode == this.constMode2up || mode == this.constModeThumb) {
// check there are enough pages to display
// $$$ this is a workaround for the mis-feature that we can't display
// short books in 2up mode
- if (this.numLeafs < 6) {
+ if (this.numLeafs < 2) {
return false;
}
}
// We load the images from archive.org -- you can modify this function to retrieve images
// using a different URL structure
-br.getPageURI = function(index) {
+br.getPageURI = function(index, reduce, rotate) {
+ // reduce and rotate are ignored in this simple implementation, but we
+ // could e.g. look at reduce and load images from a different directory
+ // or pass the information to an image server
var leafStr = '000';
var imgStr = (index+1).toString();
var re = new RegExp("0{"+imgStr.length+"}$");
br.numLeafs = 15;
// Book title and the URL used for the book title link
-br.bookTitle= 'Open Library Bookreader Presentation';
+br.bookTitle= 'Open Library BookReader Presentation';
br.bookUrl = 'http://openlibrary.org';
+// Override the path used to find UI images
+br.imagesBaseURL = '../BookReader/images/';
+
// Let's go!
br.init();
<html>
<head>
<title>bookreader demo</title>
- <link rel="stylesheet" type="text/css" href="../BookReader/BookReader.css">
+
+ <link rel="stylesheet" type="text/css" href="../BookReader/BookReader.css"></link>
+ <!-- Custom CSS overrides -->
+ <link rel="stylesheet" type="text/css" href="BookReaderDemo.css"></link>
+
<script type="text/javascript" src="http://www.archive.org/download/BookReader/lib/jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="http://www.archive.org/download/BookReader/lib/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="../BookReader/BookReader.js"></script>