From nobody Tue May 7 10:23:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554471067404626.9394805983806; Fri, 5 Apr 2019 06:31:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41FD53164693; Fri, 5 Apr 2019 13:31:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D229B1001E6F; Fri, 5 Apr 2019 13:31:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 78953181AC48; Fri, 5 Apr 2019 13:31:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x35DUgQO032269 for ; Fri, 5 Apr 2019 09:30:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4CE4660A9C; Fri, 5 Apr 2019 13:30:42 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-43.ams2.redhat.com [10.36.112.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33C9F60BF8; Fri, 5 Apr 2019 13:30:38 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Fri, 5 Apr 2019 14:30:30 +0100 Message-Id: <20190405133031.6034-2-berrange@redhat.com> In-Reply-To: <20190405133031.6034-1-berrange@redhat.com> References: <20190405133031.6034-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani Subject: [libvirt] [PATCH 1/2] docs: move javascript logic into a standalone file X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 05 Apr 2019 13:31:03 +0000 (UTC) Instead of duplicating javascript in every single page, put it in a standalone file which can be cached by the browser. Signed-off-by: Daniel P. Berrang=C3=A9 --- docs/main.js | 25 +++++++++++++++++++++++++ docs/page.xsl | 35 +++-------------------------------- 2 files changed, 28 insertions(+), 32 deletions(-) create mode 100644 docs/main.js diff --git a/docs/main.js b/docs/main.js new file mode 100644 index 0000000000..723e2fb16d --- /dev/null +++ b/docs/main.js @@ -0,0 +1,25 @@ +function pageload() { + window.addEventListener('scroll', function(e){ + var distanceY =3D window.pageYOffset || document.documentElement.s= crollTop + var shrinkOn =3D 94 + home =3D document.getElementById("home"); + links =3D document.getElementById("jumplinks"); + search =3D document.getElementById("search"); + body =3D document.getElementById("body"); + if (distanceY > shrinkOn) { + if (home.className !=3D "navhide") { + body.className =3D "navhide" + home.className =3D "navhide" + links.className =3D "navhide" + search.className =3D "navhide" + } + } else { + if (home.className =3D=3D "navhide") { + body.className =3D "" + home.className =3D "" + links.className =3D "" + search.className =3D "" + } + } + }); +} diff --git a/docs/page.xsl b/docs/page.xsl index beb864f26b..679e3f6822 100644 --- a/docs/page.xsl +++ b/docs/page.xsl @@ -99,40 +99,11 @@ =20 - - + --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 10:23:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554471068542644.7954693726521; Fri, 5 Apr 2019 06:31:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EBA36307E061; Fri, 5 Apr 2019 13:31:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C248660A35; Fri, 5 Apr 2019 13:31:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 84E12181AC45; Fri, 5 Apr 2019 13:31:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x35DUjWp032285 for ; Fri, 5 Apr 2019 09:30:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3854760D5E; Fri, 5 Apr 2019 13:30:45 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-43.ams2.redhat.com [10.36.112.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26C6C60C1B; Fri, 5 Apr 2019 13:30:42 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Fri, 5 Apr 2019 14:30:31 +0100 Message-Id: <20190405133031.6034-3-berrange@redhat.com> In-Reply-To: <20190405133031.6034-1-berrange@redhat.com> References: <20190405133031.6034-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani Subject: [libvirt] [PATCH 2/2] docs: add advanced search capabilities X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 05 Apr 2019 13:31:07 +0000 (UTC) Allow targetting the search scope to the website, wiki or mailing lists only. When javascript is disabled this should gracefully fallback to only searching the website. Signed-off-by: Daniel P. Berrang=C3=A9 --- docs/libvirt.css | 40 ++++++++++++++++++++++++++++++++++++++++ docs/main.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ docs/mobile.css | 7 +++++++ docs/page.xsl | 15 +++++++++++---- 4 files changed, 102 insertions(+), 4 deletions(-) diff --git a/docs/libvirt.css b/docs/libvirt.css index ed797d5d91..c53825019a 100644 --- a/docs/libvirt.css +++ b/docs/libvirt.css @@ -542,3 +542,43 @@ 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=3Dradio] { + height: inherit; + display: inline; +} + +#advancedsearch label { + display: inline; +} diff --git a/docs/main.js b/docs/main.js index 723e2fb16d..2c4443de90 100644 --- a/docs/main.js +++ b/docs/main.js @@ -22,4 +22,48 @@ function pageload() { } } }); + + /* Setting this class makes the advanced search options visible */ + advancedSearch =3D document.getElementById("advancedsearch") + advancedSearch.className =3D "advancedsearch" + + simpleSearch =3D document.getElementById("simplesearch") + simplesearch.addEventListener("submit", advancedsearch) +} + +function advancedsearch(e) { + e.preventDefault(); + e.stopPropagation(); + + form =3D document.createElement("form"); + form.setAttribute("method", "get"); + form.setAttribute("action", "https://google.com/search"); + + newq =3D document.createElement("input"); + newq.setAttribute("type", "hidden"); + newq.setAttribute("name", "q"); + form.appendChild(newq); + + q =3D document.getElementById("searchq"); + whats =3D document.getElementsByName("what"); + what =3D "website"; + for (var i =3D 0; i < whats.length; i++) { + if (whats[i].checked) { + what =3D whats[i].value; + break; + } + } + + if (what =3D=3D "website") { + newq.value =3D "site:libvirt.org " + q.value; + } else if (what =3D=3D "wiki") { + newq.value =3D "site:wiki.libvirt.org " + q.value; + } else if (what =3D=3D "lists") { + newq.value =3D "site:redhat.com inurl:/archives/libvir " + q.value; + } + + document.body.appendChild(form); + form.submit(); + + return false; } diff --git a/docs/mobile.css b/docs/mobile.css index 85ca497525..366d0f1a5d 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 679e3f6822..39ac095e53 100644 --- a/docs/page.xsl +++ b/docs/page.xsl @@ -126,11 +126,18 @@
-
- - - + +
+ + + +
+
+ + + +
--=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list