From nobody Mon May 6 16:38:31 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 ARC-Seal: i=1; a=rsa-sha256; t=1560953638; cv=none; d=zoho.com; s=zohoarc; b=BrfOC5SvdlXbGzeKYHqI5XLOu/39EW3JrV/C03YuVN6/34Vya8fpPE9AhL/x1TXYyDkur1GEIUYUkiIuvk7Ocr0d+9R4bBvRDv07wKgpTbwZ2dcqN6UJDJB5cCZObE1t8sqdzk42ylQU3jBH8phF+NcI5MqvMNXcyA74M68dBaQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560953638; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=8CvfUeRowNKaUTXKrTwN1/zHZsNJK7cc0JHDwrCHJGQ=; b=g2/qTwZ6k0nPhuRTiLRCQ63+R3S1aWMkNiltfMU0deEbE00z8orPxbgspvvTAJnJAwKpmYVRBgjz/keUxvqctAmB1gJvNvF5XzFX4Iw27/uSWkq3DJXnIu0mt/B12J2WEdtMADN3+YBSMOZGZ8a9z5A2rRYXV4K8driQWfpX3w0= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560953638992819.4687874472772; Wed, 19 Jun 2019 07:13:58 -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 E2FA88F91C; Wed, 19 Jun 2019 14:13:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA6271001DE7; Wed, 19 Jun 2019 14:13:01 +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 5F43119725; Wed, 19 Jun 2019 14:12:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5JEBjfB016864 for ; Wed, 19 Jun 2019 10:11:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7BCCE5C220; Wed, 19 Jun 2019 14:11:45 +0000 (UTC) Received: from caroline (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 522945C207 for ; Wed, 19 Jun 2019 14:11:43 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline (Postfix) with ESMTP id ED02A120037 for ; Wed, 19 Jun 2019 16:11:41 +0200 (CEST) From: Martin Kletzander To: libvir-list@redhat.com Date: Wed, 19 Jun 2019 16:11:40 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH] docs: Use our own implementation for fetching the RSS data 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-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.26]); Wed, 19 Jun 2019 14:13:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This is just a small script I wrote. It works the same way as all the libr= aries together which we are bundling, but with just JS. The only difference is t= hat the day of the date is formatted as 2-digit, but this should be a bug in Firefox (at least locally for me) as the documentation states that type 'numeric' should actually not have leading zeros. It will not be executed when the page is loaded locally. It also uses the same proxy that query-rss uses. We can get rid of that, b= ut we'd either need to have our own proxy, send a sss header to allow fetching= the atom.xml or providing JSONP access to the RSS feed on virt-planet. Signed-off-by: Martin Kletzander --- docs/index.html.in | 13 ------------ docs/js/main.js | 49 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/docs/index.html.in b/docs/index.html.in index f593445d061d..fa75289cad0f 100644 --- a/docs/index.html.in +++ b/docs/index.html.in @@ -5,19 +5,6 @@

The virtualization API

diff --git a/docs/js/main.js b/docs/js/main.js index e57b9f47ac11..668bf752b73d 100644 --- a/docs/js/main.js +++ b/docs/js/main.js @@ -28,7 +28,54 @@ function pageload() { advancedSearch.className =3D "advancedsearch" =20 simpleSearch =3D document.getElementById("simplesearch") - simplesearch.addEventListener("submit", advancedsearch) + simpleSearch.addEventListener("submit", advancedsearch) + + docLoc =3D document.location; + if (docLoc.protocol !=3D "file:" || + docLoc.origin !=3D "null" || + docLoc.host !=3D=3D "" || + docLoc.hostname !=3D=3D "") { + fetchRSS() + } +} + +function fetchRSS() { + cb =3D "jsonpRSSFeedCallback" + window["jsonpRSSFeedCallback"] =3D function (data) { + if (data.responseStatus !=3D 200) + return + entries =3D data.responseData.feed.entries + nEntries =3D Math.min(entries.length, 4) + + dl =3D document.createElement('dl') + + dateOpts =3D { day: 'numeric', month: 'short', year: 'numeric'} + + for (i =3D 0; i < nEntries; i++) { + entry =3D entries[i] + a =3D document.createElement('a') + a.href =3D entry.link + a.innerText =3D entry.title + + dt =3D document.createElement('dt') + dt.appendChild(a) + dl.appendChild(dt) + + date =3D new Date(entry.publishedDate) + datestr =3D date.toLocaleDateString('default', dateOpts) + + dd =3D document.createElement('dd') + dd.innerText =3D ` by ${entry.author} on ${datestr}` + + dl.appendChild(dd) + } + + planet.appendChild(dl); + }; + script =3D document.createElement("script") + script.src =3D "https://feedrapp.herokuapp.com/" + script.src +=3D `?q=3Dhttp%3A%2F%2Fplanet.virt-tools.org%2Fatom.xml&ca= llback=3D${cb}` + document.body.appendChild(script); } =20 function advancedsearch(e) { --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list