From c2cb07db00110d0cd98f536ab2e89aa766aee000 Mon Sep 17 00:00:00 2001 From: DeaDvey Date: Tue, 12 Dec 2023 18:00:21 +0000 Subject: [PATCH] added a footer and made the blog template stuff better TODO: Make the template more centralised as I have 3 --- blog/blogs.js | 5 +- blog/home-template.js | 82 ---------------------------- blog/index.html | 2 +- blog/template.js | 123 ++++++++++++++++++++++++++++++++++++++++++ index.css | 16 +++++- index.html | 10 ---- template.js | 11 ++++ 7 files changed, 153 insertions(+), 96 deletions(-) delete mode 100755 blog/home-template.js create mode 100755 blog/template.js diff --git a/blog/blogs.js b/blog/blogs.js index 799f484..d8b3b89 100644 --- a/blog/blogs.js +++ b/blog/blogs.js @@ -1,3 +1,4 @@ -let blogs = [["Test post2", "Testicy Test"], -["Test post", "Testy test!"]] +let blogs = [["I didn't like Wordpress","So... Yeah, I didn't like wordpress very much, it's pretty clunky and I don't have much control over the webpage, and it's kinda not that fun to use, I'm glad I tried it out though because I kind of know how to use it know I suppose, I might copy over the wordpress back over to this so I can use it myself for fun I suppose."], + ["Test post2", "Testicy Test"], + ["Test post", "Testy test!"]] diff --git a/blog/home-template.js b/blog/home-template.js deleted file mode 100755 index 6335414..0000000 --- a/blog/home-template.js +++ /dev/null @@ -1,82 +0,0 @@ -/////////////////////////// -// ADD THE CONTENT -/////////////////////////// - -let div = document.getElementById('main'); -let divText = div.innerHTML; - -console.log(divText); - -let newPageHTML = ` - - - - - DeaDvey's Domain - - - - -
-
Home page Blogs Videos
-
-
- ${divText} - -
- - -` - -document.body.innerHTML = newPageHTML //apply the template - -/////////////////////////// -// ADD THE LINKS -/////////////////////////// - -function loadContent(page, content, header) { - console.log(page) - let blogText = content - console.log(blogText) - let newPageHTML = ` - - - - - DeaDvey's Domain - - - - -
-
Home page Blogs Videos
-
-
-

${header}

- ${content} - -
- - - ` - document.body.innerHTML = newPageHTML -} - -let linksDiv = document.getElementById("links") - -let linksText - -for (let length = blogs.length; length > 0; length--) { - console.log(length) - - linksText += (`
  • ${blogs[length-1][0]}
  • `) -} - -linksText = linksText.slice(9) //Remove the "undefined" at the start of the string - -document.getElementById("links").innerHTML = linksText; - diff --git a/blog/index.html b/blog/index.html index 1c8b656..3d57c40 100644 --- a/blog/index.html +++ b/blog/index.html @@ -5,5 +5,5 @@ - diff --git a/blog/template.js b/blog/template.js new file mode 100755 index 0000000..94238b1 --- /dev/null +++ b/blog/template.js @@ -0,0 +1,123 @@ +/////////////////////////// +// ADD THE CONTENT +/////////////////////////// + +let div = document.getElementById('main'); +let divText = div.innerHTML; + +console.log(divText); + +let newPageHTML = ` + + + + + DeaDvey's Domain + + + + +
    +
    Home page Blogs Videos
    +
    +
    + ${divText} + +
    + + +` + +document.body.innerHTML = newPageHTML //apply the template + +/////////////////////////// +// ADD THE LINKS +/////////////////////////// + +function loadContent(page, content, header) { + console.log(page) + let blogText = content + console.log(blogText) + let newPageHTML = ` + + + + + DeaDvey's Domain + + + + +
    +
    Home page Blogs Videos
    +
    +
    +

    ${header}

    +

    ${content}

    + +
    + + + ` + document.body.innerHTML = newPageHTML +} + +function escapeQuotes(value) { + return value.replace(/["'&<>]/g, function (char) { + switch (char) { + case '"': + return """; + case "'": + return "'"; + case "&": + return "&"; + case "<": + return "<"; + case ">": + return ">"; + default: + return char; + } + }); +} +let linksDiv = document.getElementById("links") + +let linksText + +let length = blogs.length + +for (let page = 0; page < length; page++) { + console.log(length) + + linksText += (`
  • ${escapeQuotes(blogs[page][0])}
  • `) +} + +linksText = linksText.slice(9) //Remove the "undefined" at the start of the string + +document.getElementById("links").innerHTML = linksText; diff --git a/index.css b/index.css index 37a851e..73e83e2 100755 --- a/index.css +++ b/index.css @@ -2,7 +2,7 @@ display: block; text-align: center; margin-left: auto; - margin-left: auto; + margin-right: auto; } .header-image { content: url("header-image.png"); @@ -37,3 +37,17 @@ a:active { color: pink; text-decoration: none; } + +.blog-content { + text-align: center; + margin-left: auto; + margin-right: auto; + width: 500px; +} + +.footer { + display: block; + text-align: center; + margin-left: auto; + margin-right: auto; +} diff --git a/index.html b/index.html index a0acd0e..eacf074 100755 --- a/index.html +++ b/index.html @@ -3,16 +3,6 @@ Welcome to my personal website! I hope you have a good time
    Feel free to click the links above for more content!
    Also, see below for links to my other situations
    -
      - Internal: -
    1. theunderland webpages (internal link)
    2. -
    3. Experiments (internal link)
    4. -
      - External: -
    5. Github (external link)
    6. -
    7. Gitlab (external link)
    8. -
    9. Mastadon.social (external link)
    10. -