diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/blog.js | 9 | ||||
-rw-r--r-- | scripts/onload.js | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/scripts/blog.js b/scripts/blog.js index 65fc02e..bbded40 100644 --- a/scripts/blog.js +++ b/scripts/blog.js @@ -11,9 +11,10 @@ function postList(n = 0) { } // i ❤ for loops - for (var i = n - 1; i >= 0; i--) { - console.log("dkfjlaafjsdk" + i) - postCard(data.posts[i]); + for (var i = data.posts.length - 1; i >= 0; i--) { + if (i >= data.posts.length - n) { + postCard(data.posts[i]); + } } }); } @@ -80,12 +81,14 @@ function loadPost(n) { var date = document.getElementById("date"); var author = document.getElementById("author"); var tags = document.getElementById("tag-container"); + var description = document.getElementById("description"); var content = document.getElementById("content"); banner.src = post.banner; title.innerHTML = post.title; date.innerHTML = post.date; author.innerHTML = post.author; + description.innerHTML = post.description; post.tags.forEach(createTags); tags.innerHTML = evaluatedTags; diff --git a/scripts/onload.js b/scripts/onload.js index 9d9226e..10dcf1d 100644 --- a/scripts/onload.js +++ b/scripts/onload.js @@ -18,3 +18,8 @@ function blog(n) { // addNodes is called in loadPost(n);
loadPost(n);
}
+
+function index() {
+ postList(2);
+ addNodes();
+}
|