Simplify configuration and make more consistent.
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index b5e9908..a15bfcd 100644 (file)
@@ -226,17 +226,7 @@ function team($, teamName) {
     debug("start running MKWS");
 
     m_sort = mkws_config.sort_default;
-    debug("copied mkws_config.sort_default '" + mkws_config.sort_default + "' to m_sort");
-
-    if (!isNaN(parseInt(mkws_config.perpage_default))) {
-       m_perpage = parseInt(mkws_config.perpage_default);
-    }
-
-    // protocol independent link for pazpar2: "//mkws/sp" -> "https://mkws/sp"
-    if (mkws_config.pazpar2_url.match(/^\/\//)) {
-       mkws_config.pazpar2_url = document.location.protocol + mkws_config.pazpar2_url;
-       debug("adjust protocol independent links: " + mkws_config.pazpar2_url);
-    }
+    m_perpage = mkws_config.perpage_default;
 
     debug("Create main pz2 object");
     // create a parameters array and pass it to the pz2's constructor
@@ -1432,6 +1422,12 @@ function team($, teamName) {
            $(document).ready(function() { mkws.resizePage() });
        }
 
+       // protocol independent link for pazpar2: "//mkws/sp" -> "https://mkws/sp"
+       if (mkws_config.pazpar2_url.match(/^\/\//)) {
+           mkws_config.pazpar2_url = document.location.protocol + mkws_config.pazpar2_url;
+           debug("adjust protocol independent links: " + mkws_config.pazpar2_url);
+       }
+
        // Backwards compatibility: set new magic class names on any
        // elements that have the old magic IDs.
        var ids = [ "Switch", "Lang", "Search", "Pager", "Navi",