2020-09-30 00:24:37 +02:00
|
|
|
$("#blog-archive-button").on("click", function () {
|
|
|
|
let archive = $('#blog-archive');
|
|
|
|
archive.toggle();
|
|
|
|
$(this).html((archive.is(":visible") ? "Hide" : "Show") + " archived posts");
|
|
|
|
});
|
|
|
|
|
2019-02-23 16:30:23 +01:00
|
|
|
$.ajax({
|
|
|
|
dataType: "json",
|
|
|
|
url: "blog/posts.json",
|
|
|
|
cache: false,
|
|
|
|
success: function (json) {
|
|
|
|
let list = $('#blog-list');
|
2020-09-30 00:24:37 +02:00
|
|
|
let archive = $('#blog-archive');
|
2019-06-01 22:26:20 +02:00
|
|
|
list.html("");
|
2020-09-30 00:24:37 +02:00
|
|
|
archive.html("");
|
2019-02-23 16:30:23 +01:00
|
|
|
for (let i = json.length - 1; i >= 0; i--) {
|
2019-10-04 15:51:42 +02:00
|
|
|
var obj = json[i];
|
2019-02-23 16:30:23 +01:00
|
|
|
let p = "";
|
|
|
|
p += '<div class="card bg-light blog-entry rounded-0">';
|
|
|
|
p += '<div class="card-body">';
|
2020-05-16 03:25:43 +02:00
|
|
|
p += '<h4 class="card-title"><a class="blog-button" href="/blog-' + obj.id + '">' + obj.name + '</a></h4>';
|
2019-11-20 22:17:58 +01:00
|
|
|
p += '<div class="card-text text-muted blog-summary">' + obj.summary + '</div>';
|
|
|
|
p += '<span class="text-muted project-status">' + obj.date + "</span>";
|
2019-02-23 16:30:23 +01:00
|
|
|
p += '</div></div>';
|
2020-09-30 00:24:37 +02:00
|
|
|
if (obj.archived) {
|
|
|
|
archive.append(p);
|
|
|
|
} else {
|
|
|
|
list.append(p);
|
|
|
|
}
|
2019-02-17 01:56:31 +01:00
|
|
|
}
|
2020-12-16 23:54:06 +01:00
|
|
|
forceToAnchor();
|
2019-02-17 01:56:31 +01:00
|
|
|
}
|
2019-10-09 23:58:36 +02:00
|
|
|
});
|