From b48b6db02806388d004fabc1089f8dfcee327421 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 14 Jan 2019 21:01:44 +0100 Subject: [PATCH] Display all comments --- .../Export.html | 24 +++++++++- .../assets/css/main.css | 9 ++++ .../assets/js/categories/comments.js | 46 +++++++++++++++++++ .../assets/js/main.js | 1 + 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 assets/zip/personnal-data-export-navigator/assets/js/categories/comments.js diff --git a/assets/zip/personnal-data-export-navigator/Export.html b/assets/zip/personnal-data-export-navigator/Export.html index 0780ec00..30921815 100644 --- a/assets/zip/personnal-data-export-navigator/Export.html +++ b/assets/zip/personnal-data-export-navigator/Export.html @@ -88,8 +88,29 @@ +
- Loading comments + +

All your comments

+ + + + + + + + + + + + + + + + + + +
NumberPost IDDateContentImage
@@ -121,6 +142,7 @@ + \ No newline at end of file diff --git a/assets/zip/personnal-data-export-navigator/assets/css/main.css b/assets/zip/personnal-data-export-navigator/assets/css/main.css index 0195ca32..7d543387 100644 --- a/assets/zip/personnal-data-export-navigator/assets/css/main.css +++ b/assets/zip/personnal-data-export-navigator/assets/css/main.css @@ -90,4 +90,13 @@ h1 { .post .post-end-countdown { text-align: center; +} + + +/** + * Comments rules + */ +#all-comments-table .comment-img { + width: 100%; + max-width: 350px; } \ No newline at end of file diff --git a/assets/zip/personnal-data-export-navigator/assets/js/categories/comments.js b/assets/zip/personnal-data-export-navigator/assets/js/categories/comments.js new file mode 100644 index 00000000..da62c90d --- /dev/null +++ b/assets/zip/personnal-data-export-navigator/assets/js/categories/comments.js @@ -0,0 +1,46 @@ +/** + * Comments category + * + * @author Pierre HUBERT + */ + +/** + * Apply full comments list + */ +function ApplyCommentsList() { + + let target = document.querySelector("#all-comments-table tbody"); + + data.comments.forEach(comment => { + + let commentEl = createElem2({ + appendTo: target, + type: "tr", + innerHTML: + ""+comment.ID+"" + + ""+comment.postID+"" + + ""+timeToStr(comment.time_sent)+"" + + ""+comment.content+"" + }); + + + if(comment.img_path != null){ + + let imageContainer = createElem2({ + appendTo: commentEl, + type: "td" + }); + + let imageElem = createElem2({ + appendTo: imageContainer, + type: "img", + class: "comment-img" + }); + + applyURLToImage(imageElem, comment.img_url); + + } + + }); + +} \ No newline at end of file diff --git a/assets/zip/personnal-data-export-navigator/assets/js/main.js b/assets/zip/personnal-data-export-navigator/assets/js/main.js index 32c5fa31..c6f5611c 100644 --- a/assets/zip/personnal-data-export-navigator/assets/js/main.js +++ b/assets/zip/personnal-data-export-navigator/assets/js/main.js @@ -76,6 +76,7 @@ xhr.onload = function(){ ApplyUserInfo(); ApplyFriendsList(); ApplyPosts(); + ApplyCommentsList(); } xhr.send(null); \ No newline at end of file