pull out soundmanager and read-aloud code for mobile user agents
authorrajbot <raj@archive.org>
Thu, 14 Oct 2010 21:43:12 +0000 (21:43 +0000)
committerrajbot <raj@archive.org>
Thu, 14 Oct 2010 21:43:12 +0000 (21:43 +0000)
BookReader/BookReader.js
BookReaderIA/inc/BookReader.inc

index 9b27bf9..9becdb8 100644 (file)
@@ -3548,6 +3548,12 @@ BookReader.prototype.addChapterFromEntry = function(tocEntryObject) {
 BookReader.prototype.initToolbar = function(mode, ui) {
 
     // $$$mang should be contained within the BookReader div instead of body
+    var readIcon = ''
+    if (!navigator.userAgent.match(/mobile/i)) {
+        readIcon = "<button class='BRicon read modal'></button>";
+    }
+    console.log('readIcon = ' + readIcon);
+
     $("body").append(
           "<div id='BRtoolbar'>"
         +   "<span id='BRtoolbarbuttons'>"
@@ -3556,7 +3562,7 @@ BookReader.prototype.initToolbar = function(mode, ui) {
         // XXXmang icons incorrect or handlers wrong
         +     "<button class='BRicon info'></button>"
         +     "<button class='BRicon share'></button>"
-        +     "<button class='BRicon read modal'></button>"
+        +     readIcon
         +     "<button class='BRicon full'></button>"
         +   "</span>"
         +   "<span><a class='logo' href='" + this.logoURL + "'></a></span>"
index 29c21f9..5a046b9 100644 (file)
@@ -141,6 +141,7 @@ class BookReader
         <![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;
@@ -148,6 +149,7 @@ class BookReader
         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;">