/*
-** $Id: pz2.js,v 1.14 2007-05-16 07:53:32 jakub Exp $
+** $Id: pz2.js,v 1.17 2007-05-18 12:38:48 jakub Exp $
** pz2.js - pazpar2's javascript client library.
*/
__myself.showCounter++;
var delay = __myself.showTime;
if (__myself.showCounter > __myself.showFastCount)
- delay *= 2;
+ //delay *= 2;
+ delay += __myself.showCounter * __myself.dumpFactor;
if (activeClients > 0)
__myself.showTimer = setTimeout("__myself.show()", delay);
}
record['xslDoc'] = __myself.xslDoc;
} else {
for ( i = 0; i < recordNode.childNodes.length; i++) {
- if ( recordNode.childNodes[i].nodeType == Node.ELEMENT_NODE ) {
+ if ( recordNode.childNodes[i].nodeType == Node.ELEMENT_NODE
+ && recordNode.childNodes[i].nodeName != 'location' ) {
var nodeName = recordNode.childNodes[i].nodeName;
var nodeText = recordNode.childNodes[i].firstChild.nodeValue;
record[nodeName] = nodeText;
}
}
- // the location is hard coded
+ // the location might be empty!!
var locationNodes = recordNode.getElementsByTagName("location");
record["location"] = new Array();
for ( i = 0; i < locationNodes.length; i++ ) {
"id": locationNodes[i].getAttribute("id"),
"name": locationNodes[i].getAttribute("name")
};
+
for ( j = 0; j < locationNodes[i].childNodes.length; j++) {
if ( locationNodes[i].childNodes[j].nodeType == Node.ELEMENT_NODE ) {
var nodeName = locationNodes[i].childNodes[j].nodeName;
- var nodeText;
+ var nodeText = '';
if (locationNodes[i].childNodes[j].firstChild)
nodeText = locationNodes[i].childNodes[j].firstChild.nodeValue;
- else
- nodeText = '';
record["location"][i][nodeName] = nodeText;
}
}
{
this.callback = callback;
+ var getUrl = this.url;
var paramArr = new Array();
+
for ( var key in params ) {
paramArr.push(key + '=' + escape(params[key]));
}
+ if ( paramArr.length )
+ getUrl += '?' + paramArr.join('&');
+
var context = this;
- this.request.open( 'GET', this.url+'?'+paramArr.join('&'), true );
+ this.request.open( 'GET', getUrl, true );
this.request.onreadystatechange = function () {
context._handleResponse();
}
- this.request.send();
+ this.request.send(null);
},
_handleResponse: function ()