// wrapper to provide local copy of the jQuery object.
(function($) {
var log = mkws.log;
+ var _old2new = { // Maps old-style widget names to new-style
+ 'Authname': 'auth-name',
+ 'ConsoleBuilder': 'console-builder',
+ 'Coverart': 'cover-art',
+ 'GoogleImage': 'google-image',
+ 'MOTD': 'motd',
+ 'MOTDContainer': 'motd-container',
+ 'Perpage': 'per-page',
+ 'SearchForm': 'search-form',
+ };
+ // Annoyingly, there is no built-in way to invert a hash
+ var _new2old = {};
+ for (var key in _old2new) {
+ if(_old2new.hasOwnProperty(key)) {
+ _new2old[_old2new[key]] = key;
+ }
+ }
-
function handleNodeWithTeam(node, callback) {
// First branch for DOM objects; second branch for jQuery objects
var classes = node.className || node.attr('class');
for (var i = 0; i < list.length; i++) {
var cname = list[i];
- if (cname.match(/^mkws-team-/)) {
- teamName = cname.replace(/^mkws-team-/, '');
- } else if (cname.match(/^mkws-/)) {
- // New-style names of the form mkws-foo-bar
- type = cname.replace(/^mkws-/, '');
+ if (cname.match(/^mkwsTeam_/)) {
+ teamName = cname.replace(/^mkwsTeam_/, '');
} else if (cname.match(/^mkws/)) {
- type = cname.replace(/^mkws/, '');
+ // Old-style names of the form mkwsFooBar
+ var tmp = cname.replace(/^mkws/, '');
+ type = _old2new[tmp] || tmp.toLowerCase();
}
}