Reduce jumping/resizing in info modal when cover is loading
[bookreader.git] / BookReaderIA / inc / BookReader.inc
index f849d67..0c6cefd 100644 (file)
@@ -102,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();
     }
     
@@ -112,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">
@@ -119,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); ?>">
@@ -163,28 +170,34 @@ class BookReader
 */
 ?>
 
-<div id="BookReader">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>
+<!-- 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>
@@ -241,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}