Rename all the det_* IDs as mkwsDet_*
[mkws-moved-to-github.git] / experiments / spclient / mkws.js
index 105c702..f182558 100644 (file)
@@ -113,7 +113,7 @@ function my_oninit() {
 function my_onshow(data) {
     totalRec = data.merged;
     // move it out
-    var pager = document.getElementById("pager");
+    var pager = document.getElementById("mkwsPager");
     pager.innerHTML = "";
     pager.innerHTML +='<hr/><div style="float: right">' + M('Displaying') + ': '
                     + (data.start + 1) + ' ' + M('to') + ' ' + (data.start + data.num) +
@@ -121,7 +121,7 @@ function my_onshow(data) {
                      + data.total + ')</div>';
     drawPager(pager);
     // navi
-    var results = document.getElementById("results");
+    var results = document.getElementById("mkwsResults");
 
     var html = [];
     for (var i = 0; i < data.hits.length; i++) {
@@ -160,31 +160,31 @@ function my_onstat(data) {
 function my_onterm(data) {
     // no facets
     if (!mkws_config.facets || mkws_config.facets.length == 0) {
-       $("#termlist").parent().hide();
+       $("#mkwsTermlists").parent().hide();
        return;
     }
 
     // display if we first got results
-    $("#termlist").parent().show();
+    $("#mkwsTermlists").parent().show();
 
-    var termlists = [];
-    termlists.push('<div class="title">' + M('Termlists') + '</div>');
+    var acc = [];
+    acc.push('<div class="title">' + M('Termlists') + '</div>');
     var facets = mkws_config.facets;
 
     for(var i = 0; i < facets.length; i++) {
        if (facets[i] == "sources") {
-           add_single_facet(termlists, "Sources",  data.xtargets, SourceMax, null);
+           add_single_facet(acc, "Sources",  data.xtargets, SourceMax, null);
        } else if (facets[i] == "subjects") {
-           add_single_facet(termlists, "Subjects", data.subject,  SubjectMax, "su");
+           add_single_facet(acc, "Subjects", data.subject,  SubjectMax, "su");
        } else if (facets[i] == "authors") {
-           add_single_facet(termlists, "Authors",  data.author,   AuthorMax, "au");
+           add_single_facet(acc, "Authors",  data.author,   AuthorMax, "au");
        } else {
            alert("bad facet configuration: '" + facets[i] + "'");
        }
     }
 
-    var termlist = document.getElementById("termlist");
-    replaceHtml(termlist, termlists.join(''));
+    var termlist = document.getElementById("mkwsTermlists");
+    replaceHtml(termlist, acc.join(''));
 }
 
 function add_single_facet(acc, caption, data, max, cclIndex) {
@@ -210,7 +210,7 @@ function my_onrecord(data) {
     // FIXME: record is async!!
     clearTimeout(my_paz.recordTimer);
     // in case on_show was faster to redraw element
-    var detRecordDiv = document.getElementById('det_'+data.recid);
+    var detRecordDiv = document.getElementById('mkwsDet_'+data.recid);
     if (detRecordDiv) return;
     curDetRecData = data;
     var recordDiv = document.getElementById('recdiv_'+curDetRecData.recid);
@@ -219,7 +219,7 @@ function my_onrecord(data) {
 }
 
 function my_onbytarget(data) {
-    var targetDiv = document.getElementById("bytarget");
+    var targetDiv = document.getElementById("mkwsBytarget");
     var table ='<table><thead><tr><td>Target ID</td><td>Hits</td><td>Diags</td>'
         +'<td>Records</td><td>State</td></tr></thead><tbody>';
 
@@ -294,7 +294,7 @@ function limitQuery (field, value)
 // limit by target functions
 function limitTarget (id, name)
 {
-    var navi = document.getElementById('navi');
+    var navi = document.getElementById('mkwsNavi');
     navi.innerHTML =
         'Source: <a class="crossout" href="#" onclick="delimitTarget();return false;">'
         + name + '</a>';
@@ -308,7 +308,7 @@ function limitTarget (id, name)
 
 function delimitTarget ()
 {
-    var navi = document.getElementById('navi');
+    var navi = document.getElementById('mkwsNavi');
     navi.innerHTML = '';
     curFilter = null;
     resetPage();
@@ -419,7 +419,7 @@ function showDetails (prefixRecId) {
     curDetRecId = recId;
 
     // remove current detailed view if any
-    var detRecordDiv = document.getElementById('det_'+oldRecId);
+    var detRecordDiv = document.getElementById('mkwsDet_'+oldRecId);
     // lovin DOM!
     if (detRecordDiv)
       detRecordDiv.parentNode.removeChild(detRecordDiv);
@@ -450,7 +450,7 @@ function replaceHtml(el, html) {
 
 function renderDetails(data, marker)
 {
-    var details = '<div class="details" id="det_'+data.recid+'"><table>';
+    var details = '<div class="details" id="mkwsDet_'+data.recid+'"><table>';
     if (marker) details += '<tr><td>'+ marker + '</td></tr>';
 
     details += renderField("Title", data["md-title"], data["md-title-remainder"], data["md-title-responsibility"]);
@@ -545,7 +545,7 @@ function mkws_html_all(config) {
       <table width="100%" border="0" cellpadding="6" cellspacing="0">\
         <tr>\
           <td width="250" valign="top">\
-            <div id="termlist"></div>\
+            <div id="mkwsTermlists"></div>\
           </td>\
           <td valign="top">\
             <div id="ranking">\
@@ -555,9 +555,9 @@ function mkws_html_all(config) {
         ' + M('per page') + '.\
        </form>\
             </div>\
-            <div id="pager"></div>\
-            <div id="navi"></div>\
-            <div id="results"></div>\
+            <div id="mkwsPager"></div>\
+            <div id="mkwsNavi"></div>\
+            <div id="mkwsResults"></div>\
           </td>\
         </tr>\
       </table>');
@@ -573,7 +573,7 @@ function mkws_html_all(config) {
     domReady();
 
     // on first page, hide the termlist
-    $(document).ready(function() { $("#termlist").parent().hide(); } );
+    $(document).ready(function() { $("#mkwsTermlists").parent().hide(); } );
 }
 
 /* Responsive web design - change layout on the fly depending on
@@ -621,7 +621,7 @@ function mkws_html_switch(config) {
 
     debug("HTML targets");
     $("#mkwsTargets").html('\
-      <div id="bytarget">\
+      <div id="mkwsBytarget">\
        No information available yet.\
       </div>');
     $("#mkwsTargets").css("display", "none");
@@ -747,15 +747,15 @@ function mkws_mobile_resize () {
            $("#" + list[i]).hide();
        }
 
-       $("#termlist").parent().hide();
-       obj = $("#termlist").parent().html();
-        $("#mkwsTermlist").html("<hr/>" + obj);
+       $("#mkwsTermlists").parent().hide();
+       obj = $("#mkwsTermlists").parent().html();
+        $("#mkwsShiftedTermlists").html("<hr/>" + obj);
     } else {
        for(var i = 0; i < list.length; i++) {
            $("#" + list[i]).show();
        }
-       $("#termlist").parent().show();
-       $("#mkwsTermlist").html("");
+       $("#mkwsTermlists").parent().show();
+       $("#mkwsShiftedTermlists").html("");
     }
 };