Merge branch 'master' of ssh://git.indexdata.com:222/home/git/private/mkws
authorWolfram Schneider <wosch@indexdata.dk>
Sat, 12 Apr 2014 16:33:45 +0000 (16:33 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Sat, 12 Apr 2014 16:33:45 +0000 (16:33 +0000)
src/mkws-core.js
src/mkws-team.js

index 6b1e0f6..fd0c0de 100644 (file)
@@ -229,6 +229,8 @@ mkws.pagerNext = function(tname) {
                type = cname.replace(/^mkws/, '');
            }
        }
+
+        if (!teamName) teamName = "AUTO";
        callback.call(node, teamName, type);
     }
 
@@ -369,15 +371,6 @@ mkws.pagerNext = function(tname) {
            }
        }
 
-       // For all MKWS-classed nodes that don't have a team
-       // specified, set the team to AUTO.
-       $('[class^="mkws"],[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 an MKWS class, and determine their team from
        // the mkwsTeam_* class. Make all team objects.
        var then = $.now();
index 9d9e34c..d6fc49f 100644 (file)
@@ -604,7 +604,12 @@ function team($, teamName) {
        teamName = teamName || m_teamName;
 
        selector = $.map(selector.split(','), function(s, i) {
-           return s + '.mkwsTeam_' + teamName;
+           if (teamName === 'AUTO') {
+               return (s + '.mkwsTeam_' + teamName + ',' +
+                       s + ':not([class^="mkwsTeam"],[class*=" mkwsTeam"])');
+           } else {
+               return s + '.mkwsTeam_' + teamName;
+           }
        }).join(',');
 
        var node = $(selector);