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