Reduce jumping/resizing in info modal when cover is loading
[bookreader.git] / BookReaderIA / inc / BookReader.inc
index 9cff29d..0c6cefd 100644 (file)
@@ -1,11 +1,13 @@
 <?
 
 /*
- * 
-
-/*
+ * Copyright(c) 2008-2010 Internet Archive. Software license AGPL version 3.
+ *
+ * This file is part of BookReader.  The full source code can be found at GitHub:
+ * http://github.com/openlibrary/bookreader
+ *
  * Note: Edits to this file must pass through github.  To submit a patch to this
- *       file please contact mang at archive dot org or http://github.com/mangtronix
+ *       file please contact mang via http://github.com/mangtronix or mang at archive dot org
  *       Direct changes to this file may get clobbered when the code is synchronized
  *       from github.
  */
@@ -100,7 +102,8 @@ class BookReader
     $version = "r28";
     
     if (BookReader::getDevHost($server)) {
-        // on dev host - add time to force reload
+        // On dev host - add time to force reload
+        // If debugging on IE, remove this line otherwise breakpoints will be invalid after reload
         $version .= '_' . time();
     }
     
@@ -110,6 +113,10 @@ class BookReader
     }
     
     $metaURL = BookReader::jsMetadataURL($server, $identifier, $mainDir, $subPrefix);
+    $locateURL = BookReader::jsLocateURL($identifier, $subPrefix);
+    $coverThumb = 'http://www.archive.org/download/' . $identifier . '/'. $subPrefix . '/page/cover_w114.jpg';
+    // startup-up-image must be exactly 320x460
+    //$startupImage = 'http://www.archive.org/download/' . $identifier . '/'. $subPrefix . '/page/cover_w512.jpg';
     
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
@@ -117,6 +124,8 @@ class BookReader
 <head>
     <meta name="viewport" content="width=device-width, maximum-scale=1.0" />
     <meta name="apple-mobile-web-app-capable" content="yes" />
+    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
+    <link rel="apple-touch-icon" href="<? echo($coverThumb); ?>" />
     <title><? echo $title; ?></title>
 <!--[if lte IE 6]>
     <meta http-equiv="refresh" content="2; URL=/bookreader/browserunsupported.php?id=<? echo($id); ?>">
@@ -128,64 +137,69 @@ class BookReader
     <link rel="stylesheet" type="text/css" href="/bookreader/touch/BookReaderTouch.css?v=<? echo($version); ?>">
 <? } /* uiMode */ ?>
     <script src="/includes/jquery-1.4.2.min.js" type="text/javascript"></script>
-    <script type="text/javascript" src="/bookreader/jquery-ui-1.8.1.custom.min.js?v=<? echo($version); ?>"></script>
+    <script type="text/javascript" src="/bookreader/jquery-ui-1.8.5.custom.min.js?v=<? echo($version); ?>"></script>
+    <script type="text/javascript" src="http://www.archive.org/includes/analytics.js?v=2"></script>
     <script type="text/javascript" src="/bookreader/dragscrollable.js?v=<? echo($version); ?>"></script>
+    <script type="text/javascript" src="/bookreader/jquery.colorbox-min.js"></script>
+    <script type="text/javascript" src="/bookreader/jquery.ui.ipad.js"></script>
+     <!-- THIS ALLOWS BEAUTYTIPS TO WORK ON IE -->
+        <!--[if lt IE 9]>
+        <script type="text/javascript" src="/includes/excanvas.compiled.js"></script>
+        <![endif]-->
+    <script type="text/javascript" src="/bookreader/jquery.bt.min.js"></script>
     <script type="text/javascript" src="/bookreader/BookReader.js?v=<? echo($version); ?>"></script>
+<? if ( !preg_match("/mobile/i", $_SERVER['HTTP_USER_AGENT']) ) { ?>
+    <script type="text/javascript" src="/bookreader/soundmanager/soundmanager2-ia.js?v=<? echo($version); ?>"></script>
+    <script>
+        soundManager.debugMode = false;
+        soundManager.url = '/bookreader/soundmanager/swf/';       
+        soundManager.useHTML5Audio = true;
+        soundManager.flashVersion = 9; //flash 8 version of swf is buggy when calling play() on a sound that is still loading
+    </script>
+<? } /* mobile user agent */ ?>
 </head>
-<body style="background-color: #FFFFFF;">
+<body style="background-color: ##939598;">
 
-<? if ($uiMode == 'full') { ?>
-<div id="BookReader" style="left:10px; right:200px; top:10px; bottom:2em;">Internet Archive BookReader <noscript>requires JavaScript to be enabled.</noscript></div>
-<? } else { ?>
-<div id="BookReader" style="left:0; right:0; top:0; bottom:0; border:0">Internet Archive Bookreader <noscript>requires JavaScript to be enabled.</noscript></div>
-<? } /* uiMode*/ ?>
+<?
+/*
+// <? if ($uiMode == 'full') { ?>
+// <div id="BookReader" style="left:10px; right:200px; top:10px; bottom:2em;">Internet Archive BookReader <noscript>requires JavaScript to be enabled.</noscript></div>
+// <? } else { ?>
+// <div id="BookReader" style="left:0; right:0; top:0; bottom:0; border:0">Internet Archive Bookreader <noscript>requires JavaScript to be enabled.</noscript></div>
+// <? } ?>
+*/
+?>
+
+<div id="BookReader">
+    Internet Archive BookReader - <? echo $title; ?>
+    <br/>
+    
+    <noscript>
+    <p>
+        The BookReader requires JavaScript to be enabled. Please check that your browser supports JavaScript and that it is enabled in the browser settings.  You can also try one of the <a href="http://www.archive.org/details/<? echo $identifier; ?>"> other formats of the book</a>.
+    </p>
+    </noscript>
+</div>
 
 <script type="text/javascript">
   // Set some config variables -- $$$ NB: Config object format has not been finalized
   var brConfig = {};
 <? if ($uiMode == 'embed') { ?>
   brConfig["mode"] = 1;
-  brConfig["reduce"] = 8;
   brConfig["ui"] = "embed";
 <? } else { ?>
   brConfig["mode"] = 2;
 <? } ?>
 </script>
-<!-- The script included below is dynamically generated JavaScript that includes the book metadata and page image access functions -->
+<!-- The script included below is dynamically generated JavaScript that includes the book metadata and page image access functions.
+     The ia{number}.us.archive.org server referenced below can and does change, so this URL should NOT be used for permanent access.  -->
 <script type="text/javascript" src="<? echo($metaURL); ?>"></script>
-
-<? if ($uiMode == 'full') { ?>
-<div id="BookReaderSearch" style="width:190px; right:0px; top:10px; bottom:2em;">
-    <form action='javascript:' onsubmit="br.search($('#BookReaderSearchBox').val());">
-        <p style="display: inline">
-            <input id="BookReaderSearchBox" type="text" size="20" value="search..." onfocus="if('search...'==this.value)this.value='';" /><input type="submit" value="go" />
-        </p>
-    </form>
-    <div id="BookReaderSearchResults">
-        Search results
-    </div>
-</div>
-
-
-<div id="BRfooter">
-    <div class="BRlogotype">
-        <a href="http://archive.org/" class="BRblack">Internet Archive</a>
-    </div>
-    <div class="BRnavlinks">
-        <!-- <a class="BRblack" href="http://openlibrary.org/dev/docs/bookreader">About the Bookreader</a> | -->
-        <a class="BRblack" href="http://www.archive.org/about/faqs.php#Report_Item">Content Problems</a> |
-        <a class="BRblack" href="https://bugs.launchpad.net/bookreader/+filebug">Report Bugs</a> |
-        <a class="BRblack" href="http://www.archive.org/details/texts">Texts Collection</a> |
-        <a class="BRblack" href="http://www.archive.org/about/contact.php">Contact Us</a>
-    </div>
-</div>
-<? } /* uiMode */ ?>
+<!-- This URL will find the item and redirect to the correct server.  Remove the line above and use the URL below for stable access. -->
+<!-- <script type="text/javascript" src="<? echo($locateURL); ?>"></script> -->
 
 <script type="text/javascript">
-    // $$$ hack to workaround sizing bug when starting in two-up mode
-    $(document).ready(function() {
-        $(window).trigger('resize');
-    });
+    // Usage stats
+    if(window.archive_analytics) { window.archive_analytics.values['bookreader'] = 'open'};
 </script>
   <?
     exit;
@@ -240,6 +254,17 @@ class BookReader
     return $url;
   }
   
+  // This returns a URL that finds the item then returns a redirect to BookReaderJSIA.php
+  // on the item's server.
+  public static function jsLocateURL($identifier, $subPrefix = '')
+  {
+    $locateURL = 'http://www.archive.org/bookreader/BookReaderJSLocate.php?id=' . $identifier;
+    if ($subPrefix) {
+        $locateURL .= '&subPrefix=' . $subPrefix;
+    }
+    return $locateURL;
+  }
+  
   // Return the URL for the requested /download/$path, or null
   public static function getURL($path, $item) {
     // $path should look like {itemId}/{operator}/{filename}