Merge commit 'openlibrary/newui' into newui
authorLance Arthur <lance.arthur@archive.org>
Wed, 20 Oct 2010 22:46:47 +0000 (15:46 -0700)
committerLance Arthur <lance.arthur@archive.org>
Wed, 20 Oct 2010 22:46:47 +0000 (15:46 -0700)
BookReader/BookReader.css
BookReader/BookReader.js
BookReader/jquery.ui.ipad.js
BookReader/search.html [new file with mode: 0644]

index 28e4b82..ed8148f 100644 (file)
@@ -30,7 +30,6 @@ a {
     width: 100%;
     z-index: 100;
     background-color: #e2dcc5;
-    overflow: hidden;
 }
 #BRtoolbar .label {
     font-size: 1.1em;
@@ -103,13 +102,6 @@ a {
     background-color: rgb(234, 226, 205);
 }
 
-/* Disable selection on Firefox and WebKit */
-.BRnoselect {
-    -moz-user-select: none;
-    -webkit-user-select: none;
-    -webkit-user-drag: none;
-}
-
 .BRleafEdgeR {
     /*
     border-style: solid solid solid none;
@@ -808,7 +800,7 @@ div#BRzoomcontrol {
     top: 40px;
     left:3px;
     width: 23px;
-    height: 110px;    
+    height: 110px;
 }
 div#BRzoomstrip {
     position: absolute;
@@ -830,15 +822,22 @@ div#BRzoombtn {
 
 .BRprogresspopup {
     position: absolute;
-    background-color: #E6E4E1;
+    background-color: #e6e4e1;
+    border: none!important;
     font-size: 1.5em; 
     z-index: 3;   
-    padding: 5px;
-    text-align: center;
+    padding: 20px;
+    -moz-border-radius: 8px;
+    -webkit-border-radius: 8px;
+    border-radius: 8px;
+    -moz-box-shadow: 1px 0 3px #000;
+    -webkit-box-shadow: 1px 0 3px #000;
+    box-shadow: 1px 0 3px #333;
+    min-width: 300px;
 }
 
 .BRprogressbar {
-    background-image: url(images/progressbar.gif);
+    background-image: url("images/progressbar.gif");
     background-repeat:no-repeat;
     background-position:center top;
 }
@@ -858,13 +857,24 @@ div#BRzoombtn {
     -moz-border-radius-topleft: 8px;
     -webkit-border-top-left-radius: 8px;
 }
+#BRnavCntlTop {
+    top: 40px;
+    -moz-border-radius-bottomright: 8px;
+    -webkit-border-bottom-right-radius: 8px;
+    -moz-border-radius-bottomleft: 8px;
+    -webkit-border-bottom-left-radius: 8px;
+}
 .BRup {
     background-image: url("images/nav_control-up.png");
-    background-position: 8px 4px;
     background-repeat: no-repeat;
 }
 .BRdn {
     background-image: url("images/nav_control-dn.png");
-    background-position: 8px 4px;
     background-repeat: no-repeat;
+}
+#BRnavCntlBtm.BRup,#BRnavCntlBtm.BRdn {
+    background-position: 8px 4px;
+}
+#BRnavCntlTop.BRup,#BRnavCntlTop.BRdn {
+    background-position: 8px 4px;
 }
\ No newline at end of file
index 617b118..01baa27 100644 (file)
@@ -1353,6 +1353,8 @@ BookReader.prototype.switchMode = function(mode) {
         // this.twoPage.autofit = null; // Take zoom level from other mode
         this.twoPageCalculateReductionFactors();
         this.reduce = this.quantizeReduce(this.reduce, this.twoPage.reductionFactors);
+        $('button.thumb').show();
+        $('button.twopg').hide();
         this.prepareTwoPageView();
         this.twoPageCenterView(0.5, 0.5); // $$$ TODO preserve center
     }
@@ -2643,9 +2645,6 @@ BookReader.prototype.getPageWidth2UP = function(index) {
 //______________________________________________________________________________
 BookReader.prototype.search = function(term) {
     //console.log('search called with term=' + term);
-    
-    $('#textSrch').blur(); //cause mobile safari to hide the keyboard 
-    
     var url = 'http://'+this.server.replace(/:.+/, ''); //remove the port and userdir
     url    += '/~edward/inside_jsonp.php?item_id='+this.bookId;
     url    += '&doc='+this.subPrefix;   //TODO: test with subitem
@@ -3614,27 +3613,25 @@ BookReader.prototype.addChapterFromEntry = function(tocEntryObject) {
 BookReader.prototype.initToolbar = function(mode, ui) {
 
     // $$$mang should be contained within the BookReader div instead of body
-
-    var readIcon = '';
+    var readIcon = ''
     if (!navigator.userAgent.match(/mobile/i)) {
         readIcon = "<button class='BRicon read modal'></button>";
     }
-    
+
     $("body").append(
           "<div id='BRtoolbar'>"
         +   "<span id='BRtoolbarbuttons'>"
         /* XXXmang integrate search */
-        +     "<form action='javascript:br.search($(\"#textSrch\").val());' id='booksearch'><input type='search' id='textSrch' name='textSrch' val='' placeholder='Search inside'/><button type='submit' id='btnSrch' name='btnSrch'>GO</button></form>"
+        +     "<form action='javascript:' id='booksearch'><input type='search' id='textSrch' name='textSrch' val='' placeholder='Search inside'/><button type='submit' id='btnSrch' name='btnSrch'>GO</button></form>"
         // XXXmang icons incorrect or handlers wrong
-        +     "<button class='BRicon play'></button>"
-        +     "<button class='BRicon pause'></button>"
         +     "<button class='BRicon info'></button>"
         +     "<button class='BRicon share'></button>"
         +     readIcon
-        //+     "<button class='BRicon full'></button>"
+        +     "<button class='BRicon full'></button>"
         +   "</span>"
         +   "<span><a class='logo' href='" + this.logoURL + "'></a></span>"
         +   "<span id='BRreturn'><span>Back to</span><a href='" + this.bookUrl + "'>" + this.bookTitle + "</a></span>"
+        +   "<div id='BRnavCntlTop' class='BRnavCntl BRup'></div>"
         + "</div>"
         /*
         + "<div id='BRzoomer'>"
@@ -3650,8 +3647,6 @@ BookReader.prototype.initToolbar = function(mode, ui) {
         */
         );
     
-    $('#BRtoolbar .pause').hide();
-    
     this.updateToolbarZoom(this.reduce); // Pretty format
         
     if (ui == "embed" || ui == "touch") {
@@ -3678,7 +3673,7 @@ BookReader.prototype.initToolbar = function(mode, ui) {
                    '.embed': 'Embed BookReader',
                    '.link': 'Link to this book (and page)',
                    '.bookmark': 'Bookmark this page',
-                   '.read': 'Read this book aloud',
+                   '.read': 'Allow BookReader to read this aloud',
                    '.full': 'Show fullscreen',
                    '.book_left': 'Flip left',
                    '.book_right': 'Flip right',
@@ -3888,11 +3883,9 @@ BookReader.prototype.bindNavigationHandlers = function() {
     });
     
     // XXX fix integration
-    // XXX Mobile safari was not picking up this handler, so 
-    //     I explictly set the form action in initToolbar()
-    // $('#booksearch').bind('submit', function() {
-    //    self.search($('#textSrch').val());
-    // });
+    $('#booksearch').bind('submit', function() {
+        self.search($('#textSrch').val());
+    });
 
     this.initSwipeData();
     $('#BookReader').die('mousemove.navigation').live('mousemove.navigation',
@@ -4663,14 +4656,13 @@ BookReader.prototype.ttsStartCB = function (data) {
 // showProgressPopup
 //______________________________________________________________________________
 BookReader.prototype.showProgressPopup = function(msg) {
+    if (soundManager.debugMode) console.log('showProgressPopup index='+this.ttsIndex+' pos='+this.ttsPosition);
     if (this.popup) return;
     
     this.popup = document.createElement("div");
     $(this.popup).css({
         top:      ($('#BookReader').height()*0.5-100) + 'px',
-        left:     ($('#BookReader').width()-300)*0.5 + 'px',
-        width:    '300px',
-        border:   '2px solid black'
+        left:     ($('#BookReader').width()-300)*0.5 + 'px'
     }).attr('className', 'BRprogresspopup');
 
     var bar = document.createElement("div");
@@ -4991,22 +4983,28 @@ BookReader.prototype.ttsStartPolling = function () {
         },3000);
     };
     $().ready(function(){
-        $('#BRtoolbar').animate({top:0},3000).animate({top:-40});
-        $('#BRnav').animate({bottom:0},3000).animate({bottom:-53});
+    /*
+        $('#BRtoolbar').delay(3000).animate({top:-40});
+        $('#BRnav').delay(3000).animate({bottom:-53});
         changeArrow();
-        $('.BRnavCntl').animate({opacity:1},3000).animate({height:'43px'}).animate({opacity:1},1000).animate({opacity:.25},1000);
+        $('.BRnavCntl').delay(3000).animate({height:'43px'}).delay(1000).animate({opacity:.25},1000);
+    */
         $('.BRnavCntl').click(
             function(){
                 if ($('#BRnavCntlBtm').hasClass('BRdn')) {
                     $('#BRtoolbar').animate({top:-40});
-                    $('#BRnav').animate({bottom:-53});
+                    $('#BRnav').animate({bottom:-55});
                     $('#BRnavCntlBtm').addClass('BRup').removeClass('BRdn');
-                    $('.BRnavCntl').animate({height:'43px'}).animate({opacity:1},1000).animate({opacity:.25},1000);
+                    $('#BRnavCntlTop').addClass('BRdn').removeClass('BRup');
+                    $('#BRnavCntlBtm.BRnavCntl').animate({height:'45px'});
+                    $('.BRnavCntl').delay(1000).animate({opacity:.25},1000);
                 } else {
                     $('#BRtoolbar').animate({top:0});
                     $('#BRnav').animate({bottom:0});
                     $('#BRnavCntlBtm').addClass('BRdn').removeClass('BRup');
-                    $('.BRnavCntl').animate({opacity:1,height:'30px'});
+                    $('#BRnavCntlTop').addClass('BRup').removeClass('BRdn');
+                    $('#BRnavCntlBtm.BRnavCntl').animate({height:'30px'});
+                    $('.BRvavCntl').animate({opacity:1})
                 };
             }
         );
@@ -5020,5 +5018,14 @@ BookReader.prototype.ttsStartPolling = function () {
                 $('.BRnavCntl').animate({opacity:.25},250);
             };
         });
+        $('#BRnavCntlTop').mouseover(function(){
+            if ($(this).hasClass('BRdn')) {
+                $('.BRnavCntl').animate({opacity:1},250);
+            };
+        });
+        $('#BRnavCntlTop').mouseleave(function(){
+            if ($(this).hasClass('BRdn')) {
+                $('.BRnavCntl').animate({opacity:.25},250);
+            };
+        });
     });
-
index c73a1bd..6ee5160 100644 (file)
 *
 * Project Home: 
 * http://code.google.com/p/jquery-ui-for-ipad-and-iphone/
-*/
-
-
-
-
-
-$(function() {
-
-       //
-
-       // Extend jQuery feature detection
-
-       //
-
-       $.extend($.support, {
-
-               touch: typeof Touch == "object"
-
-       });
-
-       
-
-       //
-
-       // Hook up touch events
-
-       //
-
-       if ($.support.touch) {
-
-               document.addEventListener("touchstart", iPadTouchHandler, false);
-
-               document.addEventListener("touchmove", iPadTouchHandler, false);
-
-               document.addEventListener("touchend", iPadTouchHandler, false);
-
-               document.addEventListener("touchcancel", iPadTouchHandler, false);
-
-       }
-
-});
-
-
-
-
-
-var lastTap = null;                    // Holds last tapped element (so we can compare for double tap)
-
-var tapValid = false;                  // Are we still in the .6 second window where a double tap can occur
-
-var tapTimeout = null;                 // The timeout reference
-
-
-
-function cancelTap() {
-
-       tapValid = false;
-
-}
-
-
-
-
-
-var rightClickPending = false; // Is a right click still feasible
-
-var rightClickEvent = null;            // the original event
-
-var holdTimeout = null;                        // timeout reference
-
-var cancelMouseUp = false;             // prevents a click from occuring as we want the context menu
-
-
-
-
-
-function cancelHold() {
-
-       if (rightClickPending) {
-
-               window.clearTimeout(holdTimeout);
-
-               rightClickPending = false;
-
-               rightClickEvent = null;
-
-       }
-
-}
-
-
-
-function startHold(event) {
-
-       if (rightClickPending)
-
-               return;
-
-
-
-       rightClickPending = true; // We could be performing a right click
-
-       rightClickEvent = (event.changedTouches)[0];
-
-       holdTimeout = window.setTimeout("doRightClick();", 800);
-
-}
-
-
-
-
-
-function doRightClick() {
-
-       rightClickPending = false;
-
-
-
-       //
-
-       // We need to mouse up (as we were down)
-
-       //
-
-       var first = rightClickEvent,
-
-               simulatedEvent = document.createEvent("MouseEvent");
-
-       simulatedEvent.initMouseEvent("mouseup", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
-
-                       false, false, false, false, 0, null);
-
-       first.target.dispatchEvent(simulatedEvent);
-
-
-
-       //
-
-       // emulate a right click
-
-       //
-
-       simulatedEvent = document.createEvent("MouseEvent");
-
-       simulatedEvent.initMouseEvent("mousedown", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
-
-                       false, false, false, false, 2, null);
-
-       first.target.dispatchEvent(simulatedEvent);
-
-
-
-       //
-
-       // Show a context menu
-
-       //
-
-       simulatedEvent = document.createEvent("MouseEvent");
-
-       simulatedEvent.initMouseEvent("contextmenu", true, true, window, 1, first.screenX + 50, first.screenY + 5, first.clientX + 50, first.clientY + 5,
-
-                                  false, false, false, false, 2, null);
-
-       first.target.dispatchEvent(simulatedEvent);
-
-
-
-
-
-       //
-
-       // Note:: I don't mouse up the right click here however feel free to add if required
-
-       //
-
-
-
-
-
-       //cancelMouseUp = true; // XXXmang this was preventing swipe from working! make sure rest of code is okay with setting this false
-       cancelMouseUp = false;
-
-       rightClickEvent = null; // Release memory
-
-}
-
-
-
-
-
-//
-
-// mouse over event then mouse down
-
-//
-
-function iPadTouchStart(event) {
-
-       var touches = event.changedTouches,
-
-               first = touches[0],
-
-               type = "mouseover",
-
-               simulatedEvent = document.createEvent("MouseEvent");
-
-       //
-
-       // Mouse over first - I have live events attached on mouse over
-
-       //
-
-       simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
-
-                            false, false, false, false, 0, null);
-
-       first.target.dispatchEvent(simulatedEvent);
-
-
-
-       type = "mousedown";
-
-       simulatedEvent = document.createEvent("MouseEvent");
-
-
-
-       simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
-
-                            false, false, false, false, 0, null);
-
-       first.target.dispatchEvent(simulatedEvent);
-
-
-
-
-
-       if (!tapValid) {
-
-               lastTap = first.target;
-
-               tapValid = true;
-
-               tapTimeout = window.setTimeout("cancelTap();", 600);
-
-               startHold(event);
-
-       }
-
-       else {
-
-               window.clearTimeout(tapTimeout);
-
-
-
-               //
-
-               // If a double tap is still a possibility and the elements are the same
-
-               //      Then perform a double click
-
-               //
-
-               if (first.target == lastTap) {
-
-                       lastTap = null;
-
-                       tapValid = false;
-
-
-
-                       type = "click";
-
-                       simulatedEvent = document.createEvent("MouseEvent");
-
-
-
-                       simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
-
-                               false, false, false, false, 0/*left*/, null);
-
-                       first.target.dispatchEvent(simulatedEvent);
-
-
-
-                       type = "dblclick";
-
-                       simulatedEvent = document.createEvent("MouseEvent");
-
-
-
-                       simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
-
-                               false, false, false, false, 0/*left*/, null);
-
-                       first.target.dispatchEvent(simulatedEvent);
-
-               }
-
-               else {
-
-                       lastTap = first.target;
-
-                       tapValid = true;
-
-                       tapTimeout = window.setTimeout("cancelTap();", 600);
-
-                       startHold(event);
-
-               }
-
-       }
-
-}
-
-
-
-function iPadTouchHandler(event) {
-
-       var type = "",
-
-               button = 0; /*left*/
-
-
-
-       if (event.touches.length > 1)
-
-               return;
-
-
-
-       switch (event.type) {
-
-               case "touchstart":
-
-                       if ($(event.changedTouches[0].target).is("select")) {
-
-                               return;
-
-                       }
-
-                       iPadTouchStart(event); /*We need to trigger two events here to support one touch drag and drop*/
-
-                       event.preventDefault();
-
-                       return false;
-
-                       break;
-
-
-
-               case "touchmove":
-
-                       cancelHold();
-
-                       type = "mousemove";
-
-                       event.preventDefault();
-
-                       break;
-
-
-
-               case "touchend":
-
-                       if (cancelMouseUp) {
-
-                               cancelMouseUp = false;
-
-                               event.preventDefault();
-
-                               return false;
-
-                       }
-
-                       cancelHold();
-
-                       type = "mouseup";
-
-                       break;
-
-
-
-               default:
-
-                       return;
-
-       }
-
-
-
-       var touches = event.changedTouches,
-
-               first = touches[0],
-
-               simulatedEvent = document.createEvent("MouseEvent");
-
-
-
-       simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
-
-                            false, false, false, false, button, null);
-
-
-
-       first.target.dispatchEvent(simulatedEvent);
-
-
-
-       if (type == "mouseup" && tapValid && first.target == lastTap) { // This actually emulates the ipads default behaviour (which we prevented)
-
-               simulatedEvent = document.createEvent("MouseEvent");            // This check avoids click being emulated on a double tap
-
-
-
-               simulatedEvent.initMouseEvent("click", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
-
-                            false, false, false, false, button, null);
-
-
-
-               first.target.dispatchEvent(simulatedEvent);
-
-       }
-
-}
-
-
-
-
-
+*/\r
+\r
+\r
+$(function() {\r
+       //\r
+       // Extend jQuery feature detection\r
+       //\r
+       $.extend($.support, {\r
+               touch: typeof Touch == "object"\r
+       });\r
+       \r
+       //\r
+       // Hook up touch events\r
+       //\r
+       if ($.support.touch) {\r
+               document.addEventListener("touchstart", iPadTouchHandler, false);\r
+               document.addEventListener("touchmove", iPadTouchHandler, false);\r
+               document.addEventListener("touchend", iPadTouchHandler, false);\r
+               document.addEventListener("touchcancel", iPadTouchHandler, false);\r
+       }\r
+});\r
+\r
+\r
+var lastTap = null;                    // Holds last tapped element (so we can compare for double tap)\r
+var tapValid = false;                  // Are we still in the .6 second window where a double tap can occur\r
+var tapTimeout = null;                 // The timeout reference\r
+\r
+function cancelTap() {\r
+       tapValid = false;\r
+}\r
+\r
+\r
+var rightClickPending = false; // Is a right click still feasible\r
+var rightClickEvent = null;            // the original event\r
+var holdTimeout = null;                        // timeout reference\r
+var cancelMouseUp = false;             // prevents a click from occuring as we want the context menu\r
+\r
+\r
+function cancelHold() {\r
+       if (rightClickPending) {\r
+               window.clearTimeout(holdTimeout);\r
+               rightClickPending = false;\r
+               rightClickEvent = null;\r
+       }\r
+}\r
+\r
+function startHold(event) {\r
+       if (rightClickPending)\r
+               return;\r
+\r
+       rightClickPending = true; // We could be performing a right click\r
+       rightClickEvent = (event.changedTouches)[0];\r
+       holdTimeout = window.setTimeout("doRightClick();", 800);\r
+}\r
+\r
+\r
+function doRightClick() {\r
+       rightClickPending = false;\r
+\r
+       //\r
+       // We need to mouse up (as we were down)\r
+       //\r
+       var first = rightClickEvent,\r
+               simulatedEvent = document.createEvent("MouseEvent");\r
+       simulatedEvent.initMouseEvent("mouseup", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,\r
+                       false, false, false, false, 0, null);\r
+       first.target.dispatchEvent(simulatedEvent);\r
+\r
+       //\r
+       // emulate a right click\r
+       //\r
+       simulatedEvent = document.createEvent("MouseEvent");\r
+       simulatedEvent.initMouseEvent("mousedown", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,\r
+                       false, false, false, false, 2, null);\r
+       first.target.dispatchEvent(simulatedEvent);\r
+\r
+       //\r
+       // Show a context menu\r
+       //\r
+       simulatedEvent = document.createEvent("MouseEvent");\r
+       simulatedEvent.initMouseEvent("contextmenu", true, true, window, 1, first.screenX + 50, first.screenY + 5, first.clientX + 50, first.clientY + 5,\r
+                                  false, false, false, false, 2, null);\r
+       first.target.dispatchEvent(simulatedEvent);\r
+\r
+\r
+       //\r
+       // Note:: I don't mouse up the right click here however feel free to add if required\r
+       //\r
+\r
+\r
+       cancelMouseUp = true;\r
+       rightClickEvent = null; // Release memory\r
+}\r
+\r
+\r
+//\r
+// mouse over event then mouse down\r
+//\r
+function iPadTouchStart(event) {\r
+       var touches = event.changedTouches,\r
+               first = touches[0],\r
+               type = "mouseover",\r
+               simulatedEvent = document.createEvent("MouseEvent");\r
+       //\r
+       // Mouse over first - I have live events attached on mouse over\r
+       //\r
+       simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,\r
+                            false, false, false, false, 0, null);\r
+       first.target.dispatchEvent(simulatedEvent);\r
+\r
+       type = "mousedown";\r
+       simulatedEvent = document.createEvent("MouseEvent");\r
+\r
+       simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,\r
+                            false, false, false, false, 0, null);\r
+       first.target.dispatchEvent(simulatedEvent);\r
+\r
+\r
+       if (!tapValid) {\r
+               lastTap = first.target;\r
+               tapValid = true;\r
+               tapTimeout = window.setTimeout("cancelTap();", 600);\r
+               startHold(event);\r
+       }\r
+       else {\r
+               window.clearTimeout(tapTimeout);\r
+\r
+               //\r
+               // If a double tap is still a possibility and the elements are the same\r
+               //      Then perform a double click\r
+               //\r
+               if (first.target == lastTap) {\r
+                       lastTap = null;\r
+                       tapValid = false;\r
+\r
+                       type = "click";\r
+                       simulatedEvent = document.createEvent("MouseEvent");\r
+\r
+                       simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,\r
+                               false, false, false, false, 0/*left*/, null);\r
+                       first.target.dispatchEvent(simulatedEvent);\r
+\r
+                       type = "dblclick";\r
+                       simulatedEvent = document.createEvent("MouseEvent");\r
+\r
+                       simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,\r
+                               false, false, false, false, 0/*left*/, null);\r
+                       first.target.dispatchEvent(simulatedEvent);\r
+               }\r
+               else {\r
+                       lastTap = first.target;\r
+                       tapValid = true;\r
+                       tapTimeout = window.setTimeout("cancelTap();", 600);\r
+                       startHold(event);\r
+               }\r
+       }\r
+}\r
+\r
+function iPadTouchHandler(event) {\r
+       var type = "",\r
+               button = 0; /*left*/\r
+\r
+       if (event.touches.length > 1)\r
+               return;\r
+\r
+       switch (event.type) {\r
+               case "touchstart":\r
+                       if ($(event.changedTouches[0].target).is("select")) {\r
+                               return;\r
+                       }\r
+                       iPadTouchStart(event); /*We need to trigger two events here to support one touch drag and drop*/\r
+                       event.preventDefault();\r
+                       return false;\r
+                       break;\r
+\r
+               case "touchmove":\r
+                       cancelHold();\r
+                       type = "mousemove";\r
+                       event.preventDefault();\r
+                       break;\r
+\r
+               case "touchend":\r
+                       if (cancelMouseUp) {\r
+                               cancelMouseUp = false;\r
+                               event.preventDefault();\r
+                               return false;\r
+                       }\r
+                       cancelHold();\r
+                       type = "mouseup";\r
+                       break;\r
+\r
+               default:\r
+                       return;\r
+       }\r
+\r
+       var touches = event.changedTouches,\r
+               first = touches[0],\r
+               simulatedEvent = document.createEvent("MouseEvent");\r
+\r
+       simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,\r
+                            false, false, false, false, button, null);\r
+\r
+       first.target.dispatchEvent(simulatedEvent);\r
+\r
+       if (type == "mouseup" && tapValid && first.target == lastTap) { // This actually emulates the ipads default behaviour (which we prevented)\r
+               simulatedEvent = document.createEvent("MouseEvent");            // This check avoids click being emulated on a double tap\r
+\r
+               simulatedEvent.initMouseEvent("click", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,\r
+                            false, false, false, false, button, null);\r
+\r
+               first.target.dispatchEvent(simulatedEvent);\r
+       }\r
+}\r
+\r
+\r
diff --git a/BookReader/search.html b/BookReader/search.html
new file mode 100644 (file)
index 0000000..866cc35
--- /dev/null
@@ -0,0 +1,52 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
+<html> 
+<head> 
+    <meta name="viewport" content="width=device-width, maximum-scale=1.0" /> 
+    <meta name="apple-mobile-web-app-capable" content="yes" /> 
+    <title>In the wake of the war canoe : a stirring record of forty years' successful labour, peril & adventure amongst the savage Indian tribes of the Pacific coast, and the piratical head-hunting Haidas of the Queen Charlotte Islands, B. C</title> 
+<!--[if lte IE 6]>
+    <meta http-equiv="refresh" content="2; URL=/bookreader/browserunsupported.php?id=wakewarcanoe00collrich">
+<![endif]--> 
+    <link rel="stylesheet" type="text/css" href="BookReader.css"> 
+    <script src="http://www.archive.org/includes/jquery-1.4.2.min.js" type="text/javascript"></script> 
+    <script type="text/javascript" src="jquery-ui-1.8.5.custom.min.js"></script> 
+    <script type="text/javascript" src="dragscrollable.js"></script> 
+    <script type="text/javascript" src="jquery.colorbox-min.js"></script> 
+    <script type="text/javascript" src="jquery.ui.ipad.js"></script> 
+     <!-- THIS ALLOWS BEAUTYTIPS TO WORK ON IE --> 
+        <!--[if lt IE 9]>
+        <script type="text/javascript" src="/includes/excanvas.compiled.js"></script>
+        <![endif]--> 
+    <script type="text/javascript" src="jquery.bt.min.js"></script> 
+    <script type="text/javascript" src="BookReader.js"></script> 
+    <script> 
+        soundManager.debugMode = false;
+        soundManager.url = '/bookreader/soundmanager/swf/';       
+        soundManager.useHTML5Audio = true;
+        soundManager.flashVersion = 9; //flash 8 version of swf is buggy when calling play() on a sound that is still loading
+    </script> 
+</head> 
+<body style="background-color: ##939598;"> 
+<div id="BookReader">Internet Archive BookReader <noscript>requires JavaScript to be enabled.</noscript></div> 
+<script type="text/javascript"> 
+  // Set some config variables -- $$$ NB: Config object format has not been finalized
+  var brConfig = {};
+  brConfig["mode"] = 2;
+</script> 
+<!-- The script included below is dynamically generated JavaScript that includes the book metadata and page image access functions --> 
+<script type="text/javascript" src="http://ia700102.us.archive.org/~testflip/BookReader/BookReaderJSIA.php?id=wakewarcanoe00collrich&itemPath=/7/items/wakewarcanoe00collrich&server=ia700102.us.archive.org&subPrefix=wakewarcanoe00collrich"></script> 
+<script type="text/javascript"> 
+    // $$$ hack to workaround sizing bug when starting in two-up mode
+    $(document).ready(function() {
+        $(window).trigger('resize');
+    });
+    
+    // Usage stats
+    if(window.archive_analytics) { window.archive_analytics.values['bookreader'] = 'open'};
+</script> 
+