}
.GBpageform {
- float: right;
+ display: inline;
}
.GBicon {
The GnuBook source is hosted at http://github.com/openlibrary/bookreader/
- archive.org cvs $Revision: 1.58 $ $Date: 2008-11-03 22:25:40 $
+ archive.org cvs $Revision: 1.62 $ $Date: 2008-12-18 01:08:01 $
*/
// GnuBook()
this.twoPagePopUp = null;
this.leafEdgeTmp = null;
+ this.embedPopup = null;
this.searchResults = {};
// init()
//______________________________________________________________________________
GnuBook.prototype.init = function() {
-
var startLeaf = window.location.hash;
+ //console.log("startLeaf from location.hash: %s", startLeaf);
+ if ('' == startLeaf) {
+ if (this.titleLeaf) {
+ startLeaf = "#" + this.leafNumToIndex(this.titleLeaf);
+ }
+ }
var title = this.bookTitle.substr(0,50);
if (this.bookTitle.length>50) title += '...';
$("#GnuBook").empty();
$("#GnuBook").append("<div id='GBtoolbar'><span style='float:left;'><button class='GBicon' id='zoom_out' onclick='gb.zoom1up(-1); return false;'/> <button class='GBicon' id='zoom_in' onclick='gb.zoom1up(1); return false;'/> zoom: <span id='GBzoom'>25</span>% <button class='GBicon' id='script' onclick='gb.switchMode(1); return false;'/> <button class='GBicon' id='book_open' onclick='gb.switchMode(2); return false;'/> <a href='"+this.bookUrl+"' target='_blank'>"+title+"</a></span></div>");
- $("#GBtoolbar").append("<form class='GBpageform' action='javascript:' onsubmit='gb.jumpToPage(this.elements[0].value)'><button class='GBicon' id='page_code' onclick='gb.showEmbedCode(); return false;'/> page:<input id='GBpagenum' type='text' size='3' onfocus='gb.autoStop();'></input> <button class='GBicon' id='book_previous' onclick='gb.prev(); return false;'/> <button class='GBicon' id='book_next' onclick='gb.next(); return false;'/> <button class='GBicon play' id='autoImg' onclick='gb.autoToggle(); return false;'/></form>");
+ $("#GBtoolbar").append("<span id='GBtoolbarbuttons' style='float: right'><button class='GBicon' id='page_code' onclick='gb.showEmbedCode(); return false;'/><form class='GBpageform' action='javascript:' onsubmit='gb.jumpToPage(this.elements[0].value)'> page:<input id='GBpagenum' type='text' size='3' onfocus='gb.autoStop();'></input></form> <button class='GBicon' id='book_previous' onclick='gb.prev(); return false;'/> <button class='GBicon' id='book_next' onclick='gb.next(); return false;'/> <button class='GBicon play' id='autoImg' onclick='gb.autoToggle(); return false;'/></span>");
$("#GnuBook").append("<div id='GBcontainer'></div>");
$("#GBcontainer").append("<div id='GBpageview'></div>");
if (1 == this.mode) {
this.resizePageView();
- if ('' != startLeaf) {
+ if ('' != startLeaf) { // Jump to the leaf specified in the URL
this.jumpToIndex(parseInt(startLeaf.substr(1)));
- //alert('jump to ' + startLeaf);
+ //console.log('jump to ' + parseInt(startLeaf.substr(1)));
}
} else {
+ //this.resizePageView();
+
this.displayedLeafs=[0];
+ if ('' != startLeaf) {
+ this.displayedLeafs = [parseInt(startLeaf.substr(1))];
+ }
+ //console.log('titleLeaf: %d', this.titleLeaf);
+ //console.log('displayedLeafs: %s', this.displayedLeafs);
this.prepareTwoPageView();
//if (this.auto) this.nextPage();
}
// showEmbedCode()
//______________________________________________________________________________
GnuBook.prototype.showEmbedCode = function() {
+ if (null != this.embedPopup) { // check if already showing
+ return;
+ }
this.autoStop();
- var overlay = document.createElement("div");
- $(overlay).css({
+ this.embedPopup = document.createElement("div");
+ $(this.embedPopup).css({
position: 'absolute',
top: '20px',
left: ($('#GBcontainer').width()-400)/2 + 'px',
htmlStr += '<p><b>Note:</b> The bookreader is still in beta testing. URLs may change in the future, breaking embedded books. This feature is just for testing!</b></p>';
htmlStr += '<p>The bookreader uses iframes for embedding. It will not work on web hosts that block iframes. The embed feature has been tested on blogspot.com blogs as well as self-hosted Wordpress blogs. This feature will NOT work on wordpress.com blogs.</p>';
htmlStr += '<p>Embed Code: <input type="text" size="40" value="<iframe src=\'http://www.us.archive.org/GnuBook/GnuBookEmbed.php?id='+this.bookId+'\' width=\'430px\' height=\'430px\'></iframe>"></p>';
- htmlStr += '<p style="text-align:center;"><a href="" onclick="$(this.parentNode.parentNode).remove(); return false;">Close popup</a></p>';
+ htmlStr += '<p style="text-align:center;"><a href="" onclick="gb.embedPopup = null; $(this.parentNode.parentNode).remove(); return false">Close popup</a></p>';
- overlay.innerHTML = htmlStr;
+ this.embedPopup.innerHTML = htmlStr;
}
// autoToggle()
}
?>
];
-
+
+<?
+/* Output title leaf if marked */
+$titleLeaf = '';
+foreach ($scanData->pageData->page as $page) {
+ if (("Title Page" == $page->pageType) || ("Title" == $page->pageType)) {
+ $titleLeaf = "{$page['leafNum']}";
+ break;
+ }
+}
+
+if ('' != $titleLeaf) {
+ printf("gb.titleLeaf = %d;\n", $titleLeaf);
+}
+?>
+
gb.numLeafs = gb.pageW.length;
gb.bookId = '<?echo $id;?>';
echo "gb.auto = true;\n";
}
?>
+
+// Check for config object
+if (typeof(gbConfig) != 'undefined') {
+ if (gbConfig['mode'] == 1) {
+ gb.mode = 1;
+ } else if (gbConfig['mode'] == 2) {
+ gb.mode = 2;
+ }
+}
+
gb.init();
<?
--- /dev/null
+<?
+/*
+Copyright(c)2008 Internet Archive. Software license AGPL version 3.
+
+This file is part of GnuBook.
+
+ GnuBook is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ GnuBook is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with GnuBook. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+$id = $_REQUEST['id'];
+
+// Sanitize since we put this value in the page
+$id = urlencode($id);
+
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title>Unsupported browser</title>
+ <meta http-equiv="refresh" content="10;url=http://www.archive.org/stream/<? echo($id); ?>">
+ <link rel="stylesheet" href="http://www.archive.org/stylesheets/archive.css?v=1.99" type="text/css">
+</head>
+<body>
+
+<table style="background-color:white " cellspacing="0" width="100%" border="0" cellpadding="0">
+ <tbody>
+ <tr>
+ <td style="width:100px; height:72px; vertical-align:top; background-color:#000000;">
+
+ <a href="http://www.archive.org/"><img style="border:0;" alt="(logo)" src="http://www.archive.org/images/logo.jpg" width="84" height="70"/></a>
+ </td>
+ <td valign="bottom" style="background-image:url(http://www.archive.org/images/blendbar.jpg);">
+ <table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td class="level1Header">
+ <div class="tab"><a href="http://www.archive.org/web/web.php">Web</a></div><div class="tab"><a href="http://www.archive.org/details/movies">Moving Images</a></div><div class="tab"><a href="http://www.archive.org/details/texts">Texts</a></div><div class="tab"><a href="http://www.archive.org/details/audio">Audio</a></div><div class="tab"><a href="http://www.archive.org/details/software">Software</a></div><div class="tab"><a href="http://www.archive.org/details/education">Education</a></div><div class="tab"><a href="http://www.archive.org/account/login.changepw.php">Patron Info</a></div><div class="tab"><a href="http://www.archive.org/about/about.php">About IA</a></div> </td>
+
+ </tr>
+
+ </table>
+ </td>
+ <td style="width:80px; height:72px; vertical-align:top; text-align: right">
+ <a href="http://www.archive.org/about/about.php"><img alt="(navigation image)" src="http://www.archive.org/images/main-header.jpg" style="margin:0; border:0; vertical-align:top;" /></a> </td>
+ </tr>
+ </tbody>
+</table>
+
+<!--BEGIN HEADER 2-->
+<table width="100%" class="level2Header">
+ <tbody>
+ <tr>
+ <td align="left" valign="top" class="level2HeaderLeft">
+ <a class="level2Header" href="http://www.archive.org/">Home</a>
+ </td>
+ <td style="width:100%;" class="level2Header">
+ <a href="http://www.archive.org/donate/index.php">Donate</a> |
+
+<a href="http://www.archive.org/iathreads/forums.php">Forums</a> |
+<a href="http://www.archive.org/about/faqs.php">FAQs</a> |
+<a href="http://www.archive.org/contribute.php">Contributions</a> |
+<a href="http://www.archive.org/about/terms.php">Terms, Privacy, & Copyright</a> |
+<a href="http://www.archive.org/about/contact.php">Contact</a> |
+<a href="http://www.archive.org/about/jobs.php">Jobs</a> |
+
+<a href="http://www.archive.org/about/bios.php">Bios</a>
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+
+<div class="box">
+<p>
+Sorry, but our new viewer does not work in this browser yet.
+</p>
+
+<p>
+Either go to our <a href="http://www.archive.org/stream/<? echo($id) ?>">old viewer</a>,
+or download <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a> or
+<a href="http://www.microsoft.com/windows/internet-explorer/download-ie.aspx">IE7</a>.
+</p>
+
+<p>
+You will be automatically redirected to the older viewer in 10 seconds.
+</p>
+
+</div>
+
+<p id="iafoot">
+ <a href="http://www.archive.org/about/terms.php">Terms of Use (10 Mar 2001)</a>
+
+</p>
+
+</body>
+</html>
<html>
<head>
<title>bookreader demo</title>
- <link rel="stylesheet" type="text/css" href="http://www.us.archive.org/GnuBook/GnuBook.css">
+<!-- $$$ we should have IE6 support RSN and move browser support detection inside GnuBook proper -->
+<!--[if lte IE 6]>
+ <meta http-equiv="refresh" content="2; URL=browserunsupported.php?id=<? echo($id); ?>">
+<![endif]-->
+ <link rel="stylesheet" type="text/css" href="/GnuBook/GnuBook.css">
<script src="http://www.archive.org/includes/jquery-1.2.6.min.js" type="text/javascript"></script>
- <script type="text/javascript" src="http://www.us.archive.org/GnuBook/GnuBook.js"></script>
- <script type="text/javascript" src="http://www.us.archive.org/GnuBook/jquery.easing.1.3.js"></script>
+ <script type="text/javascript" src="/GnuBook/GnuBook.js"></script>
+ <script type="text/javascript" src="/GnuBook/jquery.easing.1.3.js"></script>
</head>
<body style="background-color: rgb(249, 248, 208);">
<div id="GnuBook" style="left:10px; right:200px; top:10px; bottom:2em;">x</div>
-<script type="text/javascript" src="http://www.us.archive.org/GnuBook/GnuBookJSLocate.php?id=<?echo $id;?>"></script>
+
+<script type="text/javascript">
+ // Set some config variables -- $$$ NB: Config object format has not been finalized
+ var gbConfig = {};
+ gbConfig["mode"] = 2;
+</script>
+<script type="text/javascript" src="/GnuBook/GnuBookJSLocate.php?id=<?echo $id;?>"></script>
<div id="GnuBookSearch" style="width:190px; right:0px; top:10px; bottom:2em;">
<form action='javascript:' onsubmit="gb.search($('#GnuBookSearchBox').val());">
<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="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://creativecommons.org/">CC</a> |
<a class="GBwhite" href="http://wikimediafoundation.org/">WMF</a> |
<a class="GBwhite" href="http://openlibrary.org/about/contact">Contact Us</a>
</div>
</div>
+<script type="text/javascript">
+ // $$$ hack to workaround sizing bug when starting in two-up mode
+ $(document).ready(function() {
+ $(window).trigger('resize');
+ });
+</script>
+
</body>
</html>