From nobody Sat Feb 7 09:47:34 2026 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 1554477188451687.3949923603352; Fri, 5 Apr 2019 08:13:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4A18B33027C; Fri, 5 Apr 2019 15:13:01 +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 2136D60BFB; Fri, 5 Apr 2019 15:13:00 +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 C44EF181AC45; Fri, 5 Apr 2019 15:12:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x35FCsJa023360 for ; Fri, 5 Apr 2019 11:12:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7826226341; Fri, 5 Apr 2019 15:12:54 +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 245712718E; Fri, 5 Apr 2019 15:12:52 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Fri, 5 Apr 2019 16:12:44 +0100 Message-Id: <20190405151245.18665-3-berrange@redhat.com> In-Reply-To: <20190405151245.18665-1-berrange@redhat.com> References: <20190405151245.18665-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani Subject: [libvirt] [PATCH v2 2/3] 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.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 05 Apr 2019 15:13:01 +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 Reviewed-by: Andrea Bolognani --- docs/Makefile.am | 1 + docs/main.js | 25 +++++++++++++++++++++++++ docs/page.xsl | 35 +++-------------------------------- 3 files changed, 29 insertions(+), 32 deletions(-) create mode 100644 docs/main.js diff --git a/docs/Makefile.am b/docs/Makefile.am index 2a9d99071c..29b0761a2b 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -56,6 +56,7 @@ css =3D \ main.css =20 javascript =3D \ + js/main.js \ js/jquery-3.1.1.min.js \ js/jquery.rss.min.js \ js/moment.min.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..136f3106e4 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