diff --git a/docs/js/main.js b/docs/js/main.js index 723e2fb16d89dd609ab65722a0a6225783fab4f6..e57b9f47ac1191238cb631c1f771cecefab8b686 100644 --- a/docs/js/main.js +++ b/docs/js/main.js @@ -22,4 +22,56 @@ function pageload() { } } }); + + /* Setting this class makes the advanced search options visible */ + advancedSearch = document.getElementById("advancedsearch") + advancedSearch.className = "advancedsearch" + + simpleSearch = document.getElementById("simplesearch") + simplesearch.addEventListener("submit", advancedsearch) +} + +function advancedsearch(e) { + e.preventDefault(); + e.stopPropagation(); + + form = document.createElement("form"); + form.setAttribute("method", "get"); + + newq = document.createElement("input"); + newq.setAttribute("type", "hidden"); + form.appendChild(newq); + + q = document.getElementById("searchq"); + whats = document.getElementsByName("what"); + what = "website"; + for (var i = 0; i < whats.length; i++) { + if (whats[i].checked) { + what = whats[i].value; + break; + } + } + + if (what == "website") { + form.setAttribute("action", "https://google.com/search"); + newq.setAttribute("name", "q"); + newq.value = "site:libvirt.org " + q.value; + } else if (what == "wiki") { + form.setAttribute("action", "https://wiki.libvirt.org/index.php"); + newq.setAttribute("name", "search"); + newq.value = q.value; + } else if (what == "devs") { + form.setAttribute("action", "https://google.com/search"); + newq.setAttribute("name", "q"); + newq.value = "site:redhat.com/archives/libvir-list " + q.value; + } else if (what == "users") { + form.setAttribute("action", "https://google.com/search"); + newq.setAttribute("name", "q"); + newq.value = "site:redhat.com/archives/libvirt-users " + q.value; + } + + document.body.appendChild(form); + form.submit(); + + return false; } diff --git a/docs/libvirt.css b/docs/libvirt.css index ed797d5d917eca24016a1270dc91dfe5cbfb7936..0d2d5f8ace25f51edd8f2b7ca6aeef8367d533be 100644 --- a/docs/libvirt.css +++ b/docs/libvirt.css @@ -542,3 +542,42 @@ dl.mail dt a:hover { td.enumvalue { white-space: nowrap; } + +#advancedsearch { + display: none; + vertical-align: bottom; + position: absolute; + padding: 1em; + padding-top: 0em; + margin-top: 0em; + top: 100px; + right: 0px; + width: 13em; + text-align: left; + color: white; + background: rgb(0, 95, 97); + border-left: 3px solid rgb(60, 133, 124); + border-bottom: 3px solid rgb(60, 133, 124); +} + +/* Use div.advancedsearch, not #advancedsearch because the + * 'advancedsearch' class is set dynamically when javascript + * loads. This ensures that the advancedsearch options are + * not displayed when javascript is disabled. +*/ +#search:hover div.advancedsearch { + display: table; +} + +#advancedsearch span { + display: block; +} + +#advancedsearch input[type=radio] { + height: inherit; + display: inline; +} + +#advancedsearch label { + display: inline; +} diff --git a/docs/mobile.css b/docs/mobile.css index 85ca497525114744527fff936f5c16d0484fa112..366d0f1a5d36175ea2a6a431d6d3a219dbf3e1d1 100644 --- a/docs/mobile.css +++ b/docs/mobile.css @@ -15,6 +15,7 @@ margin: 0px; background: white; padding: 0px; + height: 2em; } #search form { padding: 5px; @@ -91,4 +92,10 @@ float: none; margin-bottom: 2em; } + #advancedsearch { + margin-top: 4em; + border: 0px; + background: white; + color: black; + } } diff --git a/docs/page.xsl b/docs/page.xsl index 136f3106e482b942212d5e7b8db975797606a92a..65ddeb2bb7cd8656fd88920107079479757fd992 100644 --- a/docs/page.xsl +++ b/docs/page.xsl @@ -126,11 +126,19 @@