diff --git a/index.html b/index.html
index 4841fbe..daebfb1 100644
--- a/index.html
+++ b/index.html
@@ -14,7 +14,7 @@
@@ -41,16 +41,15 @@
async function buildArticle(target, mastopost) {
- const link = document.createElement('a');
- link.href = mastopost.url;
+
const article = document.createElement('article');
populateHeader(article, mastopost);
- populateSection(article, mastopost);
+ populateSection(article, mastopost);
populateAside(article, mastopost);
populateFooter(article, mastopost);
- target.appendChild(link).appendChild(article);
+ target.appendChild(article);
}
@@ -84,23 +83,33 @@
function populateHeader(item, obj) {
const myHeader = document.createElement('header');
- const myCW = document.createElement('summary');
const myDateTime = document.createElement('time');
+ const link = document.createElement('a');
+ link.href = obj.url;
myDateTime.datetime = obj.created_at;
creation_date = new Date(obj.created_at);
- myDateTime.textContent = creation_date.toLocaleString();
- myCW.textContent = obj.spoiler_text;
- myHeader.appendChild(myCW);
- myHeader.appendChild(myDateTime);
+ myDateTime.textContent = creation_date.toLocaleString('de-DE',{ day: "2-digit", month: "short", year: "numeric", hour:"2-digit", minute:"2-digit"});
+ if(obj.spoiler_text.length > 0){
+ const myCW = document.createElement('summary');
+ const myButton = document.createElement('button');
+ myButton.textContent = "+";
+ myCW.textContent = obj.spoiler_text;
+ myHeader.appendChild(myCW);
+ myHeader.appendChild(myButton);
+
+ }
+
+ myHeader.appendChild(link).appendChild(myDateTime);
item.appendChild(myHeader);
}
- function populateSection(item, obj){
- const mySection = document.createElement('section');
- mySection.innerHTML = `${obj['content']}`;
- item.appendChild(mySection);
+ function populateSection(item, obj){
+
+ const mySection = document.createElement('section');
+ mySection.innerHTML = `${obj['content']}`;
+ item.appendChild(mySection);
}
function populateAside(item, obj){
@@ -113,7 +122,7 @@
const myH = document.createElement('hgroup');
const myP = document.createElement('div');
myH.innerHTML = `
${obj.account['display_name']}
`;
- myP.innerHTML = ``;
+ myP.innerHTML = ``;
aside.appendChild(myH);
aside.appendChild(myP);
@@ -135,6 +144,7 @@
}
buildCommentTree("107735248507147283");
+// buildCommentTree("107724981153178707");