// you need to disable use strict at the top of the file!!!
if (mkws.log_level >= 3) {
- console.log(arguments.callee.caller);
+ // Works in Chrome; not sure about elsewhere
+ console.trace();
} else if (mkws.log_level >= 2) {
console.log(">>> called from function " + arguments.callee.caller.name + ' <<<');
}
mkws.teams[tname].limitQuery(field, value);
};
+mkws.limitCategory = function(tname, id) {
+ mkws.teams[tname].limitCategory(id);
+};
+
mkws.delimitTarget = function(tname, id) {
mkws.teams[tname].delimitTarget(id);
};
log("Service proxy auth successfully done");
mkws.authenticated = true;
var authName = $(data).find("displayName").text();
+ // You'd think there would be a better way to do this:
+ var realm = $(data).find("realm:not(realmAttributes realm)").text();
for (var teamName in mkws.teams) {
- mkws.teams[teamName].queue("authenticated").publish(authName);
+ mkws.teams[teamName].queue("authenticated").publish(authName, realm);
}
runAutoSearches();
}
}
+
+ 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));
+ }
+ });
+ });
+ }
+
+
$(document).ready(function() {
var saved_config;
if (typeof mkws_config === 'undefined') {
}
});
});
- // 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 inside mkwsResults.
- $('[class^="mkws"],[class*=" mkws"]').each(function() {
- handleNodeWithTeam(this, function(tname, type) {
- var myTeam = mkws.teams[tname];
- var myWidget = widget(j, myTeam, type, this);
- myTeam.addWidget(myWidget);
- });
- });
+
+ makeWidgetsWithin(1, $(':root'));
+
var now = $.now();
log("Walking MKWS nodes took " + (now-then) + " ms");
+// for (var tName in mkws.teams) {
+// var myTeam = mkws.teams[tName]
+// var types = myTeam.widgetTypes();
+// log("TEAM '" + tName + "' = " + myTeam + " has widget types " + types);
+// for (var i = 0; i < types.length; i++) {
+// var type = types[i];
+// log(" has widget of type '" + type + "': " + myTeam.widget(type));
+// }
+// }
+
if (mkws.config.use_service_proxy) {
authenticateSession(mkws.config.service_proxy_auth,
mkws.config.service_proxy_auth_domain,