Limit number of rss items

This commit is contained in:
kpcyrd 2014-09-12 15:45:34 +02:00
parent 04f6a2f0aa
commit 3d95d7c870

View file

@ -1,11 +1,14 @@
var rss = [
'hamburg.freifunk.net'
];
var MAX_RSS = 5;
$(document).ready(function() {
var i = 0;
rss.forEach(function(feed) {
$.get('/feeds/' + feed + '.rss', function(data) {
$(data).find('item').forEach(function(entry) {
if(i >= MAX_RSS) return;
var title = $(entry).find('title').text();
var link = $(entry).find('link').text();
@ -15,6 +18,7 @@ $(document).ready(function() {
.attr('target', '_blank')
.text(title);
$('#news').append($('<li>').append(item));
i++;
});
});
});