Remove --smart option from pandoc invocation.
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index bac4ccb..c5f7d48 100644 (file)
@@ -204,6 +204,7 @@ function add_single_facet(acc, caption, data, max, cclIndex) {
     acc.push('<div class="facet">');
     acc.push('<div class="termtitle">' + M(caption) + '</div>');
     for (var i = 0; i < data.length && i < max; i++ ) {
+       acc.push('<div class="term">');
         acc.push('<a href="#" ');
        var action;
        if (!cclIndex) {
@@ -214,7 +215,8 @@ function add_single_facet(acc, caption, data, max, cclIndex) {
            action = 'limitQuery(\'' + cclIndex + '\', this.firstChild.nodeValue)';
        }
        acc.push('onclick="' + action + ';return false;">' + data[i].name + '</a>'
-                + '<span> (' + data[i].freq + ')</span><br/>');
+                + ' <span>' + data[i].freq + '</span>');
+       acc.push('</div>');
     }
     acc.push('</div>');
 }
@@ -846,10 +848,7 @@ jQuery.extend({
        <div id="mkwsSearch"></div>\
        <div id="mkwsResults"></div>\
        <div id="mkwsTargets"></div>\
-       <div id="mkwsFooter">\
-         <div id="mkwsStat"></div>\
-         <span>Powered by MKWS &copy; 2013 <a target="_new" href="http://www.indexdata.com">Index Data</a></span>\
-       </div>';
+        <div id="mkwsStat"></div>';
 
        // new table layout
        var table = '\
@@ -897,9 +896,23 @@ jQuery.extend({
          </tr>\
        </table>';
 
+       var popup = '\
+         <div id="mkwsSearch"></div>\
+         <div id="mkwsPopup">\
+           <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') {
            this.debug2("jquery plugin layout: div");
            document.write(div);
+       } else if (config && config.layout == 'popup') {
+           this.debug2("jquery plugin layout: popup");
+           document.write(popup);
+           $(document).ready( function() { init_popup(config); } );
        } else {
            this.debug2("jquery plugin layout: table");
            document.write(table);
@@ -907,6 +920,38 @@ jQuery.extend({
     }
 });
 
+function init_popup(obj) {
+    var config = obj ? obj : {};
+
+    var height = config.height || 760;
+    var width = config.width || 880;
+    var id_button = config.button || "input#mkwsButton";
+    var id_popup = config.popup || "#mkwsPopup";
+
+    debug("popup height: " + height + ", width: " + width);
+
+    $(id_popup).dialog({
+      closeOnEscape: true,
+      autoOpen: false,
+      height: height,
+      width: width,
+      modal: true,
+      resizable: true,
+      buttons: {
+             Cancel: function() {
+                     $(this).dialog("close");
+             }
+      },
+      close: function() { }
+    });
+
+    $(id_button)
+      .button()
+      .click(function() {
+             $(id_popup).dialog("open");
+      });
+};
+
 function debug(string) {
     if (!mkws_debug)
        return;