Compatibility: set new magic classes into elements with old magic IDs.
authorMike Taylor <mike@indexdata.com>
Thu, 23 Jan 2014 23:56:50 +0000 (23:56 +0000)
committerMike Taylor <mike@indexdata.com>
Thu, 23 Jan 2014 23:56:50 +0000 (23:56 +0000)
tools/htdocs/mkws.js

index 41ecb4b..ae6740b 100644 (file)
@@ -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");