Move more global code (protocol-independent link adjusting) out of the team.
authorMike Taylor <mike@indexdata.com>
Tue, 4 Mar 2014 12:20:47 +0000 (12:20 +0000)
committerMike Taylor <mike@indexdata.com>
Tue, 4 Mar 2014 12:20:47 +0000 (12:20 +0000)
tools/htdocs/mkws.js

index b5e9908..163da6a 100644 (file)
@@ -232,12 +232,6 @@ function team($, teamName) {
        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);
-    }
-
     debug("Create main pz2 object");
     // create a parameters array and pass it to the pz2's constructor
     // then register the form submit event with the pz2.search function
@@ -1432,6 +1426,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",