diff options
author | Azul <azul@riseup.net> | 2012-08-21 18:07:36 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2012-08-21 18:07:36 +0200 |
commit | d6a78049f3356d9d645143362eca74434410bf62 (patch) | |
tree | d245ba256bf48267ed2f1b5c5f4c8739d6c98b5a /src/plainXHR.js | |
parent | 0461d76899379cb1e2ecd15456d2e6eb4fb8fa60 (diff) |
first round of making jslint happy
Diffstat (limited to 'src/plainXHR.js')
-rw-r--r-- | src/plainXHR.js | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/plainXHR.js b/src/plainXHR.js index d07416b..c03c90a 100644 --- a/src/plainXHR.js +++ b/src/plainXHR.js @@ -13,8 +13,9 @@ SRP.prototype.Remote = function() { // Calling back the specified function. function ajaxRequest(url, params, callback) { - if( window.XMLHttpRequest) + if( window.XMLHttpRequest) { xhr = new XMLHttpRequest(); + } else if (window.ActiveXObject){ try{ xhr = new ActiveXObject("Microsoft.XMLHTTP"); @@ -40,7 +41,7 @@ SRP.prototype.Remote = function() { { session.error_message("Ajax failed."); } - }; + } function parseResponse() { if (responseIsXML()) { @@ -48,16 +49,16 @@ SRP.prototype.Remote = function() { } else if (responseIsJSON()) { return JSON.parse(xhr.responseText); } - }; + } function responseIsXML() { return (xhr.responseType == 'document') || - (xhr.getResponseHeader("Content-Type").indexOf('application/xml') >= 0) + (xhr.getResponseHeader("Content-Type").indexOf('application/xml') >= 0); } function responseIsJSON() { return (xhr.responseType == 'json') || - (xhr.getResponseHeader("Content-Type").indexOf('application/json') >= 0) + (xhr.getResponseHeader("Content-Type").indexOf('application/json') >= 0); } function parseXML(xml) { @@ -66,7 +67,7 @@ SRP.prototype.Remote = function() { } else { return parseNodes(xml.childNodes); } - }; + } function parseAttributesOfElement(elem) { var response = {}; @@ -77,7 +78,7 @@ SRP.prototype.Remote = function() { } } return response; - }; + } function parseNodes(nodes) { var response = {}; @@ -86,35 +87,34 @@ SRP.prototype.Remote = function() { response[node.tagName] = node.textContent || true; } return response; - }; + } // Drupal version fetches the salt from the server. No idea why but this // should still do it. this.register = function(session, callback) { - var that = this; - ajaxRequest("register/salt/", "I="+session.getI(), receive_salt); - - function receive_salt(response) - { + function receive_salt(response) { if(response.salt) { var s = response.salt; var v = session.getV(s); that.sendVerifier(session, callback); } - }; - } + } + + var that = this; + ajaxRequest("register/salt/", "I="+session.getI(), receive_salt); + }; this.sendVerifier = function(session, callback) { ajaxRequest("register/user/", "v="+session.getV().toString(16), callback); - } + }; this.handshake = function(session, callback) { ajaxRequest("handshake/", "I="+session.getI()+"&A="+session.getAstr(), callback); - } + }; this.authenticate = function(session, callback) { ajaxRequest("authenticate/", "M="+session.getM(), callback); - } -} + }; +}; |