diff options
-rw-r--r-- | html/haddock-util.js | 17 | ||||
-rw-r--r-- | src/Haddock/Backends/Xhtml.hs | 7 |
2 files changed, 16 insertions, 8 deletions
diff --git a/html/haddock-util.js b/html/haddock-util.js index d9b0b3e4..1a57b24b 100644 --- a/html/haddock-util.js +++ b/html/haddock-util.js @@ -164,6 +164,17 @@ function perform_search(full) } } +function addFramesButton() { + if (parent.location.href == window.location.href) { + var menu = document.getElementById("page-menu"); + if (menu) { + var btn = menu.lastChild.cloneNode(false); + btn.innerHTML = "<a href='#' onclick='reframe();return true;'>Frames</a>"; + menu.appendChild(btn); + } + } +} + function setSynopsis(filename) { if (parent.window.synopsis) { parent.window.synopsis.location = filename; @@ -171,10 +182,8 @@ function setSynopsis(filename) { } function reframe() { - if (parent.location.href == window.location.href) { - setCookie("haddock-reframe", document.URL); - window.location = "frames.html"; - } + setCookie("haddock-reframe", document.URL); + window.location = "frames.html"; } function postReframe() { diff --git a/src/Haddock/Backends/Xhtml.hs b/src/Haddock/Backends/Xhtml.hs index 8618d16f..b1942561 100644 --- a/src/Haddock/Backends/Xhtml.hs +++ b/src/Haddock/Backends/Xhtml.hs @@ -115,7 +115,7 @@ headHtml docTitle miniPage themes = -- a <![CDATA[ section. Will break if the miniPage name could -- have "]]>" in it! << primHtml ( - "//<![CDATA[\nwindow.onload = function () {resetStyle();" + "//<![CDATA[\nwindow.onload = function () {addFramesButton();resetStyle();" ++ setSynopsis ++ "};\n//]]>\n") ] where @@ -172,9 +172,8 @@ bodyHtml doctitle iface themes wikiButton maybe_wiki_url (ifaceMod `fmap` iface), contentsButton maybe_contents_url, indexButton maybe_index_url, - styleMenu themes, - Just (anchor ! [ href "#", onclick "reframe();"] << "Frames")]) - ! [theclass "links"], + styleMenu themes]) + ! [theclass "links", identifier "page-menu"], nonEmpty sectionName << doctitle ], divContent << pageContent, |