archive.org cvs r1.7: Use client-side scaling for two-page mode.
authorrajbot <raj@archive.org>
Fri, 7 Nov 2008 06:36:00 +0000 (06:36 +0000)
committerrajbot <raj@archive.org>
Fri, 7 Nov 2008 06:36:00 +0000 (06:36 +0000)
archive.org cvs r1.8: Make pageNums an array of strings instead of ints to handle roman pagenums.

GnuBookIA/GnuBookJSIA.php

index fdc39e4..bb96de3 100755 (executable)
@@ -90,7 +90,19 @@ gb.getPageURI = function(index) {
     if (1==this.mode) {
         var url = 'http://'+this.server+'/GnuBook/GnuBookJP2.php?zip='+this.zip+'&file='+this.bookId+'_jp2/'+this.bookId+'_'+leafStr.replace(re, imgStr) + '.jp2&scale='+this.reduce;
     } else {
-        var url = 'http://'+this.server+'/GnuBook/GnuBookJP2.php?zip='+this.zip+'&file='+this.bookId+'_jp2/'+this.bookId+'_'+leafStr.replace(re, imgStr) + '.jp2&height='+this.twoPageH+'&origHeight='+this.getPageHeight(index);
+        var ratio = this.getPageHeight(index) / this.twoPageH;
+        var scale;
+        if (ratio <= 2) {
+            scale = 1;
+        } else if (ratio <= 4) {
+            scale = 2;
+        } else {
+            scale = 4;
+        }        
+    
+        //var url = 'http://'+this.server+'/GnuBook/GnuBookJP2.php?zip='+this.zip+'&file='+this.bookId+'_jp2/'+this.bookId+'_'+leafStr.replace(re, imgStr) + '.jp2&height='+this.twoPageH+'&origHeight='+this.getPageHeight(index);
+        var url = 'http://'+this.server+'/GnuBook/GnuBookJP2.php?zip='+this.zip+'&file='+this.bookId+'_jp2/'+this.bookId+'_'+leafStr.replace(re, imgStr) + '.jp2&scale='+scale;
+        
     }
     return url;
 }
@@ -167,7 +179,7 @@ gb.pageNums = [
                 if ("true" == $page->addToAccessFormats) {
                     if(0 != $i) echo ",";   //stupid IE                
                     if (array_key_exists('pageNumber', $page) && ('' != $page->pageNumber)) {
-                        echo "{$page->pageNumber}";
+                        echo "'{$page->pageNumber}'";
                     } else {
                         echo "null";
                     }