Limit number of rss items
This commit is contained in:
parent
04f6a2f0aa
commit
3d95d7c870
|
@ -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++;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue