X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=BookReader%2FBookReader.js;h=9ee130bbbbdf81e90d9d1d2fec7e4dcc6238817d;hb=84859c5d68e73fc209348ce2229d90c589bd489e;hp=96f30ef520fc617ebbfb64a17015107dbfc261bd;hpb=a6ada111482d1b9d1805d5de95ea5e5364d222be;p=bookreader.git diff --git a/BookReader/BookReader.js b/BookReader/BookReader.js index 96f30ef..9ee130b 100644 --- a/BookReader/BookReader.js +++ b/BookReader/BookReader.js @@ -370,7 +370,7 @@ BookReader.prototype.setClickHandler2UP = function( element, data, handler) { //console.log('setting handler'); //console.log(element.tagName); - $(element).unbind('tap').bind('tap', data, function(e) { + $(element).unbind('click').bind('click', data, function(e) { handler(e); }); } @@ -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); @@ -656,10 +657,8 @@ BookReader.prototype.drawLeafsThumbnail = function( seekIndex ) { self.firstIndex = $(this).data('leaf'); self.switchMode(self.constMode1up); event.preventDefault(); - }); - - // $$$ we don't actually go to this URL (click is handled in handler above) - link.href = '#page/' + (this.getPageNum(leaf)) +'/mode/1up' ; + event.stopPropagation(); + }); $(div).append(link); $('#BRpageview').append(div); @@ -1239,6 +1238,8 @@ BookReader.prototype.jumpToIndex = function(index, pageX, pageY) { this.willChangeToIndex(index); + this.ttsStop(); + if (this.constMode2up == this.mode) { this.autoStop(); @@ -1351,8 +1352,6 @@ BookReader.prototype.switchMode = function(mode) { // this.twoPage.autofit = null; // Take zoom level from other mode this.twoPageCalculateReductionFactors(); this.reduce = this.quantizeReduce(this.reduce, this.twoPage.reductionFactors); - $('button.thumb').show(); - $('button.twopg').hide(); this.prepareTwoPageView(); this.twoPageCenterView(0.5, 0.5); // $$$ TODO preserve center } @@ -1471,7 +1470,7 @@ BookReader.prototype.prepareTwoPageView = function(centerPercentageX, centerPerc $('#BRcontainer').append('
'); // Attaches to first child, so must come after we add the page view - $('#BRcontainer').dragscrollable(); + //$('#BRcontainer').dragscrollable(); this.bindGestures($('#BRcontainer')); // $$$ calculate first then set @@ -1496,7 +1495,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'); @@ -2375,8 +2374,13 @@ BookReader.prototype.setMouseHandlers2UP = function() { this.setClickHandler2UP( this.prefetchedImgs[this.twoPage.currentIndexL], { self: this }, function(e) { + if (e.button == 2) { + // right click + return; + } e.data.self.ttsStop(); e.data.self.left(); + e.preventDefault(); } ); @@ -2384,6 +2388,10 @@ BookReader.prototype.setMouseHandlers2UP = function() { this.setClickHandler2UP( this.prefetchedImgs[this.twoPage.currentIndexR], { self: this }, function(e) { + if (e.button == 2) { + // right click + return; + } e.data.self.ttsStop(); e.data.self.right(); e.preventDefault(); @@ -2409,7 +2417,7 @@ BookReader.prototype.prefetchImg = function(index) { if (loadImage) { //console.log('prefetching ' + index); var img = document.createElement("img"); - img.className = 'BRpageimage'; + $(img).addClass('BRpageimage').addClass('BRnoselect'); if (index < 0 || index > (this.numLeafs - 1) ) { // Facing page at beginning or end, or beyond $(img).css({ @@ -2634,8 +2642,11 @@ 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 += '/fulltext/inside.php?item_id='+this.bookId; url += '&doc='+this.subPrefix; //TODO: test with subitem url += '&path='+this.bookPath.replace(new RegExp('/'+this.subPrefix+'$'), ''); //remove subPrefix from end of path url += '&q='+escape(term); @@ -2645,19 +2656,28 @@ BookReader.prototype.search = function(term) { this.searchTerm = term; this.removeSearchResults(); - this.showProgressPopup(); - this.ttsAjax = $.ajax({url:url, dataType:'jsonp', jsonpCallback:'BRSearchCallback'}); + this.showProgressPopup(' Search results will appear below...'); + this.ttsAjax = $.ajax({url:url, dataType:'jsonp', jsonpCallback:'br.BRSearchCallback'}); } // BRSearchCallback() //______________________________________________________________________________ -// Unfortunately, we can't pass 'br.searchCallback' to our search service, -// because it can't handle the '.' -function BRSearchCallback(results) { +BookReader.prototype.BRSearchCallback = function(results) { //console.log('got ' + results.matches.length + ' 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= 0) { if (null == box.div) { //create a div for the search highlight, and stash it in the box object @@ -3079,6 +3100,8 @@ BookReader.prototype.showBookmarkCode = function() { //______________________________________________________________________________ BookReader.prototype.autoToggle = function() { + this.ttsStop(); + var bComingFrom1up = false; if (2 != this.mode) { bComingFrom1up = true; @@ -3250,7 +3273,8 @@ BookReader.prototype.initNavbar = function() { + '' + '' + '' - + '' + // $$$ not yet implemented + //+ '' + '' + '' + '' @@ -3360,10 +3384,13 @@ BookReader.prototype.initNavbar = function() { .append('
'); //.wrap('
').parent(); // XXXmang is this used for hiding the tooltip? + // $$$mang, why are these set both here and in bindNavigationHandlers? $('.BRicon.book_left').bind('click', function() { + self.ttsStop(); self.left(); }); $('.BRicon.book_right').bind('click', function() { + self.ttsStop(); self.right(); }); @@ -3412,7 +3439,7 @@ BookReader.prototype.addSearchResult = function(queryString, pageIndex) { var re = new RegExp('{{{(.+?)}}}', 'g'); queryString = queryString.replace(re, '$1') - $('