config[k] = data[k];
}
+ mkws_html_switch(config);
+ // For some reason, doing this programmatically results in
+ // document.search.query being undefined, hence the raw HTML.
+ $("#mkwsSearch").html('\
+ <form id="searchForm" name="search">\
+ <input id="query" type="text" size="50" />\
+ <input id="button" type="submit" value="Search" />\
+ </form>');
+
+ $("#mkwsRecords").html('\
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">\
+ <tr>\
+ <td width="250" valign="top">\
+ <div id="termlist"></div>\
+ </td>\
+ <td valign="top">\
+ <div id="ranking">\
+ <form name="select" id="select">\
+ Sort by' + mkws_html_sort(config) + '\
+ and show ' + mkws_html_perpage(config) + '\
+ per page.\
+ </form>\
+ </div>\
+ <div id="pager"></div>\
+ <div id="navi"></div>\
+ <div id="results"></div>\
+ </td>\
+ </tr>\
+ </table>\
+ </div>');
+
+ $("#mkwsTargets").html('\
+ <div id="bytarget">\
+ No information available yet.\
+ </div>');
+ $("#mkwsTargets").css("display", "none");
+
+ domReady();
+}
+
+function mkws_html_switch(config) {
$("#mkwsSwitch").html($("<a/>", {
href: '#',
onclick: "switchView(\'records\')",
if (!config.mkws_switch) {
$("#mkwsSwitch").css("display", "none");
}
+}
+function mkws_html_sort(config) {
var sort_html = '<select name="sort" id="sort">';
+
for(var i = 0; i < config.sort.length; i++) {
var key = config.sort[i][0];
var val = config.sort[i].length == 1 ? config.sort[i][0] : config.sort[i][1];
}
sort_html += '</select>';
+ return sort_html;
+}
+
+function mkws_html_perpage(config) {
var perpage_html = '<select name="perpage" id="perpage">';
+
for(var i = 0; i < config.perpage.length; i++) {
var key = config.perpage[i];
}
perpage_html += '</select>';
- // For some reason, doing this programmatically results in
- // document.search.query being undefined, hence the raw HTML.
- $("#mkwsSearch").html('\
- <form id="searchForm" name="search">\
- <input id="query" type="text" size="50" />\
- <input id="button" type="submit" value="Search" />\
- </form>');
-
- $("#mkwsRecords").html('\
- <table width="100%" border="0" cellpadding="6" cellspacing="0">\
- <tr>\
- <td width="250" valign="top">\
- <div id="termlist"></div>\
- </td>\
- <td valign="top">\
- <div id="ranking">\
- <form name="select" id="select">\
- Sort by' + sort_html + '\
- and show ' + perpage_html + '\
- per page.\
- </form>\
- </div>\
- <div id="pager"></div>\
- <div id="navi"></div>\
- <div id="results"></div>\
- </td>\
- </tr>\
- </table>\
- </div>');
-
- $("#mkwsTargets").html('\
- <div id="bytarget">\
- No information available yet.\
- </div>');
- $("#mkwsTargets").css("display", "none");
-
- domReady();
+ return perpage_html;
}
/*