Reorder and clarify comments.
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index 6695373..41ad849 100644 (file)
@@ -6,23 +6,22 @@
 // Set up namespace and some state.
 var mkws = {};
 
-if (!mkws_config)
-    var mkws_config = {}; // for the guys who forgot to define mkws_config...
-
-// Wrapper for jQuery
-(function ($) {
-
 /*
  * global config object: mkws_config
  *
- * needs to be defined in the HTML header before
- * including this JS file
+ * Needs to be defined in the HTML header before including this JS file.
+ * Define empty mkws_config for simple applications that don't define it.
  */
+if (!mkws_config)
+    var mkws_config = {};
+
+// Wrapper for jQuery
+(function ($) {
 
 if (typeof mkws_config.use_service_proxy === 'undefined')
     mkws_config.use_service_proxy = true;
 
-var pazpar2_url = mkws_config.pazpar2_url ? mkws_config.pazpar2_url : "http://mkws.indexdata.com/service-proxy/";
+var pazpar2_url = mkws_config.pazpar2_url || "http://mkws.indexdata.com/service-proxy/";
 
 mkws.pazpar2path = pazpar2_url;
 mkws.usesessions = mkws_config.use_service_proxy ? false : true;
@@ -172,7 +171,6 @@ function my_onshow(data) {
     for (var i = 0; i < data.hits.length; i++) {
         var hit = data.hits[i];
              html.push('<div class="record" id="mkwsRecdiv_'+hit.recid+'" >'
-            +'<span>'+ (i + 1 + recPerPage * (curPage - 1)) +'. </span>'
             +'<a href="#" id="mkwsRec_'+hit.recid
             +'" onclick="mkws.showDetails(this.id);return false;"><b>'
             + hit["md-title"] +' </b></a>');
@@ -655,7 +653,7 @@ function mkws_html_all() {
        $("#mkwsRanking").html(ranking_data);
     }
 
-    mkws_html_switch(mkws_config);
+    mkws_html_switch();
 
     if (mkws_config.use_service_proxy)
        mkws_service_proxy_auth(mkws_config.service_proxy_auth);
@@ -693,7 +691,7 @@ function mkws_set_lang()  {
     return mkws_config.lang;
 }
 
-function mkws_html_switch(config) {
+function mkws_html_switch() {
     debug("HTML switch");
 
     $("#mkwsSwitch").append($('<a href="#" id="mkwsSwitch_records" onclick="mkws.switchView(\'records\')">' + M('Records') + '</a>'));