Skip to content

Commit

Permalink
Merged changes upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
scollett committed Mar 9, 2010
1 parent cc12eda commit dfb5a3a
Show file tree
Hide file tree
Showing 14 changed files with 887 additions and 210 deletions.
6 changes: 3 additions & 3 deletions BookReader/BookReader.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ a.BRicon {
vertical-align: middle;
}

a.BRwhite { color: #fff }
a.BRwhite:hover { text-decoration: none; }
a.BRwhite:visited { color: #fff }
a.BRwhite { color: #fff }
a.BRwhite:hover { text-decoration: none; }
a.BRwhite:visited { color: #fff }

a.BRblack { color: #000000 }
a.BRblack:hover { text-decoration: none; }
Expand Down
40 changes: 30 additions & 10 deletions BookReader/BookReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ function BookReader() {
this.ui = 'full'; // UI mode
this.thumbWidth = 100;
this.thumbRowBuffer = 3; // number of rows to pre-cache out a view

this.displayedIndices = [];
this.displayedRows=[];
this.displayedIndices = [];
//this.indicesToDisplay = [];
this.imgs = {};
this.prefetchedImgs = {}; //an object with numeric keys cooresponding to page index
Expand Down Expand Up @@ -2379,13 +2378,13 @@ BookReader.prototype.search = function(term) {
term = term.replace(/\//g, ' '); // strip slashes
this.searchTerm = term;
$('#BookReaderSearchScript').remove();
var script = document.createElement("script");
script.setAttribute('id', 'BookReaderSearchScript');
script.setAttribute("type", "text/javascript");
script.setAttribute("src", 'http://'+this.server+'/BookReader/flipbook_search_br.php?url='+escape(this.bookPath + '_djvu.xml')+'&term='+term+'&format=XML&callback=br.BRSearchCallback');
document.getElementsByTagName('head')[0].appendChild(script);
$('#BookReaderSearchBox').val(term);
$('#BookReaderSearchResults').html('Searching...');
var script = document.createElement("script");
script.setAttribute('id', 'BookReaderSearchScript');
script.setAttribute("type", "text/javascript");
script.setAttribute("src", 'http://'+this.server+'/BookReader/flipbook_search_br.php?url='+escape(this.bookPath + '_djvu.xml')+'&term='+term+'&format=XML&callback=br.BRSearchCallback');
document.getElementsByTagName('head')[0].appendChild(script);
$('#BookReaderSearchBox').val(term);
$('#BookReaderSearchResults').html('Searching...');
}

// BRSearchCallback()
Expand Down Expand Up @@ -2457,7 +2456,7 @@ BookReader.prototype.BRSearchCallback = function(txt) {
$('#BookReaderSearchResults').append('</ul>');

// $$$ update again for case of loading search URL in new browser window (search box may not have been ready yet)
$('#BookReaderSearchBox').val(this.searchTerm);
$('#BookReaderSearchBox').val(this.searchTerm);

this.updateSearchHilites();
}
Expand Down Expand Up @@ -3603,6 +3602,27 @@ BookReader.prototype._getPageURI = function(index, reduce, rotate) {
return this.imagesBaseURL + "/transparent.png";
}

if ('undefined' == typeof(reduce)) {
// reduce not passed in
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) {
scale = 1;
} else if (ratio < 4) {
scale = 2;
} else if (ratio < 8) {
scale = 4;
} else if (ratio < 16) {
scale = 8;
} else if (ratio < 32) {
scale = 16;
} else {
scale = 32;
}
reduce = scale;
}

return this.getPageURI(index, reduce, rotate);
}

Expand Down
6 changes: 6 additions & 0 deletions BookReaderIA/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test:
@ echo Made tests




Loading

0 comments on commit dfb5a3a

Please sign in to comment.