Add contributed patch from https://github.com/yankl to set BRcontainer direction...
[bookreader.git] / BookReaderIA / inc / BookReader.inc
index d97b161..b949dcb 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,7 @@ class BookReader
     }
     
     $metaURL = BookReader::jsMetadataURL($server, $identifier, $mainDir, $subPrefix);
+    $locateURL = BookReader::jsLocateURL($identifier, $subPrefix);
     
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
@@ -134,12 +136,22 @@ class BookReader
     <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="excanvas.compiled.js"></script>
+        <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: ##939598;">
 
@@ -166,15 +178,13 @@ class BookReader
   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>
@@ -231,6 +241,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}