diff --git a/node/blog.js b/node/blog.js index 9a76d2d..4474539 100644 --- a/node/blog.js +++ b/node/blog.js @@ -29,40 +29,39 @@ function createBlogPages(folder) { let json = JSON.parse(data); for (let i = 0; i < json.length; i++) { let post = json[i]; - let id = post["id"]; - fs.readFile(folder + "blog/" + id + ".md", function (_, content) { + fs.readFile(folder + "blog/" + post.id + ".md", function (_, content) { let dom = new JSDOM(template); var document = dom.window.document; - document.title += " - " + post["name"]; - document.querySelector('meta[property="og:title"]').setAttribute("content", post["name"]); - document.querySelector('meta[name="description"]').setAttribute("content", post["summary"]); - document.querySelector('meta[property="og:description"]').setAttribute("content", post["summary"]); + document.title += " - " + post.name; + document.querySelector('meta[property="og:title"]').setAttribute("content", post.name); + document.querySelector('meta[name="description"]').setAttribute("content", post.summary); + document.querySelector('meta[property="og:description"]').setAttribute("content", post.summary); var nav = ""; nav += 'Back to Main Page'; if (i > 0) - nav += 'Previous Post'; + nav += 'Previous Post'; if (i < json.length - 1) - nav += 'Next Post'; + nav += 'Next Post'; document.getElementById("nav-items").innerHTML = nav; var c = ""; c += '
'; c += '
' - c += '

' + post["name"] + '

'; - c += '
' + c += '

' + post.name + '

'; + c += '
' c += converter.makeHtml(content.toString()); c += '
'; - c += '' + post["date"] + ""; - var discussLink = post["discuss"]; + c += '' + post.date + ""; + var discussLink = post.discuss; if (discussLink) - c += 'Discuss this post' + c += 'Discuss this post' c += '
'; document.getElementById("main").innerHTML = c; let html = dom.serialize(); - fs.writeFile(folder + "blog-" + id + ".html", html, function (_, _) {}); + fs.writeFile(folder + "blog-" + post.id + ".html", html, function (_, _) {}); }); } }); diff --git a/node/rss.js b/node/rss.js index e3e6577..e19abc4 100644 --- a/node/rss.js +++ b/node/rss.js @@ -47,15 +47,14 @@ function createFeed(callback) { let json = JSON.parse(data); for (let i = json.length - 1; i >= 0; i--) { let post = json[i]; - let id = post["id"]; - let date = new Date(post["date"]); + let date = new Date(post.date); - fs.readFile(__dirname + "/../blog/" + id + ".md", function (_, content) { + fs.readFile(__dirname + "/../blog/" + post.id + ".md", function (_, content) { let html = converter.makeHtml(content.toString()); feed.addItem({ - title: post["name"], - link: "https://ellpeck.de/blog-" + id, - description: post["summary"], + title: post.name, + link: "https://ellpeck.de/blog-" + post.id, + description: post.summary, content: html, date: date, published: date diff --git a/node/sitemap.js b/node/sitemap.js index fd264fc..00be23c 100644 --- a/node/sitemap.js +++ b/node/sitemap.js @@ -52,7 +52,7 @@ function refreshSitemap(folder) { for (let post of json) { sitemap.add({ - url: "/blog-" + post["id"] + url: "/blog-" + post.id }); } diff --git a/scripts/about.js b/scripts/about.js index 11b73bd..a1c045f 100644 --- a/scripts/about.js +++ b/scripts/about.js @@ -44,8 +44,8 @@ const questions = [{ a: 'German, English, Java, JavaScript, C# and a bit of C, HTML and CSS.' }, { - "q": "How do you make games?", - "a": "I usually use the .NET-based framework MonoGame together with some libraries to make it a bit easier, including my own library, MLEM, which you can read about in the Projects section." + q: "How do you make games?", + a: "I usually use the .NET-based framework MonoGame together with some libraries to make it a bit easier, including my own library, MLEM, which you can read about in the Projects section." }, { q: 'What\'s your favorite programming language?', @@ -80,8 +80,8 @@ const questions = [{ let a = ''; for (question of questions) { a += '

'; - a += 'Q: ' + question["q"] + '
'; - a += 'A: ' + question["a"]; + a += 'Q: ' + question.q + '
'; + a += 'A: ' + question.a; a += '

'; } $('#about-list').html(a); diff --git a/scripts/blog.js b/scripts/blog.js index 5ef5a52..a94f296 100644 --- a/scripts/blog.js +++ b/scripts/blog.js @@ -7,14 +7,13 @@ $.ajax({ list.html(""); for (let i = json.length - 1; i >= 0; i--) { var obj = json[i]; - let id = obj["id"]; let p = ""; p += '
'; p += '
'; - p += '

' + obj["name"] + '

'; - p += '
' + obj["summary"] + '
'; - p += '' + obj["date"] + ""; + p += '

' + obj.name + '

'; + p += '
' + obj.summary + '
'; + p += '' + obj.date + ""; p += '
'; list.append(p); } diff --git a/scripts/projects.js b/scripts/projects.js index dcda3a8..a18d9dd 100644 --- a/scripts/projects.js +++ b/scripts/projects.js @@ -62,17 +62,16 @@ let p = ''; for (project of projects) { p += '
'; p += '
'; - p += ''; + p += ''; - p += '

' + project["name"] + '

'; - p += '

' + project["desc"] + '

'; - if (project["status"]) - p += '' + project["status"] + ''; + p += '

' + project.name + '

'; + p += '

' + project.desc + '

'; + if (project.status) + p += '' + project.status + ''; - let links = project["links"]; - if (links) { - for (let name in links) { - p += '' + name + ''; + if (project.links) { + for (let name in project.links) { + p += '' + name + ''; } } diff --git a/scripts/social.js b/scripts/social.js index 93b535c..0bbb8f5 100644 --- a/scripts/social.js +++ b/scripts/social.js @@ -37,12 +37,12 @@ const socials = [{ let s = ''; for (social of socials) { - s += ''; - let icon = social["name"].toLowerCase(); - if (dark && social["darkIcon"]) + s += ''; + let icon = social.name.toLowerCase(); + if (dark && social.darkIcon) icon += '_dark'; s += ''; - s += social["name"]; + s += social.name; s += '' } $('#social-list').html(s);