Rename variable.
[mkws-moved-to-github.git] / experiments / spclient / mkws.js
index 5dfe32e..45c6b28 100644 (file)
@@ -167,21 +167,24 @@ function my_onterm(data) {
     // display if we first got results
     $("#termlist").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);
-       if (facets[i] == "subjects")
-           add_single_facet(termlists, "Subjects", data.subject,  SubjectMax, "su");
-       if (facets[i] == "authors")
-           add_single_facet(termlists, "Authors",  data.author,   AuthorMax, "au");
+       if (facets[i] == "sources") {
+           add_single_facet(acc, "Sources",  data.xtargets, SourceMax, null);
+       } else if (facets[i] == "subjects") {
+           add_single_facet(acc, "Subjects", data.subject,  SubjectMax, "su");
+       } else if (facets[i] == "authors") {
+           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(''));
+    replaceHtml(termlist, acc.join(''));
 }
 
 function add_single_facet(acc, caption, data, max, cclIndex) {
@@ -734,26 +737,26 @@ function mkws_html_lang(mkws_config) {
 }
 
 function mkws_mobile_resize () {
-   debug("resize width: " + $(window).height() + ", width: " + $(window).width());
-   var list = ["mkwsSwitch"];
-   var obj;
-   // alert($(window).width());
+    debug("resize width: " + $(window).height() + ", width: " + $(window).width());
+    var list = ["mkwsSwitch"];
+    var obj;
+    // alert($(window).width());
 
-   if ($(window).width() <= 980) {
+    if ($(window).width() <= 980) {
        for(var i = 0; i < list.length; i++) {
            $("#" + list[i]).hide();
        }
 
        $("#termlist").parent().hide();
        obj = $("#termlist").parent().html();
-       $("#mkwsTermlist").html("<hr/>" + obj);
-   } else {
+        $("#mkwsTermlist").html("<hr/>" + obj);
+    } else {
        for(var i = 0; i < list.length; i++) {
            $("#" + list[i]).show();
        }
        $("#termlist").parent().show();
        $("#mkwsTermlist").html("");
-   }
+    }
 };
 
 /* locale */