- <div id="mkwsFooter">\
- <div id="mkwsStat"></div>\
- <span>Powered by MKWS © 2013 <a target="_new" href="http://www.indexdata.com">Index Data</a></span>\
- </div>';
-
- // new table layout
- var table = '\
- <style type="text/css">\
- #mkwsTermlists div.facet {\
- float:left;\
- width: 30%;\
- margin: 0.3em;\
- }\
- #mkwsStat {\
- text-align: right;\
- }\
- </style>\
- \
- <table width="100%" border="0">\
- <tr>\
- <td>\
- <div id="mkwsSwitch"></div>\
- <div id="mkwsLang"></div>\
- <div id="mkwsSearch"></div>\
- </td>\
- </tr>\
- <tr>\
- <td>\
- <div style="height:500px; overflow: auto">\
- <div id="mkwsPager"></div>\
- <div id="mkwsNavi"></div>\
- <div id="mkwsRecords"></div>\
- <div id="mkwsTargets"></div>\
- <div id="mkwsRanking"></div>\
- </div>\
- </td>\
- </tr>\
- <tr>\
- <td>\
- <div style="height:300px; overflow: hidden">\
- <div id="mkwsTermlists"></div>\
- </div>\
- </td>\
- </tr>\
- <tr>\
- <td>\
- <div id="mkwsStat"></div>\
- </td>\
- </tr>\
- </table>';
-
- if (config && config.layout == 'div') {
- this.debug2("jquery plugin layout: div");
- document.write(div);
+ <div id="mkwsRanking"></div>\
+ </div>\
+ </td>\
+ </tr>\
+ <tr>\
+ <td>\
+ <div style="height:300px; overflow: hidden">\
+ <div id="mkwsTermlists"></div>\
+ </div>\
+ </td>\
+ </tr>\
+ <tr>\
+ <td>\
+ <div id="mkwsStat"></div>\
+ </td>\
+ </tr>\
+</table>';
+
+ var popup = '\
+<div id="mkwsSearch"></div>\
+<div id="' + id_popup + '">\
+ <div id="mkwsSwitch"></div>\
+ <div id="mkwsLang"></div>\
+ <div id="mkwsResults"></div>\
+ <div id="mkwsTargets"></div>\
+ <div id="mkwsStat"></div>\
+</div>'
+
+ if (config && config.layout == 'div') {
+ debug("jquery plugin layout: div");
+ document.write(div);
+ } else if (config && config.layout == 'popup') {
+ debug("jquery plugin layout: popup with id: " + id_popup);
+ document.write(popup);
+ $(document).ready(function() { init_popup(config); });
+ } else {
+ debug("jquery plugin layout: table");
+ document.write(table);
+ }
+ }
+ });
+};
+
+
+// wrapper to call team() after page load
+(function (j) {
+ function log(s) {
+ if (typeof console === "undefined" || typeof console.log === "undefined") { /* ARGH!!! old IE */
+ return;
+ }
+ console.log(s);
+ }
+
+ // enable before page load, so we could call it before mkws() runs
+ _mkws_jquery_plugin(j);
+
+ $(document).ready(function() {
+ log("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);
+ log("added magic class to '" + node.attr('id') + "'");
+ }
+ }
+
+ // For all MKWS-classed nodes that don't have a team
+ // specified, set the team to AUTO.
+ $('div[class^="mkws"],div[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 class (NOT id) mkwsRecords, and
+ // determine their team from the mkwsTeam_* class. So:
+ // <div class="mkwsRecords mkwsTeam_foo"/>
+ $('.mkwsSearch, .mkwsResults, .mkwsRecords, .mkwsTermlists').each(function () {
+ var node = this;
+ mkws.handle_node_with_team(node, function(tname) {
+ if (mkws.teams[tname]) {
+ log("MKWS team '" + tname + "' already exists, skipping");
+ } else {
+ mkws.teams[tname] = team(j, tname);
+ log("Made MKWS team '" + tname + "'");
+ }
+ });
+ });
+
+ if (mkws_config.use_service_proxy) {
+ authenticate_session(mkws_config.service_proxy_auth,
+ mkws_config.service_proxy_auth_domain,
+ mkws_config.pazpar2_url);