# HG changeset patch # User Rob Hoes # Date 1257330033 0 # Node ID 8828db3bbdf94804a1ffad02fb65876a729d9b92 # Parent 024f541bfe08116a6291e1bc97bf3de0985734dc [ocamldoc] Initial search functionality: searching module names Signed-off-by: Rob Hoes diff -r 024f541bfe08 -r 8828db3bbdf9 ocaml/doc/index.html --- a/ocaml/doc/index.html Wed Nov 04 10:20:33 2009 +0000 +++ b/ocaml/doc/index.html Wed Nov 04 10:20:33 2009 +0000 @@ -8,7 +8,8 @@ @@ -19,7 +20,10 @@ diff -r 024f541bfe08 -r 8828db3bbdf9 ocaml/doc/ocamldoc.js --- a/ocaml/doc/ocamldoc.js Wed Nov 04 10:20:33 2009 +0000 +++ b/ocaml/doc/ocamldoc.js Wed Nov 04 10:20:33 2009 +0000 @@ -53,6 +53,41 @@ component_modules[components[i]] = eval('modules_' + components[i].replaceAll('-', '')); component_deps[components[i]] = eval('deps_' + components[i].replaceAll('-', '')); } +} + +function do_search() +{ + query = document.getElementById('search_box').value.toLowerCase(); + + // search modules + html = '

Modules

'; + for (z in components) { + c = components[z]; + for (y in component_modules[c]) { + m = component_modules[c][y].name; + if (m.toLowerCase().indexOf(query) > -1) + html += '' + m + ' (' + c + ')
'; + } + } + + document.getElementById('results').innerHTML = html; +} + +function search_key(event) +{ + if (event.keyCode == 13) + do_search(); +} + +function search_page() +{ + html = ""; + html += '

Search

'; + html += ''; + html += '
'; + set_content(html); + + set_sidebar(""); } function find_component_for_module(m) @@ -132,8 +167,8 @@ html += ''; for (c in v.params) { n = v.params[c].name; - html += ''; - html += ''; + html += ''; + html += ''; } html += '
' + (n == "" ? '(no name)' : v.params[c].name) + '' + v.params[c].type + '
' + (n == "" ? '(no name)' : v.params[c].name) + '' + v.params[c].type + '
'; html += ''; @@ -278,7 +313,7 @@ function comment(m) { - append_content(m); + append_content('
' + m + '
'); } function parse_structure(structure) diff -r 024f541bfe08 -r 8828db3bbdf9 ocaml/doc/odoc_json.ml --- a/ocaml/doc/odoc_json.ml Wed Nov 04 10:20:33 2009 +0000 +++ b/ocaml/doc/odoc_json.ml Wed Nov 04 10:20:33 2009 +0000 @@ -1,4 +1,3 @@ - (* Copyright (C) 2009 Citrix Systems Inc. *) (* Copyright (C) 2005 Institut National de Recherche en Informatique et *) (* en Automatique. *) diff -r 024f541bfe08 -r 8828db3bbdf9 ocaml/doc/style.css --- a/ocaml/doc/style.css Wed Nov 04 10:20:33 2009 +0000 +++ b/ocaml/doc/style.css Wed Nov 04 10:20:33 2009 +0000 @@ -155,7 +155,7 @@ } #menu li a { -padding: 15px 0 0 20px; +padding: 15px 0 0 2em; font-size: 1.3em; font-weight: bold; } @@ -238,9 +238,8 @@ margin: .7em 0; } -.field-table { -// margin-left: 3em; -// width: 90%; +.field-table td { + padding: .3em 0; } .small-button {