- // I don't understand why I need this copy, but I do: mkws_config
- // is not visible inside the document.ready function, but the
- // saved copy is.
- var saved_config;
- if (typeof mkws_config === 'undefined') {
- log("setting empty config");
- saved_config = {};
- } else {
- log("using config: " + $.toJSON(mkws_config));
- saved_config = mkws_config;
+ function makeWidgetsWithin(level, node) {
+ node.find('[class^="mkws"],[class*=" mkws"]').each(function() {
+ handleNodeWithTeam(this, function(tname, type) {
+ var oldHTML = this.innerHTML;
+ var myTeam = mkws.teams[tname];
+ var myWidget = widget(j, myTeam, type, this);
+ myTeam.addWidget(myWidget);
+ var newHTML = this.innerHTML;
+ if (newHTML !== oldHTML) {
+ log("widget " + tname + ":" + type + " HTML changed from '" + oldHTML + "' to '" + newHTML + "': reparse!");
+ makeWidgetsWithin(level+1, $(this));
+ }
+ });
+ });