show error when no search results are returned.
authorrajbot <raj@archive.org>
Tue, 19 Oct 2010 15:34:34 +0000 (15:34 +0000)
committerrajbot <raj@archive.org>
Tue, 19 Oct 2010 15:34:34 +0000 (15:34 +0000)
BookReader/BookReader.css
BookReader/BookReader.js

index 52c890d..568c796 100644 (file)
@@ -827,6 +827,7 @@ div#BRzoombtn {
     font-size: 1.5em; 
     z-index: 3;   
     padding: 5px;
+    text-align: center;
 }
 
 .BRprogressbar {
index 51865c2..5855e56 100644 (file)
@@ -2645,7 +2645,7 @@ BookReader.prototype.search = function(term) {
     this.searchTerm = term;
     
     this.removeSearchResults();
-    this.showProgressPopup('<img id="searchmarker" src="'+this.imagesBaseURL + 'marker_srch-on.png'+'">Search results will appear below...');
+    this.showProgressPopup('<img id="searchmarker" src="'+this.imagesBaseURL + 'marker_srch-on.png'+'"> Search results will appear below...');
     this.ttsAjax = $.ajax({url:url, dataType:'jsonp', jsonpCallback:'BRSearchCallback'});    
 }
 
@@ -2658,7 +2658,17 @@ function BRSearchCallback(results) {
     br.removeSearchResults();
     br.searchResults = results; 
     //console.log(br.searchResults);
-        
+    
+    if (0 == results.matches.length) {
+        $(br.popup).text('No matches were found.');
+        setTimeout(function(){
+            $(br.popup).fadeOut('slow', function() {
+                br.removeProgressPopup();
+            })        
+        },1000);
+        return;
+    }
+    
     var i;    
     for (i=0; i<results.matches.length; i++) {        
         br.addSearchResult(results.matches[i].text, br.leafNumToIndex(results.matches[i].par[0].page));