configure search box size
[mkws-moved-to-github.git] / experiments / spclient / mkws.js
index a45600d..0504753 100644 (file)
@@ -455,6 +455,10 @@ function mkws_html_all(data) {
        config[k] = data[k];
        debug("Set config: " + k + ' => ' + data[k]);
     }
+    if (mkws_config.query_width < 5 || mkws_config.query_width > 150) {
+       debug("Reset query width: " + mkws_config.query_width);
+       mkws_config.query_width = 50;
+    }
    
     mkws_set_lang(mkws_config); 
     mkws_html_lang(mkws_config); 
@@ -463,8 +467,8 @@ function mkws_html_all(data) {
     // document.search.query being undefined, hence the raw HTML.
     debug("HTML search form");
     $("#mkwsSearch").html('\
-    <form id="searchForm" name="search">\
-      <input id="query" type="text" size="50" />\
+    <form id="searchForm" name="search" action="" >\
+      <input id="query" type="text" size="' + mkws_config.query_width + '" />\
       <input id="button" type="submit" value="' + M('Search') + '" />\
     </form>');
 
@@ -477,7 +481,7 @@ function mkws_html_all(data) {
           </td>\
           <td valign="top">\
             <div id="ranking">\
-              <form name="select" id="select">\
+              <form name="select" id="select" action="" >\
         ' + M('Sort by') + mkws_html_sort(config) + '\
         ' + M('and show') + ' ' + mkws_html_perpage(config) + '\
         ' + M('per page') + '.\
@@ -488,8 +492,7 @@ function mkws_html_all(data) {
             <div id="results"></div>\
           </td>\
         </tr>\
-      </table>\
-    </div>');
+      </table>');
 
     mkws_html_switch(config);
     if (mkws_config.use_service_proxy)
@@ -657,7 +660,8 @@ jQuery.extend({
 function debug(string) {
     if (!mkws_debug)
        return;
-    
+   
+    var console; // IE8 quirks 
     if (!console) { /* ARGH!!! */
        return;
     }