From 208e5e87a92f8d804c87f6812bebda2a97ff27b7 Mon Sep 17 00:00:00 2001 From: Neil Mitchell Date: Fri, 12 Jan 2007 12:17:46 +0000 Subject: Rewrite much of the index searching code, previously was too slow to execute on the base library with IE, the new version guarantees less than O(log n) operations be performed, where n is the number in the list (before was always O(n)) --- src/Haddock/Backends/Html.hs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Haddock/Backends/Html.hs b/src/Haddock/Backends/Html.hs index 10bf794a..051f71a6 100644 --- a/src/Haddock/Backends/Html.hs +++ b/src/Haddock/Backends/Html.hs @@ -448,10 +448,20 @@ ppHtmlIndex odir doctitle maybe_package maybe_html_help_format search_box = tda [colspan 2, thestyle "padding-top:5px;"] << search where search :: Html - search = "Search: " +++ input ! [identifier "searchbox", strAttr "onkeyup" "quick_search()"] +++ " " +++ input ! [value "Search", thetype "button", onclick "full_search()"] + search = "Search: " +++ input ! [identifier "searchbox", strAttr "onkeyup" "quick_search()"] + +++ " " +++ input ! [value "Search", thetype "button", onclick "full_search()"] + +++ " " +++ thespan ! [identifier "searchmsg"] << " " - index_html = td << table ! [identifier "indexlist", cellpadding 0, cellspacing 5] << - aboves (map indexElt index) + index_html = td << setTrClass (table ! [identifier "indexlist", cellpadding 0, cellspacing 5] << + aboves (map indexElt index)) + + setTrClass :: Html -> Html + setTrClass (Html xs) = Html $ map f xs + where + f (HtmlTag name attrs inner) + | map toUpper name == "TR" = HtmlTag name (theclass "indexrow":attrs) inner + | otherwise = HtmlTag name attrs (setTrClass inner) + f x = x index :: [(String, Map GHC.Name [(Module,Bool)])] index = sortBy cmp (Map.toAscList full_index) -- cgit v1.2.3