Skip to content
Snippets Groups Projects
Verified Commit 031cccb4 authored by Jonas Leder's avatar Jonas Leder
Browse files

generate footer with pure js

parent e2524efc
No related branches found
No related tags found
No related merge requests found
Pipeline #7364 passed
...@@ -20,28 +20,67 @@ class Footer extends HTMLElement { ...@@ -20,28 +20,67 @@ class Footer extends HTMLElement {
"icon": "twitter" "icon": "twitter"
} }
]; ];
this.innerHTML = ` this.links = [
<footer> {
<div id="blueBar"></div> "name": "Datenschutzerklärung",
<div id="footerContent"> "link": "/datenschutzerklaerung.html"
<div> },
<a href="/datenschutzerklaerung.html">Datenschutzerkl&auml;rung</a><br> {
<a href="/bildquellen.html">Bildquellen</a><br> "name": "Bildquellen",
<a href="/impressum.html">Impressum</a><br> "link": "/bildquellen.html"
<a href="//gitlab.jonasled.de/jonasled/website">Quellcode</a><br> },
</div> {
<div id="newestPost"> "name": "Impressum",
<h3>Neueste Beitr&auml;ge:</h3> "link": "/impressum.html"
<jl-footer_blog></jl-footer_blog> },
</div> {
<div class="center"> "name": "Quellcode",
<p class="center" id="socialButtonsContainer"> "link": "//gitlab.jonasled.de/jonasled/website"
</p> }
</div> ]
</div> const footer = document.createElement("footer");
</footer> this.appendChild(footer);
`;
const socialButtonsContainer = this.querySelector("#socialButtonsContainer"); const blueBar = document.createElement("div");
blueBar.id = "blueBar";
footer.appendChild(blueBar);
const footerContent = document.createElement("div");
footerContent.id = "footerContent";
footer.appendChild(footerContent);
const footerLinks = document.createElement("div");
footerContent.appendChild(footerLinks);
this.links.forEach(link => {
const linkElement = document.createElement("a");
linkElement.href = link["link"];
linkElement.innerText = link["name"];
footerLinks.appendChild(linkElement);
const linebreak = document.createElement("br");
footerLinks.appendChild(linebreak);
});
const footerPostDiv = document.createElement("div");
footerPostDiv.id = "newestPost";
footerContent.appendChild(footerPostDiv);
const postHeadline = document.createElement("h3");
postHeadline.innerText = "Neueste Beiträge";
footerPostDiv.appendChild(postHeadline);
const footerPost = document.createElement("jl-footer_blog");
footerPostDiv.appendChild(footerPost);
const footerIconDiv = document.createElement("div");
footerIconDiv.className = "center";
footerContent.appendChild(footerIconDiv);
const socialButtonsContainer = document.createElement("p");
socialButtonsContainer.className = "center";
footerIconDiv.appendChild(socialButtonsContainer);
this.socialButtons.forEach(button => { this.socialButtons.forEach(button => {
const link = document.createElement("a"); const link = document.createElement("a");
link.href = button["link"]; link.href = button["link"];
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment