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;
function OLAuth() {
- this.authUrl = 'http://home.us.archive.org/~rkumar/olauth.php?id=' + br.bookId;
+ this.authUrl = 'http://openlibrary.org/ia_auth/' + br.bookId;
return this;
}
htmlStr += '<p>Please wait...</p>';
this.showPopup("#ddd", "#000", htmlStr);
- $.ajax({url:this.authUrl, dataType:'jsonp', jsonpCallback:'initCallback'});
+ $.ajax({url:this.authUrl, dataType:'jsonp', jsonpCallback:'olAuth.initCallback'});
}
OLAuth.prototype.showPopup = function(bgColor, textColor, msg) {
OLAuth.prototype.startPolling = function () {
var self = this;
this.poller=setInterval(function(){
- $.ajax({url:self.authUrl, dataType:'jsonp', jsonpCallback:'callback'});
+ $.ajax({url:self.authUrl, dataType:'jsonp', jsonpCallback:'olAuth.callback'});
},300000);
}