this.pageScale = this.reduce; // preserve current reduce
// Find start index and mode if set in location hash
- var params = this.paramsFromFragment(window.location.hash);
+ var params = {};
+ if (window.location.hash) {
+ // params explicitly set in URL
+ params = this.paramsFromFragment(window.location.hash);
+ } else {
+ // params not explicitly set, use defaults if we have them
+ if ('defaults' in this) {
+ params = this.paramsFromFragment(this.defaults);
+ }
+ }
// Sanitize/process parameters
}
});
+ 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
// Attempts to jump to page. Returns true if page could be found, false otherwise.
BookReader.prototype.jumpToPage = function(pageNum) {
- var pageIndex = this.getPageIndex(pageNum);
+ var pageIndex;
+
+ // Check for special "leaf"
+ var re = new RegExp('^leaf(\\d+)');
+ leafMatch = re.exec(pageNum);
+ if (leafMatch) {
+ console.log(leafMatch[1]);
+ pageIndex = this.leafNumToIndex(parseInt(leafMatch[1],10));
+ if (pageIndex === null) {
+ pageIndex = undefined; // to match return type of getPageIndex
+ }
+
+ } else {
+ pageIndex = this.getPageIndex(pageNum);
+ }
if ('undefined' != typeof(pageIndex)) {
var leafTop = 0;
//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;
}
//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;
}
- var self = event.data['br'];
-
$(event.target).bind('mouseout.swipe',
{ 'br': self},
self.swipeMouseupHandler
this.jumpToPage(params.page);
}
}
-
+
// $$$ process /region
// $$$ process /highlight
}
.appendTo('#BRreturn');
*/
- $('#BRreturn').css({ 'line-height': '19px'} );
-
- $('<form id="BRreturnform" action="' + returnUrl + '" method="post"><input type="submit" value="Return book" /><input type="hidden" name="action" value="return" /></form>')
+ $('<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' } );
+
+
}
}