From patchwork Sun Feb 5 16:59:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Compagnucci X-Patchwork-Id: 724260 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vGcVV19jqz9s2s for ; Mon, 6 Feb 2017 04:07:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="M1cNL00K"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 361082E171; Sun, 5 Feb 2017 17:07:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iBXyX236WSi5; Sun, 5 Feb 2017 17:07:41 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 7B1162E223; Sun, 5 Feb 2017 17:07:41 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 34E651C0018 for ; Sun, 5 Feb 2017 17:07:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 3001487683 for ; Sun, 5 Feb 2017 17:07:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K4hO8kFZruto for ; Sun, 5 Feb 2017 17:07:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f171.google.com (mail-wr0-f171.google.com [209.85.128.171]) by whitealder.osuosl.org (Postfix) with ESMTPS id 28C4B87617 for ; Sun, 5 Feb 2017 17:07:39 +0000 (UTC) Received: by mail-wr0-f171.google.com with SMTP id i10so12039040wrb.0 for ; Sun, 05 Feb 2017 09:07:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kZrc3qNMYxqigvIqQ9PGWyYhvifQfnogV32DnhmXl74=; b=M1cNL00Kk7uA0mfYl2eS9cDrrgc1vyExKb0mQzkh0iK5zl9BLxC6pJyzRco1Acfnwn gGoQGkcyugY984ZK5eMNjGcc+r9iebBfAwUK4pjv0Zi8pvU5Y86tkc8zSAkcjMg3R0hz d+lfduPISDfhMmDFptXxPiGUduqpW5lNwr/vPU9VLuzbb1uq1/HgD7xuVKGlrY3147MK swRB3fZrh/WCXic2OtiBgBbjUfKcRYfggC3r4zkKvgzvbKu3p/pwq+1xH/pndrgS8LDt YK0YPDZg4foVBt7HLSGXIic+23G8BiuquO6soVkEwp3uhcUNl0w6aZna8/Em2oCqzgPz APsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kZrc3qNMYxqigvIqQ9PGWyYhvifQfnogV32DnhmXl74=; b=bqUujARxJP/sTI8FIUn+iY1wRveaDqiwLeRvZCRHblMdbG9y5cVajghaLenS3nMDmG Hs15XDdasudjepR5kWCP+3zkrydzoW+ssEwc5jYFiwJVxn6TCcIsmdVTM9M57JPoq3da jLxNumBCmpNwfoTijOFO6AVQ6WAZ52FjDm0uYb7gSksgR6gQy3Pxcxh95xFspM5HLzzX rzJuxyLiZH9xUK+dJbHHEWSjR7giy4yAWy3SEYugsYhVOH1borwAJT9moqWBhGP/V/cM dRRVOUw7rtZG+sppEBvQwynTUSf2sdyN/41jCIfZGx5LtV0G3StYkA/GF98Y0cLX7/QE 3OTA== X-Gm-Message-State: AIkVDXJT+8/+gA8Hrrhfeimqvvx/RQe0jj3Sn38We/1/hZB7MXTGpq64J+oNWNxPYe5wbw== X-Received: by 10.223.147.100 with SMTP id 91mr5771302wro.5.1486313981444; Sun, 05 Feb 2017 08:59:41 -0800 (PST) Received: from localhost.localdomain ([89.202.204.147]) by smtp.gmail.com with ESMTPSA id x39sm55808856wrb.3.2017.02.05.08.59.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Feb 2017 08:59:40 -0800 (PST) From: Angelo Compagnucci To: buildroot@buildroot.org Date: Sun, 5 Feb 2017 17:59:31 +0100 Message-Id: <1486313972-27474-3-git-send-email-angelo.compagnucci@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486313972-27474-1-git-send-email-angelo.compagnucci@gmail.com> References: <1486313972-27474-1-git-send-email-angelo.compagnucci@gmail.com> Subject: [Buildroot] [PATCH 2/3] docs/website: fix google feed API X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Google deprecated feed api to cenvert rss to json, switching to yahoo yql. This patch also reorganize the javascript code to accomodate the fixings. Signed-off-by: Angelo Compagnucci --- docs/website/footer.html | 1 - docs/website/js/buildroot.js | 73 ++++++++++++++++---------------------------- 2 files changed, 27 insertions(+), 47 deletions(-) diff --git a/docs/website/footer.html b/docs/website/footer.html index 1fcfd70..279c8b1 100644 --- a/docs/website/footer.html +++ b/docs/website/footer.html @@ -1,6 +1,5 @@ - diff --git a/docs/website/js/buildroot.js b/docs/website/js/buildroot.js index 122436e..83983e6 100644 --- a/docs/website/js/buildroot.js +++ b/docs/website/js/buildroot.js @@ -1,15 +1,17 @@ function load_activity(feedurl, divid) { - var feed = new google.feeds.Feed(feedurl); + var yqlURL = "https://query.yahooapis.com/v1/public/yql"; + var yqlQS = "?q=select%20*%20from%20xml%20where%20url%20%3D%20'"; + var yqlOPTS = "'&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback="; var container = document.getElementById(divid); - var loaded = 0; - var nb_display = 8; - feed.setNumEntries(30); - feed.load(function(result) { - if (result.error) { - return; - } - for (var i = 0; i < result.feed.entries.length; i++) { - var entry = result.feed.entries[i]; + var url = yqlURL + yqlQS + encodeURIComponent(feedurl) + yqlOPTS; + + $.getJSON(url, function(data){ + var result = data.query.results; + var loaded = 0; + var nb_display = 8; + if (result==null) return; + for (var i = 0; i < result.feed.entry.length; i++) { + var entry = result.feed.entry[i]; if (entry.title.indexOf("git commit") != -1) continue; loaded += 1; @@ -17,12 +19,12 @@ function load_activity(feedurl, divid) { break; var div = document.createElement("p"); var link = document.createElement("a"); - var d = new Date(entry.publishedDate); + var d = new Date(entry.published); var data = '[' + d.toLocaleDateString() + '] ' + entry.title var text = document.createTextNode(data); link.appendChild(text); link.title = entry.title; - link.href = entry.link + link.href = entry.link.href; div.appendChild(link); container.appendChild(div); } @@ -33,11 +35,6 @@ function load_activity(feedurl, divid) { }); } -function initialize() { - load_activity("http://rss.gmane.org/topics/excerpts/gmane.comp.lib.uclibc.buildroot", "mailing-list-activity"); - load_activity("http://git.buildroot.org/buildroot/atom/?h=master", "commit-activity"); -} - function google_analytics() { var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-21761074-1']); @@ -53,34 +50,6 @@ function google_analytics() { s.parentNode.insertBefore(ga, s); } -$(function() { - $('a[href*=#]:not([href=#])').click(function() { - if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { - var target = $(this.hash); - target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); - if (target.length) { - $('html,body').animate({ - scrollTop: target.offset().top - }, 1000); - return false; - } - } - }); -}); - -google.load("feeds", "1"); -google.setOnLoadCallback(initialize); -google_analytics(); - -jQuery(document).ready(function($) { - var url = window.location.href; - // Get the basename of the URL - url = url.split(/[\\/]/).pop() - $('.nav a[href="/' + url + '"]').parent().addClass('active'); - - $('#slides').html('') -}); - function showTooltip(elem, msg) { elem.setAttribute('class', 'btn tooltipped tooltipped-s'); elem.setAttribute('aria-label', msg); @@ -98,7 +67,7 @@ clipboard.on('success', function(e) { }); $(function() { - $('a[href*=#]:not([href=#])').click(function() { + $('a[href*=\\#]:not([href=\\#])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); @@ -111,3 +80,15 @@ $(function() { } }); }); + +jQuery(document).ready(function($) { + var url = window.location.href; + // Get the basename of the URL + url = url.split(/[\\/]/).pop() + $('.nav a[href="/' + url + '"]').parent().addClass('active'); + + load_activity("http://rss.gmane.org/topics/excerpts/gmane.comp.lib.uclibc.buildroot", "mailing-list-activity"); + load_activity("http://git.buildroot.org/buildroot/atom/?h=master", "commit-activity"); + + $('#slides').html('') +});