X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=BookReaderIA%2Fdatanode%2FBookReaderJSIA.php;h=016e988a581c37273ee841f3347a29d070656c59;hb=16035a78509d0ec1d023dd92ea90d45e69f7748e;hp=4d914e2ad74e796c10d40757e66559ee1c1584ed;hpb=c3e4e27fc6b55977153ad3c50645eae3f8216ec2;p=bookreader.git
diff --git a/BookReaderIA/datanode/BookReaderJSIA.php b/BookReaderIA/datanode/BookReaderJSIA.php
index 4d914e2..016e988 100644
--- a/BookReaderIA/datanode/BookReaderJSIA.php
+++ b/BookReaderIA/datanode/BookReaderJSIA.php
@@ -358,6 +358,52 @@ br.getOpenLibraryRecord = function(callback) {
});
}
+// getInfoDiv
+br.getInfoDiv = function() {
+ // $$$ it might make more sense to have a URL on openlibrary.org that returns this info
+
+ var escapedTitle = BookReader.util.escapeHTML(this.bookTitle);
+ var domainRe = /(\w+\.(com|org))/;
+ var domain = domainRe.exec(this.bookUrl)[1];
+ // XXX use different icon for archive.org
+ var html = [
+ '
',
+ '
',
+ '
',
+ '',
+ '',
+ ''
+ ];
+
+ return html.join('\n');
+}
+
br.pageW = [
$i=0;
@@ -489,6 +535,7 @@ if (typeof(brConfig) != 'undefined') {
function OLAuth() {
this.authUrl = 'http://openlibrary.org/ia_auth/' + br.bookId;
+ this.olConnect = false;
return this;
}
@@ -531,6 +578,7 @@ OLAuth.prototype.initCallback = function(obj) {
//user is authenticated
this.setCookie(obj.token);
+ this.olConnect = true;
this.startPolling();
br.init();
}
@@ -541,6 +589,7 @@ OLAuth.prototype.callback = function(obj) {
clearInterval(this.poller);
this.ttsPoller = null;
} else {
+ this.olConnect = true;
this.setCookie(obj.token);
}
}
@@ -558,7 +607,15 @@ OLAuth.prototype.setCookie = function(value) {
OLAuth.prototype.startPolling = function () {
var self = this;
this.poller=setInterval(function(){
- $.ajax({url:self.authUrl, dataType:'jsonp', jsonpCallback:'olAuth.callback'});
+ if (!self.olConnect) {
+ self.showPopup("#f00", "#fff", 'Cound not connect to Open Library for authentication. Please check to see if you are still connected to the Internet, and then reload this web page.');
+ clearInterval(self.poller);
+ self.ttsPoller = null;
+ } else {
+ self.olConnect = false;
+ //be sure to add random param to authUrl to avoid stale cache
+ $.ajax({url:self.authUrl+'?rand='+Math.random(), dataType:'jsonp', jsonpCallback:'olAuth.callback'});
+ }
},300000);
}