--- /dev/null
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>MKWS demo: Multiple autosearching widgets get their own teams</title>
+ <link rel="stylesheet" type="text/css" href="mkws-widget-reference.css" />
+ <script type="text/javascript">
+ var mkws_config = { service_proxy_auth: "//mkws.indexdata.com/service-proxy-testauth" };
+ </script>
+ <!-- <script type="text/javascript" src="//mkws.local/mkws-complete.js"></script> -->
+ <script type="text/javascript" src="//mkws.indexdata.com/mkws-complete.js"></script>
+ </head>
+ <body>
+ <div class='mkwsReference' autosearch='one' sentences='1'>result will appear here</div>
+ <div class='mkwsReference' autosearch='two' sentences='1'>result will appear here</div>
+ <div class='mkwsReference' autosearch='three' sentences='1'>result will appear here</div>
+ <div class='mkwsReference' sentences='1'>result will appear here</div>
+ </body>
+</html>
}
}
- if (!teamName) teamName = "AUTO";
+ // Widgets without a team are on team "AUTO"
+ if (!teamName) {
+ teamName = "AUTO";
+ // Autosearch widgets don't join team AUTO if there is already an
+ // autosearch on the team or the team has otherwise gotten a query
+ if (node.hasAttribute("autosearch")) {
+ if (mkws.autoHasAuto ||
+ mkws.teams["AUTO"] && mkws.teams["AUTO"].config()["query"]) {
+ log("AUTO team already has a query, using unique team");
+ teamName = "UNIQUE";
+ }
+ mkws.autoHasAuto = true;
+ }
+ }
+
+ // Widgets on team "UNIQUE" get a random team
+ if (teamName === "UNIQUE") {
+ teamName = Math.floor(Math.random() * 100000000).toString();
+ }
+
callback.call(node, teamName, type);
}
function init(rootsel) {
+ mkws.autoHasAuto = false;
if (!rootsel) var rootsel = ':root';
var saved_config;
if (typeof mkws_config === 'undefined') {