Skip to content

Commit 2ab115a

Browse files
AlexStoryReedCopsey
authored andcommitted
Fixed RSS news feed (#645)
* switched api from google feed to rss2json * updated paket lock dependency, reworked news feed
1 parent 801cd4d commit 2ab115a

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

build.fsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#r "FSharp.Compiler.Service.dll"
99
#r "FSharp.Literate.dll"
1010
#r "FSharp.CodeFormat.dll"
11-
#load "paket-files/www.fssnip.net/raw/pj/HttpServer.fs"
11+
#load "paket-files/www.fssnip.net/HttpServer.fs"
1212
open System
1313
open System.IO
1414
open System.Collections.Generic

js/home.js

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
function feedLoaded(result) {
2-
if (!result.error) {
2+
if (result.status === "ok") {
33
var newsContent = document.getElementById("news-list");
44

55
var count = 1;
6-
var entries = result.entries;
6+
var entries = result.items;
77
for (var i = 0; i < entries.length; i++) {
88
var entry = entries[i];
99
try {
@@ -17,7 +17,7 @@ function feedLoaded(result) {
1717
a.href = entry.link;
1818
a.target = "_blank"
1919
h4.appendChild(a);
20-
p.appendChild(document.createTextNode(entry.contentSnippet.trim()));
20+
p.appendChild(document.createTextNode(entry.content.trim()));
2121
li.appendChild(h4);
2222
li.appendChild(p);
2323
newsContent.appendChild(li);
@@ -31,7 +31,8 @@ function feedLoaded(result) {
3131
}
3232

3333
function shuffle(array) {
34-
var currentIndex = array.length, temporaryValue, randomIndex;
34+
var currentIndex = array.length,
35+
temporaryValue, randomIndex;
3536

3637
while (0 !== currentIndex) {
3738

@@ -49,18 +50,18 @@ function shuffle(array) {
4950
function shuffleSupporters() {
5051
var carouselLink = $(".carousel-img");
5152
var shuffled = shuffle(carouselLink.toArray());
52-
var srcs = $.map(shuffled, function (x) {
53+
var srcs = $.map(shuffled, function(x) {
5354
return x.getAttribute("src");
5455
});
55-
carouselLink.each(function (index, x) {
56+
carouselLink.each(function(index, x) {
5657
x.setAttribute("src", srcs[index]);
5758
});
5859
}
5960

6061
function shuffleTestimonials() {
61-
$.getJSON("testimonials.json", function (data) {
62+
$.getJSON("testimonials.json", function(data) {
6263
var arr = shuffle(data).slice(0, 6);
63-
var testimonials = $.map(arr, function (x) {
64+
var testimonials = $.map(arr, function(x) {
6465
var b = document.createElement("blockquote");
6566
var p = document.createElement("p");
6667
var link = document.createElement("a");
@@ -84,21 +85,21 @@ function shuffleTestimonials() {
8485
var col2 = $("#testimonials-col-2");
8586
col1.empty();
8687
col2.empty();
87-
$.each(testimonials.slice(0, 3), function (i, x) {
88+
$.each(testimonials.slice(0, 3), function(i, x) {
8889
col1.append(x);
8990
});
90-
$.each(testimonials.slice(3), function (i, x) {
91+
$.each(testimonials.slice(3), function(i, x) {
9192
col2.append(x);
9293
});
9394
});
9495
}
9596

96-
$(function () {
97+
$(function() {
9798
$.ajax({
98-
url: 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=http%3A%2F%2Ffpish.net%2Frss%2Fblogs%2Ftag%2F1%2Ff~23',
99+
url: 'https://api.rss2json.com/v1/api.json?rss_url=http://fpish.net/rss/blogs/tag/1/f~23',
99100
dataType: 'json',
100-
success: function (data) {
101-
feedLoaded(data.responseData.feed);
101+
success: function(data) {
102+
feedLoaded(data);
102103
}
103104
});
104105

paket.lock

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
NUGET
2-
remote: https://nuget.org/api/v2
3-
specs:
2+
remote: https://www.nuget.org/api/v2
43
FAKE (3.14.7)
54
FSharp.Compiler.Service (0.0.82)
65
FSharp.Formatting (2.6.3)
76
FSharp.Compiler.Service (>= 0.0.81)
87
HTTP
9-
remote: http://www.fssnip.net/raw/pj
10-
specs:
11-
HttpServer.fs
8+
remote: http://www.fssnip.net
9+
HttpServer.fs (/raw/pj)

0 commit comments

Comments
 (0)