summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--content/flickr.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/content/flickr.js b/content/flickr.js
index e09d5f0..545144c 100644
--- a/content/flickr.js
+++ b/content/flickr.js
@@ -113,16 +113,36 @@ Flickr.prototype = {
113 for(var p in pp.sort()) { 113 for(var p in pp.sort()) {
114 var pn = pp[p]; 114 var pn = pp[p];
115 pstr += pn+params[pn]; 115 pstr += pn+params[pn];
116 rv += pn+'='+params[pn]+'&'; 116 rv += pn+'='+params[pn]+'&';
117 } 117 }
118 rv += 'api_sig='+this.api_sig(pstr); 118 rv += 'api_sig='+this.api_sig(pstr);
119 return rv; 119 return rv;
120 }, 120 },
121 api_call_json: function(params,on_success,on_failure) {
122 if(params.auth_token=='default') params.auth_token=this.token;
123 params.format = 'json'; params.nojsoncallback=1;
124 var x = new XMLHttpRequest();
125 x.open("GET",this.api_call_url(params));
126 x.onreadystatechange=function() {
127 if(x.readyState!=4) return false;
128 if(x.status==200) {
129 var rsp=JSON.parse(x.responseText);
130 if(rsp.stat=='ok')
131 on_success && on_success(x,rsp);
132 else
133 on_failure && on_failure(rsp,rsp.stat,rsp.code,rsp.message);
134 }else
135 on_failure && on_failure(x);
136 return true;
137 };
138 x.send(null);
139 return true;
140 },
121 api_call: function(params, on_success, on_failure) { 141 api_call: function(params, on_success, on_failure) {
122 if(params.auth_token == 'default') 142 if(params.auth_token == 'default')
123 params.auth_token = this.token; 143 params.auth_token = this.token;
124 var x = new XMLHttpRequest(); 144 var x = new XMLHttpRequest();
125 x.open("GET",this.api_call_url(params)); 145 x.open("GET",this.api_call_url(params));
126 x.onreadystatechange=function() { 146 x.onreadystatechange=function() {
127 if(x.readyState!=4) return false; 147 if(x.readyState!=4) return false;
128 if(x.status==200) { 148 if(x.status==200) {