Replace zepto with jquery

This commit is contained in:
kpcyrd 2015-12-07 19:28:54 +01:00
parent cd2b5ee5e3
commit 4febd6cac0
4 changed files with 17 additions and 8 deletions

View file

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

4
js/jquery-2.1.4.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -25,9 +25,16 @@ $(document).ready(function() {
$('#news').append($('<li>').append(item).append(prev)); $('#news').append($('<li>').append(item).append(prev));
}; };
var forEach = function(x, f) {
var i;
for(i = 0; i < x.length; i++) {
f(x[i]);
}
};
var getAddedItems = function() { var getAddedItems = function() {
var news = []; var news = [];
$('#news').find('li').forEach(function(item) { forEach($('#news').find('li'), function(item) {
var a = $(item).children('a'); var a = $(item).children('a');
var p = $(item).children('p'); var p = $(item).children('p');
var title = a.text(); var title = a.text();
@ -41,13 +48,13 @@ $(document).ready(function() {
}; };
var clearNewsFeed = function() { var clearNewsFeed = function() {
$('#news').children().forEach(function(child) { forEach($('#news').children(), function(child) {
child.remove(); child.remove();
}); });
}; };
var updateNewsFeed = function(news) { var updateNewsFeed = function(news) {
var items = getAddedItems().concat(news);; var items = getAddedItems().concat(news);
items.sort(function(a, b) { items.sort(function(a, b) {
a = new Date(a.date); a = new Date(a.date);
@ -69,7 +76,7 @@ $(document).ready(function() {
$.get('/feeds/' + feed + '.rss', function(data) { $.get('/feeds/' + feed + '.rss', function(data) {
var news = []; var news = [];
$(data).find('item').forEach(function(entry) { forEach($(data).find('item'), function(entry) {
var title = $(entry).find('title').text(); var title = $(entry).find('title').text();
var link = $(entry).find('link').text(); var link = $(entry).find('link').text();
var date = $(entry).find('pubDate').text(); var date = $(entry).find('pubDate').text();
@ -78,7 +85,7 @@ $(document).ready(function() {
news.push({title:title, link:link, date:date, text:text}); news.push({title:title, link:link, date:date, text:text});
}); });
$(data).find('entry').forEach(function(entry) { forEach($(data).find('entry'), function(entry) {
var title = $(entry).find('title').text(); var title = $(entry).find('title').text();
var link = $(entry).find('link').attr('href'); var link = $(entry).find('link').attr('href');
var date = $(entry).find('published').text(); var date = $(entry).find('published').text();

2
js/zepto.min.js vendored

File diff suppressed because one or more lines are too long