2019-06-20 09:21:37 +00:00
|
|
|
"use strict";
|
|
|
|
|
2019-04-05 12:59:31 +00:00
|
|
|
function pageload() {
|
2019-06-20 09:21:37 +00:00
|
|
|
window.addEventListener("scroll", function(e){
|
|
|
|
var distanceY = window.pageYOffset || document.documentElement.scrollTop;
|
|
|
|
var shrinkOn = 94;
|
|
|
|
var home = document.getElementById("home");
|
|
|
|
var links = document.getElementById("jumplinks");
|
|
|
|
var search = document.getElementById("search");
|
|
|
|
var body = document.getElementById("body");
|
2019-04-05 12:59:31 +00:00
|
|
|
if (distanceY > shrinkOn) {
|
|
|
|
if (home.className != "navhide") {
|
2019-06-20 09:21:37 +00:00
|
|
|
body.className = "navhide";
|
|
|
|
home.className = "navhide";
|
|
|
|
links.className = "navhide";
|
|
|
|
search.className = "navhide";
|
2019-04-05 12:59:31 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (home.className == "navhide") {
|
2019-06-20 09:21:37 +00:00
|
|
|
body.className = "";
|
|
|
|
home.className = "";
|
|
|
|
links.className = "";
|
|
|
|
search.className = "";
|
2019-04-05 12:59:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2019-04-05 15:49:05 +00:00
|
|
|
|
|
|
|
/* Setting this class makes the advanced search options visible */
|
2019-06-20 09:21:37 +00:00
|
|
|
var advancedSearch = document.getElementById("advancedsearch");
|
|
|
|
advancedSearch.className = "advancedsearch";
|
2019-04-05 15:49:05 +00:00
|
|
|
|
2019-06-20 09:21:37 +00:00
|
|
|
var simpleSearch = document.getElementById("simplesearch");
|
|
|
|
simpleSearch.addEventListener("submit", advancedsearch);
|
2019-04-05 15:49:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function advancedsearch(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
|
2019-06-20 09:21:37 +00:00
|
|
|
var form = document.createElement("form");
|
2023-10-27 11:24:26 +00:00
|
|
|
form.method = "get";
|
2019-04-05 15:49:05 +00:00
|
|
|
|
2023-12-04 11:09:32 +00:00
|
|
|
var q = document.getElementById("searchq");
|
2019-06-20 09:21:37 +00:00
|
|
|
var newq = document.createElement("input");
|
2023-10-27 11:24:26 +00:00
|
|
|
newq.type = "hidden";
|
|
|
|
newq.name = "q";
|
2023-12-04 11:09:32 +00:00
|
|
|
newq.value = q.value;
|
2019-04-05 15:49:05 +00:00
|
|
|
form.appendChild(newq);
|
|
|
|
|
2019-06-20 09:21:37 +00:00
|
|
|
var whats = document.getElementsByName("what");
|
|
|
|
var what = "website";
|
2019-04-05 15:49:05 +00:00
|
|
|
for (var i = 0; i < whats.length; i++) {
|
|
|
|
if (whats[i].checked) {
|
|
|
|
what = whats[i].value;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-27 11:24:26 +00:00
|
|
|
if (what == "website" || what == "wiki") {
|
2023-12-04 11:09:32 +00:00
|
|
|
form.action = "https://duckduckgo.com/";
|
|
|
|
|
|
|
|
var newsite = document.createElement("input");
|
|
|
|
newsite.type = "hidden";
|
|
|
|
newsite.name = "sites";
|
|
|
|
form.appendChild(newsite);
|
|
|
|
|
2023-10-27 11:24:26 +00:00
|
|
|
if (what == "website") {
|
2023-12-04 11:09:32 +00:00
|
|
|
newsite.value = "libvirt.org";
|
2023-10-27 11:24:26 +00:00
|
|
|
} else {
|
2023-12-04 11:09:32 +00:00
|
|
|
newsite.value = "wiki.libvirt.org";
|
2023-10-27 11:24:26 +00:00
|
|
|
}
|
|
|
|
} else if (what == "devs" || "users") {
|
|
|
|
form.action = "https://lists.libvirt.org/archives/search";
|
|
|
|
|
|
|
|
var newl = document.createElement("input");
|
|
|
|
newl.type = "hidden";
|
|
|
|
newl.name = "mlist";
|
|
|
|
form.appendChild(newl);
|
|
|
|
|
|
|
|
if (what == "devs") {
|
|
|
|
newl.value = "devel@lists.libvirt.org";
|
|
|
|
} else {
|
|
|
|
newl.value = "users@lists.libvirt.org";
|
|
|
|
}
|
2019-04-05 15:49:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
document.body.appendChild(form);
|
|
|
|
form.submit();
|
|
|
|
|
|
|
|
return false;
|
2019-04-05 12:59:31 +00:00
|
|
|
}
|