fix search on mobile safari
authorrajbot <raj@archive.org>
Wed, 20 Oct 2010 03:14:27 +0000 (03:14 +0000)
committerrajbot <raj@archive.org>
Wed, 20 Oct 2010 03:14:27 +0000 (03:14 +0000)
BookReader/BookReader.js

index 36032e7..5d532a9 100644 (file)
@@ -2636,6 +2636,9 @@ BookReader.prototype.getPageWidth2UP = function(index) {
 //______________________________________________________________________________
 BookReader.prototype.search = function(term) {
     //console.log('search called with term=' + term);
+    
+    $('#textSrch').blur(); //cause mobile safari to hide the keyboard 
+    
     var url = 'http://'+this.server.replace(/:.+/, ''); //remove the port and userdir
     url    += '/~edward/inside_jsonp.php?item_id='+this.bookId;
     url    += '&doc='+this.subPrefix;   //TODO: test with subitem
@@ -3608,7 +3611,7 @@ BookReader.prototype.initToolbar = function(mode, ui) {
           "<div id='BRtoolbar'>"
         +   "<span id='BRtoolbarbuttons'>"
         /* XXXmang integrate search */
-        +     "<form action='javascript:' id='booksearch'><input type='search' id='textSrch' name='textSrch' val='' placeholder='Search inside'/><button type='submit' id='btnSrch' name='btnSrch'>GO</button></form>"
+        +     "<form action='javascript:br.search($(\"#textSrch\").val());' id='booksearch'><input type='search' id='textSrch' name='textSrch' val='' placeholder='Search inside'/><button type='submit' id='btnSrch' name='btnSrch'>GO</button></form>"
         // XXXmang icons incorrect or handlers wrong
         +     "<button class='BRicon info'></button>"
         +     "<button class='BRicon share'></button>"
@@ -3868,9 +3871,11 @@ BookReader.prototype.bindNavigationHandlers = function() {
     });
     
     // XXX fix integration
-    $('#booksearch').bind('submit', function() {
-        self.search($('#textSrch').val());
-    });
+    // XXX Mobile safari was not picking up this handler, so 
+    //     I explictly set the form action in initToolbar()
+    // $('#booksearch').bind('submit', function() {
+    //    self.search($('#textSrch').val());
+    // });
 
     $('#BookReader').die('mousemove.navigation').live('mousemove.navigation',
         { 'br': this },
@@ -4531,7 +4536,6 @@ BookReader.prototype.ttsStartCB = function (data) {
 // showProgressPopup
 //______________________________________________________________________________
 BookReader.prototype.showProgressPopup = function(msg) {
-    if (soundManager.debugMode) console.log('showProgressPopup index='+this.ttsIndex+' pos='+this.ttsPosition);
     if (this.popup) return;
     
     this.popup = document.createElement("div");