this.willChangeToIndex(index);
+ this.ttsStop();
+
if (this.constMode2up == this.mode) {
this.autoStop();
// 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
}
this.setClickHandler2UP( this.prefetchedImgs[this.twoPage.currentIndexL],
{ self: this },
function(e) {
- console.log(e);
if (e.button == 2) {
// right click
return;
e.data.self.ttsStop();
e.data.self.left();
- // XXXpreventing drag and right-click?
e.preventDefault();
}
);
this.setClickHandler2UP( this.prefetchedImgs[this.twoPage.currentIndexR],
{ self: this },
function(e) {
- if (e.buttong == 2) {
+ if (e.button == 2) {
// right click
return;
}
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({
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'});
}
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));
.append('<div id="pagenum"><span class="currentpage"></span></div>');
//.wrap('<div class="ui-handle-helper-parent"></div>').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();
});
BookReader.prototype.initToolbar = function(mode, ui) {
// $$$mang should be contained within the BookReader div instead of body
- var readIcon = ''
+
+ 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:' 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>"
+ "<button class='BRicon share'></button>"
+ readIcon
- + "<button class='BRicon full'></button>"
+ //+ "<button class='BRicon full'></button>"
+ "</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>"
*/
);
+ $('#BRtoolbar .pause').hide();
+
this.updateToolbarZoom(this.reduce); // Pretty format
if (ui == "embed" || ui == "touch") {
'.embed': 'Embed BookReader',
'.link': 'Link to this book (and page)',
'.bookmark': 'Bookmark this page',
- '.read': 'Allow BookReader to read this aloud',
+ '.read': 'Read this book aloud',
'.full': 'Show fullscreen',
'.book_left': 'Flip left',
'.book_right': 'Flip right',
});
jIcons.filter('.zoom_in').bind('click', function() {
+ self.ttsStop();
self.zoom(1);
return false;
});
jIcons.filter('.zoom_out').bind('click', function() {
+ self.ttsStop();
self.zoom(-1);
return false;
});
}
BookReader.prototype.swipeMousedownHandler = function(event) {
- console.log('swipe mousedown'); // XXX
- console.log(event);
+ //console.log('swipe mousedown');
+ //console.log(event);
var self = event.data['br'];
self.initSwipeData(event.clientX, event.clientY);
}
BookReader.prototype.swipeMousemoveHandler = function(event) {
- //console.log('swipe move ' + event.clientX + ',' + event.clientY); // XXX
+ //console.log('swipe move ' + event.clientX + ',' + event.clientY);
var _swipe = event.data['br']._swipe;
if (! _swipe.mightBeSwiping) {
var absY = Math.abs(_swipe.deltaY);
// Minimum distance in the amount of tim to trigger the swipe
- var minSwipeLength = Math.max($('#BookReader').width() / 5, 150);
+ var minSwipeLength = Math.max($('#BookReader').width() / 5, 100);
var maxSwipeTime = 1000;
// Check for horizontal swipe
if (absX > absY && (absX > minSwipeLength) && _swipe.deltaT < maxSwipeTime) {
- console.log('swipe! ' + _swipe.deltaX + ',' + _swipe.deltaY + ' ' + _swipe.deltaT + 'ms');
+ //console.log('swipe! ' + _swipe.deltaX + ',' + _swipe.deltaY + ' ' + _swipe.deltaT + 'ms');
_swipe.mightBeSwiping = false; // only trigger once
if (event.data['br'].mode == event.data['br'].constMode2up) {
}
}
BookReader.prototype.swipeMouseupHandler = function(event) {
- console.log('swipe mouseup'); // XXX
- console.log(event);
+ //console.log('swipe mouseup');
+ //console.log(event);
event.data['br']._swipe.mightBeSwiping = false;
}