summaryrefslogtreecommitdiff
path: root/src/jqueryRest.js
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2012-11-14 12:28:57 +0100
committerAzul <azul@riseup.net>2012-11-14 12:33:31 +0100
commit2859af0287d7672df0a8965be43fb9859fca8bf8 (patch)
tree4be112443f48a29763b6adae5f68d521022dcc55 /src/jqueryRest.js
parent7b73cbd591aa9ac3f46400c040ae14ec26e2d839 (diff)
parent47c7a78e948f139074ec8d975cdd38cc3335253d (diff)
Merge branch 'feature/cleanup-non-restful' into develop
Diffstat (limited to 'src/jqueryRest.js')
-rw-r--r--src/jqueryRest.js46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/jqueryRest.js b/src/jqueryRest.js
index 133e3fd..54a0908 100644
--- a/src/jqueryRest.js
+++ b/src/jqueryRest.js
@@ -1,51 +1,5 @@
jqueryRest = function() {
- function parseResponse() {
- if (responseIsXML()) {
- return parseXML(xhr.responseXML);
- } else if (responseIsJSON()) {
- return JSON.parse(xhr.responseText);
- }
- }
-
- function responseIsXML() {
- return (xhr.responseType == 'document') ||
- (xhr.getResponseHeader("Content-Type").indexOf('application/xml') >= 0);
- }
-
- function responseIsJSON() {
- return (xhr.responseType == 'json') ||
- (xhr.getResponseHeader("Content-Type").indexOf('application/json') >= 0);
- }
-
- function parseXML(xml) {
- if (xml.getElementsByTagName("r").length > 0) {
- return parseAttributesOfElement(xml.getElementsByTagName("r")[0]);
- } else {
- return parseNodes(xml.childNodes);
- }
- }
-
- function parseAttributesOfElement(elem) {
- var response = {};
- for (var i = 0; i < elem.attributes.length; i++) {
- var attrib = elem.attributes[i];
- if (attrib.specified) {
- response[attrib.name] = attrib.value;
- }
- }
- return response;
- }
-
- function parseNodes(nodes) {
- var response = {};
- for (var i = 0; i < nodes.length; i++) {
- var node = nodes[i];
- response[node.tagName] = node.textContent || true;
- }
- return response;
- }
-
// we do not fetch the salt from the server
function register(session, callback)
{