$subPrefix = $_REQUEST['subPrefix'];
$server = $_REQUEST['server'];
+// $$$mang this code has been refactored into BookReaderMeta.inc.php for use e.g. by
+// BookReaderPreview.php and BookReaderImages.php. The code below should be
+// taken out and replaced by calls into BookReaderMeta
+
// Check if we're on a dev vhost and point to JSIA in the user's public_html on the datanode
+
// $$$ TODO consolidate this logic
if (strpos($_SERVER["REQUEST_URI"], "/~mang") === 0) { // Serving out of home dir
$server .= ':80/~mang';
+} else if (strpos($_SERVER["REQUEST_URI"], "/~rkumar") === 0) { // Serving out of home dir
+ $server .= ':80/~rkumar';
} else if (strpos($_SERVER["REQUEST_URI"], "/~testflip") === 0) { // Serving out of home dir
$server .= ':80/~testflip';
}
return "<iframe src='" + this.getEmbedURL() + "' width='480px' height='430px'></iframe>";
}
+// getOpenLibraryRecord
+br.getOpenLibraryRecord = function(callback) {
+ // Try looking up by ocaid first, then by source_record
+
+ var jsonURL = 'http://openlibrary.org/query.json?type=/type/edition&*=&ocaid=' + br.bookId;
+ $.ajax({
+ url: jsonURL,
+ success: function(data) {
+ if (data && data.length > 0) {
+ callback(br, data[0]);
+ } else {
+ // try sourceid
+ jsonURL = 'http://openlibrary.org/query.json?type=/type/edition&*=&source_records=ia:' + br.bookId;
+ $.ajax({
+ url: jsonURL,
+ success: function(data) {
+ if (data && data.length > 0) {
+ callback(br, data[0]);
+ }
+ },
+ dataType: 'jsonp'
+ });
+ }
+ },
+ dataType: 'jsonp'
+ });
+}
+
br.pageW = [
<?
$i=0;