Make background ever so slightly brigher. Drop shadow for nav -- Safari only since...
[bookreader.git] / BookReader / BookReader.js
index 5f9dcfc..7eacf55 100644 (file)
@@ -465,6 +465,7 @@ BookReader.prototype.drawLeafsOnePage = function() {
 
             var img = document.createElement("img");
             img.src = this._getPageURI(index, this.reduce, 0);
+            $(img).addClass('BRnoselect');
             $(img).css('width', width+'px');
             $(img).css('height', height+'px');
             $(div).append(img);
@@ -1496,7 +1497,7 @@ BookReader.prototype.prepareTwoPageView = function(centerPercentageX, centerPerc
     $(this.twoPage.coverDiv).attr('id', 'BRbookcover').css({
         width:  this.twoPage.bookCoverDivWidth + 'px',
         height: this.twoPage.bookCoverDivHeight+'px',
-        visibility: 'visible',
+        visibility: 'visible'
     }).appendTo('#BRtwopageview');
     
     this.leafEdgeR = document.createElement('div');
@@ -2644,7 +2645,7 @@ 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 
+    $('#textSrch').blur(); //cause mobile safari to hide the keyboard     
     
     var url = 'http://'+this.server.replace(/:.+/, ''); //remove the port and userdir
     url    += '/fulltext/inside.php?item_id='+this.bookId;
@@ -2870,9 +2871,10 @@ BookReader.prototype.updateSearchHilites2UP = function() {
     var i, j;
     for (i=0; i<results.matches.length; i++) {
         //console.log(results.matches[i].par[0]);
+        //TODO: loop over all par objects
+        var pageIndex = this.leafNumToIndex(results.matches[i].par[0].page);        
         for (j=0; j<results.matches[i].par[0].boxes.length; j++) {
             var box = results.matches[i].par[0].boxes[j];
-            var pageIndex = this.leafNumToIndex(box.page);
             if (jQuery.inArray(pageIndex, this.displayedIndices) >= 0) {
                 if (null == box.div) {
                     //create a div for the search highlight, and stash it in the box object
@@ -3100,6 +3102,8 @@ BookReader.prototype.showBookmarkCode = function() {
 //______________________________________________________________________________
 BookReader.prototype.autoToggle = function() {
 
+    this.ttsStop();
+
     var bComingFrom1up = false;
     if (2 != this.mode) {
         bComingFrom1up = true;
@@ -3474,6 +3478,9 @@ BookReader.prototype.addSearchResult = function(queryString, pageIndex) {
         shadow: false
     })
     .hover( function() {
+                // remove from other markers then turn on just for this
+                // XXX should be done when nav slider moves
+                $('.search,.chapter').removeClass('front');
                 $(this).addClass('front');
             }, function() {
                 $(this).removeClass('front');
@@ -3538,6 +3545,8 @@ BookReader.prototype.addChapter = function(chapterTitle, pageNumber, pageIndex)
         shadow: false
     })
     .hover( function() {
+            // remove hover effect from other markers then turn on just for this
+            $('.search,.chapter').removeClass('front');
                 $(this).addClass('front');
             }, function() {
                 $(this).removeClass('front');
@@ -3607,18 +3616,16 @@ 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>";
     }
-    
+
     $("body").append(
           "<div id='BRtoolbar'>"
         +   "<span id='BRtoolbarbuttons'>"
         /* XXXmang integrate search */
         +     "<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 play'></button>"
         +     "<button class='BRicon pause'></button>"
         +     "<button class='BRicon info'></button>"
@@ -3628,6 +3635,7 @@ BookReader.prototype.initToolbar = function(mode, ui) {
         +   "</span>"
         +   "<span><a class='logo' href='" + this.logoURL + "'></a></span>"
         +   "<span id='BRreturn'><span>Back to</span><a href='" + this.bookUrl + "'>" + this.bookTitle + "</a></span>"
+        +   "<div id='BRnavCntlTop' class='BRnavCntl BRup'></div>"
         + "</div>"
         /*
         + "<div id='BRzoomer'>"
@@ -3643,7 +3651,7 @@ BookReader.prototype.initToolbar = function(mode, ui) {
         */
         );
     
-    $('#BRtoolbar .pause').hide();
+    $('#BRtoolbar .pause').hide();    
     
     this.updateToolbarZoom(this.reduce); // Pretty format
         
@@ -3880,13 +3888,6 @@ BookReader.prototype.bindNavigationHandlers = function() {
         return false;
     });
     
-    // XXX fix integration
-    // 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());
-    // });
-
     this.initSwipeData();
     $('#BookReader').die('mousemove.navigation').live('mousemove.navigation',
         { 'br': this },
@@ -4560,6 +4561,9 @@ BookReader.util = {
 // ttsToggle()
 //______________________________________________________________________________
 BookReader.prototype.ttsToggle = function () {
+
+    this.autoStop();
+
     if (false == this.ttsPlaying) {
         this.ttsPlaying = true;
         this.showProgressPopup('Loading audio...');    
@@ -4656,14 +4660,13 @@ 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");
     $(this.popup).css({
         top:      ($('#BookReader').height()*0.5-100) + 'px',
-        left:     ($('#BookReader').width()-300)*0.5 + 'px',
-        width:    '300px',
-        border:   '2px solid black'
+        left:     ($('#BookReader').width()-300)*0.5 + 'px'
     }).attr('className', 'BRprogresspopup');
 
     var bar = document.createElement("div");
@@ -4984,22 +4987,28 @@ BookReader.prototype.ttsStartPolling = function () {
         },3000);
     };
     $().ready(function(){
-        $('#BRtoolbar').animate({top:0},3000).animate({top:-40});
-        $('#BRnav').animate({bottom:0},3000).animate({bottom:-53});
+    /*
+        $('#BRtoolbar').delay(3000).animate({top:-40});
+        $('#BRnav').delay(3000).animate({bottom:-53});
         changeArrow();
-        $('.BRnavCntl').animate({opacity:1},3000).animate({height:'43px'}).animate({opacity:1},1000).animate({opacity:.25},1000);
+        $('.BRnavCntl').delay(3000).animate({height:'43px'}).delay(1000).animate({opacity:.25},1000);
+    */
         $('.BRnavCntl').click(
             function(){
                 if ($('#BRnavCntlBtm').hasClass('BRdn')) {
                     $('#BRtoolbar').animate({top:-40});
-                    $('#BRnav').animate({bottom:-53});
+                    $('#BRnav').animate({bottom:-55});
                     $('#BRnavCntlBtm').addClass('BRup').removeClass('BRdn');
-                    $('.BRnavCntl').animate({height:'43px'}).animate({opacity:1},1000).animate({opacity:.25},1000);
+                    $('#BRnavCntlTop').addClass('BRdn').removeClass('BRup');
+                    $('#BRnavCntlBtm.BRnavCntl').animate({height:'45px'});
+                    $('.BRnavCntl').delay(1000).animate({opacity:.25},1000);
                 } else {
                     $('#BRtoolbar').animate({top:0});
                     $('#BRnav').animate({bottom:0});
                     $('#BRnavCntlBtm').addClass('BRdn').removeClass('BRup');
-                    $('.BRnavCntl').animate({opacity:1,height:'30px'});
+                    $('#BRnavCntlTop').addClass('BRup').removeClass('BRdn');
+                    $('#BRnavCntlBtm.BRnavCntl').animate({height:'30px'});
+                    $('.BRvavCntl').animate({opacity:1})
                 };
             }
         );
@@ -5013,5 +5022,14 @@ BookReader.prototype.ttsStartPolling = function () {
                 $('.BRnavCntl').animate({opacity:.25},250);
             };
         });
+        $('#BRnavCntlTop').mouseover(function(){
+            if ($(this).hasClass('BRdn')) {
+                $('.BRnavCntl').animate({opacity:1},250);
+            };
+        });
+        $('#BRnavCntlTop').mouseleave(function(){
+            if ($(this).hasClass('BRdn')) {
+                $('.BRnavCntl').animate({opacity:.25},250);
+            };
+        });
     });
-