Fix indentation for making pz2 object.
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index 41ecb4b..bfda71a 100644 (file)
@@ -265,17 +265,17 @@ function _make_mkws_team($, teamName) {
     // create a parameters array and pass it to the pz2's constructor
     // then register the form submit event with the pz2.search function
     // autoInit is set to true on default
-    mkws.paz = new pz2( { "onshow": my_onshow,
-                          "showtime": 500,            //each timer (show, stat, term, bytarget) can be specified this way
-                          "pazpar2path": mkws_config.pazpar2_url,
-                          "oninit": my_oninit,
-                          "onstat": my_onstat,
-                          "onterm": my_onterm,
-                          "termlist": "xtargets,subject,author",
-                          "onbytarget": my_onbytarget,
-                          "usesessions" : mkws_config.use_service_proxy ? false : true,
-                          "showResponseType": '', // or "json" (for debugging?)
-                          "onrecord": my_onrecord } );
+    mkws.paz = new pz2({ "onshow": my_onshow,
+                        "showtime": 500,            //each timer (show, stat, term, bytarget) can be specified this way
+                        "pazpar2path": mkws_config.pazpar2_url,
+                        "oninit": my_oninit,
+                        "onstat": my_onstat,
+                        "onterm": my_onterm,
+                        "termlist": "xtargets,subject,author",
+                        "onbytarget": my_onbytarget,
+                        "usesessions" : mkws_config.use_service_proxy ? false : true,
+                        "showResponseType": '', // or "json" (for debugging?)
+                        "onrecord": my_onrecord } );
 
     if (!isNaN(parseInt(mkws_config.perpage_default))) {
        m_recPerPage = parseInt(mkws_config.perpage_default);
@@ -1401,6 +1401,21 @@ function _mkws_jquery_plugin ($) {
 
     $(document).ready(function() {
        log("on load ready");
+
+       // Backwards compatibility: set new magic class names on any
+       // elements that have the old magic IDs.
+       var ids = [ "Switch", "Lang", "Search", "Pager", "Navi",
+                   "Results", "Records", "Targets", "Ranking",
+                   "Termlists", "Stat" ];
+       for (var i = 0; i < ids.length; i++) {
+           var id = 'mkws' + ids[i];
+           var node = $('#' + id);
+           if (node.attr('id')) {
+               node.addClass(id + " mkwsTeam_AUTO");
+               log("added magic classes to '" + node.attr('id') + "'");
+           }
+       }
+
        // Backwards compatibility: the special-case undefined team
        mkws.teams[''] = _make_mkws_team(j, undefined);
        log("Made the unnamed MKWS team");
@@ -1428,6 +1443,5 @@ function _mkws_jquery_plugin ($) {
                log("Made MKWS team '" + tname + "'");
            }
        });
-       
     });
 })(jQuery);