+
+
+ $(document).ready(function() {
+ debug("on load ready");
+ default_mkws_config();
+
+ // Backwards compatibility: set new magic class names on any
+ // elements that have the old magic IDs.
+ var ids = [ "Switch", "Lang", "Search", "Pager", "Navi",
+ "Results", "Records", "Targets", "Ranking",
+ "Termlists", "Stat" ];
+ for (var i = 0; i < ids.length; i++) {
+ var id = 'mkws' + ids[i];
+ var node = $('#' + id);
+ if (node.attr('id')) {
+ node.addClass(id);
+ debug("added magic class to '" + node.attr('id') + "'");
+ }
+ }
+
+ // 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_/)) {
+ debug("adding AUTO team to node with class '" + this.className + "'");
+ $(this).addClass('mkwsTeam_AUTO');
+ }
+ });
+
+ // Find all nodes with an class, and determine their team from
+ // the mkwsTeam_* class. Make all team objects.
+ var then = $.now();
+ $('[class^="mkws"],[class*=" mkws"]').each(function () {
+ mkws.handle_node_with_team(this, function(tname) {
+ if (!mkws.teams[tname]) {
+ mkws.teams[tname] = team(j, tname);
+ debug("Made MKWS team '" + tname + "'");
+ }
+ var myTeam = mkws.teams[tname]
+ var myWidget = widget(j, myTeam, this)
+ });
+ });
+ var now = $.now();
+ debug("Walking MKWS nodes took " + (now-then) + " ms");
+
+ if (mkws_config.use_service_proxy) {
+ authenticate_session(mkws_config.service_proxy_auth,
+ mkws_config.service_proxy_auth_domain,
+ mkws_config.pazpar2_url);
+ } else {
+ // raw pp2
+ run_auto_searches();
+ }
+ });