Browse Source

made non-blog content be removed by html class instead of by regex

commissions
Ellpeck 5 months ago
parent
commit
fb7c50f3e5
2 changed files with 112 additions and 108 deletions
  1. +100
    -100
      index.html
  2. +12
    -8
      node/blog.js

+ 100
- 100
index.html View File

@ -83,92 +83,92 @@
<script src="scripts/cookieinfo.js"></script>
<div id="main">
<!-- NOBLOG -->
<!-- Home -->
<div class="jumbotron">
<div class="container">
<div class="row">
<div class="col-md-auto">
<img src="res/me.png" class="rounded-circle" width="200" height="200" id="navbar-image">
</div>
<div class="col">
<h1 class="display-4" id="intro-text"></h1>
<script src="scripts/greet.js"></script>
<p class="lead">Welcome to my little website! I'm Ellpeck, a student and programmer from Germany. I do a lot of stuff, actually. My life is pretty busy.</p>
<p>Look around this website to find out more about my projects and other places you can find me!</p>
<div class="no-blog">
<!-- Home -->
<div class="jumbotron">
<div class="container">
<div class="row">
<div class="col-md-auto">
<img src="res/me.png" class="rounded-circle" width="200" height="200" id="navbar-image">
</div>
<div class="col">
<h1 class="display-4" id="intro-text"></h1>
<script src="scripts/greet.js"></script>
<p class="lead">Welcome to my little website! I'm Ellpeck, a student and programmer from Germany. I do a lot of stuff, actually. My life is pretty busy.</p>
<p>Look around this website to find out more about my projects and other places you can find me!</p>
</div>
</div>
</div>
</div>
</div>
<!-- Projects -->
<a class="anchor" id="projects"></a>
<div class="list-display rounded">
<h1>Projects</h1>
<p>
Here is a list of some of the things that you might know me from. If you want to have a more in-depth look at everything I do, check out some of the sites linked in the <a href="#social">Social</a> section.
</p>
<div id="project-list">
<em>The content that should be here is dynamically generated. Please enable JavaScript if you see this.</em>
<!-- Projects -->
<a class="anchor" id="projects"></a>
<div class="list-display rounded">
<h1>Projects</h1>
<p>
Here is a list of some of the things that you might know me from. If you want to have a more in-depth look at everything I do, check out some of the sites linked in the <a href="#social">Social</a> section.
</p>
<div id="project-list">
<em>The content that should be here is dynamically generated. Please enable JavaScript if you see this.</em>
</div>
<script src="scripts/projects.js"></script>
</div>
<script src="scripts/projects.js"></script>
</div>
<!-- Social -->
<a class="anchor" id="social"></a>
<div class="list-display rounded">
<h1>Social</h1>
<p>
These are other websites where you can find me and the things I do, including the pages where I publish my code and games and where I sometimes stream and upload videos. This list also includes a lot of ways to reach me.
</p>
<div class="row">
<div class="col">
<div id="social-list">
<!-- Social -->
<a class="anchor" id="social"></a>
<div class="list-display rounded">
<h1>Social</h1>
<p>
These are other websites where you can find me and the things I do, including the pages where I publish my code and games and where I sometimes stream and upload videos. This list also includes a lot of ways to reach me.
</p>
<div class="row">
<div class="col">
<div id="social-list">
<em>The content that should be here is dynamically generated. Please enable JavaScript if you see this.</em>
</div>
Additionally, here are some miscellaneous platforms:
<ul>
<li>My Nintendo Switch friend code is <strong>SW-5281-8834-6801</strong></li>
<li>If you want to play my Mario Maker 2 levels, my ID is <strong>8BH-566-4WF</strong></li>
<li>If you play The Sims 4, you can check out my builds on the gallery by searching for <strong>Ellpeck</strong></li>
</ul>
</div>
<div class="col-md-auto" id="discord-div">
<em>The content that should be here is dynamically generated. Please enable JavaScript if you see this.</em>
</div>
Additionally, here are some miscellaneous platforms:
<ul>
<li>My Nintendo Switch friend code is <strong>SW-5281-8834-6801</strong></li>
<li>If you want to play my Mario Maker 2 levels, my ID is <strong>8BH-566-4WF</strong></li>
<li>If you play The Sims 4, you can check out my builds on the gallery by searching for <strong>Ellpeck</strong></li>
</ul>
</div>
<div class="col-md-auto" id="discord-div">
<em>The content that should be here is dynamically generated. Please enable JavaScript if you see this.</em>
</div>
</div>
<script src="scripts/social.js"></script>
</div>
<script src="scripts/social.js"></script>
</div>
<!-- About -->
<a class="anchor" id="about"></a>
<div class="list-display rounded">
<h1>About</h1>
<p>
Sometimes, some people ask me some questions about myself or my projects, so I decided to compile a list of some of the answers in a Q&A-like fashion so that I don't have to keep repeating them. If you're curious about me, this might be interesting to you!
</p>
<div id="about-list">
<em>The content that should be here is dynamically generated. Please enable JavaScript if you see this.</em>
<!-- About -->
<a class="anchor" id="about"></a>
<div class="list-display rounded">
<h1>About</h1>
<p>
Sometimes, some people ask me some questions about myself or my projects, so I decided to compile a list of some of the answers in a Q&A-like fashion so that I don't have to keep repeating them. If you're curious about me, this might be interesting to you!
</p>
<div id="about-list">
<em>The content that should be here is dynamically generated. Please enable JavaScript if you see this.</em>
</div>
<script src="scripts/about.js"></script>
</div>
<script src="scripts/about.js"></script>
</div>
<!-- Blog -->
<a class="anchor" id="blog"></a>
<div class="list-display rounded">
<h1>Blog</h1>
<p>
Occasionally I enjoy writing stuff. So here's some of the stuff I've written. Just click on any of the headers to open the post. Alternatively, you can subscribe to this blog using <a href="/rss.xml">RSS</a>, <a href="/atom.xml">Atom</a> or <a href="/feed.json">JSON</a>.
</p>
<!-- Blog -->
<a class="anchor" id="blog"></a>
<div class="list-display rounded">
<h1>Blog</h1>
<p>
Occasionally I enjoy writing stuff. So here's some of the stuff I've written. Just click on any of the headers to open the post. Alternatively, you can subscribe to this blog using <a href="/rss.xml">RSS</a>, <a href="/atom.xml">Atom</a> or <a href="/feed.json">JSON</a>.
</p>
<div id="blog-list">
<em>The content that should be here is dynamically generated. Please enable JavaScript if you see this.</em>
<div id="blog-list">
<em>The content that should be here is dynamically generated. Please enable JavaScript if you see this.</em>
</div>
<script src="scripts/blog.js"></script>
</div>
<script src="scripts/blog.js"></script>
</div>
<!-- /NOBLOG -->
</div>
</div>
@ -182,40 +182,40 @@
</div>
</div>
<!-- NOBLOG -->
<!-- Commissions -->
<div class="modal fade" id="commissions-modal" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title">Ellpeck's Minecraft Mod Commissions</h1>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body">
<p>If you need a small to medium sized Minecraft mod for a modpack, a video or for personal use, you can contact me to make it for you.</p>
<p>Here is all the information you need if you want to commission me to make a mod for you:</p>
<ul>
<li>Minecraft Forge mods only</li>
<li>Minecraft Versions 1.12.2 and upwards only</li>
<li>No ports of existing mods or content</li>
<li>No content that can't be created using "traditional" Java code (coremods)</li>
<li>I charge between 10€ ($11) and 30€ ($33) an hour
<ul>
<li>I estimate the total amount of time it will take based on the size and complexity of the mod beforehand</li>
<li>The amount I estimate will be what you pay for, no matter how much longer or shorter it actually takes. This usually works out in your favor</li>
<li>I request half of the amount to be paid before I start working on the mod, the other half once I'm finished. That way, there's security for both of us</li>
</ul>
</li>
<li>You will have the choice of whether you want to receive the source code privately or whether I should publish it on GitHub</li>
<li>You will have the choice of whether you want to be sent the mod jar or whether I should publish the mod on CurseForge. If the mod is published on CurseForge, you will get up to 50% of the share of Curse Points generated through the mod</li>
<li>After the mod is completed, bug fixes are included for free, but feature updates and Minecraft version updates are not. They can be requested at a later date for a small fee though</li>
</ul>
<p>If you're interested, you can either <a href="mailto:me@ellpeck.de">send me an email</a>, but better yet, <a href="https://ellpeck.de/discord">join my Discord server</a> and message me privately from there so we can talk about the details.</p>
<div class="no-blog">
<!-- Commissions -->
<div class="modal fade" id="commissions-modal" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title">Ellpeck's Minecraft Mod Commissions</h1>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body">
<p>If you need a small to medium sized Minecraft mod for a modpack, a video or for personal use, you can contact me to make it for you.</p>
<p>Here is all the information you need if you want to commission me to make a mod for you:</p>
<ul>
<li>Minecraft Forge mods only</li>
<li>Minecraft Versions 1.12.2 and upwards only</li>
<li>No ports of existing mods or content</li>
<li>No content that can't be created using "traditional" Java code (coremods)</li>
<li>I charge between 10€ ($11) and 30€ ($33) an hour
<ul>
<li>I estimate the total amount of time it will take based on the size and complexity of the mod beforehand</li>
<li>The amount I estimate will be what you pay for, no matter how much longer or shorter it actually takes. This usually works out in your favor</li>
<li>I request half of the amount to be paid before I start working on the mod, the other half once I'm finished. That way, there's security for both of us</li>
</ul>
</li>
<li>You will have the choice of whether you want to receive the source code privately or whether I should publish it on GitHub</li>
<li>You will have the choice of whether you want to be sent the mod jar or whether I should publish the mod on CurseForge. If the mod is published on CurseForge, you will get up to 50% of the share of Curse Points generated through the mod</li>
<li>After the mod is completed, bug fixes are included for free, but feature updates and Minecraft version updates are not. They can be requested at a later date for a small fee though</li>
</ul>
<p>If you're interested, you can either <a href="mailto:me@ellpeck.de">send me an email</a>, but better yet, <a href="https://ellpeck.de/discord">join my Discord server</a> and message me privately from there so we can talk about the details.</p>
</div>
</div>
</div>
</div>
</div>
<!-- /NOBLOG -->
<!-- Impressum -->
<div class="modal fade" id="impressum-modal" tabindex="-1">


+ 12
- 8
node/blog.js View File

@ -7,23 +7,27 @@ const converter = require("./showdown")(2);
let folder = __dirname + "/../";
console.log("Refreshing blog sub-sites...");
fs.readFile(folder + "index.html", function (_, data) {
// this can probably be done a lot easier but regex is hard ok
var template = data.toString().replace(/<!-- ?NOBLOG ?-->([^](?!<!-- ?NOBLOG ?-->))*<!-- ?\/NOBLOG ?-->/g, "");
fs.readFile(folder + "index.html", function (_, html) {
let templateDom = new JSDOM(html);
let noBlog = templateDom.window.document.getElementsByClassName("no-blog");
while (noBlog.length > 0)
noBlog[0].parentNode.removeChild(noBlog[0]);
let template = templateDom.serialize();
fs.readFile(folder + "blog/posts.json", function (_, data) {
let json = JSON.parse(data);
for (let i = 0; i < json.length; i++) {
let post = json[i];
fs.readFile(folder + "blog/" + post.id + ".md", function (_, content) {
let dom = new JSDOM(template);
var document = dom.window.document;
let 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);
var nav = "";
let nav = "";
nav += '<a class="nav-item nav-link" href="/#blog">Back to Main Page</a>';
let last = getAdjacentPost(json, i, -1);
if (last)
@ -33,7 +37,7 @@ fs.readFile(folder + "index.html", function (_, data) {
nav += '<a class="nav-item nav-link" href="/blog-' + next.id + '">Next Post</a>';
document.getElementById("nav-items").innerHTML = nav;
var c = "";
let c = "";
c += '<div class="list-display rounded">';
c += '<div class="blog-isolated">'
c += '<h1>' + post.name + '</h1>';
@ -48,8 +52,8 @@ fs.readFile(folder + "index.html", function (_, data) {
c += '</div></div>';
document.getElementById("main").innerHTML = c;
let html = dom.serialize();
fs.writeFile(folder + "blog-" + post.id + ".html", html, function (_, _) {});
let ret = dom.serialize();
fs.writeFile(folder + "blog-" + post.id + ".html", ret, function (_, _) {});
});
}
});


Loading…
Cancel
Save