1
0
Fork 0
forked from wezm/wezm.net
wezm.net/output/js/articles.js

34 lines
624 B
JavaScript
Raw Normal View History

var articles;
function articles_loaded(data) {
articles = data;
console.log(data);
$('.pagination').slideDown('fast');
};
jQuery(function() {
$('.newer, .older').click(function() {
var elem = $(this);
var page;
var matches;
if(matches = elem.attr('href').match(/(\d+)$/)) {
page = new Number(matches[1]);
}
else {
return false;
}
var per_page = 10;
var i = (page - 1) * per_page;
for(; i < page * per_page; i++) {
console.log(articles[i].title);
}
return false;
});
jQuery.get('/articles/index.json', {}, articles_loaded, 'json');
});