}
gb.getPageURI = function(index) {
- var leafStr = '0000';
+ var leafStr = '0000';
var imgStr = this.leafMap[index].toString();
var re = new RegExp("0{"+imgStr.length+"}$");
var ratio = this.getPageHeight(index) / this.twoPage.height;
var scale;
// $$$ we make an assumption here that the scales are available pow2 (like kakadu)
- if (ratio <= 2) {
+ if (ratio < 2) {
scale = 1;
- } else if (ratio <= 4) {
+ } else if (ratio < 4) {
scale = 2;
- } else if (ratio <= 8) {
+ } else if (ratio < 8) {
scale = 4;
- } else if (ratio <= 16) {
+ } else if (ratio < 16) {
scale = 8;
- } else if (ratio <= 32) {
+ } else if (ratio < 32) {
scale = 16;
} else {
scale = 32;
gb.uniquifyPageNums();
}
+// getEmbedURL
+//________
+// Returns a URL for an embedded version of the current book
+gb.getEmbedURL = function() {
+ // We could generate a URL hash fragment here but for now we just leave at defaults
+ var url = 'http://' + window.location.host + '/stream/'+this.bookId;
+ if (this.subPrefix != this.bookId) { // Only include if needed
+ url += '/' + this.subPrefix;
+ }
+ url += '?ui=embed';
+ return url;
+}
+
+// getEmbedCode
+//________
+// Returns the embed code HTML fragment suitable for copy and paste
+gb.getEmbedCode = function() {
+ return "<iframe src='" + this.getEmbedURL() + "' width='480px' height='430px'></iframe>";
+}
+
gb.pageW = [
<?
$i=0;