More responsive record view.
[pazpar2-moved-to-github.git] / www / demo / search.js
index 76f10a6..c996c1b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: search.js,v 1.12 2007-01-10 11:41:34 sondberg Exp $
+/* $Id: search.js,v 1.15 2007-01-10 12:20:51 sondberg Exp $
  * ---------------------------------------------------
  * Javascript container
  */
@@ -197,6 +197,12 @@ function create_element (name, cdata) {
 }
 
 
+function clear_cell (cell) {
+    while (cell.hasChildNodes())
+        cell.removeChild(cell.firstChild);
+}
+
+
 function show_records()
 {
     if (xshow.readyState != 4)
@@ -205,8 +211,8 @@ function show_records()
     var xml = xshow.responseXML;
     var body = document.getElementById("body");
     var hits = xml.getElementsByTagName("hit");
-    
-    body.innerHTML = '';
+
+    clear_cell(body);
 
     if (!hits[0]) // We should never get here with blocking operations
     {
@@ -329,15 +335,9 @@ function show_termlist()
            if (namen[0])
                 var refine_cell = create_element('a',
                                     namen[0].childNodes[0].nodeValue);
-                refine_cell.setAttribute('href', '#hejsa');
+                refine_cell.setAttribute('href', '#');
                 refine_cell.setAttribute('onclick', 'refine_query(this)');
                 body.appendChild(refine_cell);
-
-                /*
-               body.innerHTML += '<a href="#" onclick="refine_query(this)">' +
-                                  namen[0].childNodes[0].nodeValue +
-                                  '</a>';
-                */
        }
 
        if (clients > 0)
@@ -442,7 +442,6 @@ function start_search()
     xsearch.onreadystatechange=search_started;
     xsearch.open("GET", url);
     xsearch.send(null);
-//    document.getElementById("termlist").innerHTML = '';
     document.getElementById("body").innerHTML = '';
     update_history();
     shown = 0;