2021-04-12 19:38:30 +02:00
|
|
|
class blogFooter extends HTMLElement {
|
|
|
|
constructor(){
|
|
|
|
super();
|
|
|
|
let xhr = new XMLHttpRequest();
|
|
|
|
let ul = document.createElement("ul");
|
|
|
|
xhr.onreadystatechange = () => {
|
|
|
|
if(xhr.readyState === 4 && xhr.status === 200){
|
|
|
|
let blog = JSON.parse(xhr.responseText);
|
|
|
|
blog.forEach((element) => {
|
|
|
|
let li = document.createElement("li");
|
|
|
|
let a = document.createElement("a");
|
2021-04-13 10:17:35 +02:00
|
|
|
a.href = "/post.html?id=" + element["id"];
|
2021-04-12 19:38:30 +02:00
|
|
|
a.innerText = element["title"];
|
|
|
|
li.appendChild(a);
|
|
|
|
ul.appendChild(li);
|
|
|
|
});
|
|
|
|
this.appendChild(ul);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xhr.open("GET", "/API/getBlogElements.php?position=footer");
|
|
|
|
xhr.send();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
customElements.define("jl-footer_blog", blogFooter);
|