}
});
+ if (this.protected) {
+ $('.BRpagediv1up').live('contextmenu dragstart', this, function(e) {
+ return false;
+ });
+
+ $('.BRpageimage').live('contextmenu dragstart', this, function(e) {
+ return false;
+ });
+
+ $('.BRpagedivthumb').live('contextmenu dragstart', this, function(e) {
+ return false;
+ });
+
+ }
+
$('.BRpagediv1up').bind('mousedown', this, function(e) {
// $$$ the purpose of this is to disable selection of the image (makes it turn blue)
// but this also interferes with right-click. See https://bugs.edge.launchpad.net/gnubook/+bug/362626
// Remove class so we no longer count as loading
$(this).removeClass('BRlazyloading');
})
- .attr( { width: $(dummyImage).width(),
- height: $(dummyImage).height(),
- src: $(dummyImage).data('srcURL')
+
+ //the width set with .attr is ignored by Internet Explorer, causing it to show the image at its original size
+ //but with this one line of css, even IE shows the image at the proper size
+ /*
+ .css({
+ 'width': $(dummyImage).width()+'px',
+ 'height': $(dummyImage).height()+'px'
+ })
+ .attr({
+ 'width': $(dummyImage).width(),
+ 'height': $(dummyImage).height(),
+ 'src': $(dummyImage).data('srcURL')
});
+ */
// replace with the new img
$(dummyImage).before(img).remove();
//console.log(' animating newIndexR ' + newIndexR + ' to ' + newWidthR + ' from ' + $(self.prefetchedImgs[newIndexR]).width());
$(self.prefetchedImgs[newIndexR]).animate({width: newWidthR+'px'}, self.flipSpeed, 'easeOutSine', function() {
$(self.prefetchedImgs[newIndexL]).css('zIndex', 2);
+
+ //jquery adds display:block to the element style, which interferes with our print css
+ $(self.prefetchedImgs[newIndexL]).css('display', '');
+ $(self.prefetchedImgs[newIndexR]).css('display', '');
$(self.leafEdgeR).css({
// Moves the right leaf edge
$(self.leafEdgeTmp).animate({left: gutter-newWidthL-leafEdgeTmpW+'px'}, speed, 'easeOutSine');
$(self.prefetchedImgs[newIndexL]).animate({width: newWidthL+'px'}, speed, 'easeOutSine', function() {
$(self.prefetchedImgs[newIndexR]).css('zIndex', 2);
+
+ //jquery adds display:block to the element style, which interferes with our print css
+ $(self.prefetchedImgs[newIndexL]).css('display', '');
+ $(self.prefetchedImgs[newIndexR]).css('display', '');
$(self.leafEdgeL).css({
width: newLeafEdgeWidthL+'px',
this.setClickHandler2UP( this.prefetchedImgs[this.twoPage.currentIndexL],
{ self: this },
function(e) {
- if (e.button == 2) {
+ if (e.which == 3) {
// right click
+ if (e.data.self.protected) {
+ return false;
+ }
return true;
}
this.setClickHandler2UP( this.prefetchedImgs[this.twoPage.currentIndexR],
{ self: this },
function(e) {
- if (e.button == 2) {
+ if (e.which == 3) {
// right click
+ if (e.data.self.protected) {
+ return false;
+ }
return true;
}
var errStr = 'No matches were found.';
var timeout = 1000;
if (false === results.indexed) {
- errStr = "<p>This book isn't in the search engine yet.</p><p>Please <a href='http://openlibrary.org/contact?path=archive.org/stream/"+this.bookId+"/search'>drop us a line</a> so we can fix it. Thanks!</p>";
+ errStr = "<p>This book hasn't been indexed for searching yet. We've just started indexing it, so search should be available soon. Please try again later. Thanks!</p>";
timeout = 5000;
}
$(br.popup).html(errStr);
$('.BRpageimage').die('mousedown.swipe').live('mousedown.swipe',
{ 'br': this },
this.swipeMousedownHandler
- )
- .die('mousemove.swipe').live('mousemove.swipe',
- { 'br': this },
- this.swipeMousemoveHandler
- )
- .die('mouseup.swipe').live('mouseup.swipe',
- { 'br': this },
- this.swipeMouseupHandler
);
this.bindMozTouchHandlers();
BookReader.prototype.swipeMousedownHandler = function(event) {
//console.log('swipe mousedown');
//console.log(event);
-
+
var self = event.data['br'];
+
+ // We should be the last bubble point for the page images
+ // Disable image drag and select, but keep right-click
+ if (event.which == 3) {
+ if (self.protected) {
+ return false;
+ }
+ return true;
+ }
+
+ $(event.target).bind('mouseout.swipe',
+ { 'br': self},
+ self.swipeMouseupHandler
+ ).bind('mouseup.swipe',
+ { 'br': self},
+ self.swipeMouseupHandler
+ ).bind('mousemove.swipe',
+ { 'br': self },
+ self.swipeMousemoveHandler
+ );
+
self.initSwipeData(event.clientX, event.clientY);
self._swipe.mightBeSwiping = true;
self._swipe.mightBeDragging = true;
- // We should be the last bubble point for the page images
- // Disable image drag and select, but keep right-click
- if ($(event.originalTarget).hasClass('BRpageimage') && event.button != 2) {
- event.preventDefault();
- }
+ event.preventDefault();
+ event.returnValue = false;
+ event.cancelBubble = true;
+ return false;
}
BookReader.prototype.swipeMousemoveHandler = function(event) {
}
_swipe.lastX = event.clientX;
_swipe.lastY = event.clientY;
+
+ event.preventDefault();
+ event.returnValue = false;
+ event.cancelBubble = true;
+ return false;
}
BookReader.prototype.swipeMouseupHandler = function(event) {
var _swipe = event.data['br']._swipe;
//console.log('swipe mouseup - did swipe ' + _swipe.didSwipe);
_swipe.mightBeSwiping = false;
_swipe.mightBeDragging = false;
+
+ $(event.target).unbind('mouseout.swipe').unbind('mouseup.swipe').unbind('mousemove.swipe');
+
if (_swipe.didSwipe || _swipe.didDrag) {
// Swallow event if completed swipe gesture
event.preventDefault();
- event.stopPropagation();
+ event.returnValue = false;
+ event.cancelBubble = true;
+ return false;
}
+ return true;
}
-
BookReader.prototype.bindMozTouchHandlers = function() {
var self = this;
}
// $$$mang cleanup
- self.bookUrl = 'http://openlibrary.org' + olObject.key;
+ self.bookUrl = self.olHost + olObject.key;
self.bookTitle = olObject['title'];
$('#BRreturn a').attr( {'href': self.bookUrl, 'title': "Go to this book's page on Open Library" } );
$('#BRreturn a').text(self.bookTitle);
$('#BRinfo').remove();
$('#BRshare').after(self.blankInfoDiv());
self.buildInfoDiv($('#BRinfo'));
+
+ // Check for borrowed book
+ if (self.olAuth) {
+ var returnUrl = self.olHost + olObject.key + '/do_return/borrow';
+ var borrowUrl = self.olHost + olObject.key + '/borrow';
+
+ /*
+ $('<a/>')
+ .attr('href', borrowUrl)
+ .text('Return this book')
+ .click(function(event) {
+ event.preventDefault();
+ $('#BRreturnform').trigger('submit');
+ })
+ .appendTo('#BRreturn');
+ */
+
+ $('<form id="BRreturnform" action="' + returnUrl + '" method="post"><input type="submit" value="Return book" onclick="olAuth.deleteCookies();"/><input type="hidden" name="action" value="return" /></form>')
+ .appendTo('#BRreturn');
+
+ } else {
+ $('<a/>').attr( { 'href': self.bookUrl, 'title': 'Go to this book\'s page on Open Library' } )
+ .text('On openlibrary.org')
+ .appendTo('#BRreturn');
+ }
+
+ $('#BRreturn').css({ 'line-height': '19px'} );
+ $('#BRreturn a').css( {'height': '18px' } );
+
+
}
}