'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
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/)) {
// Old-style names of the form mkwsFooBar
var tmp = cname.replace(/^mkws/, '');
- type = _old2new[tmp] || tmp;
+ type = _old2new[tmp] || tmp.toLowerCase();
}
}
for (var tname in mkws.teams) {
var team = mkws.teams[tname];
team.visitWidgets(function(t, w) {
- var w1 = team.widget(t + "-container-" + from);
- var w2 = team.widget(t + "-container-" + to);
+ var w1 = team.widget(t + "-Container-" + from);
+ var w2 = team.widget(t + "-Container-" + to);
if (w1) {
w1.node.hide();
}
s += '.mkws-' + type;
s += ',.mkws-' + type + "-container-wide";
s += ',.mkws-' + type + "-container-narrow";
- // ### Do we need to do something about old-style names?
+ // Annoyingly, we also need to recognise old-style names
+ var oldtype = _new2old[type] || type.charAt(0).toUpperCase() + type.slice(1);
+ s += ',.mkws' + oldtype;
+ s += ',.mkws' + oldtype + "-Container-wide";
+ s += ',.mkws' + oldtype + "-Container-narrow";
}
return s;
}