Merge commit 'rajbot/newui' into newui
authorMichael Ang <mang@archive.org>
Wed, 24 Nov 2010 00:18:31 +0000 (00:18 +0000)
committerMichael Ang <mang@archive.org>
Wed, 24 Nov 2010 00:18:31 +0000 (00:18 +0000)
1  2 
BookReader/BookReader.js

diff --combined BookReader/BookReader.js
@@@ -119,7 -119,7 +119,7 @@@ function BookReader() 
      this.twoPage = {
          coverInternalPadding: 0, // Width of cover
          coverExternalPadding: 0, // Padding outside of cover
-         bookSpineDivWidth: 0,    // Width of book spine  $$$ consider sizing based on book length
+         bookSpineDivWidth: 64,    // Width of book spine  $$$ consider sizing based on book length
          autofit: 'auto'
      };
      
@@@ -1526,7 -1526,7 +1526,7 @@@ BookReader.prototype.prepareTwoPageVie
      $(div).attr('id', 'BRbookspine').css({
          width:           this.twoPage.bookSpineDivWidth+'px',
          height:          this.twoPage.bookSpineDivHeight+'px',
-         left:            this.twoPage.bookSpineDivLeft+'px',
+         left:            (this.twoPage.gutter - this.twoPage.bookSpineDivWidth*0.5)+'px',
          top:             this.twoPage.bookSpineDivTop+'px'
      }).appendTo('#BRtwopageview');
      
@@@ -2191,6 -2191,8 +2191,8 @@@ BookReader.prototype.flipLeftToRight = 
      
          //console.log('     and now leafEdgeTmp to left: gutter+newWidthR ' + (gutter + newWidthR));
          $(self.leafEdgeTmp).animate({left: gutter+newWidthR+'px'}, self.flipSpeed, 'easeOutSine');
+         
+         $('#BRbookspine').css({left: (gutter - self.twoPage.bookSpineDivWidth*0.5)+'px'});        
  
          //console.log('  animating newIndexR ' + newIndexR + ' to ' + newWidthR + ' from ' + $(self.prefetchedImgs[newIndexR]).width());
          $(self.prefetchedImgs[newIndexR]).animate({width: newWidthR+'px'}, self.flipSpeed, 'easeOutSine', function() {
              $(self.twoPage.coverDiv).css({
                  width: self.twoPageCoverWidth(newWidthL+newWidthR)+'px',
                  left: gutter-newWidthL-newLeafEdgeWidthL-self.twoPage.coverInternalPadding+'px'
-             });
+             });            
              
              $(self.leafEdgeTmp).remove();
              self.leafEdgeTmp = null;
@@@ -2339,6 -2341,7 +2341,7 @@@ BookReader.prototype.flipRightToLeft = 
      
      $(this.leafEdgeTmp).animate({left: gutter}, speed, 'easeInSine');    
      $(this.prefetchedImgs[this.twoPage.currentIndexR]).animate({width: '0px'}, speed, 'easeInSine', function() {
+         $('#BRbookspine').css({left: (gutter - self.twoPage.bookSpineDivWidth*0.5)+'px'});
          $(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);
              $(self.twoPage.coverDiv).css({
                  width: self.twoPageCoverWidth(newWidthL+newWidthR)+'px',
                  left: gutter - newWidthL - newLeafEdgeWidthL - self.twoPage.coverInternalPadding + 'px'
-             });
-             
+             });            
+     
              $(self.leafEdgeTmp).remove();
              self.leafEdgeTmp = null;
              
@@@ -2480,14 -2483,13 +2483,13 @@@ BookReader.prototype.prepareFlipLeftToR
      //console.log('    prevL.left: ' + (gutter - scaledW) + 'px');
      //console.log('    changing prevL ' + prevL + ' to left: ' + (gutter-scaledW) + ' width: ' + scaledW);
      
-     leftCSS = {
+     var leftCSS = {
          position: 'absolute',
          left: gutter-scaledW+'px',
          right: '', // clear right property
          top:    top+'px',
          height: this.twoPage.height,
          width:  scaledW+'px',
-         borderRight: '1px solid black', // XXXmang check
          zIndex: 1
      }
      
  
      //console.log('    changing prevR ' + prevR + ' to left: ' + gutter + ' width: 0');
  
-     rightCSS = {
+     var rightCSS = {
          position: 'absolute',
          left:   gutter+'px',
          right: '',
          top:    top+'px',
          height: this.twoPage.height,
-         borderLeft: '1px solid black', // XXXmang check
          width:  '0',
          zIndex: 2
      }
@@@ -2992,9 -2993,56 +2993,9 @@@ BookReader.prototype.getPrintURI = func
      return '/bookreader/print.php?' + options;
  }
  
 -/* iframe implementation
 -BookReader.prototype.getPrintFrameContent = function(index) {    
 -    // We fit the image based on an assumed A4 aspect ratio.  A4 is a bit taller aspect than
 -    // 8.5x11 so we should end up not overflowing on either paper size.
 -    var paperAspect = 8.5 / 11;
 -    var imageAspect = this._getPageWidth(index) / this._getPageHeight(index);
 -    
 -    var rotate = 0;
 -    
 -    // Rotate if possible and appropriate, to get larger image size on printed page
 -    if (this.canRotatePage(index)) {
 -        if (imageAspect > 1 && imageAspect > paperAspect) {
 -            // more wide than square, and more wide than paper
 -            rotate = 90;
 -            imageAspect = 1/imageAspect;
 -        }
 -    }
 -    
 -    var fitAttrs;
 -    if (imageAspect > paperAspect) {
 -        // wider than paper, fit width
 -        fitAttrs = 'width="95%"';
 -    } else {
 -        // taller than paper, fit height
 -        fitAttrs = 'height="95%"';
 -    }
 -
 -    var imageURL = this._getPageURI(index, 1, rotate);
 -    var iframeStr = '<html style="padding: 0; border: 0; margin: 0"><head><title>' + this.bookTitle + '</title></head><body style="padding: 0; border:0; margin: 0">';
 -    iframeStr += '<div style="text-align: center; width: 99%; height: 99%; overflow: hidden;">';
 -    iframeStr +=   '<img src="' + imageURL + '" ' + fitAttrs + ' />';
 -    iframeStr += '</div>';
 -    iframeStr += '</body></html>';
 -    
 -    return iframeStr;
 -}
 -
 -BookReader.prototype.updatePrintFrame = function(delta) {
 -    var newIndex = this.indexToPrint + delta;
 -    newIndex = BookReader.util.clamp(newIndex, 0, this.numLeafs - 1);
 -    if (newIndex == this.indexToPrint) {
 -        return;
 -    }
 -    this.indexToPrint = newIndex;
 -    var doc = BookReader.util.getIFrameDocument($('#printFrame')[0]);
 -    $('body', doc).html(this.getPrintFrameContent(this.indexToPrint));
 -}
 -*/
 -
  // showEmbedCode()
 +//
 +// Note: Has been replaced by the share dialog
  //______________________________________________________________________________
  BookReader.prototype.showEmbedCode = function() {
      if (null != this.embedPopup) { // check if already showing
@@@ -3775,8 -3823,7 +3776,8 @@@ BookReader.prototype.bindNavigationHand
          self.printPage();
          return false;
      });
 -        
 +    
 +    // Note: Functionality has been replaced by .share
      jIcons.filter('.embed').click(function(e) {
          self.showEmbedCode();
          return false;
@@@ -5083,7 -5130,8 +5084,7 @@@ BookReader.prototype.buildShareDiv = fu
          }
          
          // console.log(params);
 -        var embedLink = self.getEmbedURL( params );    
 -        form.find('.BRframeEmbed').val('<iframe src="' + embedLink + '" width="480" height="480"></iframe>');
 +        form.find('.BRframeEmbed').val(self.getEmbedCode());
      })
      jForm.find('input[name=thispage]').trigger('change');
      jForm.find('input, textarea').bind('focus', function() {