From a8e3bae5b1fe7d01fad6544e0333de1eb0cc96a6 Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Mon, 4 Dec 2023 12:09:32 +0100 Subject: [PATCH] docs: Use DuckDuckGo for website/wiki search Ideally we'd just perform the search ourselves, but as long as we have to rely on an external provider, at least make it a somewhat privacy-conscious one. Signed-off-by: Andrea Bolognani Reviewed-by: Martin Kletzander --- docs/js/main.js | 16 +++++++++++----- docs/page.xsl | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/js/main.js b/docs/js/main.js index 57e1faf030..87b817b287 100644 --- a/docs/js/main.js +++ b/docs/js/main.js @@ -40,12 +40,13 @@ function advancedsearch(e) { var form = document.createElement("form"); form.method = "get"; + var q = document.getElementById("searchq"); var newq = document.createElement("input"); newq.type = "hidden"; newq.name = "q"; + newq.value = q.value; form.appendChild(newq); - var q = document.getElementById("searchq"); var whats = document.getElementsByName("what"); var what = "website"; for (var i = 0; i < whats.length; i++) { @@ -56,15 +57,20 @@ function advancedsearch(e) { } if (what == "website" || what == "wiki") { - form.action = "https://google.com/search"; + form.action = "https://duckduckgo.com/"; + + var newsite = document.createElement("input"); + newsite.type = "hidden"; + newsite.name = "sites"; + form.appendChild(newsite); + if (what == "website") { - newq.value = "site:libvirt.org " + q.value; + newsite.value = "libvirt.org"; } else { - newq.value = "site:wiki.libvirt.org " + q.value; + newsite.value = "wiki.libvirt.org"; } } else if (what == "devs" || "users") { form.action = "https://lists.libvirt.org/archives/search"; - newq.value = q.value; var newl = document.createElement("input"); newl.type = "hidden"; diff --git a/docs/page.xsl b/docs/page.xsl index 27607e4d92..8a1a77fa99 100644 --- a/docs/page.xsl +++ b/docs/page.xsl @@ -77,9 +77,9 @@