Add newsfeed

This commit is contained in:
kpcyrd 2014-09-10 16:49:19 +02:00
parent 58ad3987a1
commit 673c83154b
4 changed files with 27 additions and 1 deletions

View file

@ -9,4 +9,6 @@
<link rel="stylesheet" href="{{ "/css/bootstrap.css" | prepend: site.baseurl }}">
<link rel="stylesheet" href="{{ "/css/font-awesome.css" | prepend: site.baseurl }}">
<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
<script src="/js/zepto.min.js"></script>
<script src="/js/main.js"></script>
</head>

View file

@ -12,7 +12,7 @@
</div>
<div class="col-md-4">
<h2>News</h2>
<ul class="list-unstyled">
<ul class="list-unstyled" id="news">
</ul>
</div>
</div>

22
js/main.js Normal file
View file

@ -0,0 +1,22 @@
var rss = [
'hamburg.freifunk.net'
];
$(document).ready(function() {
rss.forEach(function(feed) {
$.get('/feeds/' + feed + '.rss', function(data) {
$(data).find('.entry').forEach(function(entry) {
var a = $(entry).find('a');
var title = a.text();
var link = a.attr('href');
var text = $(entry).children('.feedEntryContent').text();
var item = $('<a>')
.attr('href', link)
.attr('target', '_blank')
.text(title);
$('#news').append($('<li>').append(item));
});
});
});
});

2
js/zepto.min.js vendored Normal file

File diff suppressed because one or more lines are too long