function my_onbytarget(data, teamName) {
debug("target for " + teamName);
- var targetDiv = document.getElementById("mkwsBytarget");
+ var targetDiv = $('.mkwsBytarget.mkwsTeam_' + teamName);
if (!targetDiv) {
// No mkwsTargets div.
return;
}
table += '</tbody></table>';
- targetDiv.innerHTML = table;
+ targetDiv.html(table);
}
////////////////////////////////////////////////////////////////////////////////
function mkws_html_switch() {
- debug("HTML switch");
+ debug("HTML switch for team " + m_teamName);
- $("#mkwsSwitch").append($('<a href="#" id="mkwsSwitch_records" onclick="mkws.switchView(\'records\')">' + M('Records') + '</a>'));
- $("#mkwsSwitch").append($("<span/>", { text: " | " }));
- $("#mkwsSwitch").append($('<a href="#" id="mkwsSwitch_targets" onclick="mkws.switchView(\'targets\')">' + M('Targets') + '</a>'));
+ var node = $(".mkwsSwitch.mkwsTeam_" + m_teamName);
+ node.append($('<a href="#" onclick="mkws.switchView(\'records\')">' + M('Records') + '</a>'));
+ node.append($("<span/>", { text: " | " }));
+ node.append($('<a href="#" onclick="mkws.switchView(\'targets\')">' + M('Targets') + '</a>'));
debug("HTML targets");
- $("#mkwsTargets").html('\
-<div id="mkwsBytarget" class="mkwsBytarget mkwsTeam_AUTO">\
+ var node = $(".mkwsTargets.mkwsTeam_" + m_teamName);
+ node.html('\
+<div class="mkwsBytarget mkwsTeam_' + m_teamName + '">\
No information available yet.\
</div>');
- $("#mkwsTargets").css("display", "none");
+ node.css("display", "none");
}
$("#mkwsTermlistContainer1").hide();
$("#mkwsTermlistContainer2").show();
for(var i = 0; i < list.length; i++) {
- $("#" + list[i]).hide();
+ $("#" + list[i]).hide(); // ### make team-aware
}
} else if ($(window).width() > width &&
parentId === "mkwsTermlistContainer2") {
$("#mkwsTermlistContainer1").show();
$("#mkwsTermlistContainer2").hide();
for(var i = 0; i < list.length; i++) {
- $("#" + list[i]).show();
+ $("#" + list[i]).show(); // ### make team-aware
}
}
};
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') + "'");
+ node.addClass(id);
+ log("added magic class to '" + node.attr('id') + "'");
}
}
+ // For all MKWS-classed nodes that don't have a team
+ // specified, set the team to AUTO.
+ $('div[class^="mkws"],div[class*=" mkws"]').each(function () {
+ if (!this.className.match(/mkwsTeam_/)) {
+ log("adding AUTO team to node with class '" + this.className + "'");
+ $(this).addClass('mkwsTeam_AUTO');
+ }
+ });
+
// Find all nodes with class (NOT id) mkwsRecords, and
// determine their team from the mkwsTeam_* class. So:
// <div class="mkwsRecords mkwsTeam_foo"/>
tname = cname.replace(/^mkwsTeam_/, '');
}
}
- if (!tname)
- tname = "AUTO";
callback(tname);
}