From: Mike Taylor Date: Tue, 18 Mar 2014 17:39:29 +0000 (+0000) Subject: Walk across all MKWS nodes twice: once to make teams, then to make widgets. X-Git-Tag: 1.0.0~1307 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=efb560394dd731154a378cfa4c64cb89f67a9a38;p=mkws-moved-to-github.git Walk across all MKWS nodes twice: once to make teams, then to make widgets. It has to be done in two passes because the first pass has the side-effect of creating some widget elements, e.g. mkwsResults has mkwsTermlists created within it. So far, no functional differences. --- diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 8c102b5..e1bcd06 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -1473,6 +1473,14 @@ function team($, teamName) { mkws.teams[tname] = team(j, tname); debug("Made MKWS team '" + tname + "'"); } + }); + }); + // Second pass: make the individual widget objects. This has + // to be done separately, and after the team-creation, since + // that sometimes makes new widget nodes (e.g. creating + // mkwsTermlists instead mkwsResults. + $('[class^="mkws"],[class*=" mkws"]').each(function () { + mkws.handleNodeWithTeam(this, function(tname, type) { var myTeam = mkws.teams[tname]; var myWidget = widget(j, myTeam, type, this); });