socialbox: limit history to 50 elements to reduce long term browser memory usage; webbuild: debugging console messages improvements

This commit is contained in:
Silvan Calarco 2021-08-02 09:51:34 +02:00
parent 09448ed3dd
commit ba336825f1
2 changed files with 12 additions and 3 deletions

View File

@ -97,8 +97,13 @@ function ajax_getvalues_refresh(request,user,user_email,secret) {
var nodes = xmldoc.getElementsByTagName("socialbox")[0].childNodes;
for (var i = 0; i < nodes.length; i++) {
var id = nodes[i].attributes[0].value;
$("<span name=social sid=\""+ id + "\">" + nodes[i].childNodes[0].nodeValue + "</span>")
.clone().hide().prependTo("#socialbox").slideDown();
$("<span name=social sid=\""+ id + "\">" + nodes[i].childNodes[0].nodeValue + "</span>")
.clone().hide().prependTo("#socialbox").slideDown();
}
if (nodes.length > 0) {
var span_nodes = $("#socialbox").children("span").each(function(idx, el) {
if (idx >= 50) el.remove(); // keep a maximum of 50 elements
});
}
}
if (xmldoc.getElementsByTagName("processes")[0] != undefined) {

View File

@ -74,7 +74,11 @@ function ajax_getvalues(request,confirm) {
if (o.xmlhttp.responseXML == undefined) {
// && xmlhttp.responseText == undefined) {
document.getElementById("status").innerHTML = "";
document.getElementById("output").innerHTML = "<br>ERROR: there was a network connection problem.";
var errormsg = "<div id=\"outputbottom\" class=\"outputbox\"><pre>";
errormsg += "ERROR: there was an error in the network connection or in the format of the XML response.";
errormsg += "</pre></div>";
document.getElementById("output").innerHTML = errormsg;
console.error(o.xmlhttp.responseText);
o.xmlhttp.abort();
return;
}